Search completed in 1.47 seconds.
JSS Provider Notes
cipher supported algorithms
notes aes des desede (des3 ) rc2 rc4 rsa the following modes and padding schemes are supported: algorithm mode padding des ecb nopadding ...
... keyfactory supported algorithms
notes dsa rsa the following transformations are supported for generatepublic() and generateprivate(): from to rsapublickeyspec rsapublickey dsapublickeyspec dsapubl...
...
note that a public key's data can be accessed directly from the key.
...And 8 more matches
Mozilla-JSS JCA Provider notes
dsakpg.initialize(1024); keypair dsapair = dsakpg.generatekeypair(); supported classes cipher dsaprivatekey dsapublickey keyfactory keygenerator keypairgenerator mac messagedigest rsaprivatekey rsapublickey secretkeyfactory secretkey securerandom signature cipher supported algorithms
notes aes des desede (des3) rc2 rc4 rsa the following modes and padding schemes are supported: algorithm mode padding des ecb nopadding cbc nopadding pkcs5 padding desede des3 ecb nopadding cbc nop...
... keyfactory supported algorithms
notes dsa rsa the following transformations are supported for generatepublic() and generateprivate(): from to rsapublickeyspec rsapublickey dsapublickeyspec dsapublickey x509encodedkeyspec rsapublickey dsapublickey rsaprivatecrtkeyspec rsaprivatekey dsaprivatekeyspec dsap...
...
note that a public key's data can be accessed directly from the key.
...And 8 more matches
NSS 3.35 release notes
note that this release does not include support for the latter.
...
note that debug builds will use a lower count, for better performance in test environments.
...
note: in this release, support for new rsa_pss_pss_shax signature schemes have been disabled; end-entity certificates with rsa-pss keys will still be used to produce signatures, but they will use the rsa_pss_rsae_shax codepoints.
...And 5 more matches
nss tech note5
using nss to perform miscellaneous cryptographic operations nss technical
note: 5 nss project info is at http://www.mozilla.org/projects/security/pki/nss/ you can browse the nss source online at http://lxr.mozilla.org/mozilla/source/security/nss/ and http://lxr.mozilla.org/security/ be sure to look for sample code first for things you need to do.
...
note: this document contains code snippets that focus on essential aspects of the task and often do not illustrate all the cleanup that needs to be done.
...
note that some mechanisms (*_pad) imply the padding is handled for you by nss.
...And 5 more matches
Example Sticky Notes - Archive of obsolete content
notes.html all parts are made and commented by vk [schools_ring@yahoo.com].
... view this example <!doctype html public "-//w3c//dtd html 4.01//en" "http://www.w3.org/tr/html401/strict.dtd"> <html> <head> <title>xbl demo : sticky
notes</title> <meta http-equiv="content-type" 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, inc.
... the eggs!</p></div> <div class="sticker"><p>the new project - who's on charge?</p></div> <div class="sticker"><p>learn more about xbl.</p></div> <p style="clear: left"><a href="http://validator.w3.org/check?uri=referer"><img src="https://udn.realityripple.com/samples/e2/dd625ef1cd.png" width="88" height="31" alt="valid html 4.01" style="border: 1px none"></a></p> </body> </html>
notes.xml <?xml version="1.0"?> <bindings xmlns="http://www.mozilla.org/xbl" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <!-- in above only xbl namespace declaration is mandatory.
...And 3 more matches
nss tech note1
how to use the nss asn.1 and quickder decoders nss technical
note: 1 nss 3.6 contains several decoders for asn.1 and der.two of them are extensively used and are part of the public nss api : the "classic" asn.1 decoder, written by lisa repka .
...the syntax of these templates is identical for both decoders, except where
noted.
...it is only needed if the template instructs the decoder to save some data, such as for primitive component types, or for some modifiers where
noted.when needed, it tells the decoder where in the target data to save the current component.
...And 3 more matches
Release notes for recent versions of NSS
(nss 3.56 release
notes) the current esr releases of nss are 3.44.4 (nss 3.44.4 release
notes), intended for firefox esr 68, which was released on 19 may 2020, and 3.53.1 (nss 3.53.1 release
notes), intended for firefox esr 78, which was released on 16 june 2020.
... past releases nss 3.56 release
notes nss 3.55 release
notes nss 3.54 release
notes nss 3.53.1 release
notes nss 3.53 release
notes nss 3.52.1 release
notes nss 3.44.4 release
notes nss 3.52 release
notes nss 3.51.1 release
notes nss 3.51 release
notes nss 3.50 release
notes nss 3.49.2 release
notes nss 3.49.1 release
notes nss 3.49 release
notes nss 3.48.1 release
notes nss 3.48 release
notes nss 3.47.1 release
notes nss 3.47 release
notes nss 3.46.1 release
notes nss 3.46 release
notes nss 3.45 release
notes nss 3.44.3 release
notes nss 3.44.2 release
notes nss 3.44.1 release
notes nss 3.44 release
notes nss 3.43 release
notes nss 3.42.1 release
notes nss 3.42 release
notes nss 3.36.8 release
notes nss 3.36.7 release
notes nss 3.41 release
notes nss 3.40.1 ...
...release
notes nss 3.36.6 release
notes nss 3.40 release
notes nss 3.39 release
notes nss 3.38 release
notes nss 3.37.3 release
notes nss 3.37.1 release
notes nss 3.37 release
notes nss 3.36.5 release
notes nss 3.36.4 release
notes nss 3.36.2 release
notes nss 3.36.1 release
notes nss 3.36 release
notes nss 3.35 release
notes nss 3.34.1 release
notes nss 3.34 release
notes nss 3.33 release
notes nss 3.32 release
notes nss 3.31.1 release
notes nss 3.31 release
notes nss 3.30.2 release
notes nss 3.30.1 release
notes nss 3.30 release
notes nss 3.29.5 release
notes nss 3.29.3 release
notes nss 3.29.2 release
notes nss 3.29.1 release
notes nss 3.29 release
notes nss 3.28.5 release
notes nss 3.28.4 release
notes nss 3.28.3 release
notes nss 3.28.2 release
notes nss 3.2...
...And 2 more matches
NSS_3.12_release_notes.html
nss 3.12 release
notes 17 june 2008 newsgroup: mozilla.dev.tech.crypto contents introduction distribution information new in nss 3.12 bugs fixed documentation compatibility feedback introduction network security services (nss) 3.12 is a minor release with the following new features: sqlite-based shareable certificate and key databases libpkix: an rfc 3280 compliant certificate path validation library camellia cipher support tls session ticket extension (rfc 5077) nss 3.12 is tri-licensed under the mpl 1.1/gpl 2.0/lgpl 2.1.
...
note: firefox 3 uses nss 3.12, but not the new sqlite-based shareable certificate and key databases.
...sec_oid_pkcs5_pbmac1 sec_oid_hmac_sha1 sec_oid_hmac_sha224 sec_oid_hmac_sha256 sec_oid_hmac_sha384 sec_oid_hmac_sha512 sec_oid_pkix_timestamping sec_oid_pkix_ca_repository sec_oid_iso_sha1_with_rsa_signature changed oids (see secoidt.h) sec_oid_pkcs12_key_usage changed to sec_oid_bogus_key_usage sec_oid_ansix962_ecdsa_signature_with_sha1_digest changed to sec_oid_ansix962_ecdsa_sha1_signature
note: sec_oid_ansix962_ecdsa_signature_with_sha1_digest is also kept for compatibility reasons.
...esponse_alert ssl_error_bad_cert_hash_value_alert ssl_error_rx_unexpected_new_session_ticket ssl_error_rx_malformed_new_session_ticket new tls cipher suites (see sslproto.h): tls_rsa_with_camellia_128_cbc_sha tls_dhe_dss_with_camellia_128_cbc_sha tls_dhe_rsa_with_camellia_128_cbc_sha tls_rsa_with_camellia_256_cbc_sha tls_dhe_dss_with_camellia_256_cbc_sha tls_dhe_rsa_with_camellia_256_cbc_sha
note: the following tls cipher suites are declared but are not yet implemented: tls_dh_dss_with_camellia_128_cbc_sha tls_dh_rsa_with_camellia_128_cbc_sha tls_dh_anon_with_camellia_128_cbc_sha tls_dh_dss_with_camellia_256_cbc_sha tls_dh_rsa_with_camellia_256_cbc_sha tls_dh_anon_with_camellia_256_cbc_sha tls_ecdh_anon_with_null_sha tls_ecdh_anon_with_rc4_128_sha tls_ecdh_anon_with_3des_ede_cbc_sha tls_...
New Skin Notes - Archive of obsolete content
--dria stuff that's been fixed
note that while i've made these fixes, they haven't necessarily been checked in yet.
...--mmondor 12:25, 26 aug 2005 (pdt) hmm,
note that when logged-in, the theme is all fine like the old one, it's when a user doesn't login and reads the docs through the test site that the menu bar then is at the right and is slightly too large...
...--dria further
notes and ideas (future) skin designed more for the editorial crowd, with the editor tools more prominently placed in the skin.
NSS 3.12.6 release notes
nss 3.12.6 release
notes 2010-03-03 newsgroup: mozilla.dev.tech.crypto introduction network security services (nss) 3.12.6 is a patch release for nss 3.12.
...
note: the tls server name indication for clients is already fully implemented in nss.
...
note: the code must be built with trace defined to use this functionality.
NSS 3.45 release notes
notable changes in nss 3.45 bug 1540403 - implement delegated credentials (draft-ietf-tls-subcerts) this adds a new experimental function: ssl_delegatecredential
note: in 3.45, selfserv does not yet support delegated credentials.
...
note: in 3.45 the sslchannelinfo is left unmodified, while an upcoming change in 3.46 will set sslchannelinfo.authkeybits to that of the delegated credential for better policy enforcement.
... bug 1546477 - various changes in response to the ongoing fips review
note: the source package size has increased substantially due to the new fips test vectors.
nss tech note2
using the pkcs #11 module logger nss technical
note: 2 modes of operation extracting output from log files the logger displays all activity between nss and a specified pkcs #11 module.
...for example, to log the softoken, use: nss_debug_pkcs11_module="nss internal pkcs #11 module"
note: in the command prompt on windows, do not quote the name of the target module, otherwise the quotes are considered part of the name.
...yyyyyyy for example, 1024[805ef10]: c_initialize 1024[805ef10]: pinitargs = 0x4010c938 1024[805ef10]: rv = 0x0 1024[805ef10]: c_getinfo 1024[805ef10]: pinfo = 0xbffff340 1024[805ef10]: rv = 0x0 1024[805ef10]: c_getslotlist 1024[805ef10]: tokenpresent = 0x0 1024[805ef10]: pslotlist = 0x0 1024[805ef10]: pulcount = 0xbffff33c 1024[805ef10]: *pulcount = 0x2 1024[805ef10]: rv = 0x0
note that when a pkcs #11 function takes a pointer argument for which it will set a value (c_getslotlist above), this mode will display the value upon return.
Notes on HTML Reflow - Archive of obsolete content
for example, a <div> with a constrained width (e.g., set via the css width property) would
note this in the reflow state object before flowing its children.
...the root frame
notes the incremental reflow reason specified in the reflow state, and inspects the path contained within the reflow command object.
Localization notes
these comments are generally referred to as localization
notes.
...dtd files <!-- localization
note (entity name): comment --> properties files # localization
note (key): comment file-wide comments should use the same format, be at the top of the file (after the license header, though) and just drop the (entity name/key) reference.
4.3 Release Notes
tus_response_alert ssl_error_bad_cert_hash_value_alert new tls cipher suites (see http://mxr.mozilla.org/security/sour...sslsocket.java): tls_rsa_with_camellia_128_cbc_sha tls_dhe_dss_with_camellia_128_cbc_sha tls_dhe_rsa_with_camellia_128_cbc_sha tls_rsa_with_camellia_256_cbc_sha tls_dhe_dss_with_camellia_256_cbc_sha tls_dhe_rsa_with_camellia_256_cbc_sha
note: the following tls cipher suites are declared but are not yet implemented: tls_dh_dss_with_camellia_128_cbc_sha tls_dh_rsa_with_camellia_128_cbc_sha tls_dh_anon_with_camellia_128_cbc_sha tls_dh_dss_with_camellia_256_cbc_sha tls_dh_rsa_with_camellia_256_cbc_sha tls_dh_anon_with_camellia_256_cbc_sha tls_ecdh_anon_with_null_sha tls_ecdh_anon_with_rc4_128_sha tls...
...
note that some bugs may have been fixed since jss 4.3 was released.
NSS 3.14.1 release notes
note that this code is used primarily for purposes of testing.
...
note: the criteria for false start may change again in future nss releases.
NSS 3.14.2 release notes
note: the new assembly code requires gnu as version 2.19 or newer.
...
note: please apply the patch in https://bugzilla.mozilla.org/show_bug.cgi?id=837799 if you build nss with the system sqlite library and your system sqlite library is older than 3.7.15.
NSS 3.24 release notes
note: this approach is only useful when the arena use is tightly bounded, for example, if it is only used in a single function.
...
note that tls 1.3 support is experimental and not suitable for production use.
NSS 3.28.3 release notes
please
note that nss 3.29 also contained the incorrect change.
...see also the separate release
notes for nss 3.29.1 feedback bugs discovered should be reported by filing a bug report with bugzilla.mozilla.org (product nss).
NSS 3.28 release notes
note that there is a difference between tls 1.3 and key exporters in older versions of tls.
...
note that this detection has a one-off performance cost, which can be avoided by using the ssl_namedgroupconfig function, to limit supported groups to those that nss provides.
nss tech note3
all about certificate extensions nss technical
note: 3 09 may 2002 nelson b.
... sslserver: cert_sign; ssl_ca; sslca: cert_sign; ssl_ca; emailsigner: cert_sign; email_ca or ssl_ca emailrecipient: cert_sign; email_ca or ssl_ca objectsigner: cert_sign; object_signing_ca; usageanyca: cert_sign; object_signing_ca or email_ca or ssl_ca; statusresponder: cert_sign; object_signing_ca or email_ca or ssl_ca;
note: when the required key usage is key_agreement or key_encipherment, the actual key usage required depends on the key's algorithm.
Notes on TLS - SSL 3.0 Intolerant Servers
post a
note on your site instructing users of old versions of browsers like netscape 6.0/6.01/6.1 preview release 1 and mozilla 0.9.1 and earlier to turn off the tls option at: edit | preferences | privacy and security | ssl | enable tls.
...(
note: you will be asked to provide your email address before you can file a bug at bugzilla.) original document information author : katsuhiko momoi last updated date: january 27th, 2003 copyright © 2001-2003 netscape.
NSS_3.11.10_release_notes.html
nss 3.11.10 release
notes 2008-12-10 newsgroup: <ahref="news: mozilla.dev.tech.crypto"="" news.mozilla.org="">mozilla.dev.tech.crypto</ahref="news:> contents introduction distribution information bugs fixed documentation compatibility feedback introduction network security services (nss) 3.11.10 is a patch release for nss 3.11.
NSS_3.12.1_release_notes.html
nss 3.12.1 release
notes 2008-09-05 newsgroup: mozilla.dev.tech.crypto contents introduction distribution information new in nss 3.12.1 bugs fixed documentation compatibility feedback introduction network security services (nss) 3.12.1 is a patch release for nss 3.12.
NSS_3.12.2_release_notes.html
nss 3.12.2 release
notes 2008-10-20 newsgroup: mozilla.dev.tech.crypto contents introduction distribution information new in nss 3.12.2 bugs fixed documentation compatibility feedback introduction network security services (nss) 3.12.2 is a patch release for nss 3.12.
Index
(
note that it's important to look at the number 11, as there are other pkcs standards with different numbers that define quite different topics.) a software or hardware module conforming to the pkcs#11 standard implements an interface of c calls, which allow querying the characteristics and offered services of the module.
... it's important to
note that nss requires strict cleanup for all handles returned by nss.
...when creating the network socket for data exchange,
note that you must use the operating system independent apis provided by nspr and nss.
...And 151 more matches
Editor Embedding Guide - Archive of obsolete content
nscomptr<nsieditingsession> editingsession; nsiwebbrowser->do_getinterface(getter_addrefs(editingsession)); if (editingsession) editingsession->makewindoweditable(domwindow, "html", pr_true); the valid editor types are: "text" (similar to
notepad or a textarea; does not allow for html) "textmail" (similar to "text" but html can be inserted; intended for plaintext mail usage and handling of citations) "html" (this is the default type if no type is specified; it allows for all html tags to be inserted) "htmlmail" (this is much like "html" except there are a few editing rules/behaviors that differ such as splitting of mail quotes) ed...
... getcommandstate "state_all"(boolean), "state_begin"(boolean), "state_end"(boolean), "state_mixed"(boolean), "state_enabled" (boolean) docommand no parameters
note this one is not visually notable in the general case.
... getcommandstate "state_all"(boolean), "state_begin"(boolean), "state_end"(boolean), "state_mixed"(boolean), "state_enabled" (boolean) docommand no parameters
note this is logical style.
...And 53 more matches
ARIA Test Cases - Accessibility
jaws 9 & 10 with ie beta 2 nvda 0.6p2 with firefox 3 orca with firefox 3 window-eyes 7 with ie 8 beta 2 and firefox 3 voiceover (leopard) with safari 4.0.2 zoom (leopard) with safari 4.0.2, firefox 3.x and opera 9.x zoomtext 9.1 with firefox 3 and ie 8 beta 2 test case structure test cases are organized as follows: test case links test details expected at behavior markup
notes results table at firefox ie opera safari jaws 9 - - - - jaws 10 - 1.
... reference to link example
note regarding dojo/dijit test files the main purpose of dojo's dijit test files are for dojo developers to exercise and debug the code.
...still, dojo's widgets implement aria, and the
noted test files could be used as an "aria test file".
...And 53 more matches
BluetoothCharacteristicProperties - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetbluetoothcharacteristicproperties experimentalchrome full support 56
notes full support 56
notes
notes chromeos and macos only.
... full support 56
notes disabled
notes linux and versions of windows earlier than 10.disabled from version 56: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled).
... full support 70
notes
notes windows 10.edge full support ≤79
notes full support ≤79
notes
notes edgeos and macos only.
...And 48 more matches
Example and tutorial: Simple synth keyboard - Web APIs
we will be programmatically constructing the keyboard, because doing so gives us the flexibility to configure each key as we determine the appropriate data for the corresponding
note.
...for now, we will have two controls: one to set the master volume and another to select what periodic waveform to use when generating
notes.
... wavepicker is the <select> element used to choose the waveform to use for the
notes.
...And 37 more matches
BluetoothRemoteGATTDescriptor - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetbluetoothremotegattdescriptor experimentalchrome full support 57
notes full support 57
notes
notes macos only.
... full support 57
notes disabled
notes linux and versions of windows earlier than 10.disabled from version 57: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled).
... full support 70
notes
notes windows 10.edge full support ≤79
notes full support ≤79
notes
notes macos only.
...And 35 more matches
Client-side storage - Learn web development
note: there are limits to the amount of data you can store using client-side storage apis (possibly both per individual api and cumulatively); the exact limit varies depending on the browser and possibly based on user settings.
... next,
note how our html references a javascript file called index.js (see line 40).
...
note: there is another, slightly more complex example to explore at using the web storage api.
...And 31 more matches
Index - Archive of obsolete content
2 .htaccess ( hypertext access ) 301 redirect, cache control, custom error pages, htaccess, permanent redirect, redirect file accessing : htaccess files can be opened using any text editor, like windows
notepad, vin, sublime text editor or any other.
... 132 release
notes add-on sdk no summary!
...every multiple item package must provide an install.rdf file (not old-style install.js!) and has the same requirements as an extension except as
noted below.
...And 30 more matches
Parser API
note: this page describes spidermonkey-specific behavior and might be incomplete.
...
note: expression closures are spidermonkey-specific.
...
note: generators are spidermonkey-specific.
...And 23 more matches
JavaScript modules - JavaScript
to change preferences in firefox, visit about:config.opera android full support 45safari ios full support 10.3samsung internet android full support 8.0nodejs full support 13.2.0
notes full support 13.2.0
notes
notes modules must either have a filename ending in .mjs, or the nearest parent package.json file must contain "type": "module".
... full support 12.0.0
notes disabled
notes modules must either have a filename ending in .mjs, or the nearest parent package.json file must contain "type": "module".
... full support 8.5.0
notes disabled
notes module filenames must end with .mjs, not .js.
...And 22 more matches
Advanced techniques: Creating and sequencing audio - Web APIs
note: you can find the source code on github as step-sequencer; see the step-sequencer running live also.
...when they are enabled the
note will sound.
...ociated web audio api feature "sweep" oscillator, periodic wave oscillatornode, periodicwave "pulse" multiple oscillators oscillatornode "noise" random noise buffer, biquad filter audiobuffer, audiobuffersourcenode, biquadfilternode "dial up" loading a sound sample to play audiocontext.decodeaudiodata(), audiobuffersourcenode
note: this instrument was not created to sound good, it was created to provide demonstration code and represents a very simplified version of such an instrument.
...And 19 more matches
Handling common accessibility problems - Learn web development
note: like many things in web development, accessibility isn't about 100% success or not; 100% accessibility is pretty much impossible to achieve for all content, especially as sites get more complex.
...
note: accessibility is morally the right thing to do, and good for business (numbers of disabled users, users on mobile devices, etc.
...
note that different browsers may have different keyboard control options available.
...And 18 more matches
nsINavBookmarksService
faces.nsinavbookmarksservice); method overview void addobserver(in nsinavbookmarkobserver observer, in boolean ownsweak); void beginupdatebatch(); obsolete since gecko 1.9 void changebookmarkuri(in long long aitemid, in nsiuri anewuri); long long createdynamiccontainer(in long long aparentfolder, in autf8string aname, in astring acontractid, in long aindex);
note: renamed from createcontainer in gecko 1.9 obsolete since gecko 13.0 long long createfolder(in long long aparentfolder, in autf8string name, in long index); void endupdatebatch(); obsolete since gecko 1.9 void exportbookmarkshtml(in nsifile file); obsolete since gecko 1.9 nsiuri getbookmarkedurifor(in nsiuri auri); void getbookmarkfolderstarray(in nsiu...
...obsolete since gecko 1.9 void getbookmarkidsforuri(in nsiuri auri, [optional] out unsigned long count, [array, retval, size_is(count)] out long long bookmarks);
note: renamed from getbookmarkfolders in gecko 1.9 void getbookmarkidsforuritarray(in nsiuri auri, in print64array aresult); native code only!
...
note: renamed from bookmarksroot in gecko 1.9 placesroot long long the item id of the top-level folder that contains bookmarks, tags and all other places data.
...And 18 more matches
Bytecode Descriptions
note: this is used to implement ++ and --.
...
note that obj is the top value, like jsop::in.
...(the spec refers to an "iterator object" with a next method, but
notes that it "is never directly accessible" to scripts.
...And 17 more matches
OS.File for the main thread
note that this snippet is useful as a demonstration of complex asynchronous programming with os.file – in most cases, function os.file.writeatomic is a better choice.
... if (pos <= view.bytelength) { //
note: should this be pos >= view.bytelength ?
...sk.spawn(function() { let view = new uint8array(data); let pos = 0; while (pos < view.bytelength) { pos += yield outfile.write(view.subarray(pos, chunksize)); } outfile.close(); }).then( null, function onfailure(reason) { outfile.close(); throw reason; } ); } example: save canvas to disk this exmaple uses image to load an image from a path (
note: if your path is a file on disk you must use local file; this is accomplished with os.path.tofileuri, which accepts a string).
...And 16 more matches
WebAssembly - JavaScript
desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jswebassemblychrome full support 57edge full support 16firefox full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).ie no support noopera full support 44safari full support 11webview android full support ...
... 57chrome android full support 57firefox android full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).opera android full support 43safari ios full support 11samsung internet android full support 7.0nodejs full support 8.0.0compileerrorchrome full support 57edge full support 16firefox full support 52...
...
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).ie no support noopera full support 44safari full support 11webview android full support 57chrome android full support 57firefox android full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).opera android full support 43safari ios full sup...
...And 16 more matches
WebAssembly
desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jswebassemblychrome full support 57edge full support 16firefox full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).ie no support noopera full support 44safari full support 11webview android full support ...
... 57chrome android full support 57firefox android full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).opera android full support 43safari ios full support 11samsung internet android full support 7.0nodejs full support 8.0.0compileerrorchrome full support 57edge full support 16firefox full support 52...
...
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).ie no support noopera full support 44safari full support 11webview android full support 57chrome android full support 57firefox android full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).opera android full support 43safari ios full sup...
...And 16 more matches
CSS property compatibility table for form controls - Learn web development
property n t
note css box model width yes yes height partial[1][2] yes webkit browsers (mostly on mac osx and ios) use the native look & feel for the search fields.
... font yes yes see the
note about line-height letter-spacing yes yes text-align yes yes text-decoration partial partial see the
note about opera text-indent partial[1] partial[1] ie9 supports this property only on <textarea>s, whereas opera only supports it on single line text fields.
... property n t
note css box model width yes yes height partial[1] yes this property is not applied on webkit based browsers on mac osx or ios.
...And 15 more matches
Handling common JavaScript problems - Learn web development
note: buggy javascript code: the 10 most common mistakes javascript developers make has some nice discussions of these common mistakes and more.
...
note: eslint takes a bit more setup and configuration than jshint, but it is more powerful too.
...
note: similar tools are available in other browsers; the sources tab in chrome, debugger in safari (see safari web development tools), etc.
...And 15 more matches
Index - Web APIs
note that all these properties are read-only.
... 433 cssomstring api, cssom, reference cssomstring is used to de
note string data in cssom specifications and can refer to either domstring or usvstring.
...
note that the cache interface is exposed to windowed scopes as well as workers.
...And 15 more matches
Using XMLHttpRequest - Web APIs
note: starting with gecko 30.0 (firefox 30.0 / thunderbird 30.0 / seamonkey 2.27), synchronous requests on the main thread have been deprecated due to the negative effects to the user experience.
...
note: the constructor function xmlhttprequest isn't limited to only xml documents.
...
note: xmlhttprequest can now interpret html for you using the responsexml property.
...And 15 more matches
JXON - Archive of obsolete content
if you want a complete bidirectional jxon library (modelled on the json global object), skip to the dedicated paragraph (but please read the
note about the const statement compatibility).
...
note: if you are interested to address only some parts of an xml document (and are not starting in javascript/json for templating purposes), use xpath instead of converting the whole document into json.
...
note: if you are using an instance of xmlhttprequest in order to retrieve your xml file, please use the yourrequest.responsexml property to get a parsed xml document.
...And 14 more matches
Audio for Web games - Game development
note: playing part of your file at zero volume could also work if the browser allows you to change volume (see below).
... also
note that playing and immediately pausing your audio does not guarantee that a small piece of audio won't be played.
...
note: adding a web app to your mobile's homescreen may change its capabilities.
...And 14 more matches
Drawing graphics - Learn web development
note: basic canvas functionality is supported well across browsers, with the exception of ie 8 and below for 2d canvas, and ie 11 and below for webgl.
...
note: you should generally set the size of the image using html attributes or dom properties, as explained above.
... in this case we want a 2d canvas, so add the following javascript line below the others inside the <script> element: const ctx = canvas.getcontext('2d');
note: other context values you could choose include webgl for webgl, webgl2 for webgl 2, etc., but we won't need those in this article.
...And 14 more matches
EventTarget.addEventListener() - Web APIs
note: for event listeners attached to the event target, the event is in the target phase, rather than the capturing and bubbling phases.
...
note: usecapture has not always been optional.
... return value undefined usage
notes the event listener callback the event listener can be specified as either a callback function or an object that implements eventlistener, whose handleevent() method serves as the callback function.
...And 14 more matches
Understanding WebAssembly text format - WebAssembly
note: this is potentially overkill if you are a web developer who just wants to load a wasm module into a page and use it in your code (see using the webassembly javascript api), but it is more useful if for example, you want to write wasm modules to optimize the performance of your javascript library, or build your own webassembly compiler.
... (
note that when this text gets converted to binary, though, the binary will contain only the integer.) stack machines before we can write a function body, we have to talk about one more thing: stack machines.
... next, we’ll load our binary into a typed array called addcode (as described in fetching webassembly bytecode), compile and instantiate it, and execute our add function in javascript (we can now find add() in the exports property of the instance): webassembly.instantiatestreaming(fetch('add.wasm')) .then(obj => { console.log(obj.instance.exports.add(1, 2)); // "3" });
note: you can find this example in github as add.html (see it live also).
...And 14 more matches
Introduction to automated testing - Learn web development
note: the above two categories are not mutually exclusive.
...
note that node comes with node package manager (npm), which allows you to easily install packages, share your own packages with others, and run useful scripts on your projects.
...to update npm, use the following command in your terminal: npm install npm@latest -g
note: if the above command fails with permissions errors, fixing npm permissions should sort you out.
...And 13 more matches
Observer Notifications
unless otherwise
noted you register for the topics using the nsiobserverservice.
... [nsobserverservice.cpp] topic description xpcom-startup
note: an extension can no longer be registered to receive this notification in firefox 4 and later.
... app-startup
note: an extension can no longer be registered to receive this notification in firefox 4 and later.
...And 13 more matches
nsIURI
note: ipv6 addresses are not enclosed in square brackets.
...about:blank)
note: characters are not escaped.
...about:blank)
note: characters are not escaped.
...And 13 more matches
Signaling and video calling - Web APIs
note: if you try out the example on glitch, please
note that any changes made to the code will immediately reset any connections.
... it's important to
note that the server doesn't need to understand or interpret the signaling data content.
...
note: the important thing to
note is this: the only thing your code is responsible for during ice negotiation is accepting outgoing candidates from the ice layer and sending them across the signaling connection to the other peer when your onicecandidate handler is executed, and receiving ice candidate messages from the signaling server (when the "new-ice-candidate" message is received) and delivering ...
...And 13 more matches
Simple Storage - Archive of obsolete content
note that these examples create a mystorage variable to emphasize the fact that jetpack.storage.simple is just a normal javascript object.
...it's a simple
note-taking jetpack.
... select some text on the page, right-click, and select
note.
...And 12 more matches
Client-side form validation - Learn web development
note: there are several errors that will prevent the form from being submitted, including a badinput, patternmismatch, rangeoverflow or rangeunderflow, stepmismatch, toolong or tooshort, typemismatch, valuemissing, or a customerror.
...(required)</label> <input id="choose" name="i_like" required> <button>submit</button> </form>
note the css that is included in the example file: input:invalid { border: 2px dashed red; } input:invalid:required { background-image: linear-gradient(to right, pink, lightgreen); } input:valid { border: 2px solid black; } this css causes the input to have a red dashed border when it is invalid and a more subtle solid black border when valid.
...try out the new behavior in the example below:
note: you can find this example live on github as fruit-validation.html (see also the source code.) try submitting the form without a value.
...And 12 more matches
Setting up your own test automation environment - Learn web development
note: if you want to find out how to use webdriver with other server-side environments, also check out platforms supported by selenium for some useful links.
...to install selenium-webdriver, run the following command, making sure you are inside your project folder: npm install selenium-webdriver
note: it is still a good idea to follow these steps even if you previously installed selenium-webdriver and downloaded the browser drivers.
...
note: just to reiterate, the path you add to path needs to be the path to the directory containing the drivers, not the paths to the drivers themselves!
...And 12 more matches
Localization content best practices
note: if you're a localizer and you want to contribute to the localization of mozilla products, you might want to read our localization quick start guide for information on localizing mozilla code.
...
note on localizers mozilla localizers are volunteers with very diverse technical skills: some of them rely exclusively on translation tools, others prefer to work directly with text editors and don't have problems working with vcs systems.
... add localization
notes localizers usually work on the localizable files without the context of the source files including the localized strings; it is important to add comments to the localizable files themselves, too.
...And 12 more matches
Hacking Tips
note that some functions have been moved under an 'os' object, and help(os) will give brief help on just the members of that "namespace".
... getting the bytecode of a function (from js shell) the shell has a small function named dis to dump the bytecode of a function with its source
notes.
... js> function f () { return 1; } js> dis(f); flags: loc op ----- -- main: 00000: one 00001: return 00002: stop source
notes: ofs line pc delta desc args ---- ---- ----- ------ -------- ------ 0: 1 0 [ 0] newline 1: 2 0 [ 0] colspan 2 3: 2 2 [ 2] colspan 9 getting the bytecode of a function (from gdb) in jsopcode.cpp, a function named js::disassembleatpc can print the bytecode of a script.
...And 12 more matches
Index
unless otherwise
noted you register for the topics using the nsiobserverservice.
... 91 working with multiple versions of interfaces add-ons, extensions, xpcom in this short
note we illustrate how one can update an xpcom module in order for it to work in both firefox 2 and firefox 3, even if the interfaces have changed in the interim.
...
note that even a read only text object can support the copy capability so this interface is not limited to editable objects.
...And 12 more matches
WebIDL bindings
notes: need to document the setup for indexed and named setters/creators/deleters.
...
note that if you're adding new interfaces, then the test at dom/tests/mochitest/general/test_interfaces.html will most likely fail.
...
note that you may not need to do this if your objects can only be created, never gotten from other objects.
...And 12 more matches
BasicCardResponse - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetbasiccardresponsechrome no support noedge no support ≤18 — 79firefox full support 56
notes disabled full support 56
notes disabled
notes available only in nightly builds.disabled from version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true) and the dom.payments.request.supportedregions preference (needs to be set to a comma-delineated list of one or more 2-character iso country codes indicatin...
... webview android no support nochrome android full support 57firefox android full support 56
notes disabled full support 56
notes disabled
notes available only in nightly builds.disabled from version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true) and the dom.payments.request.supportedregions preference (needs to be set to a comma-delineated list of one or more 2-character iso country codes indicatin...
... samsung internet android full support 7.0billingaddresschrome no support noedge no support ≤18 — 79firefox full support 56
notes disabled full support 56
notes disabled
notes available only in nightly builds.disabled from version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
...And 12 more matches
Using IndexedDB - Web APIs
(
note that this will delete the information in the object store!
...
note: as of firefox 40, indexeddb transactions have relaxed durability guarantees to increase performance (see bug 1112702.) previously in a readwrite transaction idbtransaction.oncomplete was fired only when all data was guaranteed to have been flushed to disk.
...here's what that looks like: var transaction = db.transaction(["customers"], "readwrite"); //
note: older experimental implementations use the deprecated constant idbtransaction.read_write instead of "readwrite".
...And 12 more matches
background-size - CSS: Cascading Style Sheets
note: the behavior of <gradient>s changed in gecko 8.0 (firefox 8.0 / thunderbird 8.0 / seamonkey 2.5).
...
note: in gecko, background images created using the element() function are currently treated as images with the dimensions of the element, or of the background positioning area if the element is svg, with the corresponding intrinsic proportion.
...
note: svg images have a preserveaspectratio attribute that defaults to the equivalent of contain.
...And 12 more matches
package.json - Archive of obsolete content
note: jpm supports nodejs people fields.
...
note: this is deprecated along with cfx; it's not available when using jpm.
... firefox: firefox desktop fennec: firefox for android thunderbird: thunderbird seamonkey: seamonkey any application uuid example: "engines": { "firefox": ">= 38.0a1", "fennec": ">= 38.0a1" } fullname
note: this is deprecated along with cfx; it's not available when using jpm.
...And 11 more matches
Simple Storage - Archive of obsolete content
note: this page documents the jetpack prototype, which is no longer under active development.
...
note that these examples create a mystorage variable to emphasize the fact that jetpack.storage.simple is just a normal javascript object.
...it's a simple
note-taking jetpack.
...And 11 more matches
Choosing the right approach - Learn web development
droidfirefox for androidopera for androidsafari on iossamsung internetsettimeoutchrome full support 30edge full support 12firefox full support 1 full support 1 full support 52
notes
notes setinterval now defined on windoworworkerglobalscope mixin.ie full support 4opera full support 4safari full support 1webview android full support 4.4chrome android full support ...
... 30firefox android full support 4 full support 4 full support 52
notes
notes setinterval now defined on windoworworkerglobalscope mixin.opera android full support 10.1safari ios full support 1samsung internet android full support 3.0supports parameters for callbackchrome full support yesedge full support 12firefox full support yesie full support ...
... legend full support full support compatibility unknown compatibility unknownsee implementation
notes.see implementation
notes.
...And 11 more matches
Cooperative asynchronous JavaScript: Timeouts and intervals - Learn web development
(see the
note below on why it runs "as soon as possible" and not "immediately".) more on why you might want to do this later.
...
note: the specified amount of time (or the delay) is not the guaranteed time to execution, but rather the minimum time to execution.
...so to cancel our above timeout, you'd do this: cleartimeout(mygreeting);
note: see greeter-app.html for a slightly more involved demo that allows you to set the name of the person to say hello to in a form, and cancel the greeting using a separate button (see the source code also).
...And 11 more matches
Introduction to events - Learn web development
note: event handlers are sometimes called event listeners — they are pretty much interchangeable for our purposes, although strictly speaking, they work together.
...
note: web events are not part of the core javascript language — they are defined as part of the apis built into the browser.
...
note: it doesn't work if you try to register this event handler on the button itself — we've had to register it on the window object, which represents the entire browser window.
...And 11 more matches
Component; nsIPrefBranch
note: this method does nothing if the prefbranch it is called on is a default branch.
... remarks
note: prior to gecko 6.0, this method would throw an exception if there was no user value set for the specified preference.
...
note: this method can be called on either a default or user branch but, in effect, always operates on both.
...And 11 more matches
:is() (:matches(), :any()) - CSS: Cascading Style Sheets
note: :matches() was renamed to :is() in csswg issue #3258.
...
note that currently browsers support this functionality as :matches(), or through an older, prefixed pseudo-class — :any(), including older versions of chrome, firefox, and safari.
... desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internet:is()chrome full support 68
notes disabled full support 68
notes disabled
notes combinators in the selector list argument may not match correctly (see bug 842157).disabled from version 68: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled).
...And 11 more matches
Cross-Origin Resource Sharing (CORS) - HTTP
apart from the headers automatically set by the user agent (for example, connection, user-agent, or the other headers defined in the fetch spec as a “forbidden header name”), the only headers which are allowed to be manually set are those which the fetch spec defines as a “cors-safelisted request-header”, which are: accept accept-language content-language content-type (but
note the additional requirements below) dpr downlink save-data viewport-width width the only allowed values for the content-type header are: application/x-www-form-urlencoded multipart/form-data text/plain no event listeners are registered on any xmlhttprequestupload object used in the request; these are accessed using the xmlhttprequest.upload property.
...
note: these are the same kinds of cross-site requests that web content can already issue, and no response data is released to the requester unless the server sends an appropriate header.
...
note: webkit nightly and safari technology preview place additional restrictions on the values allowed in the accept, accept-language, and content-language headers.
...And 11 more matches
Install Manifests - Archive of obsolete content
note: the id property is optional in a webextension.
...
note: extensions compatible with firefox 3.5 should specify a maxversion of 3.5.*, so that they are automatically compatible with security and stability updates.
...
note: as of gecko 2.0, the dialog receives the addon object representing your add-on as a parameter.
...And 10 more matches
Chapter 3: Introduction to XUL—How to build a more intuitive UI - Archive of obsolete content
note: if you want to contribute to this document please follow the guidelines on the contribute page.
...
note: although there is a specification document, its markup is based on implementations and markup as of 2001, and current xul differs from it in many aspects.
...
note: with attributes like hidden, collapsed, and disabled, which take boolean values, setting disabled="false" in xul can have unintended consequences.
...And 10 more matches
Chapter 4: Using XPCOM—Implementing advanced processes - Archive of obsolete content
note: if you're developing components in c++ or other compiled languages, be sure to include binaries for every platform.
...
note: interface definition language (idl) is a language for giving standard definitions of objects, methods, and so forth.
...
note: to look at the firefox 3 source code, choose "firefox 3" in the starting points list.
...And 10 more matches
RDF in Mozilla FAQ - Archive of obsolete content
var ds = rdf.getdatasource("http://www.mozilla.org/some-rdf-file.rdf"); //
note that ds will load asynchronously, so assertions will not // be immediately available alternatively, you can create one directly using the xpcom component manager, as the following code fragment illustrates: // create an rdf/xml datasource using the xpcom component manager var ds = components .classes["@mozilla.org/rdf/datasource;1?name=xml-datasource"] .createinstance(components.interfac...
...
note that this will happen asynchronously.
...remote.refresh(false); //
note that ds will load asynchronously, so assertions will not // be immediately available you may decide that you need to "manually" create an rdf/xml datasource if you want to force it to load synchronously.
...And 10 more matches
What is JavaScript? - Learn web development
px; display: inline-block; cursor: pointer; } and finally, we can add some javascript to implement dynamic behaviour: const para = document.queryselector('p'); para.addeventlistener('click', updatename); function updatename() { let name = prompt('enter a new name'); para.textcontent = 'player 1: ' + name; } try clicking on this last version of the text label to see what happens (
note also that you can find this demo on github — see the source code, or run it live)!
...
note: many of the above demos won't work in an older browser — when experimenting, it's a good idea to use a modern browser like firefox, chrome, edge or opera to run your code in.
...
note: these apis are advanced, and we'll not be covering any of these in this module.
...And 10 more matches
Handling common HTML and CSS problems - Learn web development
note: one common problem with css and html arises when different css rules begin to conflict with one another.
...for example, see: sublimelinter for sublime text
notepad++ linter vscode linters browser developer tools the developer tools built into most browsers also feature useful tools for hunting down errors, mainly for css.
...
note: html errors don't tend to show up so easily in dev tools, as the browser will try to correct badly-formed markup automatically; the w3c validator is the best way to find html errors — see validation above.
...And 10 more matches
Mozilla’s UAAG evaluation report
checkpoint title status
notes/plans 1.1 full keyboard access.
... checkpoint title status
notes/plans checkpoint title status
notes/plans 2.1 render content according to specification.
... checkpoint title status
notes/plans 3.1 toggle background images.
...And 10 more matches
Chrome registration
note: with gecko 1.9.2 and older, mozilla reads chrome/*.manifest files from applications.
...
note: scripts (including those found in xbl) loaded from skin packages will not execute.
... locale packagename localename path/to/files skin packagename skinname path/to/files
note: the characters @ # ; : ?
...And 10 more matches
Command line options
in some cases, option arguments must be enclosed in quotation marks (this is
noted in the option descriptions below).
...
note profile_name and profile_dir are quoted together, and are separated by exactly 1 space (as with the previous syntax, profile_name must not contain spaces).
... firefox -createprofile "joeluser c:\internet\joelusers-moz-profile"
note: profile_dir must not exist and you must not already have a profile called profile_name.
...And 10 more matches
sslfnc.html
note that at least one of the functions listed in ssl export policy functions must also be called during nss initialization.
... syntax #include "ssl.h" secstatus ssl_optionsetdefault(print32 option, prbool on); parameters this function has the following parameters: option one of the following values (except as
noted, the factory setting is "off"): ssl_security enables use of security protocol.
...
note that calling ssl_enable to set ssl_v2_compatible_hello to pr_false implicitly also sets the ssl_enable_ssl2 option to pr_false for that ssl socket.
...And 10 more matches
Introduction to the JavaScript shell
note: starting with spidermonkey 44 (firefox 44 / thunderbird 44 / seamonkey 2.41), the standard, web-compatible javascript version is used by default (and not js1.7+ anymore).
...from a bash console when using a pre-compiled binary, try <path to your firefox's run-mozilla.sh>/run-mozilla.sh ./js -- that worked for me] if you'd like to run the javascript code in the file foo.js, you can use this command: js foo.js to run foo.js then drop into the interactive shell, do this: js -f foo.js -i reference
note: because the javascript shell is used as a test environment for the javascript engine, the available options and built-in functions can change over time.
...
note: this list is incomplete and overlaps with shell global objects.
...And 10 more matches
Using Service Workers - Web APIs
note: as of firefox 44, when appcache is used to provide offline support for a page a warning message is now displayed in the console advising developers to use service workers instead (bug 1204581.) service workers should finally fix these issues.
... chrome canary: go to chrome://flags and turn on experimental-web-platform-features; restart browser (
note that some features are now enabled by default in chrome.) opera: go to opera://flags and enable support for serviceworker; restart browser.
...(see our promises test example for the source code, or look at it running live.)
note: a real service worker implementation would use caching and onfetch rather than the xmlhttprequest api.
...And 10 more matches
Proxy Auto-Configuration (PAC) file - HTTP
notes: the javascript function should always be saved to a file by itself but not be embedded in a html file or any other file.
...) convert_addr() myipaddress() dnsdomainlevels() url/hostname based conditions shexpmatch() time based conditions weekdayrange() daterange() timerange() logging utility alert() there was one associative array (object) already defined, because at the time javascript code was unable to define it by itself: proxyconfig.bindings
note: pactester (part of the pacparser package) was used to test the following syntax examples.
...
note that the patterns are shell glob expressions, not regular expressions.
...And 10 more matches
SVG 2 support in Mozilla - SVG: Scalable Vector Graphics
general change
notes length attribute and indexed property for list interfaces implementation status unknown <script> element in content model of all elements implementation status unknown initialize(), appenditem(), replaceitem(), and insertitembefore() on list objects making a copy of any list item being inserted that is already in another list implementation status unknown crossorigin attribute for <image> and <script> elements not implemented yet...
... (at least for <image>; bug 1240357) rendering model change
notes svg root and <foreignobject> not overflow:hidden in ua style sheet implementation status unknown allow overflow: auto; to clip and show scroll bars implementation status unknown allow overflow: scroll; to show scroll bars on <svg> elements implementation status unknown basic data types and interfaces change
notes dommatrix or dommatrixreadonly instead of svgmatrix implementation status unknown domrect or domrectreadonly instead of svgrect implementation status unknown dompoint or dompointreadonly instead of svgpoint implementation status unknown members of svgstylable and svglangspace available in svge...
...t element implementation status unknown animval attribute alias of baseval implementation status unknown dataset attribute for svgelement implementation status unknown moved pathlength attribute and gettotallength() and getpointatlength() methods from svgpathelement to svggeometryelement implemented (bug 1239100) document structure change
notes svgsvgelement.suspendredraw(), svgsvgelement.unsuspendredraw(), and svgsvgelement.unsuspendredrawall() deprecated turned into no-ops (bug 734079) externalresourcesrequired attribute removed implementation status unknown auto value for width and height in <image> implementation status unknown referencing entire document with <use> implementation...
...And 10 more matches
Chapter 6: Firefox extensions and XUL applications - Archive of obsolete content
fixme: figure 1: uncheck “exclude browser files.” set up quick
note for the purposes of this explanation, we’re going to use the file-storage mechanism in quick
note1 for our debugger.
... install quick
note from the following url and relaunch firefox.
... after relaunching firefox, activate quick
note.
...And 9 more matches
Reference - Archive of obsolete content
the "backwards compatibility" sections have been renamed to "behavior in older versions." however, i think this is only appropriate if we are going to document the evolution of everything, or at least
note the most significant changes introduced in the various versions.
...maybe something like main article: javascript 1.2--sevenspade 15:16, 6 july 2006 (pdt) as a side
note, the ability to to specify different versions has come up again - now between versions 1.6 and 1.7.
...--nickolay 00:58, 26 aug 2005 (pdt) (more coding style questions) --maian 04:06, 31 aug 2005 (pdt) i'd say, just make a
note here about decisions you make.
...And 9 more matches
Positioning - Learn web development
note: you can see the example at this point live at 1_static-positioning.html (see source code).
...to try this out, add the following declarations to the .positioned rule in your css: top: 30px; left: 30px;
note: the values of these properties can take any units you'd logically expect — pixels, mm, rems, %, etc.
...
note: you can see the example at this point live at 2_relative-positioning.html (see source code).
...And 9 more matches
UI pseudo-classes - Learn web development
note: a number of the pseudo-classes discussed here are concerned with styling form controls based on their validation state (is their data valid, or not?) you'll learn much more about setting and controlling validation constraints in our next article — client-side form validation — but for now we'll keep things simple with regards to form validation, so it doesn't confuse things.
...
note: you'll probably not find yourself using the :optional pseudo-class very often.
...
note: if one radio button in a same-named group of radio buttons has the required attribute, all the radio buttons will be invalid until one is selected, but only the one with the attribute assigned will actually match :required.
...And 9 more matches
Graceful asynchronous programming with Promises - Learn web development
note: you can learn more about this somewhat advanced topic, if you're interested, in the article signaling and video calling.
...
note: you can make further improvements with async/await syntax, which we'll dig into in the next article.
...
note: the following example will not work if you just run it directly from the file (i.e.
...And 9 more matches
Inheritance in JavaScript - Learn web development
i\'m ' + this.name.first + '.'); };
note: in the source code, you'll also see bio() and farewell() methods defined.
... as a
note, we could have simply done this: function teacher(first, last, age, gender, interests, subject) { this.name = { first, last }; this.age = age; this.gender = gender; this.interests = interests; this.subject = subject; } but this is just redefining the properties anew, not inheriting them from person(), so it defeats the point of what we are trying to do.
... inheriting from a constructor with no parameters
note that if the constructor you are inheriting from doesn't take its property values from parameters, you don't need to specify them as additional arguments in call().
...And 9 more matches
TypeScript support in Svelte - Learn web development
note that our application is fully functional and porting it to typescript is completely optional.
...
note: if you are curious about how typescript transpiles our code to javascript you can have a look at the typescript playground.
...
note: remember that you can run npx degit opensas/mdn-svelte-tutorial/07-typescript-support svelte-todo-typescript to get the complete to-do list application in javascript before you start porting it to typescript.
...And 9 more matches
CustomizableUI.jsm
note that it is expressly not really aware about the specific ui used by users to make customizations.
...
note that these are also abstract cross-window objects; customizableui will manage the actual dom manipulation involved with adding/moving/removing widgets in all windows for you.
...
note that this is fired for each dom node.
...And 9 more matches
Web Video Text Tracks Format (WebVTT) - Web APIs
these should be on separate lines, starting with the string
note.
... a comment consists of three parts: the string
note.
... zero or more characters other than those
noted above.
...And 9 more matches
Using Web Workers - Web APIs
note: see the web workers api landing page for reference documentation on workers and additional guides.
...
note: notice that onmessage and postmessage() need to be hung off the worker object when used in the main script thread, but not when used in the worker.
...
note: when a message is passed between the main thread and worker, it is copied or "transferred" (moved), not shared.
...And 9 more matches
clip-path - CSS: Cascading Style Sheets
note: a computed value other than none results in the creation of a new stacking context the same way that css opacity does for values other than 1.
...> = nonzero | evenodd<box> = border-box | padding-box | content-box examples comparison of html and svg <svg class="defs"> <defs> <clippath id="mypath" clippathunits="objectboundingbox"> <path d="m0.5,1 c0.5,1,0,0.7,0,0.3 a0.25,0.25,1,1,1,0.5,0.3 a0.25,0.25,1,1,1,1,0.3 c1,0.7,0.5,1,0.5,1 z" /> </clippath> </defs> </svg> <div class="grid"> <div class="col"> <div class="
note">clip-path: none</div> <div class="row"> <div class="cell"> <span>html</span> <div class="container"> <p class="none"> i love<br><em>clipping</em> </p> </div> </div> <div class="cell"> <span>svg</span> <div class="container viewbox"> <svg viewbox="0 0 192 192"> <g class="none"> <rect ...
...x="24" y="24" width="144" height="144" /> <text x="96" y="91">i love</text> <text x="96" y="109" class="em">clipping</text> </g> </svg> </div> </div> </div> <div class="
note">clip-path: url(#mypath)<br><br> assuming the following clippath definition: <pre> <svg> <clippath id="mypath" clippathunits="objectboundingbox"> <path d="m0.5,1 c 0.5,1,0,0.7,0,0.3 a 0.25,0.25,1,1,1,0.5,0.3 a 0.25,0.25,1,1,1,1,0.3 c 1,0.7,0.5,1,0.5,1 z" /> </clippath> </svg></pre> </div> <div class="row"> <div class="cell"> <span>html</span> <div class="container"> <p class="svg"> i love<br><em>clipping</em> </p> </d...
...And 9 more matches
<input>: The Input (Form Input) element - HTML: Hypertext Markup Language
note: an element with the autofocus attribute may gain focus before the domcontentloaded event is fired.
...(only the htmlinputelement’s checked idl attribute is updated.)
note: unlike other input controls, a checkboxes and radio buttons value are only included in the submitted data if they are currently checked.
...
note: although not required by the specification, firefox will by default persist the dynamic disabled state of an <input> across page loads.
...And 9 more matches
Link types - HTML: Hypertext Markup Language
note: although recognized, the singular archive is incorrect and must be avoided.
...
note: this may be a mailto: hyperlink, but this is not recommended on public pages as robot harvesters will quickly lead to a lot of spam sent to the address.
...
note: other link types related to linking resources in the same sequence are last, prev, next.
...And 9 more matches
WebAssembly.Table - JavaScript
note: tables can currently only store function references, but this will likely be expanded in the future.
... webassembly.instantiatestreaming(fetch('table2.wasm'), importobject) .then(function(obj) { console.log(tbl.length); console.log(tbl.get(0)()); console.log(tbl.get(1)()); });
note how you've got to include a second function invocation operator at the end of the accessor to actually invoke the referenced function and log the value stored inside it (e.g.
... desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jstablechrome full support 57edge full support 16firefox full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).ie no support noopera full support 44safari full support 11webview android full support ...
...And 9 more matches
fill - SVG: Scalable Vector Graphics
value <paint> default value black animatable yes
note: as a presentation attribute fill can be used as a css property.
... value <paint> default value black animatable yes
note: as a presentation attribute fill can be used as a css property.
... value <paint> default value black animatable yes
note: as a presentation attribute fill can be used as a css property.
...And 9 more matches
File I/O - Archive of obsolete content
note: file objects are nsifile.
... createinstance(components.interfaces.nsilocalfile); file.initwithpath("/home");
note: the path should be in the "native" form (for example"c:\\windows").
...
note: you can still get a file object even if the specified file does not exist, and no exception will be thrown.
...And 8 more matches
nsIContentPolicy - Archive of obsolete content
warning: do not block the caller in your implementations of shouldload() or shouldprocess() (for example, by launching a dialog to prompt the user for something).")
note: in reality, much of this interface is defined in the nsicontentpolicybase interface, but for now is documented here until someone has time to split things up.
...
note: gecko uses type_internal_frame and type_internal_iframe in order to discern the difference internally.
...
note: this rejection only applies to the current request on this server, not to future requests of the same type.
...And 8 more matches
HTML: A good basis for accessibility - Learn web development
note: it is a good idea to have a screen reader set up on your local computer so that you can do some testing of the examples shown below.
...
note: in addition to having good semantics and an attractive layout, your content should make logical sense in its source order — you can always place it where you want using css later on, but you should get the source order right to start with, so what screen reader users get read out to them will make sense.
...
note: different browsers may have different keyboard control options available.
...And 8 more matches
HTML: A good basis for accessibility - Learn web development
note: it is a good idea to have a screen reader set up on your local computer so that you can do some testing of the examples shown below.
...
note: in addition to having good semantics and an attractive layout, your content should make logical sense in its source order — you can always place it where you want using css later on, but you should get the source order right to start with, so what screen reader users get read out to them will make sense.
...
note: different browsers may have different keyboard control options available.
...And 8 more matches
Legacy layout methods - Learn web development
note: you can see this example running at 0_two-column-layout.html (see also the source code).
...
note: we've also given each column a light red color so you can see exactly how much space each one takes up.
...
note: if you are having trouble getting the above example to work, try comparing it against our finished version on github (see it running live also).
...And 8 more matches
The HTML5 input types - Learn web development
note: most of the features discussed in this article have wide support across browsers.
... we'll
note any exceptions.
...see the firefox for android keyboard screenshot below for an example:
note: you can find examples of the basic text input types at basic input examples (see the source code also).
...And 8 more matches
How to build custom form controls - Learn web development
note: we'll focus on building the control, not on how to make the code generic and reusable; that would involve some non-trival javascript code and dom manipulation in an unknown context, and that is out of the scope of this article.
...if you want to learn more about this topic, you should check out the following helpful resources: uxmatters.com uxdesign.com the ux design section of smashingmagazine
note: also, in most systems there is a way to open the <select> element with the keyboard to look at all the available choices (this is the same as clicking the <select> element with a mouse).
...--> <ul class="optlist"> <!-- each option only contains the value to be displayed, we'll see later how to handle the real value that will be sent with the form data --> <li class="option">cherry</li> <li class="option">lemon</li> <li class="option">banana</li> <li class="option">strawberry</li> <li class="option">apple</li> </ul> </div>
note the use of class names; these identify each relevant part regardless of the actual underlying html elements used.
...And 8 more matches
Looping code - Learn web development
basic for loop example</title> <style> </style> </head> <body> <p></p> <script> const cats = ['bill', 'jeff', 'pete', 'biggles', 'jasmin']; let info = 'my cats are called '; const para = document.queryselector('p'); for (let i = 0; i < cats.length; i++) { info += cats[i] + ', '; } para.textcontent = info; </script> </body> </html>
note: you can find this example code on github too (also see it running live).
...
note: we have made the condition i < cats.length, not i <= cats.length, because computers count from 0, not 1 — we are starting i at 0, and going up to i = 4 (the index of the last array item).
...
note: a common mistake with conditions is making them use "equal to" (===) rather than say "less than or equal to" (<=).
...And 8 more matches
Basic math in JavaScript — numbers and operators - Learn web development
note: actually, javascript has a second number type, bigint, used for very, very large integers.
...
note: you'll sometimes see numbers involved in arithmetic referred to as operands.
...
note: you may sometimes see exponents expressed using the older math.pow() method, which works in a very similar way.
...And 8 more matches
Introduction to the server side - Learn web development
note: client-side frameworks are often used to help speed up development of client-side code, but you can also choose to write all the code by hand; in fact, writing your code by hand can be quicker and more efficient if you only need a small, simple web site ui.
...you'll
note that there is some overlap!
...
note: your imagination doesn't have to work hard to see the benefit of server-side code for efficient storage and delivery of information: go to amazon or some other e-commerce site.
...And 8 more matches
Strategies for carrying out testing - Learn web development
note: yahoo first made this approach popular, with their graded browser support approach.
...
note: you can only have one version of ie or edge installed on a machine at once, so you will probably have to use virtual machine, or other strategy to do the testing you need.
...
note: "the ceo of my company uses a blackberry, so we'd better make sure it looks good on that" can also be a persuasive argument.
...And 8 more matches
Command line crash course - Learn web development
side
note: what's the difference between a command line and a terminal?
...ify their metadata): touch copy files: cp move files: mv delete files or directories: rm download files found at specific urls: curl search for fragments of text inside larger bodies of text: grep view a file's contents page by page: less, cat manipulate and transform streams of text (for example changing all the instances of <div>s in an html file to <article>): awk, tr, sed
note: there are a number of good tutorials on the web that go much deeper into the command line on the web — this is only a brief introduction!
...
note: a very useful terminal shortcut is using the tab key to autocomplete names that you know are present, rather than having to type out the whole thing.
...And 8 more matches
Midas
notes since an entire document becomes editable, authors often load the editable document into an iframe and do the bulk of the scripting in the parent document.
... examples this example shows the basic structure described in the
notes section : <html> <head> <title>simple edit box</title> </head> <body> <iframe id="midasform" src="about:blank" onload="this.contentdocument.designmode='on';" ></iframe> </body> </html> methods document.execcommand executes the given command.
...
note: this command won't work without setting a pref or using signed js.
...And 8 more matches
Using XPCOM Utilities to Make Things Easier
note that all of the macros described in this section are similar but are used in slightly different situations.
...}; the important thing to
note in the fictitious listing above is that it can support multiple components in a module.
...
note that it uses the actual name of the interface and not an iid.
...And 8 more matches
mozIStorageConnection
note: this is not reliable if you are using asynchronous statements or if you are using the connection on multiple threads.
...
note: this is not reliable if you are using asynchronous statements or if you are using the connection on multiple threads.
...
note: this is not reliable if you are using asynchronous statements or if you are using the connection on multiple threads.
...And 8 more matches
nsINavHistoryQueryOptions
note: currently, only bookmark folder containers support being opened asynchronously.
...
note that this has no effect on folder links, which are place: uris returned by nsinavbookmarkservice's getfolderuri method.
...
note: this option is only used on query_type_history.
...And 8 more matches
Fullscreen API - Web APIs
note: support for this api varies somewhat across browsers, with many requiring vendor prefixes and/or not implementing the latest specification.
...
note: these event handler properties are not available as html content attributes.
...
note: use the fullscreenelement property on the document or shadowroot instead; if it's not null, then it's an element currently being displayed in full-screen mode.
...And 8 more matches
NavigationPreloadManager - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnavigationpreloadmanager experimentalchrome full support 62edge full support 18firefox no support no
notes no support no
notes
notes implementation tracked in bug 1290958ie ?
... webview android full support 62chrome android full support 62firefox android no support no
notes no support no
notes
notes implementation tracked in bug 1290958opera android full support 46safari ios ?
... samsung internet android full support 8.0disable experimentalchrome full support 62edge full support 18firefox no support no
notes no support no
notes
notes implementation tracked in bug 1290958ie ?
...And 8 more matches
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.
...
note that in that same section of the css color module 3, there are algorigthms available to translate the hsl to rgb.
... in speaking specifically to relative luminance, wcag's definition of relative luminance
notes: "
note 2: almost all systems used today to view web content assume srgb encoding.
...And 8 more matches
Variable fonts guide - CSS: Cascading Style Sheets
a
note about font families, weights, and variants you might notice that we have been talking about having a specific font file for every weight and style (i.e.
...
note that an axis can be a range or a binary choice.
...
notes when using font-variation-settings it is important to
note that axis names are case-sensitive.
...And 8 more matches
<input type="email"> - HTML: Hypertext Markup Language
the :valid and :invalid css pseudo-classes are automatically applied as appropriate to visually de
note whether the current value of the field is a valid e-mail address or not.
...
note: normally, if you specify the required attribute, the user must enter a valid e-mail address for the field to be considered valid.
...
note: avoid using the placeholder attribute if you can.
...And 8 more matches
<textarea> - HTML: Hypertext Markup Language
note: placeholders should only be used to show an example of the type of data that should be entered into a form; they are not a substitute for a proper <label> element tied to the input.
... <textarea name="textarea" rows="5" cols="30" minlength="10" maxlength="20">write something here</textarea>
note that minlength doesn't stop the user from removing characters so that the number entered goes past the minimum, but it does make the value entered into the <textarea> invalid.
... also
note that even if you have a minlength value set (3, for example), an empty <textarea> is still considered valid unless you also have the required attribute set.
...And 8 more matches
Using the WebAssembly JavaScript API - WebAssembly
note: if you are unfamiliar with the basic concepts mentioned in this article and need more explanation, read webassembly concepts first, then come back.
...
note: you can find the sample code in our webassembly-examples github repo.
...
note: this is a convoluted, longwinded example that achieves very little, but it does serve to illustrate what is possible — using webassembly code alongside javascript in your web applications.
...And 8 more matches
Extension Versioning, Update and Compatibility - Archive of obsolete content
as a rough overview this is a version string split by periods, some examples: 2.0 1.0b1 3.0pre1 5.0.1.2
note: before firefox 1.5 the more basic firefox version format was used: major.minor.release.build[+] where only digits were allowed.
... firefox 3
note in applications based on gecko 1.9 you can also use a targetapplication entry with an id toolkit@mozilla.org and minversion and maxversion that match the toolkit version of the running application.
...
note: before firefox 1.5 the preference app.extensions.version could be used to override the version that the application believed itself to be to allow normally incompatible extensions to install.
...And 7 more matches
Mozilla Crypto FAQ - Archive of obsolete content
note that this document is for your information only and is not intended as legal advice.
...
note that due to various implementation issues, psm support for mozilla on the macintosh is lagging somewhat behind psm support on windows, linux, and other platforms.
... also
note that the nss developers are creating code for support of s/mime secure messages; however full s/mime support within mozilla will require further development, and may not be available until after the mozilla 1.0 release.
...And 7 more matches
Tamarin build documentation - Archive of obsolete content
note that additional command-line arguments are only available in the debug configuration.
...its options are '104u', '105' or '106' (
note: no '.') if you don't pass the --mac-sdk switch you will get no sdk in your build.
... setup the shell environment with the following environment variables: #
note: the include, lib and libpath must contain windows path information and separator and not cygwin paths.
...And 7 more matches
Textbox (XPFE autocomplete) - Archive of obsolete content
alwaysopenpopup obsolete since gecko 1.9.1 type: boolean
note: applies to: thunderbird and seamonkeyif true, the autocomplete popup will be displayed even when there are no matches.
... autofill obsolete since gecko 1.9.1 type: boolean
note: applies to: thunderbird and seamonkeyif set to true, the best match will be filled into the textbox as the user types.
... disablehistory obsolete since gecko 2.0 type: boolean
note: applies to: thunderbird and seamonkeyif false, an arrow button will appear on the end of the textbox which will open a dropdown menu of all available results.
...And 7 more matches
Browser Detection and Cross Browser Support - Archive of obsolete content
note that some other browsers such as safari are reporting (like gecko) in their user agent strings and can confuse simple tests.
... a final
note on vendor/version strategies.
...if (document.all) { // internet explorer 4+ document.write('<link rel="stylesheet" type="text/css" src="style-ie.css">'); } else if (document.layers) { // navigator 4 document.write('<link rel="stylesheet" type="text/css" src="style-nn.css">'); }
note how the above example only provided stylesheets for internet explorer and navigator 4 and even then only if the visitor has javascript support turned on in their browser.
...And 7 more matches
Implementation Status - Archive of obsolete content
document structure section title status
notes bugs 3.1 namespaces supported 3.2.1 common attributes supported 3.2.2 linking attributes supported 3.2.3 single-node binding attributes supported 3.2.4 node-set binding attributes supporte...
...processing model (events) section title status
notes bugs 4 processing model (events) partial the xforms-recalculate, xforms-revalidate, and xforms-refresh events are not as separated as they should be.
...datatypes section title status
notes bugs 5.1 xml schema built-in datatypes partial whitespace facet not supported.
...And 7 more matches
WAI-ARIA basics - Learn web development
note: you can find a useful list of all the aria roles and their uses, with links to futher information, in the wai-aria spec — see definition of roles.
...
note: some javascript libraries support wai-aria, meaning that when they generate ui features like complex form controls, they add aria attributes to improve the accessibility of those features.
...
note: also, try to make sure you test your site with a variety of real users — non-disabled people, people using screenreaders, people using keyboard navigation, etc.
...And 7 more matches
JavaScript basics - Learn web development
you should see something like this:
note: the reason the instructions (above) place the <script> element near the bottom of the html file is that the browser reads code in the order it appears in the file.
...
note: both of the features you used in this exercise are parts of the document object model (dom) api, which has the capability to manipulate documents.
...you start by declaring a variable with the var (less recommended, dive deeper for the explanation) or the let keyword, followed by the name you give to the variable: let myvariable;
note: a semicolon at the end of a line indicates where a statement ends.
...And 7 more matches
Mozilla internal string guide
note that you must null-terminate buffers used by to nsdependentstring.
...la strings are always a single buffer, iteration over the characters in the string is done using raw pointers: /** * find whether there is a tab character in `data` */ bool hastab(const nsastring& data) { const char16_t* cur = data.beginreading(); const char16_t* end = data.endreading(); for (; cur < end; ++cur) { if (char16_t('\t') == *cur) return true; } return false; }
note that `end` points to the character after the end of the string buffer.
...
note that iterators become invalid after changing the length of a string: /** * replace every tab character in `data` with four spaces.
...And 7 more matches
nsIAccessibleHyperLink
inherits from: nsisupports last changed in gecko 1.9 (firefox 3) method overview nsiaccessible getanchor(in long index);
note: renamed from getobject in gecko 1.9 nsiuri geturi(in long index); boolean isselected(); obsolete since gecko 1.9 boolean isvalid(); obsolete since gecko 1.9 attributes attribute type description anchorcount long the number of anchors within this hyperlink.
...
note: renamed from anchors in gecko 1.9 exceptions thrown ns_error_failure indicates that the accessible is unattached from the accessible tree.
...
note: the link itself is represented by one embedded character within the parent text, so the endindex should be startindex + 1.
...And 7 more matches
nsIBrowserHistory
is, in unsigned long alength, in boolean adobatchnotify); void removepagesbytimeframe(in long long abegintime, in long long aendtime); void removepagesfromhost(in autf8string ahost, in boolean aentiredomain); void removevisitsbytimeframe(in long long abegintime, in long long aendtime); void unregisteropenpage(in nsiuri auri); obsolete since gecko 9.0
note: the markpageasfollowedlink and markpageastyped methods were moved to nsinavhistoryservice in gecko 22.0 so that all markpageas* methods can be found in one interface.
...
note: the count attribute was removed in gecko 15.0 because it was only used to determine if there were any entries at all anyway, so the nsinavhistoryservice.hashistoryentries attribute is better for this.
... methods addpagewithdetails() obsolete since gecko 15.0 (firefox 15.0 / thunderbird 15.0 / seamonkey 2.12)
note: this method was removed in gecko 15.0.
...And 7 more matches
nsIDocShell
note that out-of-process browsers do not have an nsidocshell; instead you can access the nsidocshell object from a frame script.
...
note: prior to gecko 12.0, this attribute was part of a separate nsidoccharset interface.
...obsolete since gecko 12.0
note: the properties of the old nsidocumentcharsetinfo interface were merged into nsidocshell in gecko 12.0.
...And 7 more matches
Address Book examples
note: thunderbird and seamonkey user interfaces now reference 'contacts' not 'cards' however, as the backend still uses the 'cards' terminology, that is what is used here this article provides examples on accessing and manipulating thunderbird address books.
... let card = collection.cardforemailaddress("foo@bar.invalid.com");
note: both of these functions may raise an ns_error_not_implemented exception if the collection has not implemented that function.
... formulate a boolean search string (see nsiabcard for built-in property names): var searchquery = "(or(primaryemail,bw,@v)(nickname,bw,@v)(and(ismaillist,=,true)(
notes,bw,@v)))"; searchquery = searchquery.replace(/@v/g, encodeuricomponent("mystr") the search queries use lisp syntax with operators enumerated in nsabquerystringtoexpression.cpp.
...And 7 more matches
Browser storage limits and eviction criteria - Web APIs
note: the information below should be fairly accurate for most modern browsers, but browser specifics are called out where known.
...we term them "quota clients" in this context: indexeddb asm.js caching cache api cookies
note: in firefox, web storage will soon start to use the same storage management tools too, as described in this document.
...
note: in private browsing mode, most data storage is not supported.
...And 7 more matches
Migrating from webkitAudioContext - Web APIs
note: there is a library called webkitaudiocontext monkeypatch, which automatically fixes some of these changes to make most code targetting webkitaudiocontext to work on the standards based audiocontext out of the box, but it currently doesn't handle all of the cases below.
... changes to starting and stopping nodes in webkitaudiocontext, there are two ways to start and stop audiobuffersourcenode and oscillatornode: the
noteon() and
noteoff() methods, and the start() and stop() methods.
... (audiobuffersourcenode has yet another way of starting output: the
notegrainon() method.) the
noteon()/
notegrainon()/
noteoff() methods were the original way to start/stop output in these nodes, and in the newer versions of the specification, the
noteon() and
notegrainon() methods were consolidated into a single start() method, and the
noteoff() method was renamed to the stop() method.
...And 7 more matches
Operable - Accessibility
note: to read the w3c definitions for operable and its guidelines and success criteria, see principle 2: operable — user interface components and navigation must be operable.
... understanding character key shortcuts
note: also see the wcag description for guideline 2.1 keyboard accessible: make all functionality available from a keyboard.
... understanding timeouts
note: also see the wcag description for guideline 2.2 enough time: provide users enough time to read and use content.
...And 7 more matches
min-width - CSS: Cascading Style Sheets
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetmin-widthchrome full support 1edge full support 12firefox full support 1
notes full support 1
notes
notes css 2.1 leaves the behavior of min-width with table undefined.
... firefox supports applying min-width to table elements.ie full support 7opera full support 4
notes full support 4
notes
notes css 2.1 leaves the behavior of min-width with table undefined.
... opera supports applying min-width to table elements.safari full support 1webview android full support 4.4chrome android full support 18firefox android full support 4
notes full support 4
notes
notes css 2.1 leaves the behavior of min-width with table undefined.
...And 7 more matches
<input type="file"> - HTML: Hypertext Markup Language
note: if multiple files are selected, the string represents the first selected file.
...
note: capture was previously a boolean attribute which, if present, requested that the device's media capture device(s) such as camera or microphone be used instead of requesting a file input.
...
note: though originally implemented only for webkit-based browsers, webkitdirectory is also usable in microsoft edge as well as firefox 50 and later.
...And 7 more matches
<input type="url"> - HTML: Hypertext Markup Language
the :valid and :invalid css pseudo-classes are automatically applied as appropriate to visually de
note whether the current value of the field is a valid url or not.
...
note: avoid using the placeholder attribute if you can.
...
note: because a read-only field cannot have a value, required does not have any effect on inputs with the readonly attribute also specified.
...And 7 more matches
Introduction to using XPath in JavaScript - XPath
note that, if the xpathexpression contains a namespace prefix, this will result in a domexception being thrown with the code namespace_err.
...
note: xpath defines qnames without a prefix to match only elements in the null namespace.
...
notes adapts any dom node to resolve namespaces so that an xpath expression can be easily evaluated relative to the context of the node where it appeared within the document.
...And 7 more matches
Elements - Archive of obsolete content
notes in the current stable releases of mozilla products (e.g.
...
note: the normal same-origin policy is used for web sites; they can only link to xbl files on the same domain, or within the chrome.
...
note that content cannot be inherited, only behavior.
...And 6 more matches
Examples - Archive of obsolete content
if you wish to test these examples by yourself, please read the important
notes.
... important
notes if you plan to test these examples by yourself, you must use the right filename extension (it is written at the beginning of the code).
... please
note that the examples 4, 5 and 6 require a file named style.css to exist in the same directory as the example.
...And 6 more matches
Fundamental text and font styling - Learn web development
note: if the above paragraph leaves you feeling confused, then no matter — go back and review our box model article, to brush up on the box model theory, before carrying on.
...
note: bear in mind that the text inside an element is all affected as one single entity.
... the list of actual web safe fonts will change as operating systems evolve, but it's reasonable to consider the following fonts web safe, at least for now (many of them have been popularized thanks to the microsoft core fonts for the web initiative in the late 90s and early 2000s): name generic type
notes arial sans-serif it's often considered best practice to also add helvetica as a preferred alternative to arial as, although their font faces are almost identical, helvetica is considered to have a nicer shape, even if arial is more broadly available.
...And 6 more matches
Basic native form controls - Learn web development
note: the features discussed in this article are supported in all browsers, which is not the case for all form controls.
...
note: html form text fields are simple plain text input controls.
...
note: the <input> element is unique amongst html elements because it can take many different forms depending on its type attribute value.
...And 6 more matches
Sending form data - Learn web development
note: to get a better idea of how client-server architectures work, read our server-side website programming first steps module.
... in this example, the data is sent to an absolute url — https://example.com: <form action="https://example.com"> here, we use a relative url — the data is sent to a different url on the same origin: <form action="/somewhere_else"> when specified with no attributes, as below, the <form> data is sent to the same page that the form is present on: <form>
note: it's possible to specify a url that uses the https (secure http) protocol.
...in this case we are passing two pieces of data to the server: say, which has a value of hi to, which has a value of mom the http request looks like this: get /?say=hi&to=mom http/2.0 host: foo.com
note: you can find this example on github — see get-method.html (see it live also).
...And 6 more matches
Document and website structure - Learn web development
note: colorblind people represent around 4% of the world population or, to put it another way, approximately 1 in every 12 men and 1 in every 200 women are colorblind.
...it's considered best practice to begin each section with a heading; also
note that you can break <article>s up into different <section>s, or <section>s up into different <article>s, depending on the context.
...for example: <p>the king walked drunkenly back to his room at 01:00, the beer doing nothing to aid him as he staggered through the door <span class="editor-
note">[editor's
note: at this point in the play, the lights should be down low]</span>.</p> in this case, the editor's
note is supposed to merely provide extra direction for the director of the play; it is not supposed to have extra semantic meaning.
...And 6 more matches
Getting started with HTML - Learn web development
for example, consider the following line of text: my cat is very grumpy if we wanted the text to stand by itself, we could specify that it is a paragraph by enclosing it in a paragraph (<p>) element: <p>my cat is very grumpy</p>
note: tags in html are case-insensitive.
...(the spacing is due to default css styling that the browser applies to paragraphs.)
note: html5 redefined the element categories: see element content categories.
...
note: the terms block and inline, as used in this article, should not be confused with the types of css boxes that have the same names.
...And 6 more matches
What went wrong? Troubleshooting JavaScript - Learn web development
note: you might well have your own version of the game example that doesn't work, which you might want to fix!
...
note: see our typeerror: "x" is not a function reference page for more details about this error.
...
note: null is a special value that means "nothing", or "no value".
...And 6 more matches
Object prototypes - Learn web development
note: this article covers traditional javascript constructors and classes.
...
note: it's important to understand that there is a distinction between an object's prototype (available via object.getprototypeof(obj), or via the deprecated __proto__ property) and the prototype property on constructor functions.
...
note: we want to reiterate that the methods and properties are not copied from one object to another in the prototype chain.
...And 6 more matches
Getting started with Svelte - Learn web development
note: recently svelte has added official typescript support, one of its most requested features.
...
note that you can also use the yarn package manager in place of npm, but we'll assume you are using npm in this set of tutorials.
... to create your starter app template, run the following terminal commands: npx degit sveltejs/template moz-todo-svelte cd moz-todo-svelte npm install npm run dev
note: degit doesn't do any kind of magic — it just lets you download and unzip the latest version of a git repo's contents.
...And 6 more matches
Advanced Svelte: Reactivity, lifecycle, accessibility - Learn web development
note: if foo is a top level variable, you can easily tell svelte to update obj whenever foo is changed with the following reactive statement: $: foo, obj = obj.
...
note: svelte allows us to specify different options that affect how the compiler works.
...
note: the { name } syntax is just a shorthand for { name: name }.
...And 6 more matches
Introducing a complete toolchain - Learn web development
note: it's also worth repeating that not all of these tools need to be run on the command line.
...
note: though it's not clear from the install process, installing npm also installs a complimentary tool called npx.
...
note that, although we're using github in this chapter, there are several alternatives including gitlab and bitbucket, and you could even host your own git repositories.
...And 6 more matches
Performance best practices for Firefox front-end engineers
it's also important to
note that most of our javascript runs on the main thread, so it's easy for script to cause delays in event processing or painting.
...
note that requestanimationframe() lets you queue up javascript to run right before the style flush occurs.
...
note that your test and function must be called synchronously in order for this test to be accurate.
...And 6 more matches
Dict.jsm
avascript scope: components.utils.import("resource://gre/modules/dict.jsm"); creating a dictionary you can create a new, empty dictionary by simply calling the dict() constructor: var newdict = new dict(); if you wish, you may also pass in an object literal of key/value pairs with which to initialize the dictionary: var someobj = {}; var newdict = new dict({key1: "foo", key2: someobj});
note that values may be any javascript object type.
...
note: you can actually specify non-strings as keys; these are converted to strings before being used, so they're documented here as if they were a string parameter.
... in firefox 19 and above, you may also pass a json string to initialize the dictionary: var somejson = '{key1: "foo", key2: {}}'; var newdict = new dict(somejson);
note: any string you pass will be assumed to be json.
...And 6 more matches
Application Translation with Mercurial
gaia-* de
notes branches of firefox os, the operating system for mobile devices.
... firefox and fx-* de
note branches of firefox for desktop, the browser for desktops and
notebooks running, windows, mac os or linux.
... fennec and fennec-* de
note branches of firefox for mobile, the firefox browser for the android operating system.
...And 6 more matches
Profiling with the Firefox Profiler
note that high priority events such as vsync are not included here.
... also
note that this indicates what would have happened had there been an event waiting and not necessarily that there was an event pending for that long.
...as you zoom in on ranges, breadcrumbs are created allowing you to easily navigate back to previously-selected ranges or the entire profile (de
noted as "full range").
...And 6 more matches
nsIFaviconService
note: this is an asynchronous operation; when it completes, a "places-favicons-expired" notification is dispatched through the observer's service.
... getfavicondata() obsolete since gecko 22.0 (firefox 22.0 / thunderbird 22.0 / seamonkey 2.19)
note: this method was removed in gecko 22.0.
... getfavicondataasdataurl() obsolete since gecko 22.0 (firefox 22.0 / thunderbird 22.0 / seamonkey 2.19)
note: this method was removed in gecko 22.0.
...And 6 more matches
nsINavHistoryObserver
methods onbeforedeleteuri() obsolete since gecko 21.0 (firefox 21.0 / thunderbird 21.0 / seamonkey 2.18)
note: this method was removed in gecko 21.0 as part of bug 826409.
...
note: the page does not necessarily have to have ever existed for this function to be called.
...
note: see using onbeforedeleteuri() in gecko 1.9.1 for how to implement this in gecko 1.9.1 void onbeforedeleteuri( in nsiuri auri, in acstring aguid ); parameters auri the uri of the page about to be deleted.
...And 6 more matches
nsIPropertyBag2
note: accessing a property of a different type may attempt conversion to this type.
...
note: accessing a property of a different type may attempt conversion to this type.
...
note: accessing a property of a different type may attempt conversion to this type.
...And 6 more matches
nsISessionStore
the api operates on top-level browser.xul and navigator.xul windows; see
note on windows for details.
...
note: the returned string does not include cookies.
...see #
note on windows.
...And 6 more matches
nsIWindowWatcher
inherits from: nsisupports last changed in gecko 0.9.6 usage
notes: this component has an activewindow property.
...
note that there is no interface for such notifications (not a public one, anyway).
...
note: this method will search all open windows for any window or frame with the given window name.
...And 6 more matches
Plug-in Basics - Plugins
note: np_initialize and np_shutdown are not technically a part of the function table that the plug-in hands to the browser.
...
note: plug-in api calls and callbacks use the main navigator thread.
... %appdata%\mozilla\plugins, where %appdata% de
notes per-user application data directory.
...And 6 more matches
Debugger - Firefox Developer Tools
however,
note that a { return:value } resumption value is treated like undefined (“continue normally”);value is ignored.
...however,
note that a { return:value } resumption value is treated like undefined (“continue normally”);value is ignored.
...however,
note that a { return:value } resumption value is treated like undefined (“continue normally”);value is ignored.
...And 6 more matches
WindowOrWorkerGlobalScope.setTimeout() - Web APIs
note that in either case, the actual delay may be longer than intended; see reasons for delays longer than specified below.
...
note: passing additional parameters to the function in the first syntax does not work in internet explorer 9 and below.
...function () { vcallback.apply(othis, aargs); } : vcallback, ndelay); };
note: these two replacements will also enable the html5 standard passage of arbitrary arguments to the callback functions of timers in ie.
...And 6 more matches
Using CSS animations - CSS: Cascading Style Sheets
examples
note: some older browsers (pre-2017) may need prefixes; the live examples you can click to see in your browser include the -webkit prefixed syntax.
...
note that animations like this can cause the page to become wider than the browser window.
... <p>the caterpillar and alice looked at each other for some time in silence: at last the caterpillar took the hookah out of its mouth, and addressed her in a languid, sleepy voice.</p>
note: reload page to see the animation, or click the codepen button to see the animation in the codepen environment.
...And 6 more matches
<color> - CSS: Cascading Style Sheets
a <color> can be defined in any of the following ways: using a keyword (such as blue or transparent) using the rgb cubic-coordinate system (via the #-hexadecimal or the rgb() and rgba() functional notations) using the hsl cylindrical-coordinate system (via the hsl() and hsla() functional notations)
note: this article describes the <color> data type in detail.
...
note: although <color> values are precisely defined, their actual appearance may vary (sometimes significantly) from device to device.
...
note: the list of accepted keywords has undergone many changes during the evolution of css: css level 1 only included 16 basic colors, called the vga colors as they were taken from the set of displayable colors on vga graphics cards.
...And 6 more matches
Cross-browser audio basics - Developer guides
sic audio example the code below is an example of a basic audio implementation using html5: <audio controls> <source src="audiofile.mp3" type="audio/mpeg"> <source src="audiofile.ogg" type="audio/ogg"> <!-- fallback for non supporting browsers goes here --> <p>your browser does not support html5 audio, but you can still <a href="audiofile.mp3">download the music</a>.</p> </audio>
note: you can also use an mp4 file instead of mp3.
...</audio>
note: this value is often ignored on mobile platforms, and its use is not recommended unless really necessary.
...</audio>
note: this value is often ignored on mobile platforms.
...And 6 more matches
WebAssembly.Module - JavaScript
desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jsmodulechrome full support 57edge full support 16firefox full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).ie no support noopera full support 44safari full support 11webview android full support ...
... 57chrome android full support 57firefox android full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).opera android full support 43safari ios full support 11samsung internet android full support 7.0nodejs full support 8.0.0module() constructorchrome full support 57edge full support 16firefox full support ...
... 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).ie no support noopera full support 44safari full support 11webview android full support 57chrome android full support 57firefox android full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).opera android full support 43safari ios ...
...And 6 more matches
d - SVG: Scalable Vector Graphics
value <string> default value none animatable yes
note: the point of origin (the coordinate 0,0) is usually the upper left corner of the context.
... svg defines 6 types of path commands, for a total of 20 commands: moveto: m, m lineto: l, l, h, h, v, v cubic bézier curve: c, c, s, s quadratic bézier curve: q, q, t, t elliptical arc curve: a, a closepath: z, z
note: commands are case-sensitive.
... command parameters
notes m (x, y)+ move the current point to the coordinate x,y.
...And 6 more matches
Using custom elements - Web Components
note: custom elements are supported by default in firefox, chrome, and edge (76).
...
note that custom element names require a dash to be used in them (kebab-case); they can't be single words.
...over in our html, we use it like so: <popup-info img="img/alt.png" data-text="your card validation code (cvc) is an extra security feature — it is the last 3 or 4 numbers on the back of your card."></popup-info>
note: you can see the full javascript source code here.
...And 6 more matches
Preferences - Archive of obsolete content
note: this article doesn't cover all available methods for manipulating preferences; please refer to the xpcom reference pages listed in resources section for the complete list of methods.
...var value = prefs.getboolpref("typeaheadfind"); // get a pref (accessibility.typeaheadfind) prefs.setboolpref("typeaheadfind", !value); // set a pref (accessibility.typeaheadfind) complex types as
noted in the previous section, each entry in the preferences database (prefs.js) must have a string, an integer, or a boolean value.
... however, there is a concept of complex types, which makes it easier for developers to save and load nsilocalfile and nsisupportsstring objects in preferences (as strings —
note that from the preferences system's point of view, complex values have a nsiprefbranch.pref_string type.) there are two nsiprefbranch methods implementing the concept — setcomplexvalue() and getcomplexvalue().
...And 5 more matches
Menu - Archive of obsolete content
note: this page documents the jetpack prototype, which has since been replaced by the add-on sdk.
...(
note that any falsey value will suffice, including undefined, null, and the empty string.
...
note that some environments, notably gnome 2.28, do not support menuitem icons either by default or at all.
...And 5 more matches
Using the Editor from XUL - Archive of obsolete content
note that the <editor> element is really just an <iframe> which takes over some of the task of creating the editor from javascript.
...
note: since we already know this when we have an <editor></editor> tag, we should remove the need to call this.
...
note: these callbacks also fire for every subdocument that loads as a result of the parent document load, for example with frameset documents, or html documents with their own embedded <iframe>s.
...And 5 more matches
Getting started with XULRunner - Archive of obsolete content
note: if you are using firefox build from ubuntuzilla repository, replace /usr/lib/firefox/platform.ini with /opt/firefox/platform.ini.
...see the
note below.
...
note: in xulrunner 2.0, the chrome.manifest is now used to register xpcom components in addition to its previous uses.
...And 5 more matches
CSS and JavaScript accessibility best practices - Learn web development
note: a high contrast ratio will also allow anyone using a smartphone or tablet with a glossy screen to better read pages when in a bright environment, such as sunlight.
...
note: invisible content just for screen reader users has a lot more useful detail surrounding this topic.
...
note: server-side validation has not been implemented in this simple demo.
...And 5 more matches
Cascade and inheritance - Learn web development
note: on mdn css property reference pages you can find a technical information box, usually at the bottom of the specifications section, which lists a number of data points about that property, including whether it is inherited or not.
...
note: there is also a newer value, revert, which has limited browser support.
...
note: see origin of css declarations in introducing the css cascade for more information on each of these and how they work.
...And 5 more matches
CSS values and units - Learn web development
note: you'll also see css values referred to as data types.
...
note: yes, css values tend to be de
noted using angle brackets, to differentiate them from css properties (e.g.
...
note that, while many values accept a length or a percentage, there are some that only accept length.
...And 5 more matches
Practical positioning examples - Learn web development
our simple example will look like this once we are finished:
note: you can see the finished example running live at info-box.html (source code).
...
note: some web developers take things even further, only having one page of information loaded at once, and dynamically changing the information shown using a javascript feature such as xmlhttprequest.
...first, add the following rule at the bottom of your css to remove the default padding-left and margin-top from the unordered list: .info-box ul { padding-left: 0; margin-top: 0; }
note: we are using descendant selectors with .info-box at the start of the chain throughout this example — this is so that we can insert this feature into a page with other content already on it, without fear of interfering with the styles applied to other parts of the page.
...And 5 more matches
Responsive design - Learn web development
note: see this simple liquid layout: example, source code.
...
note: see this simple fixed-width layout: example, source code.
...
note: the screenshots above are taken using the responsive design mode in firefox devtools.
...And 5 more matches
Creating hyperlinks - Learn web development
note: a url can point to html files, text files, images, text documents, video and audio files, or anything else that lives on the web.
...
note: a link title is only revealed on mouse hover, which means that people relying on keyboard controls or touchscreens to navigate web pages will have difficulty accessing title information.
... <a href="https://www.mozilla.org/"> <img src="mozilla-image.png" alt="mozilla logo that links to the mozilla homepage"> </a>
note: you'll find out more about using images on the web in a future article.
...And 5 more matches
Images in HTML - Learn web development
note: you should read a quick primer on urls and paths to refresh your memory on relative and absolute urls before continuing.
...
note: search engines also read image filenames and count them towards seo.
... our above code would give us the following result:
note: elements like <img> and <video> are sometimes referred to as replaced elements.
...And 5 more matches
From object to iframe — other embedding technologies - Learn web development
note: in order to improve speed, it's a good idea to set the iframe's src attribute with javascript after the main content is done with loading.
...
note: github pages allow content to be served via https by default, so is useful for hosting content.
...one important
note is that you should never add both allow-scripts and allow-same-origin to your sandbox attribute — in that case, the embedded content could bypass the same-origin policy that stops sites from executing scripts, and use javascript to turn off sandboxing altogether.
...And 5 more matches
Video and audio content - Learn web development
note: before you begin here, you should also know that there are quite a few ovps (online video providers) like youtube, dailymotion, and vimeo, and online audio providers like soundcloud.
...here is a <a href="rabbit320.webm">link to the video</a> instead.</p> </video> the features of
note are: src in the same way as for the <img> element, the src (source) attribute contains a path to the video you want to embed.
... preload used for buffering large files; it can take one of three values: "none" does not buffer the file "auto" buffers the media file "metadata" buffers only the metadata for the file you can find the above example available to play live on github (also see the source code.)
note that we haven't included the autoplay attribute in the live version — if the video starts to play as soon as the page loads, you don't get to see the poster!
...And 5 more matches
HTML table advanced features and accessibility - Learn web development
note: the summary attribute can also be used on the <table> element to provide a description — this is also read out by screenreaders.
...
note: you can find our version on github — see timetable-caption.html (see it live also).
...
note: <tbody> is always included in every table, implicitly if you don't specify it in your code.
...And 5 more matches
Making decisions in your code — conditionals - Learn web development
this code is pretty human-readable — it is saying "if the condition returns true, run code a, else run code b" you should
note that you don't have to include the else and the second curly brace block — the following is also perfectly legal code: if (condition) { code to run if condition is true } run some other code however, you need to be careful here — in this case, the second block of code is not controlled by the conditional statement, so it always runs, regardless of whether the condition returns true or fa...
...
note: you can see a more complete version of this example on github (also see it running live.) else if the last example provided us with two choices, or outcomes — but what if we want more than two?
...
note: you can also find this example on github (see it running live on there also.) a
note on comparison operators comparison operators are used to test the conditions inside our conditional statements.
...And 5 more matches
Introduction to web APIs - Learn web development
note: see also the api glossary entry for further description.
...
note that javascript is also available in other programming environments, such as node.
...
note: you can find information on a lot more 3rd party apis at the programmable web api directory.
...And 5 more matches
Aprender y obtener ayuda - Learn web development
note: the above text should have given you an important fact — you aren't expected to remember everything!
...
note: online code editors are also really useful for sharing code you've written, for example, if you are collaborating on learning with someone else who isn't in the same location, or are sending it someone to ask for help with it.
...
note: you might favor one learning method over the others, but realistically a hybrid approach is probably what you will end up with.
...And 5 more matches
Creating our first Vue component - Learn web development
note: if you need to check your code against our version, you can find a finished version of the sample vue app code in our todo-vue repository.
...
note that the component file name and its representation in javascript is always in upper camel case (e.g.
...
note: prop validation only happens in development mode, so you can't strictly rely on it in production.
...And 5 more matches
Getting started with Vue - Learn web development
note: if you don't have the above installed, find out more about installing npm and node.js here.
...
note: we've not gone over all of the options here, but you can find more information on the cli in the vue docs.
...
note: this is not the template for managing the layout of your application — this template is for managing static html that sits outside of your vue app.
...And 5 more matches
Eclipse CDT
note: your moz_objdir must be outside the mozilla source directory.
...when changing individual key bindings,
note that bindings are context sensitive and that any changes you make may be ignored if they conflict with existing bindings, or if they are overridden by a binding for a more specific context.
...
note that the search, call hierarchy, and other tabs have a "pin" button that allows you to open multiple tabs of these type.
...And 5 more matches
IME handling guide
selected clause of raw text typed by the user selection_ime_selectedrawtext eimeselectedrawclause eselectedrawclause converted clause by ime selection_ime_convertedtext eimeconvertedclause econvertedclause selected clause by the user or ime and also converted by ime selection_ime_selectedconvertedtext eimeselectedclause eselectedclause
note that typically, "selected clause of raw text typed by the user" isn't used because when composition string is already separated to multiple clauses, that means that the composition string has already been converted by ime at least once.
...
note that all instances of textcomposition are managed by imestatemanager.
...
note that microsoft word uses this hack.
...And 5 more matches
Download
note: you shouldn't rely on this property being equal to totalbytes to determine whether the download is completed.
...
note: you shouldn't rely on this property being equal to 100 to determine whether the download is completed.
...
note: this property's value may not match the actual final size of the downloaded file if the download is encoded during the network transfer.
...And 5 more matches
Sqlite.jsm
note: the sqlite.jsm javascript code module can only be used from chrome -- that is, from within the application itself or an add-on.
...please
note that this is not a timer on the idle service and this could fire while the application is active.
...see
notes below.
...And 5 more matches
Mozilla MathML Status
attribute
notes display implemented.
... attribute
notes id, class, style implemented.
... token elements element [- attribute]
notes mi implemented.
...And 5 more matches
Index
91 jsclass.call jsapi reference, spidermonkey
note that when a custom object is called, a this argument is calculated for it just as if it were a function.
...embeddings must not pass jsid_void into jsapi entry points expecting a jsid and do not need to handle jsid_void in hooks receiving a jsid except when explicitly
noted in the api contract.
...
note also that while for..in includes properties inherited from prototypes, iterator objects do not.) 411 js_newregexpobject jsapi reference, reference, référence(2), spidermonkey js_newregexpobject and js_newucregexpobject create a new regexp instance.
...And 5 more matches
JSAPI User Guide
note: the foss wiki page contains a few links to other libraries and programs that can make life easier when using spidermonkey and jsapi.
...again,
note that calling js_reporterror does not cause a c++ exception to be thrown.
...
note that the most important example is in the "a minimal example" section above.
...And 5 more matches
Shell global objects
note: this list overlaps with "built-in functions" in introduction to the javascript shell and is probably not complete.
...all disassembly functions take these options as leading string arguments: -r disassemble recursively -l show line numbers -s omit source
notes dis([fun/code]) disassemble functions into bytecodes.
...
notes([fun]) show source
notes for functions.
...And 5 more matches
Places Developer Guide
other bookmarks apis
note: this document covers the toolkit places services.
...
note: this does not re-index the whole folder - use moveitem for a managed solution.
...
note that this service is only currently available for firefox, not other toolkit-based applications.
...And 5 more matches
How to build an XPCOM component in JavaScript
here's the xpidl definition for our helloworld component: helloworld.idl #include "nsisupports.idl" [scriptable, uuid(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)] interface nsihelloworld : nsisupports { string hello(); };
note that you must generate a new uuid for each xpcom component that you create.
... for code outside the tree
note: on windows if you download the gecko sdk without the whole build tree, you will be missing some required dlls for xpidl.exe and it will run with no errors but not do anything.
...
note: the mac version of the sdk provided for download is powerpc-only.
...And 5 more matches
Introduction to XPCOM for the DOM
important
note: this document assumes some knowledge of c++, specially the object-oriented part of it.
...the important thing to
note is that a pointer to nsifoo can only call the methods defined on the nsifoo interface, and on its parents.
...
note: the previous paragraph is extremely important.
...And 5 more matches
mozIStorageStatement
methods initialize() obsolete since gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0)
note: this method has been removed for gecko 1.9.1.
... void finalize();
note: this method does not need to be used from native callers because you have to release the statement in order to not leak.
...
note: javascript callers should always wrap their execution in a try block, and have a reset statement in a finally block.
...And 5 more matches
nsICryptoHash
note: this method may be called any time after " ..
...
note: this method or " ..
...
note: this method or " ..
...And 5 more matches
nsIFile
to create an nsifile from a path you can use fileutils.jsm: var fileutils = cu.import("resource://gre/modules/fileutils.jsm").fileutils var nsifile = new fileutils.file( filename )
note: nsilocalfile was merged with this interface in gecko 14.
...
note: the value of the followlinks attribute is not encoded in the persistent descriptor.
...
note: this method does not return a new nsifile; it modifies the object it was called on.
...And 5 more matches
nsILocalFileMac
obsolete since gecko 2.0 methods native code only!getcfurl
note: observes the state of the followlinks attribute.
...
note: supported only for xp_macosx.
...native code only!getfsref
note: observes the state of the followlinks attribute.
...And 5 more matches
nsIPrincipal
note that this may be empty; prefer to get the certificate itself and get this information from it, since that may provide more information.
...
note: this wasn't accessible by scripts prior to gecko 2.0.
...
note: prior to gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1), this was not available to scripts.
...And 5 more matches
characteristic - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcharacteristic experimentalchrome full support 57
notes full support 57
notes
notes macos only.
... full support 57
notes disabled
notes linux and versions of windows earlier than 10.disabled from version 57: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled).
... full support 70
notes
notes windows 10.edge full support ≤79
notes full support ≤79
notes
notes macos only.
...And 5 more matches
readValue() - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetreadvalue experimentalchrome full support 57
notes full support 57
notes
notes macos only.
... full support 57
notes disabled
notes linux and versions of windows earlier than 10.disabled from version 57: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled).
... full support 70
notes
notes windows 10.edge full support ≤79
notes full support ≤79
notes
notes macos only.
...And 5 more matches
uuid - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetuuid experimentalchrome full support 57
notes full support 57
notes
notes macos only.
... full support 57
notes disabled
notes linux and versions of windows earlier than 10.disabled from version 57: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled).
... full support 70
notes
notes windows 10.edge full support ≤79
notes full support ≤79
notes
notes macos only.
...And 5 more matches
value - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetvalue experimentalchrome full support 57
notes full support 57
notes
notes macos only.
... full support 57
notes disabled
notes linux and versions of windows earlier than 10.disabled from version 57: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled).
... full support 70
notes
notes windows 10.edge full support ≤79
notes full support ≤79
notes
notes macos only.
...And 5 more matches
writeValue() - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetwritevalue experimentalchrome full support 57
notes full support 57
notes
notes macos only.
... full support 57
notes disabled
notes linux and versions of windows earlier than 10.disabled from version 57: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled).
... full support 70
notes
notes windows 10.edge full support ≤79
notes full support ≤79
notes
notes macos only.
...And 5 more matches
Cache - Web APIs
note that the cache interface is exposed to windowed scopes as well as workers.
...
note: the key matching algorithm depends on the vary header in the value.
...
note: the caching api doesn't honor http caching headers.
...And 5 more matches
Using the Web Audio API - Web APIs
example code our boombox looks like this:
note the retro cassette deck with a play button, and vol and pan sliders to allow you to alter the volume and stereo panning.
...
note: if you just want to process audio data, for instance, buffer and stream it but not play it, you might want to look into creating an offlineaudiocontext.
... <audio src="mycooltrack.mp3"></audio>
note: if the sound file you're loading is held on a different domain you will need to use the crossorigin attribute; see cross origin resource sharing (cors) for more information.
...And 5 more matches
Window.prompt() - Web APIs
note that in internet explorer 7 and 8, if you do not provide this parameter, the string "undefined" is the default value.
... the above prompt appears as follows (in chrome on os x):
notes a prompt dialog contains a single-line textbox, a cancel button, and an ok button, and returns the (possibly empty) text the user entered into that textbox.
... please
note that result is a string.
...And 5 more matches
ARIA annotations - Accessibility
note: you can find all the examples discussed in this article in a demo file at aria-annotations.
... role="insertion" and role="deletion" — semantically de
note html elements whose contents represent an insertion to or deletion from the overall document.
...
note that these aren’t part of the new aria annotations features, but they are of central relevance.
...And 5 more matches
position - CSS: Cascading Style Sheets
(
note that there are browser inconsistencies with perspective and filter contributing to containing block formation.) its final position is determined by the values of top, right, bottom, and left.
...
note that a sticky element "sticks" to its nearest ancestor that has a "scrolling mechanism" (created when overflow is hidden, scroll, auto, or overlay), even if that ancestor isn't the nearest actually scrolling ancestor.
...in the example below,
note how the other elements are placed as if "two" were taking up the space of its normal location.
...And 5 more matches
Getting Started - Developer guides
httprequest = new xmlhttprequest(); } else if (window.activexobject) { // ie 6 and older httprequest = new activexobject("microsoft.xmlhttp"); }
note: for illustration purposes, the above is a somewhat simplified version of the code to be used for creating an xmlhttp instance.
...at this stage, you need to tell the xmlhttp request object which javascript function will handle the response, by setting the onreadystatechange property of the object and naming it after the function to call when the request changes state, like this: httprequest.onreadystatechange = nameofthefunction;
note that there are no parentheses or parameters after the function name, because you're assigning a reference to the function, rather than actually calling it.
...
note that if you want to post data, you may have to set the mime type of the request.
...And 5 more matches
Live streaming web audio and video - Developer guides
note: some vendors implement propriety transport protocols, such as realnetworks and their real data transport (rdt).
...
note: time shifting is the process of consuming a live stream sometime after it happened.
...
note: you can find a guide to encoding hls and mpeg-dash for use on the web at setting up adaptive streaming media sources.
...And 5 more matches
Audio and Video Delivery - Developer guides
note: the preload attribute may be ignored by some mobile browsers.
...
note: the autoplay attribute may be ignored by some mobile browsers.
...
note: play will be ignored by most browsers unless issued by a user-initiated event.
...And 5 more matches
Audio and video manipulation - Developer guides
note: due to potential security issues if your video is on a different domain than your code, you'll need to enable cors (cross origin resource sharing) on your video server.
...
note: you can find the source code of this demo on github (see it live also).
...
note that the playbackrate property works with both <audio> and <video>, but in both cases, it changes the playback speed but not the pitch.
...And 5 more matches
User input and controls - Developer guides
note: have a look at the events reference and keyboardevent guide to find out more about keyboard events.
...
note: for further information about what you can do with touch events, please read our touch events guide.
...
note: pointer events are not widely supported yet, but a pointer.js polyfill is available on mozilla github.
...And 5 more matches
<link>: The External Resource Link element - HTML: Hypertext Markup Language
the rel stands for "relationship", and is probably one of the key features of the <link> element — the value de
notes how the item being linked to is related to the containing document.
... other usage
notes: a <link> element can occur either in the <head> or <body> element, depending on whether it has a link type that is body-ok.
...
note: the importance attribute may only be used for the <link> element if rel="preload" or rel="prefetch" is present.
...And 5 more matches
<th> - HTML: Hypertext Markup Language
note: do not use this attribute as it is obsolete in the latest standard.
...
note: do not use this attribute as it is obsolete in the latest standard: use the scope attribute instead.
... lime = "#00ff00" gray = "#808080" olive = "#808000" white = "#ffffff" yellow = "#ffff00" maroon = "#800000" navy = "#000080" red = "#ff0000" blue = "#0000ff" purple = "#800080" teal = "#008080" fuchsia = "#ff00ff" aqua = "#00ffff"
note: do not use this attribute, as it is non-standard and only implemented in some versions of microsoft internet explorer: the <th> element should be styled using css.
...And 5 more matches
Firefox user agent string reference - HTTP
note that platform can consist of multiple "; "-separated tokens.
... for other products based on gecko, the string can take one of two forms, where the tokens have the same meaning except those
noted below: mozilla/5.0 (platform; rv:geckoversion) gecko/geckotrail appname/appversion mozilla/5.0 (platform; rv:geckoversion) gecko/geckotrail firefox/firefoxversion appname/appversion appname/appversion indicates the application name and version.
...
note that the same gecko—with the same capabilities—is shipped to all versions of android.
...And 5 more matches
cfx - Archive of obsolete content
but
note that the version must be 4.0b7 or later.
...but
note that at present only firefox is supported.
...
note the hyphen after "test" in the module name.
...And 4 more matches
StringView - Archive of obsolete content
if you want to see how to create a stringview bigger than its content, please, see this
note.
... performance
note: each invocation of stringview.makeindex() runs a cycle for all characters contained in the stringview object between startfrom and startfrom + characterslength.
...xamples function mycallback (charcode, characteroffset, rawoffset /*, rawdataarray */) { this.appendchild(document.createtextnode("char #" + characteroffset + ", raw index: " + rawoffset + ", character: " + string.fromcharcode(charcode))); this.appendchild(document.createelement("br")); } (new stringview("\u4367\ud889\ude54\u4343\u5431")).foreachchar(mycallback, document.body);
note: stringview.foreachchar() executes a complete cycle through all characters in the stringview between characteroffset and characteroffset + characterslength.
...And 4 more matches
Setting up an extension development environment - Archive of obsolete content
note: for an extended guide on how to set up even more user profiles, take a look at multiple firefox profiles.
...
note: you could run firefox using your regular profile while developing.
...
note that since many people have this setting turned off when developing, you will see lots of warnings for problems with their code in addition to warnings for your own extension.
...And 4 more matches
Learn XPI Installer Scripting by Example - Archive of obsolete content
first, a quick scan of the contents of the xpi file (which you can open using with any unzip utility) reveals the following high-level directory structure: install.js bin\ chrome\ components defaults\ icons\ plugins\ res\
note that this high-level structure parallels the directory structure of the installed browser very closely: as you will see in the installation script, the contents of the archive are installed onto the file system in much the same way that they are stored in the archive itself, though it's possible to rearrange things arbitrarily upon installation--to create new directories, to install files in s...
...
note also that when you call methods on the install--as you do so often in installation scripts (getfolder, initinstall, addfile, and performinstall are all examples of common install object methods)--the install object is implicit; like the window object in regular web page scripts, the install object does not need to be prefixed to the method.
...
note that in the first few lines of this process, new content from the xpi is being registered, and in the remainder, it is new skin information.
...And 4 more matches
OpenClose - Archive of obsolete content
note that the open property applies to the menu or button, not to the menupopup.
...
note that while the open attribute applies to the parent menu or button, the openpopup method applies to the menupopup element.
... somepopup.openpopup(anchor, "after_start", 10, -2, false, false);
note that the anchor and positioning only specifies the position when the popup is opened.
...And 4 more matches
textbox (Toolkit autocomplete) - Archive of obsolete content
note: for seamonkey 2.0 and all versions of thunderbird prior to 3.0 you also need to provide the disablehistory attribute.
...
note: for firefox 12 and above, this event handler must be set as an initial attribute.
...
note: for firefox 12 and above, this event handler must be set as an initial attribute.
...And 4 more matches
Modifying a XUL Interface - Archive of obsolete content
note this button is not visible, nor is it attached to anything yet.
...
note that for all these functions, the object referred to by the variable referencechild or the variables newchild and oldchild must already exist or an error occurs.
...
note that some elements, such as listbox and menulist provide some additional specialized modification functions which you should use instead when you can.
...And 4 more matches
Building a Theme - Archive of obsolete content
note: this tutorial is about building themes for firefox 29 and later.
...
note: firefox for mac os x has changed some directories so the guide may be obsolete.
...this is a value you come up with to identify your extension in email address format (
note that it should not be your email).
...And 4 more matches
Responsive images - Learn web development
note: the new features discussed in this article — srcset/sizes/<picture> — are all supported in release versions of modern desktop and mobile browsers (including microsoft's edge browser, although not internet explorer.) how do you create responsive images?
...you should
note that we will be focusing on the html <img>s for this section, as seen in the content area of the example above — the image in the site header is only for decoration, and therefore implemented using css background images.
...for each one, we write: an image filename (elva-fairy-480w.jpg) a space the image's intrinsic width in pixels (480w) —
note that this uses the w unit, not px as you might expect.
...And 4 more matches
HTML table basics - Learn web development
name mass (1024kg) diameter (km) density (kg/m3) gravity (m/s2) length of day (hours) distance from sun (106km) mean temperature (°c) number of moons
notes terrestial planets mercury 0.330 4,879 5427 3.7 4222.6 57.9 167 0 closest to the sun venus 4.87 12,104 5243 8.9 2802.0 108.2 464 0 earth 5.97 12,756 5514 9.8 24.0 149.6 15 1 our world mars 0.642 6,792 3933 3.7 24.7 227.9 -65 2 the red planet ...
...
note: you can also find this on github as simple-table.html (see it live also).
...this works in exactly the same way as a <td>, except that it de
notes a header, not a normal cell.
...And 4 more matches
Introducing asynchronous JavaScript - Learn web development
you can try it for yourself: <button>click me</button>
note: it is important to remember that alert(), while being very useful for demonstrating a synchronous blocking operation, is terrible for use in real world applications.
...
note that not all callbacks are async — some run synchronously.
...let's look at a quick example, from our fetching data from the server article: fetch('products.json').then(function(response) { return response.json(); }).then(function(json) { products = json; initialize(); }).catch(function(err) { console.log('fetch problem: ' + err.message); });
note: you can find the finished version on github (see the source here, and also see it running live).
...And 4 more matches
Functions — reusable blocks of code - Learn web development
note: feel free to enter these lines into your browser's javascript console to re-familiarize yourself with their functionality, if needed.
...
note: parameters are sometimes called arguments, properties, or even attributes.
...when called, it always returns a random number between 0 and 1: let mynumber = math.random(); the browser's built-in string replace() function however needs two parameters — the substring to find in the main string, and the substring to replace that string with: let mytext = 'i am a string'; let newstring = mytext.replace('string', 'sausage');
note: when you need to specify multiple parameters, they are separated by commas.
...And 4 more matches
Third-party APIs - Learn web development
note: you might want to just get all our code examples at once, in which case you can then just search the repo for the example files you need in each section.
...
note: some apis handle access to their functionality slightly differently, requiring the developer to make an http request to a specific url pattern to retrieve data.
...
note: when creating your own examples, you'll use your own api key in place of any placeholder.
...And 4 more matches
Object-oriented JavaScript for beginners - Learn web development
note: the fancy word for the ability of multiple object types to implement the same functionality is polymorphism.
...
note: a constructor function name usually starts with a capital letter — this convention is used to make constructor functions easier to recognize in code.
...
note that they are using their own name value that was assigned to them when they were created; this is one reason why it is very important to use this, so each one uses its own value, and not some other value.
...And 4 more matches
Getting started with React - Learn web development
the jsx approach allows us to nest our elements within each other, just like we do with html: const header = ( <header> <h1>mozilla developer network</h1> </header> );
note: the parentheses in the previous snippet aren't unique to jsx, and don’t have any effect on your application.
...
note: if you have the yarn package manager installed, create-react-app will default to using it instead of npm.
...
note the use of ./ at the beginning of the path, and the .svg extension at the end — these tell us that the file is local and that it is not a javascript file.
...And 4 more matches
Implementing feature detection - Learn web development
note how the javascript representations of those properties that are stored inside the htmlelement.style object use lower camel case, not hyphens, to separate the words.
...
note: if you have trouble getting this to work, you can compare it to our css-feature-detect-finished.html code (see also the live version).
...
note: often such an approach is overkill for a minor feature detection problem — you can often get away with using multiple vendor prefixes and fallback properties, as described in css fallback behavior and handling css prefixes.
...And 4 more matches
Deploying our app - Learn web development
note: cache busting is a new term that we haven't met before in the module.
... the above tasks also break down into further tasks;
note that most web development teams will have their own terms and processes for at least some part of the post-development phase.
... "build": "parcel build src/index.html" }
note: if the scripts property already has a command inside it, put a comma at the end of it.
...And 4 more matches
Accessibility API cross-reference
ents cross reference table use this info to expand mozilla's accessibility api coverage to include mac, so that we can start to freeze them talk about the fact that msaa uses one interface (iaccessible), wherease gnome accessibility uses a lot of different interfaces depending on the type of object go through the atk info and make sure it's up-to-date accessible roles description &
notes msaa role (role_system_*) java accessibility role gnome accessibility role (atk_role_*) mac os x accessibility role aria (role=*) html tagged pdf relevant xul for alerts, in java/gnome for any alert, in msaa if no other role applies.
...aria role de
notes interactive (not browsable) content operable in ways that differ from any of the other interactive aria roles, and may be only a part of the main document.
...
note a selectable item in a select list.
...And 4 more matches
Configuring Build Options
note: do not make substantive changes to this document without consulting benjamin smedberg <benjamin@smedbergs.us> or one of the build-config peersthis document details how to configure firefox builds.
...
note that in the export example below the filename was not mozconfig.
... parallel compilation
note: the build system automatically makes an intelligent guess for how many cpu cores to use when building.
...And 4 more matches
Commenting IDL for better documentation
we will take your comments and
notes and turn them into beautiful, easy to search and read documentation.
...comment format doxygen supports several comment formats; for style and consistency reasons, we use the following: /** * */
note the two asterisks ("**") on the first line of the comment.
... @
note description used to include a
note styled paragraph.
...And 4 more matches
Obsolete Build Caveats and Tips
this
note below seems redundant as this is true by default https://msdn.microsoft.com/en-us/library/dh8che7s%28v=vs.110%29.aspx
note: starting with gecko 7.0, you should no longer include "-zc:wchar_t-" in the command line when building on windows.
...to get this code, do the following: # pull the mozilla source to the folder 191src/ - may take a while # as hundreds of megabytes of history is downloaded to .hg hg clone https://hg.mozilla.org/releases/mozilla-1.9.1/ 191src cd 191src
note: starting with gecko 5.0, you can actually build firefox without a .mozconfig file.
...
note that you need service pack 1--for the express edition it is a separate download.
...And 4 more matches
Fonts for Mozilla's MathML engine
note that most of these instructions may as well apply to other web rendering engines.
...
note:cambria math is installed by default on windows 7 and later versions and should ensure relatively good mathml rendering.
...
note: a deprecated version of stix is preinstalled starting with os x lion and should ensure relatively good mathml rendering.
...And 4 more matches
Memory reporting
size_t mystring::sizeofexcludingthis(mozilla::mallocsizeof amallocsizeof) const { return amallocsizeof(mbuffer); } size_t mystring::sizeofincludingthis(mozilla::mallocsizeof amallocsizeof) const { return amallocsizeof(this) + sizeofexcludingthis(amallocsizeof); } (
note that sizeofexcludingthis and sizeofincludingthis aren't overrides of methods on a global base class that is common to all reporters.
...that said,
note that for some classes these methods may be virtual.) mfbt/memoryreporting.h defines mozilla::mallocsizeof as follows: typedef size_t (*mallocsizeof)(const void* p); functions with this signature measure the size of p by asking the heap allocator how big it is (via moz_malloc_usable_size).
... some other things to
note.
...And 4 more matches
SpiderMonkey Build Documentation
mkdir build_opt.obj cd build_opt.obj /bin/sh ../configure.in # use "mozmake" on windows make a few
notes about this: the most common build problems are dependency problems.
...
note: if you are on mac and getting an error similar to "checking whether the c compiler (gcc-4.2 ) works...
...refer the release
notes under command line tools -> new features the release
notes also states that this compatibility package will no longer be provided in the near future, so the build system on macos will have to be adapted to look for headers in the sdk until then, the following should help, open /library/developer/commandlinetools/packages/macos_sdk_headers_for_macos_10.14.pk this builds an executable nam...
...And 4 more matches
SpiderMonkey 1.8.7
draft in progress - this is a draft, and right now it's mostly just a copy of the 1.8.5 release
notes.
...see the 1.8.5 release
notes for information on migrating from earlier versions.
...
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.
...And 4 more matches
TPS Tests
note: be prepared not to use your computer for 15 or so minutes after starting a full run of tps, as it will open and close a fairly large number of firefox windows.
...eps get the source code clone mozilla-central (choose your flavor): hg clone hg.mozilla.org/mozilla-central or git clone github.com/mozilla/gecko-dev cd into the tps folder cd testing/tps create the environment i suggest the path to be outside of the mc source tree python create_venv.py --username=%email% --password=%password% %path%
note: if you are updating the tps environment and want to keep your existing config (eg, the existing username and password), you should instead execute: python create_venv.py --keep-config %path% activate the environment source %path%/bin/activate run some tests
note that the testfile is not a path, it should only be the filename from services/sync/tests/tps/ runtps --debug --...
...}
note that in this example, the foobar@restmail.net account must be registered on stage, otherwise authentication will fail (and the whole test will fail as well.
...And 4 more matches
Building the WebLock UI
the "shell" for the xul file, then, looks like this: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <dialog id="weblock_ui" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" title="web lock manager" persist="screenx screeny" screenx="24" screeny="24"> </dialog>
note that this part of the xul file also contains a stylesheet declaration, which imports css rules and applies them to particular parts of the interface.
...
note that this file defines the dialog that displays when the user/administrator clicks the web locking icon in the bottom right corner of the browser.
...r/there.is.only.xul"> <script type="application/javascript" src="chrome://weblock/content/weblock.js"/> <statusbar id="status-bar"> <statusbarpanel class="statusbarpanel-iconic" id="weblock-status" insertbefore="offline-status" oncommand="loadweblock();" status="none"/> </statusbar> </overlay>
note that the root element for this file is not a <window/> but an <overlay/>.
...And 4 more matches
mozIJSSubScriptLoader
to get this service, use: var mozijssubscriptloader = components.classes["@mozilla.org/moz/jssubscript-loader;1"] .getservice(components.interfaces.mozijssubscriptloader);
note: see components.utils.import for another way to import javascript code.
...
note: this method must only be called from javascript!
...
note: in versions of gecko prior to gecko 1.9, you could use data: urls as well, but this introduced security concerns, and is no longer permitted.
...And 4 more matches
nsIAccessibleTable
inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview nsiaccessible getcellat(in long rowindex, in long columnindex);
note: renamed from cellrefat in gecko 1.9.2 long getcellindexat(in long rowindex, in long columnindex);
note: renamed from getindexat in gecko 1.9.2 astring getcolumndescription(in long columnindex); long getcolumnextentat(in long row, in long column); long getcolumnindexat(in long cellindex);
note: renamed from getcolumnatindex in gecko 1.9.2 void getrowandcolumnindicesat(in long cellindex, out long rowindex, out long columnindex); astring getrowdesc...
...ription(in long rowindex); long getrowextentat(in long row, in long column); long getrowindexat(in long cellindex);
note: renamed from getrowatindex in gecko 1.9.2 void getselectedcellindices(out unsigned long cellsarraysize, [retval, array, size_is(cellsarraysize)] out long cellsarray);
note: renamed from getselectedcells in gecko 1.9.2 void getselectedcolumnindices(out unsigned long columnsarraysize, [retval, array, size_is(columnsarraysize)] out long columnsarray);
note: renamed from getselectedcolumns in gecko 1.9.2 void getselectedrowindices(out unsigned long rowsarraysize, [retval, array, size_is(rowsarraysize)] out long rowsarray);
note: renamed from getselectedrows in gecko 1.9.2 boolean iscellselected(in long rowindex, in long colu...
...
note: renamed from columns in gecko 1.9.2 columnheader nsiaccessibletable read only.
...And 4 more matches
nsIAnnotationService
to use this service, use: var annotationservice = components.classes["@mozilla.org/browser/annotation-service;1"] .getservice(components.interfaces.nsiannotationservice);
note: the annotation service is not thread-safe.
...
note: use of value "1" is omitted due to it's temporary use as expire_never in bug 319455.
...
note: all page annotations will get deleted when the page is removed from history if the page is not bookmarked.
...And 4 more matches
nsIChannel
note: as of gecko 19.0, this parameter changed from long to int64_t.
...
note: the content type can often be wrongly specified (for example wrong file extension, wrong mime type, wrong document type stored on a server and so on.), and the caller most likely wants to verify with the actual data.
...
note: a channel implementation should take care when "caching" an interface pointer queried from its notification callbacks.
...And 4 more matches
nsIContentViewer
note: prior to gecko 10.0 (firefox 10.0 / thunderbird 10.0 / seamonkey 2.7), this attribute was part of nsidocumentviewer.
...
note: prior to gecko 10.0 (firefox 10.0 / thunderbird 10.0 / seamonkey 2.7), this attribute was part of nsidocumentviewer.
...
note: if the document is currently being printed, it will not be saved in session history.
...And 4 more matches
nsIDOMWindowUtils
note: if there are some panels at the point, this method send the query event to the panel's widget automatically.
...
note: event handlers won't get aevent as parameter, but a similar event.
...
note: for scrollable frames containing documents (that is, <frame> and <iframe>), the enclosed document's root element is returned.
...And 4 more matches
getFile
c constant string value
notes ns_os_home_dir "home" ns_os_temp_dir "tmpd" ns_os_current_working_dir "curworkd" ns_os_desktop_dir "desk" otherwise same as home ns_os_current_process_dir "curprocd" ns_xpcom_current_process_dir "xcurprocd" can be overriden by passing a "bin directory" to ns_initxpcom2().
... ns_xpcom_component_dir "comsd" ns_xpcom_component_dir_list "comsdl" ns_xpcom_component_registry_file "comregf" ns_xpcom_xpti_registry_file "xptiregf" ns_xpcom_library_file "xpcomlib" ns_gre_dir "gred"
note: on mac os x, up through firefox 34 this is the contents/macos directory within the application's bundle.
... c constant string value
notes ns_os_system_dir "sysd" available on mac os x only these locations are supported only on mac os x versions of gecko.
...And 4 more matches
nsIIOService
note: nsiioservice may only be used from the main thread.
...
note: most url parsing is done via nsiuri, and in fact the scheme can also be extracted from a url string via nsiuri.
...please
note, aloadingprincipal is *not* the principal of the resource being loaded.
...And 4 more matches
nsIOutputStream
note: blocking output streams are often written to on a background thread to avoid locking up the main application thread.
...
note: this method may be called more than once, but subsequent calls are ignored.
... isnonblocking()
note: writing to a blocking output stream will block the calling thread until all given data can be consumed by the stream.
...And 4 more matches
nsIProcess
gecko 1.9.1
note this attribute is no longer implemented as of gecko 1.9.1, and is removed entirely in gecko 1.9.2.
... gecko 1.9.1
note this attribute is no longer implemented as of gecko 1.9.1, and is removed entirely in gecko 1.9.2.
... gecko 1.9.1
note this attribute is no longer implemented as of gecko 1.9.1, and is removed entirely in gecko 1.9.2.
...And 4 more matches
nsIZipWriter
note: although it is not necessary to add directory entries in order to add file entries within them, some zip utilities may have problems with that, so it may be best to add the directory entries explicitly first.
...
note: you must use forward slashes ('/') in the path.
...
note: although it is not necessary to add directory entries in order to add file entries within them, some zip utilities may have problems with that, so it may be best to add the directory entries explicitly first.
...And 4 more matches
Storage
note: storage is not the same as the dom:storage feature which can be used by web pages to store persistent data or the session store api (an xpcom storage utility for use by extensions).
... getter_addrefs(dbfile)); ns_ensure_success(rv, rv); rv = dbfile->append(ns_literal_string("my_db_file_name.sqlite")); ns_ensure_success(rv, rv); nscomptr<mozistorageservice> dbservice = do_getservice(moz_storage_service_contractid, &rv); ns_ensure_success(rv, rv); nscomptr<mozistorageconnection> dbconn; rv = dbservice->opendatabase(dbfile, getter_addrefs(dbconn)); ns_ensure_success(rv, rv);
note: moz_storage_service_contractid is defined in storage/build/mozstoragecid.h.
...
note: numerical indexes for parameters are always one less than the number you write in the sql.
...And 4 more matches
XPIDL
note: starting in gecko 9.0, the older xpidl utility, which was previously used to generate c++ header files, typelib information, and so forth has been replaced with pyxpidl in the gecko sdk.
...the following is the correspondence table: table 1: standard idl types idl c++ in parameter c++ out parameter js type
notes boolean bool bool* boolean char char char* string only chars in range \u0000-\u00ff permitted double double double* number float float float* number long int32_t int32_t* number long long int64_t int64_t* number octet uint8_t uint8_t* number ...
... in addition to this list, nearly every idl file includes nsrootidl.idl in some fashion, which also defines the following types: table 2: types provided by nsrootidl.idl idl typedef c++ in parameter c++ out parameter js type
notes prtime (xpidl unsigned long long typedef, 64 bits) number prtime is in microseconds, while js date assumes time in milliseconds nsresult (xpidl unsigned long typedef, 32 bits) number nsrefcnt (xpidl unsigned long typedef, 32 bits) number size_t (xpidl unsigned long typedef, 32 bits) number voidptr void* ...
...And 4 more matches
Edit fonts - Firefox Developer Tools
note: the updated font tools as shown in this article are available in firefox 63 onwards; if you are using an older version of firefox the tools will not look or behave quite the same, but they will be similar (most notably the font editor will not be available).
...
note: if you want to use a different unit such as pt for font-size or line-height, you can set the property value applied to the currently inspected element to use that unit via the rules view, and the font editor will automatically pick it up and make it available in the associated units dropdown menu.
...
note: for variable fonts (see below) that define a wght variation axis, this range is custom.
...And 4 more matches
Applying styles and colors - Web APIs
note: when you set the strokestyle and/or fillstyle property, the new value becomes the default for all shapes being drawn from then on.
...
note: be aware that in our vertical line example, the y position still referenced an integer gridline position—if it hadn't, we would see pixels with half coverage at the endpoints (but
note also that this behavior depends on the current linecap style whose default value is butt; you may want to compute consistent strokes with half-pixel coordinates for odd-width lines, by setting the linecap style ...
...
note also that only start and final endpoints of a path are affected: if a path is closed with closepath(), there's no start and final endpoint; instead, all endpoints in the path are connected to their attached previous and next segment using the current setting of the linejoin style, whose default value is miter, with the effect of automatically extending the outer borders of the connected segments to their intersection point, so that the rendered stroke will exactly cover full pixels centered at each endpoint if those connected segments are horizontal and/or vertical).
...And 4 more matches
Document.cookie - Web APIs
note that each key and value may be surrounded by whitespace (space and tab characters): in fact, rfc 6265 mandates a single space after each semicolon, but some user agents may not abide by this.
...
note that you can only set/update a single cookie at a time using this method.
...
note: prior to gecko 6.0, paths with quotes were treated as if the quotes were part of the string, instead of as if they were delimiters surrounding the actual path string.
...And 4 more matches
IDBDatabase - Web APIs
note: this feature is available in web workers.
...
note: everything you do in indexeddb always happens in the context of a transaction, representing interactions with data in the database.
...for a complete working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); // these two event handlers act on the idbdatabase object, // when the database is opened successfully, or not dbopenrequest.onerror = function(event) {
note.innerhtml += '<li>error loading database.</li>'; }; dbopenrequest.onsuccess = function(event) {
note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db // variable.
...And 4 more matches
IDBTransaction.oncomplete - Web APIs
note: this feature is available in web workers.
...
note: in firefox, if you wish to ensure durability for some reason (e.g.
...
note also the functions attached to transaction event handlers to report on the outcome of the transaction opening in the event of success or failure.
...And 4 more matches
IDBTransaction.onerror - Web APIs
note: consider using idbtransaction.onabort instead to handle non- successful completion of the transaction.
...
note: this feature is available in web workers.
...
note also the functions attached to transaction event handlers to report on the outcome of the transaction opening in the event of success or failure.
...And 4 more matches
IDBTransaction - Web APIs
note: this feature is available in web workers.
... firefox durability guarantees
note that as of firefox 40, indexeddb transactions have relaxed durability guarantees to increase performance (see bug 1112702.) previously in a readwrite transaction idbtransaction.oncomplete was fired only when all data was guaranteed to have been flushed to disk.
...
note that this doesn't normally have to be called — a transaction will automatically commit when all outstanding requests have been satisfied and no new requests have been made.
...And 4 more matches
Using the Payment Request API - Web APIs
note: the code snippets from this section are from our feature detect support demo.
... request = new paymentrequest(buildsupportedpaymentmethodnames(), buildshoppingcartdetails()); }); }
note: see our feature detect support demo for the full code.
... checkoutbutton.innertext = "checkout with w3c"; }); }
note: see our customizing the payment button demo for the full code.
...And 4 more matches
PushEvent - Web APIs
full support 17firefox full support 44
notes full support 44
notes
notes extended support releases (esr) before firefox 78 esr do not support service workers and the push api.ie no support noopera full support 37safari no support nowebview android ...
... no support nochrome android full support 42firefox android full support 44 full support 44 full support 48
notes
notes push enabled by default.opera android full support 37safari ios no support nosamsung internet android full support 4.0pushevent() constructor experimentalchrome full support 42edge full support 16disabled full support ...
... full support 17firefox full support 44
notes full support 44
notes
notes extended support releases (esr) before firefox 78 esr do not support service workers and the push api.ie no support noopera full support 37safari no support nowebview android no support nochrome android full support 42firefox android full suppo...
...And 4 more matches
Using the Web Storage API - Web APIs
the keys and the values are always strings (
note that, as with objects, integer keys will be automatically converted to strings).
...these three lines all set the (same) colorsetting entry: localstorage.colorsetting = '#a4509b'; localstorage['colorsetting'] = '#a4509b'; localstorage.setitem('colorsetting', '#a4509b');
note: it's recommended to use the web storage api (setitem, getitem, removeitem, key, length) to prevent the pitfalls associated with using plain objects as key-value stores.
... testing for availability
note: this api is available in current versions of all major browsers.
...And 4 more matches
Web accessibility for seizures and physical reactions - Accessibility
the fact that static images may cause seizures and other disorders is documented in such articles as “gamma oscillations and photosensitive epilepsy”, where it is
noted “certain visual images, even in the absence of motion or flicker, can trigger seizures in patients with photosensitive epilepsy” the epilepsy foundation, in its article, "shedding light on photosensitivity, one of epilepsy's most complex conditions" talks about static images and patterns.
...selim benbadis of usf's comprehensive epilepsy program
notes, "the only thing that is really documented is flashing lights, which can trigger seizures in patients with photosensitive epilepsy.
...in its article, "a revised definition of epilepsy" the epilepsy foundation
notes that…"a seizure is an event and epilepsy is the disease involving recurrent unprovoked seizures." according to the epilepsy foundation's page "how serious are seizures?" , "sudden unexpected death in epilepsy (sudep) is likely the most common disease-related cause of death in with epilepsy.
...And 4 more matches
Perceivable - Accessibility
note: to read the w3c definitions for perceivable and its guidelines and success criteria, see principle 1: perceivable - information and user interface components must be presentable to users in ways they can perceive.
...
note: also see the wcag description for guideline 1.1: text alternatives.
...
note that if the audio/video serves as an alternative to existing text content, you don't need to provide another text alternative.
...And 4 more matches
display - CSS: Cascading Style Sheets
note: browsers that support the two value syntax, on finding the outer value only, such as when display: block or display: inline is specified, will set the inner value to flow.
...
note: browsers that support the two value syntax, on finding the inner value only, such as when display: flex or display: grid is specified, will set their outer value to block.
...
note: in browsers that support the two-value syntax, if no inner value is specified it will default to flow.
...And 4 more matches
font-variant - CSS: Cascading Style Sheets
to change preferences in firefox, visit about:config.opera android full support 41safari ios full support 9.3samsung internet android full support 6.0greek accented characterschrome no support no
notes no support no
notes
notes some operating systems may correctly omit accents in all-uppercase greek text.edge no support no
notes no support no
notes
notes some operating systems may correctly omit accents in all-uppercase greek text.firefox no supp...
...ort no
notes no support no
notes
notes some operating systems may correctly omit accents in all-uppercase greek text.ie no support noopera no support no
notes no support no
notes
notes some operating systems may correctly omit accents in all-uppercase greek text.safari no support nowebview android no support no
notes no support no
notes
notes some operating systems may correctly omit accents in all-uppercase greek.chrome android no support ...
... no
notes no support no
notes
notes some operating systems may correctly omit accents in all-uppercase greek text.firefox android no support no
notes no support no
notes
notes some operating systems may correctly omit accents in all-uppercase greek text.opera android no support no
notes no support no
notes
notes some operating systems may correctly omit accents in all-uppercase greek text.safari ios no support nosamsung internet android no support no
notes ...
...And 4 more matches
Setting up adaptive streaming media sources - Developer guides
note: you will need to be comfortable with make files and installing dependencies to get this software up and running.
...
note: since mpeg-dash decoding is done partially using javascript and mse files are often grabbed using xhr, keep same origin rules in mind.
...
note: if you use webm you can use the methods shown in this tutorial dash adaptive streaming for html 5 video.
...And 4 more matches
<a>: The Anchor element - HTML: Hypertext Markup Language
notes: download only works for same-origin urls, or the blob: and data: schemes.
...
note: when using target, add rel="noreferrer noopener" to avoid exploitation of the window.opener api;
note: in newer browser versions (e.g.
...
note: this attribute is obsolete and should not be used by authors.
...And 4 more matches
<input type="number"> - HTML: Hypertext Markup Language
note: avoid using the placeholder attribute if you can.
...
note: because a read-only field cannot have a value, required does not have any effect on inputs with the readonly attribute also specified.
...
note: when the data entered by the user doesn't adhere to the stepping configuration, the user agent may round to the nearest valid value, preferring numbers in the positive direction when there are two equally close options.
...And 4 more matches
<input type="search"> - HTML: Hypertext Markup Language
note: avoid using the placeholder attribute if you can.
...
note: because a read-only field cannot have a value, required does not have any effect on inputs with the readonly attribute also specified.
...
note: this has been standardized as the global attribute enterkeyhint, but is not yet widely implemented.
...And 4 more matches
WebAssembly.Memory - JavaScript
desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jsmemorychrome full support 57edge full support 16firefox full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).ie no support noopera full support 44safari full support 11webview android full support ...
... 57chrome android full support 57firefox android full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).opera android full support 43safari ios full support 11samsung internet android full support 7.0nodejs full support 8.0.0memory() constructorchrome full support 57edge full support 16firefox full support ...
... 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).ie no support noopera full support 44safari full support 11webview android full support 57chrome android full support 57firefox android full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).opera android full support 43safari ios ...
...And 4 more matches
Lexical grammar - JavaScript
\r u+2028 line separator <ls> wikipedia u+2029 paragraph separator <ps> wikipedia comments comments are used to add hints,
notes, suggestions, or warnings to javascript code.
...
note also that no whitespace of any kind is permitted before the #!.
...an example is as follows: #!/usr/bin/env node console.log("hello world");
note: hashbang comments in javascript mimic shebangs in unix used to run files with proper interpreter.
...And 4 more matches
this - JavaScript
// in web browsers, the window object is also the global object: console.log(this === window); // true a = 37; console.log(window.a); // 37 this.b = "mdn"; console.log(window.b) // "mdn" console.log(b) // "mdn"
note: you can always easily get the global object using the global globalthis property, regardless of the current context in which your code is running.
...all non-static methods within the class are added to the prototype of this: class example { constructor() { const proto = object.getprototypeof(this); console.log(object.getownpropertynames(proto)); } first(){} second(){} static third(){} } new example(); // ['constructor', 'first', 'second']
note: static methods are not properties of this.
...(c, d) { return this.a + this.b + c + d; } var o = {a: 1, b: 3}; // the first parameter is the object to use as // 'this', subsequent parameters are passed as // arguments in the function call add.call(o, 5, 7); // 16 // the first parameter is the object to use as // 'this', the second is an array whose // members are used as the arguments in the function call add.apply(o, [10, 20]); // 34
note that in non–strict mode, with call and apply, if the value passed as this is not an object, an attempt will be made to convert it to an object.
...And 4 more matches
Web video codec guide - Web media technologies
note the blue and pink fringes around the edges of the star above (as well as the stepping and other significant compression artifacts).
...
note the blockiness of the colors in the plumage of the bald eagle in the photo above (and the snowy owl in the background).
... in the example image above,
note how the sky has bands of different shades of blue, instead of being a consistent gradient as the sky color changes toward the horizon.
...And 4 more matches
Codecs used by WebRTC - Web media technologies
note: these requirements are for web browsers and other fully-webrtc compliant products.
... other
notes the network payload format for sharing vp8 using rtp (such as when using webrtc) is described in rfc 7741: rtp payload format for vp8 video.
...this is useful to
note, since in rfc 6184 ("rtp payload format for h.264 video"), profile-level-id is entirely optional.
...And 4 more matches
Performance fundamentals - Web Performance
note: humans usually cannot perceive differences in framerate above 60hz.
...
note: for much more information on improving startup performance, read optimizing startup performance.
... on the same
note, notice that locally-cached, static resources can be loaded much faster than dynamic data fetched over high-latency, low-bandwidth mobile networks.
...And 4 more matches
Add to Home screen - Progressive web apps (PWAs)
(
note: in android 8 and higher, a system-level "add to home screen" permission dialog will be shown first.) if you have mobile chrome available, the experience is slightly different; upon loading our site, you'll see an install banner pop up asking whether you want to add this app to your home screen.
...
note: you can find out a lot more about chrome install banners from the article web app install banners.
...
note: the .webmanifest extension is specified in the media type registration section of the specification, but generally browsers will support manifests with other appropriate extensions, e.g.
...And 4 more matches
Chapter 5: Let's build a Firefox extension - Archive of obsolete content
one point you need to take special
note of is that in step 4, you updated chrome.manifest so that the files it refers to have paths pointing inside the zip archive.
...since you’ve already got the development version of the hello world extension running as a test install on your current profile, restart firefox under a different profile (see foot
note 1).
...erate menu items (event handler) createmenu: function(event) { }, // read file _readfile: function(afile) { }, // write file _writefile: function(afile, adata) { }, }; window.addeventlistener("load", function(){ gsessionstore.init(); }, false); window.addeventlistener("unload", function(){ gsessionstore.uninit(); }, false); wrap methods and variables as properties of objects you’ll
note that in listing 15, i’ve defined a lot of different methods and variables as properties of a single object, gsessionstore.
...And 3 more matches
Underscores in class and ID Names - Archive of obsolete content
note: browser support for underscores in css has greatly improved since this article was originally published in 2001 and the following recommendation is no longer accurate for most circumstances.
...this technical
note examines the use of underscores in css, and why they should be generally avoided in most circumstances.
... the css1 specification, published in its final form in 1996, did not allow for the use of underscores in class and id names unless they were "escaped." an escaped underscore would look something like this: p.urgent\_
note {color: maroon;} this was not well supported by browsers at the time, however, and the practice has never caught on.
...And 3 more matches
Layout System Overview - Archive of obsolete content
(
note: it is unclear if this is really a benefit - it may have been better to use a copy of the content model for each presentation, and to remove the complexity of managing separate presentations - analysis is needed here).
...
note that lines may contain only inline elements, whereas block may contain both inline elements and other blocks.other layout models: xul in addition to managing css-defined formatting, the layout system provides a way to integrate other layout schemes into the presentation.
...the presentation shell is the root of the presentation, and as such it owns and manages a lot of layout objects that are used to create and maintain a presentation (
note that the documentviewer is the owner of the presentation shell, and in some cases the creator of the objects used by the presentation shell to manage the presentation.
...And 3 more matches
Priority Content - Archive of obsolete content
note: use example at sample:original document information to credit original authors.
... devedge devedge mirror
note: if you're digging around the mirror and see anything there that you think should be migrated to devmo that isn't on this list, feel free to add it below.
...keller licensing: these css charts appear to be under a cc:by-nc-sa license, please make
note of that on the page when you do the migration.
...And 3 more matches
Table Layout Regression Tests - Archive of obsolete content
execute the baseline test shutdown the layoutdebugger execute mozilla -layoutdebug - p foo >selftest.txt execute the verify test make a
note which tests have failed grep 'failed' selftest.txt (these are false positives, quite frequently they indicate reflow problems, pages showing differently when loaded from cache) make your changes to the source, recompile.
... execute mozilla -layoutdebug - p foo >outputfile.txt execute the verify test make a
note which tests have failed grep 'failed' outputfile.txt check how many tests have failed and analyze your results: if the regression tests have failed at the same place as the previous diagnosed false positives => ignore try to figure out what the other regressions are: are they improving the picture or are they regressions?
...
note the difficult to explain test failures.
...And 3 more matches
Reading from Files - Archive of obsolete content
file and stream guide: [ nsiscriptableio | accessing files | getting file information | reading from files | writing to files | moving, copying and deleting files | uploading and downloading files | working with directories ] important
note: the pages from the file and stream guide use the io object (nsiscriptableio), which was not available in any released version of the platform (pending some fixes).
...
note that this is distinct from the number of bytes to read.
...
note that this method returns the number of bytes available, not the number of characters available, because the file hasn't been read and parsed yet, so the actual number of characters isn't known yet.
...And 3 more matches
textbox - Archive of obsolete content
note that decimal numbers are stored as floats.
...
note: the behavior of this event has evolved over time.
...
note: the behavior of this event has evolved over time.
...And 3 more matches
Archived Mozilla and build documentation - Archive of obsolete content
liveconnect gives your extension's javascript code (linked from or contained in xul code) access to 2 objects: java and packages (
note that per this thread, although the new documentation for the liveconnect reimplementation states that these globals will be deprecated (in the context of applets), "firefox and the java plug-in will continue to support the global java/packages keywords, in particular in the context of firefox extensions.").
...
note that this document is for your information only and is not intended as legal advice.
... new skin
notes devmo has a new skin that is ready for testing.
...And 3 more matches
Sunbird Theme Tutorial - Archive of obsolete content
to make a theme, you usually need these tools: a jar tool or zip tool an editor for plain text files software for creating and editing images
note: some zip tools only work with files whose names have <tt>.zip</tt> at the end.
...
note: if the <tt>extensions</tt> directory is empty, you are in the wrong place—start again and follow the instructions more carefully.
...
note: if your theme is for a version of sunbird later than 0.4, then also change the maxversion.
...And 3 more matches
Theme changes in Firefox 4 - Archive of obsolete content
it's also important to
note that skin files are now split into two subfolders within the omni.jar file, and you'll need to look in both places to find all the skin resources you need.
...
note: when extracting omni.jar, you may incorrectly get false warnings from some virus protection software.
... iconsize value actual add-on toolbar button icon dimensions (assuming correct stylesheet and images) small 16x16 pixels large 24x24 pixels
note: for stock buttons, the theme is free to use icons of any size.
...And 3 more matches
Anatomy of a video game - Game development
here is an example of a simple main loop: window.main = function () { window.requestanimationframe( main ); // whatever your main loop needs to do }; main(); // start the cycle
note: in each of the main() methods discussed here, we schedule a new requestanimationframe before performing our loop contents.
...
note: in practice, it is more common to prevent the next requestanimationframe() with an if-statement, rather than calling cancelanimationframe().
...
note: systems (hardware or software) that are not capable of microsecond accuracy are allowed to provide millisecond accuracy as a minimum.
...And 3 more matches
Mobile accessibility - Learn web development
note: you can get to your home screen at any time by swiping up and left in a smooth motion.
...
note: see get started on android with talkback for more complete documentation.
...
note: some older ios devices have the voiceover menu at settings app > general > accessibility > voiceover.
...And 3 more matches
Accessible multimedia - Learn web development
note that we also check to see if the currenttime is more than the total media duration, or if the media is not playing, when the fwd button is pressed.
...if the audio you are presenting is something like a face to face meeting or live spoken performance, it would be acceptable to take
notes during the performance, publish them in full along with the audio, then seek help in cleaning up the
notes afterwards.
...
note: an audio transcript will in general help multiple user groups.
...And 3 more matches
Introduction to CSS layout - Learn web development
let's look at a quick html example: <p>i love my cat.</p> <ul> <li>buy cat food</li> <li>exercise</li> <li>cheer up friend</li> </ul> <p>the end!</p> by default, the browser will display this code as follows:
note here how the html is displayed in the exact order in which it appears in the source code, with elements stacked up on top of one another — the first paragraph, followed by the unordered list, followed by the second paragraph.
...
note: the direction in which block element contents are laid out is described as the block direction.
... flexbox example 2 * {box-sizing: border-box;} .wrapper > div { border-radius: 5px; background-color: rgb(207,232,220); padding: 1em; } .wrapper { display: flex; } .wrapper > div { flex: 1; } <div class="wrapper"> <div class="box1">one</div> <div class="box2">two</div> <div class="box3">three</div> </div>
note: this has been a very short introduction to what is possible in flexbox, to find out more, see our flexbox article.
...And 3 more matches
Styling links - Learn web development
default styles the following example illustrates what a link will behave like by default (the css is simply enlarging and centering the text to make it stand out more.) <p><a href="#">a simple link</a></p> p { font-size: 2rem; text-align: center; }
note: all the links in the examples in this page are fake links — a # (hash, or pound sign) is put in place of the real url.
...
note: you are not just limited to the above properties to style your links — you are free to use any properties you like.
...two points to
note here are: the underline has been created using border-bottom, not text-decoration — some people prefer this because the former has better styling options than the latter, and is drawn a bit lower, so doesn't cut across the descenders of the word being underlined (e.g.
...And 3 more matches
Other form controls - Learn web development
note that even though you can put anything inside a <textarea> element (including other html elements, css, and javascript), because of its nature, it is all rendered as if it was plain text content.
...
note: you can find a slightly more interesting example of text area usage in the example we put together in the first article of the series (see the source code also).
...
note: you can find examples of all the drop-down box types on github at drop-down-content.html (see it live also).
...And 3 more matches
Your first form - Learn web development
note: we'll look at how those attributes work in our sending form data article later on.
...
note the use of the for attribute on all <label> elements, which takes as its value the id of the form control with which it is associated — this is how you associate a form control with its label.
... last but not least,
note the syntax of <input> vs.
...And 3 more matches
CSS basics - Learn web development
(the term ruleset is often referred to as just rule.)
note the names of the individual parts: selector this is the html element name at the start of the ruleset.
...(for example, there are many color values in addition to red.)
note the other important parts of the syntax: apart from the selector, each ruleset must be wrapped in curly braces.
... html { font-size: 10px; /* px means "pixels": the base font size is now 10 pixels high */ font-family: "open sans", sans-serif; /* this should be the rest of the output you got from google fonts */ }
note: anything in css between /* and */ is a css comment.
...And 3 more matches
What’s in the head? Metadata in HTML - Learn web development
for example, your page could handle english and japanese just fine: if you set your character encoding to iso-8859-1, for example (the character set for the latin alphabet), your page rendering may appear all messed up:
note: some browsers (e.g.
...
note: in google, you will see some relevant subpages of mdn web docs listed below the main homepage link — these are called sitelinks, and are configurable in google's webmaster tools — a way to make your site's search results better in the google search engine.
...
note: many <meta> features just aren't used any more.
...And 3 more matches
Manipulating documents - Learn web development
e> </head> <body> <section> <img src="dinosaur.png" alt="a red tyrannosaurus rex: a two legged dinosaur standing upright like a human, with small arms, and a large head with lots of sharp teeth."> <p>here we will add a link to the <a href="https://www.mozilla.org/">mozilla homepage</a></p> </section> </body> </html> the dom on the other hand looks like this:
note: this dom tree diagram was created using ian hickson's live dom viewer.
...add the following line, again at the bottom: link.href = 'https://developer.mozilla.org';
note that, as with many things in javascript, there are many ways to select an element and store a reference to it in a variable.
...if you look at that paragraph in your browser's page inspector/dom inspector, you'll see that these lines are indeed adding inline styles to the document: <p style="color: white; background-color: black; padding: 10px; width: 250px; text-align: center;">we hope you enjoyed the ride.</p>
note: notice how the javascript property versions of the css styles are written in lower camel case whereas the css versions are hyphenated (e.g.
...And 3 more matches
Website security - Learn web development
note: this is an introductory topic, designed to help you start thinking about website security, but it is not exhaustive.
...as you read,
note how threats are most successful when the web application either trusts, or is not paranoid enough about the data coming from the browser.
...
note: xss vulnerabilities have been historically more common than any other type of security threat.
...And 3 more matches
Accessibility in React - Learn web development
note how "main render" logged first, and "side effect" logged second, even though the "side effect" log appears first in the code.
...using pseudocode, our logic should be something like this: if (was
noteditingbefore && iseditingnow) { focusoneditfield() } if (waseditingbefore && is
noteditingnow) { focusoneditbutton() } the react team had discussed ways to get a component’s previous state, and has provided an example custom hook we can use for the job.
...with isediting as an argument: const wasediting = useprevious(isediting); with this constant, we can update our useeffect() hook to implement the pseudocode we discussed before — update it as follows: useeffect(() => { if (!wasediting && isediting) { editfieldref.current.focus(); } if (wasediting && !isediting) { editbuttonref.current.focus(); } }, [wasediting, isediting]);
note that the logic of useeffect() now depends on wasediting, so we provide it in the array of dependencies.
...And 3 more matches
Working with Svelte stores - Learn web development
give it the following content: import { writable } from 'svelte/store' export const alert = writable('welcome to the to-do list app!')
note: stores can be defined and used outside of svelte components, so you can organize them in any way you please.
...
note: outside of svelte components you cannot use the $store syntax.
...
note: if you are following this guide working from the svelte repl you won't be able to complete this step.
...And 3 more matches
Dynamic behavior in Svelte: working with variables and props - Learn web development
note: svelte uses the $: javascript label statement syntax to mark reactive statements.
...add this snippet at the end of the <script> section: $: console.log('newtodoname: ', newtodoname)
note: as you may have noticed, reactive statements aren't limited to variable declarations.
...add this to the bottom of your <script> block inside src/components/todo.svelte: function addtodo() { todos.push({ id: 999, name: newtodoname, completed: false }) newtodoname = '' }
note: for the moment we are just assigning the same id to every todo, but don't worry, we will fix that soon.
...And 3 more matches
Focus management with Vue refs - Learn web development
it's important to
note that a ref needs to be unique within a component.
...
note: the vue docs provide a nice diagram for visualizing when these hooks happen.
... in todoitemeditform.vue, attach ref="labelinput" to the <input> element, like so: <input :id="id" ref="labelinput" type="text" autocomplete="off" v-model.lazy.trim="newname" /> next, add a mounted() property just inside your component object —
note that this should not be put inside the methods property, but rather at the same hierarchy level as props, data(), and methods.
...And 3 more matches
Debugging on Mac OS X
these builds enable hardened runtime and only differ from production builds in that they are not notarized which should not otherwise affect functionality, (other than the ability to easily launch the browser on macos 10.15+ -- see quarantine
note below).
...
note that disabling sip bypasses hardened runtime restrictions which can mask some bugs that only occur with hardened runtime so it is recommended to test fixes with sip enabled.
...
note also that since xcode 7.3.1 it doesn't seem to be possible to have the xcode project live outside the source tree.
...And 3 more matches
HTTP logging
note: the web console also offers the ability to peek at http transactions within firefox.
...go to the web site that is broken for you and make the bug happen in the browser) make a
note of the value of "current log file".
...
note that this approach winds up logging the whole browser history, so files can get rather large (they compress well :) setting environment variables differs by operating system.
...And 3 more matches
Eclipse CDT Manual Setup
note the requirements that this method of build option discovery imposes on us.
... conversely,
note this very carefully: if you configure eclipse to invoke a build process that is parallelized, silenced, or that fails to identify the directory that the compiler is being run from, then it will mess up the compiler options that eclipse associates with your files, and that in turn will significantly degrade the quality of the code assistance that eclipse will provide after it next re-indexes the c...
... to avoid confusion in this and the following sections,
note that "workspace preferences" and "project properties" are different things (we'll get to the details below).
...And 3 more matches
Displaying Places information using views
note: starting in gecko 2.0, you can't use the place attribute with menus.
...
note that in the latter case it is not sufficient to call setattribute on the element; use the element's place property instead.
...
note: starting in gecko 2.0, nsinavhistoryresultviewer has been replaced by the more powerful nsinavhistoryresultobserver.
...And 3 more matches
Mozilla Content Localized in Your Language
note: if this doens't apply, how is expressed in your language to indicate importance or name of a movie, book title, product uis (save, file...).
...
note: if this doens't apply, indicate so with n/a.
...
note: if this doens't apply, indicate so with n/a.
...And 3 more matches
DMD
note that stack information you get will likely be less detailed, due to being unable to symbolicate.
...
note that on mac this step can take 30+ seconds.
...(if you are familiar with the recommended "--es env0" method for setting environment variables when launching fennec,
note that you cannot use this method here because those are processed too late in the startup process.
...And 3 more matches
NSS environment variables
note: nss environment variables are subject to be changed and/or removed from nss.
...
note: the code must be built with pkix_object_leak_test defined to use this functionality.
... 3.11 ssldebug integer debug level
note: the code must be built with debug defined to use this functionality.
...And 3 more matches
SpiderMonkey 1.8.5
note that version 1.8.5 is outdated.
...
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.
...
note also that spidermonkey can now fit a full 32-bit integer (jsint) inside a jsval without promoting to a jsdouble.
...And 3 more matches
XPCOM array guide
note that this class differs from the other array types by using unsigned indices.
... nsisupportsarray xpcom object yes no yes* no reference counted, strong (*)
note: concrete c++ arrays can be made read-only by declaring them const.
...
note that if the nstarray<t> holds pointers to objects, the objects will not be deleted (and hence not have their destructors called).
...And 3 more matches
nsIJSON
1.0 66 introduced gecko 1.9 inherits from: nsisupports last changed in gecko 7.0 (firefox 7.0 / thunderbird 7.0 / seamonkey 2.4)
note: this interface may only be used from javascript code, with the exception of the legacydecodetojsval() method.
...to create an instance, use: var nativejson = components.classes["@mozilla.org/dom/json;1"] .createinstance(components.interfaces.nsijson); method overview
note: the idl file has portions of the idl commented out because they represent things that can't actually be properly described by idl; however, for the purposes of this article, we'll pretend they can be and ignore that issue.
...
note: this method is more flexible than it should be, and accepts some not-correctly-structured json.
...And 3 more matches
nsITreeView
constants constant value description progress_normal 1
note: renamed from progressnormal in gecko 1.8 progress_undetermined 2
note: renamed from progressundetermined in gecko 1.8 progress_none 3
note: renamed from progressnone in gecko 1.8 drop_before -1 drop_on 0 drop_after 1 indropbefore 0 obsolete since gecko 1.8 indropon 1 ...
...
note: drop_on will only be passed to candrop() if the item is a container; see iscontainer().
...(
note that this is not the column index.) return value the text of the cell.
...And 3 more matches
nsIWebProgressListener
note: for document requests, a second state_stop is generated (see the description of state_is_window for more details).
...
note: if any progress value is unknown, or if its value would exceed the maximum value of type long, then its value is replaced with -1.
...
note: if the object also implements nsiwebprogresslistener2 and the caller knows about that interface, this function will not be called.
...And 3 more matches
nsIWindowMediator
note this method is advisory only: it changes nothing either in windowmediator's internal state or with the window.
...
note: it compares the nsixulwindow to nsiwidgets.
...
note: starting in gecko 8.0, the returned value is an nsidomwindow; previously, it was an nsidomwindowinternal.
...And 3 more matches
Add to iPhoto
note: this extension uses carbon routines, which can no longer be used in firefox add-ons now that firefox is a 64-bit application.
...
note: in a few cases, this code takes the easy way out by using ctypes.voidptr_t instead of a typed pointer.
...the interesting things to
note about the declaration of corefoundation.cfurlcreatefromfilesystemrepresentation() are: it returns a cfurlref, which is an opaque pointer similar to the cfstringref we
noted above.
...And 3 more matches
about:debugging - Firefox Developer Tools
note: you do not need to install the full android studio sdk.
...
note: if the version of firefox on your remote device is more than one major version older than the version running on your computer, you may see a message like the following: in firefox 76 and above, the message can look like the following: see connection for firefox for android 68 for more information.
...
note: it's recommended that you use the browser toolbox, not the add-on debugger, for debugging webextensions.
...And 3 more matches
BiquadFilterNode() - Web APIs
please
note that for this filter type, this value is not a traditional q, but is a resonance value in decibels.
...please
note that for this filter type, this value is not a traditional q, but is a resonance value in decibels.
... desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetbiquadfilternode() constructorchrome full support 55
notes full support 55
notes
notes before chrome 59, the default values were not supported.edge full support ≤79firefox full support 53ie no support noopera full support 42
notes ...
...And 3 more matches
Drawing shapes with canvas - Web APIs
note: when the current path is empty, such as immediately after calling beginpath(), or on a newly created canvas, the first path construction command is always treated as a moveto(), regardless of what it actually is.
...
note: when you call fill(), any open shapes are closed automatically, so you don't have to call closepath().
...
note: to learn more about the arc() function, see the arcs section below.
...And 3 more matches
Document.write() - Web APIs
note: because document.write() writes to the document stream, calling document.write() on a closed (loaded) document automatically calls document.open(), which will clear the document.
... example <html> <head> <title>write example</title> <script> function newcontent() { document.open(); document.write("<h1>out with the old, in with the new!</h1>"); document.close(); } </script> </head> <body onload="newcontent();"> <p>some original document content.</p> </body> </html>
notes the text you write is parsed into the document's structure model.
...for example: <script> document.write("<h1>main title</h1>") </script>
note: document.write() and document.writeln do not work in xhtml documents (you'll get an "operation is not supported" [ns_error_dom_not_supported_err] error in the error console).
...And 3 more matches
Element.getClientRects() - Web APIs
firefox 3.5
note firefox 3.5 adds width and height properties to the textrectangle object.
...
note that the javascript function that paints the client rects is connected to the markup via the class withclientrectsoverlay.
...
note that the p has onlyone border box, while the span has multiple border boxes.</p> <div> <strong>original</strong> <p> <span>paragraph that spans multiple lines</span> </p> </div> <div> <strong>p's rect</strong> <p class="withclientrectsoverlay"> <span>paragraph that spans multiple lines</span> </p> </div> <div> <strong>span's rect</strong> <p> <span class="withclientrectsoverlay">paragraph that spans multiple lines</sp...
...And 3 more matches
Element.querySelectorAll() - Web APIs
note: this method is implemented based on the parentnode mixin's queryselectorall() method.
...
note: characters which are not part of standard css syntax must be escaped using a backslash character.
...
note: if the specified selectors include a css pseudo-element, the returned list is always empty.
...And 3 more matches
FileSystemDirectoryEntry - Web APIs
nosafari ios full support 11.3samsung internet android full support yesgetdirectory experimentalchrome full support 8edge full support 79firefox full support 50
notes full support 50
notes
notes in firefox, the errorcallback's input parameter is a domexception rather than a fileerror object.ie no support noopera no support nosafari full support 11.1webview android fu...
...ll support ≤37chrome android full support 18firefox android full support 50
notes full support 50
notes
notes in firefox, the errorcallback's input parameter is a domexception rather than a fileerror object.opera android no support nosafari ios full support 11.3samsung internet android full support yesgetfile experimentalchrome full support 8edge full support 79firefox full support ...
... 50
notes full support 50
notes
notes in firefox, the errorcallback's input parameter is a domexception rather than a fileerror object.ie no support noopera no support nosafari full support 11.1webview android full support ≤37chrome android full support 18firefox android full support 50
notes full support 50
notes
notes in firefox, the errorcallback's input parameter is a domexception rather than a fileerror object.opera andr...
...And 3 more matches
FileSystemFlags - Web APIs
note that these option flags currently don't have any useful meaning when used in the scope of web content, where security precautions prevent the creation of new files or the replacement of existing ones.
... 13prefixed full support 13prefixed prefixed implemented with the vendor prefix: webkitedge full support ≤79prefixed full support ≤79prefixed prefixed implemented with the vendor prefix: webkitfirefox partial support 50
notes partial support 50
notes
notes for security reasons, firefox does not support creating files.
...esprefixed full support yesprefixed prefixed implemented with the vendor prefix: webkitchrome android full support yesprefixed full support yesprefixed prefixed implemented with the vendor prefix: webkitfirefox android partial support 50
notes partial support 50
notes
notes for security reasons, firefox does not support creating files.
...And 3 more matches
Drag Operations - Web APIs
note: when an element is made draggable, text or other elements within it can no longer be selected in the normal way by clicking and dragging with the mouse.
...
note that both the text/uri-list and text/plain contain the same data in this example.
...
note that these values must be used exactly as listed above.
...And 3 more matches
Working with the History API - Web APIs
note: calling history.back() normally behaves the same way as clicking the back button.
...
note that the browser won't attempt to load this url after a call to pushstate(), but it might attempt to load the url later, for instance after the user restarts the browser.
...
note: in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) through gecko 5.0 (firefox 5.0 / thunderbird 5.0 / seamonkey 2.2), the passed object is serialized using json.
...And 3 more matches
IDBObjectStore.createIndex() - Web APIs
note that this method must be called only from a versionchange transaction mode callback.
...
note: this feature is available in web workers.
...
note that it is possible to create an index with an empty name.
...And 3 more matches
IDBTransaction.error - Web APIs
note: this feature is available in web workers.
...
note also the functions attached to transaction event handlers to report on the outcome of the transaction opening in the event of success or failure.
...
note the transaction.onerror = function(event) { }; block, making use of transaction.error to help in reporting what went wrong when the transaction was unsuccessful.
...And 3 more matches
IDBTransaction.onabort - Web APIs
note: this feature is available in web workers.
...
note also the functions attached to transaction event handlers to report on the outcome of the transaction opening in the event of success or failure.
...
note the transaction.onabort = function(event) { }; block, reporting when the transaction has been aborted.
...And 3 more matches
ImageCapture.takePhoto() - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internettakephoto experimentalchrome full support 60 full support 60 no support 59 — 60
notes
notes photosettings argument not supported.edge full support ≤79firefox ?
... opera full support 47 full support 47 no support 46 — 47
notes
notes photosettings argument not supported.safari ?
... webview android full support 60 full support 60 no support 59 — 60
notes
notes photosettings argument not supported.chrome android full support 60 full support 60 no support 59 — 60
notes
notes photosettings argument not supported.firefox android ?
...And 3 more matches
NotificationEvent - Web APIs
note: this interface is specified in the notifications api, but accessed through serviceworkerglobalscope.
... desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnotificationevent experimentalchrome full support 42edge full support ≤18firefox full support 44
notes full support 44
notes
notes extended support releases (esr) before firefox 78 esr do not support service workers and the push api.ie ?
... samsung internet android full support 4.0notificationevent() constructor experimentalchrome full support 42edge full support ≤18firefox full support 44
notes full support 44
notes
notes extended support releases (esr) before firefox 78 esr do not support service workers and the push api.ie ?
...And 3 more matches
Using the Screen Capture API - Web APIs
note: it may be useful to
note that recent versions of the webrtc adapter.js shim include implementations of getdisplaymedia() to enable screen sharing on browsers that support it but do not implement the current standard api.
...
note: unlike most uses of constraints in media apis, here it's solely used to define the stream configuration, and not to filter the available choices.
...
note: constraints never cause changes to the list of sources available for capture by the screen sharing api.
...And 3 more matches
WebGL model view projection - Web APIs
note: this article is also available as an mdn content kit.
...
note: the code for each webglbox example is available in this github repo and is organized by section.
... // performance
note: creating a new array buffer for every draw call is slow.
...And 3 more matches
Writing WebSocket servers - Web APIs
note: read the latest official websockets specification, rfc 6455.
...
note: regular http status codes can be used only before the handshake.
...
note: this seemingly overcomplicated process exists so that it's obvious to the client whether the server supports websockets.
...And 3 more matches
Web Authentication API - Web APIs
please
note: both create() and get() require a secure context (e.g.
...
note most javascript programmers that are creating an application will only really care about steps 1 and 5 where the create() function is called and subsequently returns; however, steps 2, 3, and 4 are essential to understanding the processing that takes place in the browser and authenticator and what the resulting data means.
...
note that it is absolutely critical that the challenge be a buffer of random information (at least 16 bytes) and it must be generated on the server in order to ensure the security of the registration process.
...And 3 more matches
Window.open() - Web APIs
note that remote urls won't load immediately.
...
note on the use of window.open() to reopen an existing window with name windowname : this functionality is not valid for all browsers and more with variable conditions.
... tip:
note that in some browsers, users can override the windowfeatures settings and enable (or prevent the disabling of) features position and size features windowfeatures parameter can specify the position and size of the new window.
...And 3 more matches
Using media queries - CSS: Cascading Style Sheets
note: the examples on this page use css's @media for illustrative purposes, but the basic syntax remains the same for all types of media queries.
...
note: a style sheet with a media query attached to its <link> tag will still download even if the query returns false.
... name summary
notes any-hover does any available input mechanism allow the user to hover over elements?
...And 3 more matches
max-width - CSS: Cascading Style Sheets
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetmax-widthchrome full support 1edge full support 12firefox full support 1
notes full support 1
notes
notes css 2.1 leaves the behavior of max-width with table undefined.
... firefox supports applying max-width to table elements.ie full support 7opera full support 4
notes full support 4
notes
notes css 2.1 leaves the behavior of max-width with table undefined.
... opera supports applying max-width to table elements.safari full support 1webview android full support 4.4chrome android full support 18firefox android full support 4
notes full support 4
notes
notes css 2.1 leaves the behavior of max-width with table undefined.
...And 3 more matches
HTML attribute: rel - HTML: Hypertext Markup Language
note: apple's ios does not use this link type, nor the sizes attribute, like others mobile browsers do, to select a webpage icon for web clip or a start-up placeholder.
...
note: the obsolete rev="made" is treated as rel="alternate" bookmark relevant as the rel attribute value for the <a> and <area> elements, the bookmark provides a permalink for ancestor section, which is the nearest ancestor <article> or <section>, if there is at least one, otherwise, the nearest heading sibling or ancestor descendant, to the next..
...
note: apple's ios does not use this link type, nor the sizes attribute, like others mobile browsers do, to select a webpage icon for web clip or a start-up placeholder.
...And 3 more matches
<audio>: The Embed Audio element - HTML: Hypertext Markup Language
note: sites that automatically play audio (or videos with an audio track) can be an unpleasant experience for users, so should be avoided when possible.
... usage
notes: the autoplay attribute has precedence over preload.
... waiting playback has stopped because of a temporary lack of data usage
notes browsers don't all support the same file types and audio codecs; you can provide multiple sources inside nested <source> elements, and the browser will then use the first one it understands: <audio controls> <source src="myaudio.mp3" type="audio/mpeg"> <source src="myaudio.ogg" type="audio/ogg"> <p>your browser doesn't support html5 audio.
...And 3 more matches
<input type="datetime-local"> - HTML: Hypertext Markup Language
you can set a default value for the input by including a date and time inside the value attribute, like so: <label for="party">enter a date and time for your party booking:</label> <input id="party" type="datetime-local" name="partydate" value="2017-06-01t08:30"> one thing to
note is that the displayed date and time formats differ from the actual value; the displayed date and time are formatted according to the user's locale as reported by their operating system, whereas the date/time value is always formatted yyyy-mm-ddthh:mm.
...
note: also bear in mind that if such data is submitted via http get, the colon character will need to be escaped for inclusion in the url parameters, e.g.
...
note: when the data entered by the user doesn't adhere to the stepping configuration, the user agent may round to the nearest valid value, preferring numbers in the positive direction when there are two equally close options.
...And 3 more matches
<input type="tel"> - HTML: Hypertext Markup Language
note: browsers that don't support type tel fall back to being a standard text input.
...
note: avoid using the placeholder attribute if you can.
...
note: because a read-only field cannot have a value, required does not have any effect on inputs with the readonly attribute also specified.
...And 3 more matches
<input type="text"> - HTML: Hypertext Markup Language
note: avoid using the placeholder attribute if you can.
...
note: because a read-only field cannot have a value, required does not have any effect on inputs with the readonly attribute also specified.
...
note: this has been standardized as the global attribute enterkeyhint, but is not yet widely implemented.
...And 3 more matches
<u>: The Unarticulated Annotation (Underline) element - HTML: Hypertext Markup Language
see the usage
notes section for further details on when it's appropriate to use <u> and when it isn't.
... usage
notes along with other pure styling elements, the original html underline (<u>) element was deprecated in html 4; however, <u> was restored in html 5 with a new, semantic, meaning: to mark text as having some form of non-textual annotation applied.
... use cases valid use cases for the <u> element include annotating spelling errors, applying a proper name mark to de
note proper names in chinese text, and other forms of annotation.
...And 3 more matches
HTTP Public Key Pinning (HPKP) - HTTP
note: public key pinning mechanism was deprecated in favor of certificate transparency and expect-ct header.
...
note: the current specification requires including a second pin for a backup key which isn't yet used in production.
... this allows for changing the server's public key without breaking accessibility for clients that have already
noted the pins.
...And 3 more matches
Expressions and operators - JavaScript
note that the return values are always based on the operands’ values before the operation.
... var1 <= var2 var2 <= 5
note: (=>) is not an operator, but the notation for arrow functions.
...these operators work as they do in most other programming languages when used with floating point numbers (in particular,
note that division by zero produces infinity).
...And 3 more matches
Regular expression syntax cheatsheet - JavaScript
note that the m multiline flag doesn't change the dot behavior.
...
note that some characters like :, -, @, etc.
...
note that a matched word boundary is not included in the match.
...And 3 more matches
Function.prototype.apply() - JavaScript
note that this may not be the actual value seen by the method: if the method is a function in non-strict mode code, null and undefined will be replaced with the global object, and primitive values will be boxed.
... description
note: while the syntax of this function is almost identical to that of call(), the fundamental difference is that call() accepts an argument list, while apply() accepts a single array of arguments.
...
note: when the first argument is undefined or null a similar outcome can be achieved using the array spread syntax.
...And 3 more matches
WebAssembly.Instance - JavaScript
desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jsinstancechrome full support 57edge full support 16firefox full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).ie no support noopera full support 44safari full support 11webview android full support ...
... 57chrome android full support 57firefox android full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).opera android full support 43safari ios full support 11samsung internet android full support 7.0nodejs full support 8.0.0instance() constructorchrome full support 57edge full support 16firefox full support ...
... 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).ie no support noopera full support 44safari full support 11webview android full support 57chrome android full support 57firefox android full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).opera android full support 43safari ios ...
...And 3 more matches
The building blocks of responsive design - Progressive web apps (PWAs)
note: you can find the snapshot app on github; check out the code and help improve it.
...
note that getusermedia() is an experimental technology, which currently only works in google chrome and firefox desktop.
... the markup is very simple: <x-deck selected-index="0"> <x-card> … </x-card> <x-card> … </x-card> <x-card> … </x-card> </x-deck>
note: these weird x- elements may be unfamiliar; they are part of brick, mozilla's ui element library for mobile web apps.
...And 3 more matches
Namespaces crash course - SVG: Scalable Vector Graphics
note that the namespace declaration only needs to be provided once on a root element.
...
note that namespace names are just strings, so the fact that the svg namespace name also looks like a uri isn't important.
...
note that it is an xml error to use a prefix that hasn't been bound to a namespace name.
...And 3 more matches
Subresource Integrity - Web security
note: for subresource-integrity verification of a resource served from an origin other than the document in which it’s embedded, browsers additionally check the resource using cross-origin resource sharing (cors), to ensure the origin serving the resource allows it to be shared with the requesting origin.
...
note: an integrity value may contain multiple hashes separated by whitespace.
...
note: an integrity value's "hash" part is, strictly speaking, a cryptographic digest formed by applying a particular hash function to some input (for example, a script or stylesheet file).
...And 3 more matches
Using templates and slots - Web Components
we'll call it <my-paragraph>: customelements.define('my-paragraph', class extends htmlelement { constructor() { super(); let template = document.getelementbyid('my-paragraph'); let templatecontent = template.content; const shadowroot = this.attachshadow({mode: 'open'}) .appendchild(templatecontent.clonenode(true)); } } ); the key point to
note here is that we append a clone of the template content to the shadow root, created using the node.clonenode() method.
... so for example: <template id="my-paragraph"> <style> p { color: white; background-color: #666; padding: 5px; } </style> <p>my paragraph</p> </template> now we can use it by just adding it to our html document: <my-paragraph></my-paragraph>
note: templates are well-supported in browsers; the shadow dom api is supported by default in firefox (version 63 onwards), chrome, opera, safari, and edge (starting with version 79).
...as before, this can be anything you like, for example: <my-paragraph> <span slot="my-text">let's have some different text!</span> </my-paragraph> or <my-paragraph> <ul slot="my-text"> <li>let's have some different text!</li> <li>in a list!</li> </ul> </my-paragraph>
note: elements that can be inserted into slots are known as slotable; when an element has been inserted in a slot, it is said to be slotted.
...And 3 more matches
tabs - Archive of obsolete content
lose", logclose); } function logshow(tab) { console.log(tab.url + " is loaded"); } function logactivate(tab) { console.log(tab.url + " is activated"); } function logdeactivate(tab) { console.log(tab.url + " is deactivated"); } function logclose(tab) { console.log(tab.url + " is closed"); } tabs.on('open', onopen); manipulate a tab you can get and set various properties of tabs (but
note that properties relating to the tab's content, such as the url, will not contain valid values until after the tab's ready event fires).
...ript to the page hosted in a tab, and use that to access and manipulate the page's content (see the modifying the page hosted by a tab tutorial): var tabs = require("sdk/tabs"); tabs.on('activate', function(tab) { var worker = tab.attach({ contentscript: 'self.port.emit("html", document.body.innerhtml);' }); worker.port.on("html", function(message) { console.log(message) }) });
note that tab.attach is tab-centric: if the user navigates to a new page in the same tab, then the worker and content scripts will be reattached to the new page.
... high-level tab var lowleveltab = viewfor(tab); // now we can, for example, access the tab's content directly var browser = tab_utils.getbrowserfortab(lowleveltab); console.log(browser.contentdocument.body.innerhtml); // get the high-level tab back from the xul tab var highleveltab = modelfor(lowleveltab); console.log(highleveltab.url); } tabs.on("ready", maphighleveltolowlevel);
note that directly accessing xul objects and web content like this means you're no longer protected by the compatibility guarantees made by the sdk's high-level apis.
...And 2 more matches
JavaScript Debugger Service - Archive of obsolete content
note that onerror is called for every exception.
..._error) messagetype = "error"; if (flags & jsdierrorhook.report_warning) messagetype = "warning"; if (flags & jsdierrorhook.report_exception) messagetype = "uncaught-exception"; if (flags & jsdierrorhook.report_strict) messagetype += "-strict"; dump(messagetype + "\n"); return false; // trigger debughook // return true; if you do not wish to trigger debughook } }; //
note that debughook does not _always_ trigger when jsd.errorhook[onerror] returns false // it is not well-known why debughook sometimes fails to trigger jsd.debughook = { onexecute: function(frame, type, rv) { stacktrace = ""; for (var f = frame; f; f = f.callingframe) { stacktrace += f.script.filename + "@" + f.line + "@" + f.functionname + "\n"; } dump(stacktrace); return components.i...
...
note that the jsdifilter only applies to jsdiexecutionhooks, which are breakpointhook, debughook, debuggerhook, interrupthook and throwhook.
...And 2 more matches
Progress Listeners - Archive of obsolete content
note that if you just want to execute your code each time a page loads, you can use an an easier method, onpageload().
...
note that onpageload does not fire for back button clicks.
...
note that the browser uses a weak reference to your listener object, so make sure to keep an external reference to your object to ensure that it stays in memory.
...And 2 more matches
Java in Firefox Extensions - Archive of obsolete content
note: the global java object has been removed in gecko 16.0, so this page is out of date.
...
note bug 834918 about click-to-play effect on java plugins in chrome and bug 775301.
...liveconnect gives your extension's javascript code (linked from or contained in xul code) access to 2 objects: java and packages (
note that per this thread, although the new documentation for the liveconnect reimplementation states that these globals will be deprecated (in the context of applets), "firefox and the java plug-in will continue to support the global java/packages keywords, in particular in the context of firefox extensions.").
...And 2 more matches
How to Write and Land Nanojit Patches - Archive of obsolete content
(
note: this document is called nanojitmerge for historical reasons -- adobe and mozilla used to have separate copies of nanojit, but this was a maintenance headache so they were merged.
...once it passes review, land it on nanojit-central, mark the bug's whiteboard as fixed-in-nanojit, and
note the revision in a comment.
... (
note that nanojit-central revision urls have the form http://hg.mozilla.org/projects/nanojit-central/<revid>, ie.
...And 2 more matches
Plugin Architecture - Archive of obsolete content
this page contains some
notes on how plugins work internally in gecko.
...
note: this document documents how trunk works, i.e.
...
note: this document describes how things are, not necessarily how things should be.
...And 2 more matches
BundleLibrary - Archive of obsolete content
note: these bundles have not be tested with the latest version of prism and probably won't run.
...bundles gmail: gmail.webapp google calendar: gcalendar.webapp google docs: gdocs.webapp google groups: groups.webapp google analytics: ganalytics.webapp google reader: greader.webapp facebook: facebook.webapp twitter: twitter.webapp user contributed bundles gmail w/gtalk: gmail.webapp (
note: work with latest version of prism!) 32 online todo lists: zip file with web apps for 32 online todo lists anywhere.fm: anywhere.fm@prism.app.webapp a service that lets you upload your entire music library to their servers and listen from anywhere through a slick flash interface.
... aol email : aolemail.webapp bbc radio player bbcradioplayer.webapp bloglines : bloglines.webapp bloglines beta: beta.bloglines.webapp chandler: chandler.webapp flash earth (integrates all major mapping sites) flashearth.webapp flickr: flickr.webapp gollum wikipedia browser in english:gollum_en.webapp google
notebook: g
note.webapp google page creator: google_pagecreator.webapp google reader + gtalk : prism-bundle-google-reader-with-gtalk.webapp google webmaster tools: google_webmastertools.webapp grandcentral inbox: grandc.webapp (
note: grandcentral requires the flash plugin.
...And 2 more matches
Supporting private browsing mode - Archive of obsolete content
note: private browsing mode may only be detected by chrome code, such as extensions; web content cannot detect whether or not private browsing is in effect.
...nexitprivatebrowsing(); } } } else if (atopic == "quit-application") { this._os.removeobserver(this, "quit-application"); this._os.removeobserver(this, "private-browsing"); } }, get inprivatebrowsing() { return this._inprivatebrowsing; }, get watcher() { return this._watcher; }, set watcher(val) { this._watcher = val; } }; of special
note is the fact that this helper object is designed to not break on versions of firefox without private browsing support (those prior to firefox 3.5).
...ueryinterface(components.interfaces.nsisupportsprbool); // if another extension has not already canceled entering the private mode if (!asubject.data) { if (adata == "exit") { // if we are leaving the private mode /* you should display some user interface here */ asubject.data = true; // cancel the operation } } }, "private-browsing-cancel-vote", false);
note: a well-mannered extension should display some sort of user interface to indicate that private browsing mode will be kept on, and possibly offer the option to cancel whatever operation is preventing the extension from allowing private browsing to be shut off.
...And 2 more matches
Anonymous Content - Archive of obsolete content
note that the inherits attribute is never cloned when content is generated from a template.
...
note that children elements are never cloned when content is generated from a template.
... [editor's
note: should there be an api for retrieving insertion points, for dynamically creating new insertion points, or for removing insertion points?
...And 2 more matches
execute - Archive of obsolete content
(
note that this path points into the xpi itself.) args a parameter string that is passed to the executable.
...see
note below.
...see
note below.
...And 2 more matches
MenuItems - Archive of obsolete content
note that the image element is on a child level underneath the menu or menuitem, and it will have the class menu-iconic-icon.
...
note that the checked state is updated before the command event fires, so if you use the menuitem's checked attribute within the command listener, it will already be in the new state.
...
note that the code has been reversed in the condition blocks to hide the toolbar when the menuitem is checked and show the toolbar when the menuitem is not checked because the checked state hasn't been modified.
...And 2 more matches
Template Logging - Archive of obsolete content
however,
note that the result is specified as being 'inactive'.
...
note that this result is active and an indication is made in parantheses that there is no longer any active query.
...
note that this error does not occur simply because, for example, a particular container has no children; it means that a logic error in the query implies that a variable could never be computed properly.
...And 2 more matches
Creating toolbar buttons (Customize Toolbar Window) - Archive of obsolete content
note: some people overlay chrome://messenger/content/mailwindowoverlay.xul.
...just add code like this to your overlay: <toolbarpalette id="browsertoolbarpalette"> <toolbarbutton id="myextension-button" class="toolbarbutton-1" label="&toolbarbutton.label;" tooltiptext="&toolbarbutton.tooltip;" oncommand="myextension.ontoolbarbuttoncommand(event);"/> </toolbarpalette>
notes: the id of the palette (browsertoolbarpalette in the example) depends on the window (the parent window of the toolbar you wish to insert a button).
...to attach it to the overlay, put this processing instruction (pi) at the top of the overlay file: <?xml-stylesheet href="chrome://myextension/skin/toolbar-button.css" type="text/css"?>
note: the css file with your toolbar styles needs to be included in the overlay file, as you would expect, but also in the chrome.manifest file.
...And 2 more matches
SeaMonkey - making custom toolbar (SM ver. 1.x) - Archive of obsolete content
note that this extension is very simplified.
...
note: for a similar tutorial that applies to seamonkey 2, firefox, thunderbird and sunbird, see: custom toolbar button earlier versions and other mozilla applications also support extensions, but some parts of this tutorial are not appropriate for them.
...
note: for information about how to find the directory where you installed seamonkey, see: installation directory if you cannot easily find the directory, you can use the following method to find it.
...And 2 more matches
Document Object Model - Archive of obsolete content
the various dom objects have functions which may be accessed in script, however, it is important to
note that the dom is an api that is accessible by javascript.
...
note that we qualified the property with the 'window' identifier just to be clearer.
...it is important to
note, however, that the open() method returns before the window has fully loaded, so functions will not typically be available yet.
...And 2 more matches
Tree Box Objects - Archive of obsolete content
note that redrawing does not occur until the calling script ends since mozilla does not redraw in the background.
...
note: it is not necessary to run tree.boxobject.queryinterface(components.interfaces.nsitreeboxobject) as shown in the code examples on this page because: let boxobject = tree.treeboxobject;
note: is equivalent to: let boxobject = tree.boxobject; boxobject.queryinterface("components.interfaces.nsitreeboxobject"); scrolling the tree you can also scroll the tree using four different methods, similar to those available for listboxes.
...eeitem label="row 2"/> <treeitem label="row 3"/> <treeitem label="row 4"/> <treeitem label="row 5"/> <treeitem label="row 6"/> <treeitem label="row 7"/> <treeitem label="row 8"/> <treeitem label="row 9"/> </treechildren> </tree> <hbox align="center"> <label value="scroll to row:"/> <textbox id="tbox"/> <button label="scroll" oncommand="doscroll();"/> </hbox>
note that we use the rows attribute on the tree to specify that only four rows are displayed at a time.
...And 2 more matches
Tree View Details - Archive of obsolete content
note that the tree will call neither iscontainerempty nor iscontaineropen for rows that are not containers as indicated by the return value of the iscontainer method.
...
note: as of this writing (gecko 2.0), custom nsitreeview implementations must be prepared to handle a call to toggleopenstate for any row index which returns true for a call to iscontainer, regardless of whether the container is empty.
...
note that it should return the current number of visible rows, not the total.
...And 2 more matches
window - Archive of obsolete content
note: starting in gecko 1.9.2, you can detect when a window is activated or deactivated by watching for the "activate" and "deactivate" events.
...
note: this has no effect if the tabs on top preference is turned off.
...
note: when a window is minimized, the sizemode attribute is not updated.
...And 2 more matches
MacFAQ - Archive of obsolete content
(
note this document has not been reviewed for accuracy or completeness.) special build
notes enable libxul.
...
note that in order to copy the framework while keeping the relative soft-links in the framework, do something like: % ( cd dist ; gnutar cf - xul.framework | ( cd /library/frameworks ; gnutar xf - )) installing your application your application must be installed as a xulrunner app before you can open it.
... to do this, type: xulrunner-bin --install-app /path/to/appdir
note the path to your application must end with the directory containing application.ini; you should not reference application.ini in this command.
...And 2 more matches
calICalendarView - Archive of obsolete content
it should be
noted, however, that the methods and attributes implemented by a calicalendarview need not behave in any predictable fashion.
...
note that in most cases, this attribute will be set by the consumers of calicalendarview very early in an application/extension's loading process.
...implementations should therefore be wary to check whether a controller has been assigned to the view, before calling any of the methods it implements.
note that in most cases, this attribute will be set by the consumers of calicalendarview very early in an application/extension's loading process.
...And 2 more matches
The First Install Problem - Archive of obsolete content
note that myapplication consists of one dll (which is an npapi plugin handling a given mimetype -- say application/x-myapp) and one xpt file, for scriptable interfaces.
...(
note that the file name must still begin with "np", just as it must when the file is loaded from the .\plugins directory.) example: [hkey_local_machine\software\mozillaplugins\@mycompany.com/myapplication,version=5.01] path=c:\mycompany\myapplication\netscape\npmyapp.dll "xptpath" -- string value -- absolute path to xpt module required for scripting plug-in, if applicable ...
...
note that this means that at a minimum, the plugin vendor is ensuring compatibility with 0.9.4.2 browsers.
...And 2 more matches
Advanced styling effects - Learn web development
note: there is another item that can be set in the box-shadow value — another length value can be optionally set just before the color value, which is a spread radius.
...
note: blend modes are also very new, and slightly less well supported than filters.
...
note: don't worry if you don't understand some of the layout properties above, like position, top, bottom, z-index, etc.
...And 2 more matches
What is CSS? - Learn web development
note: a browser is sometimes called a user agent, which basically means a computer program that represents a person inside a computer system.
...
note: you can find links to all the css property pages (along with other css features) listed on the mdn css reference.
... desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetfont-familychrome full support 1edge full support 12firefox full support 1
notes full support 1
notes
notes not supported on option elements.
...And 2 more matches
CSS FAQ - Learn web development
note: see selectors for more information.
...(see eric meyer's
note about the working group's stance).
...for example: -ms-transform: rotate(90deg); -webkit-transform: rotate(90deg); transform: rotate(90deg);
note: for more information on dealing with prefixed properties, see handling common html and css problems — handling css prefixes from our cross-browser testing module.
...And 2 more matches
Web fonts - Learn web development
note: web fonts as a technology have been supported in internet explorer since version 4!
...
note: under the "find fonts" section in the right-hand column, you can click on the different tags and classifications to filter the displayed choices.
...
note: if you have any problems getting this to work, feel free to compare your version to our finished files — see web-font-finished.html and web-font-finished.css (run the finished example live).
...And 2 more matches
Advanced form styling - Learn web development
input { -webkit-appearance: none; appearance: none; }
note: it is a good idea to always include both declarations — prefixed and unprefixed — when using a prefixed property.
...
note: you may have noticed that in the search field, the "x" delete icon disappears when the input loses focus in edge and chrome, but stays put in safari.
...
note: while internet explorer doesn't support any version of appearance, the input[type=checkbox]::-ms-check enables the targeting of checkboxes in ie only.
...And 2 more matches
A first splash into JavaScript - Learn web development
note: many of the code features you'll see in javascript are the same as in other programming languages — functions, loops, etc.
... the first three constants are each made to store a reference to the results paragraphs in our html, and are used to insert values into the paragraphs later on in the code (
note how they are inside a <div> element, which is itself used to select all three later on for resetting, when we restart the game): <div class="resultparas"> <p class="guesses"></p> <p class="lastresult"></p> <p class="loworhi"></p> </div> the next two constants store references to the form text input and submit button and are used to control submitting the guess later on.
...
note: you'll learn a lot more about variables/constants later on in the course, starting with the next article.
...And 2 more matches
Arrays - Learn web development
try this: shopping[0] = 'tahini'; shopping; // shopping will now return [ "tahini", "milk", "cheese", "hummus", "noodles" ]
note: we've said it before, but just as a reminder — computers start counting from 0!
...
note that an array inside an array is called a multidimensional array.
...
note: okay, this is technically a string method, not an array method, but we've put it in with arrays as it goes well here.
...And 2 more matches
Storing the information you need — Variables - Learn web development
note: we say variables contain values.
...
note: in javascript, all code instructions should end with a semi-colon (;) — your code may work correctly for single lines, but probably won't when you are writing multiple lines of code together.
...if they don't exist, you'll get an error message — try typing in scoobydoo;
note: don't confuse a variable that exists but has no defined value with a variable that doesn't exist at all — they are very different things.
...And 2 more matches
Componentizing our Svelte app - Learn web development
note: in the process of creating our first couple of components, we will also learn different techniques to communicate between components, and the pros and cons of each.
...first of all, we need to import it — add the following line at the top of the todos.svelte <script> section: import filterbutton from './filterbutton.svelte' now, replace the filters <div> with a call to the filterbutton component, which takes the current filter as a prop — the below line is all you need: <filterbutton {filter} />
note: remember that when the html attribute name and variable matches, they can be replaced with {variable}, that's why we could replace <filterbutton filter={filter} /> with <filterbutton {filter} />.
...
note: custom events in svelte share the same api as regular dom events.
...And 2 more matches
Deployment and next steps - Learn web development
note that our application is fully functional and porting it to typescript is completely optional.
...
note: there is also an official template for using webpack and also many community-maintained plugins for other bundlers.
...
note: the following section could be applied to any client-side static web site requiring a build step, not just svelte apps.
...And 2 more matches
Understanding client-side JavaScript frameworks - Learn web development
react tutorials
note: react tutorials last tested in may 2020, with react/reactdom 16.13.1 and create-react-app 3.4.1.
... ember tutorials
note: ember tutorials last tested in may 2020, with ember/ember cli version 3.18.0.
... vue tutorials
note: vue tutorials last tested in may 2020, with vue 2.6.11.
...And 2 more matches
Simple Thunderbird build
note that the downloaded outlook 2010 mapi header files contain 18 fies, of which only 17 are needed.
... 2,743 mapioid.h 02/06/2009 17:02 32,978 mapispi.h 02/06/2009 17:02 54,395 mapitags.h 02/06/2009 17:02 26,467 mapiutil.h 02/06/2009 17:02 97,301 mapival.h 02/06/2009 17:02 9,334 mapiwin.h 02/06/2009 17:02 1,906 mapiwz.h 02/06/2009 17:02 18,277 mapix.h 02/06/2009 17:02 5,012 mspst.h get the source
note: on windows, you won't be able to build the thunderbird source code if it's under a directory with spaces in the path (e.g., don't use "documents and settings").
...
note: parts of the build process also have problems when the source code is in a directory where the path is long (nested many levels deep).
...And 2 more matches
Using the Browser API
note: an iframe enhanced by the browser api is commonly referred to as a "browser iframe".
...
note that promise versions of browser api dom request methods also exist, so you can use async promise style syntax if you so wish.
...when you tap the url bar, you can enter a url using the built-in firefox os keyboard (although
note that we haven't implemented anything sophisticated in this app, like autofilling the http://, etc.).
...And 2 more matches
FileUtils.jsm
note: if you want to use the full path to get to the directory you cannot use getdir.
...
note: 'safe' and 'atomic' file output streams will never append; they will always overwrite an existing file.
...
note: openatomicfileoutputstream() is generally better than opensafefileoutputstream() because flushing is not needed in most of the issues.
...And 2 more matches
Bootstrapping a new locale
you can choose to use:
notepad++ or
notepad2 on windows, vim, gedit or kate on gnu/linux, textwrangler on mac os x.
... (read more about tools at l10n:tools.) after you have downloaded your editor of choice, type the following command in the same path from above (~/ab-cd/browser/chrome/browser) $ edit ab-cd/browser/chrome/browser/aboutcerterror.dtd read the top of the file to get any context on how to translate contained in the
notes written by the developers or l10n-drivers.
... localization
notes will look like this: <!-- localization
notes...
...And 2 more matches
Localizing without a specialized tool
going one-by-one with your compare-locales output open for review, we will start with the first file with "// add and localize this file"
note.
...you can choose to use:
notepad++ or
notepad2 on windows, vim, gedit or kate on gnu/linux, textwrangler on mac os x.
... (read more about tools at l10n:tools.) after you have downloaded your editor of choice, type the following command in the same path from above (l10n-mozilla-1.9.2/x-testing/browser/chrome/browser) $ edit l10n-mozilla-1.9.2/x-testing/browser/chrome/browser/aboutcerterror.dtd read the top of the file to get any context on how to translate contained in the
notes written by the developers or l10n-drivers.
...And 2 more matches
SVN for Localizers
note: if you do not already have access to svn, visit this wiki page on how to get set up with an svn account before proceeding.
...
note: we use the terms stage and prod (abbreviations of the terms staging and production) to refer to testing and publicly visible websites, respectively.
...
note: the directory you create will be located inside the directory that you're currently in with your console (or cygwin console).
...And 2 more matches
Creating localizable web applications
note: most of the code snippets used in the examples below come from an early version of the getpersonas.com website.
...
note that some strings might be hidden in libraries' code (e.g.
...good: // %1$s is the persona's name, %2$s is the athor's username printf(_('%1$s by %2$s'), $persona['name'], $persona['display_username']);
note the single quotes around '%1$s by %2$s'.
...And 2 more matches
NSS API Guidelines
note: it's not necessary all eight files exist.
... threadmark code
notes the thread id, whenever an arena is marked, and disallows any allocations or marks by any other thread.
...
note: error stacks are vertical, and never horizontal.
...And 2 more matches
SpiderMonkey 24
these release
notes are an incomplete draft and were initially seeded from the spidermonkey 17 release
notes, so they're not necessarily complete or fully accurate.
... (this change was motivated by garbage collector improvements, which lean quite heavily on c++'s support for raii through constructors and destructors.) if you are compiling with microsoft's visual studio,
note that the minimum supported version is msvc10/2010: msvc8/9 support has been dropped.
... please
note that spidermonkey reserves the js:: namespace for itself (and the js:: namespace for internal use).
...And 2 more matches
SpiderMonkey 31
these release
notes are incomplete.
... if you are compiling with microsoft's visual studio,
note that the minimum supported version is msvc10/2010: msvc8/9 support has been dropped.
...please
note that spidermonkey reserves the js:: namespace for itself (and the js:: namespace for internal use).
...And 2 more matches
SpiderMonkey 38
these release
notes are incomplete.
... if you are compiling with microsoft's visual studio,
note that the minimum supported version is msvc10/2010.
...please
note that spidermonkey reserves the js:: namespace for itself (and the js:: namespace for internal use).
...And 2 more matches
Handling Mozilla Security Bugs
note that the focus of this new structure is restricted solely to addressing actual security vulnerabilities arising from problems in mozilla code.
... as
noted above, information about security bugs can be held confidential for some period of time; there is no pre-determined lmit on how long that time period might be.
...(as described previously, once added to the security bug group, that person would then have automatic access to all bugs marked security-sensitive, without having to be explicitly added to the cc list for each one.)
note that, although we intend to make it relatively simple for a new person to join the security bug group, and we are not limiting the size of the group to any arbitrary number, we do not want the group to expand without any limits whatsoever.
...And 2 more matches
Places utilities for JavaScript
note these variants also do not return the dialog "performed" state since they may not open the dialog modally.
...
note: the location, description and "load in sidebar" fields are visible only if there is no initial uri (auri is null).
...
note: when adefaultinsertionpoint is not set, the dialog defaults to the bookmarks root folder.
...And 2 more matches
Starting WebLock
also
note that the nsicomponentmanager is passed into the callback.
... declaration macros the class declaration for the weblock class that implements these three interfaces is as follows: class weblock: public nsiobserver, public iweblock { public: weblock(); virtual ~weblock(); ns_decl_isupports ns_decl_nsiobserver ns_decl_iweblock };
note that we derive from the nsiobserver interface as well as the iweblock class.
...if you really want to change the return result type you can use a special flag in your xpidl that de
notes this (see the xpidl reference).
...And 2 more matches
mozIPersonalDictionary
note that this method is not currently implemented.
...
note that this parameter is currently unused.
...
note that this parameter is currently ignored.
...And 2 more matches
nsIAppShellService
orsplashscreen); 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.
...
note: size_to_content may be used for width or height.
...e10s
notes: the browser is created in process.
...And 2 more matches
nsIContentPrefService
note: prior to gecko 2.0, the site could only be specified by nsiuri.
...
note: prior to gecko 2.0, the site could only be specified by nsiuri.
...
note: prior to gecko 2.0, the site could only be specified by nsiuri.
...And 2 more matches
nsICrashReporter
1.0 66 introduced gecko 1.9 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview void annotatecrashreport(in acstring key, in acstring data); void appendapp
notestocrashreport(in acstring data); void appendobjcexceptioninfotoapp
notes(in voidptr aexception); native code only!
... appendapp
notestocrashreport() append some data to the "
notes" field, to be submitted with a crash report.
...void appendapp
notestocrashreport( in acstring data ); parameters data data to be added.
...And 2 more matches
nsIDOMWindow
note: prior to gecko 7.0 this attribute was part of nsidomwindow2.
...
note: prior to gecko 8.0 this attribute was part of nsidomstoragewindow.
...
note: prior to gecko 8.0 this attribute was part of nsidomstoragewindow.
...And 2 more matches
nsIHttpChannel
note: an http redirect results in a new channel being created.
...
note: the channel may silently refuse to set the referer: header if the uri does not pass certain security checks (e.g., a "https://" url will never be sent as the referrer for a plaintext http request).
...
note: the data for a "post" or "put" request can be configured via nsiuploadchannel.
...And 2 more matches
nsIInputStream
note: blocking input streams are often read on a background thread to avoid locking up the main application thread.
...
note: some nsiinputstream implementations automatically close() when end-of-file is reached; others do not.
...
note: this method should not be used to determine the total size of a stream, even if the stream corresponds to a local file.
...And 2 more matches
nsIRequest
note: these flags are intended for normal browsing, and they should therefore not apply to content that must be validated before each use.
...
note: this will prevent proxy authentications from working, so use this flag with caution.
...
note: most nsirequest implementations expect astatus to be a failure code; however, some implementations may allow astatus to be a success code such as ns_ok.
...And 2 more matches
nsIScriptableInputStream
note: this method should not be used to determine the total size of a stream, even if the stream corresponds to a local file.
...
note: the close method may be called more than once, but subsequent calls are ignored.
...
note: the init method may be called more than once, allowing a nsiscriptableinputstream instance to be reused.
...And 2 more matches
nsIXPConnect
pports acomobj, in nsiidref aiid, in nsiprincipal aprincipal, in nsisupports aextraptr, in pruint32 aflags); nsivariant jstovariant(in jscontextptr ctx, in jsval value); nsivariant jsvaltovariant(in jscontextptr cx, in jsvalptr ajsval); void movewrappers(in jscontextptr ajscontext, in jsobjectptr aoldscope, in jsobjectptr anewscope); [noscript,notxpcom] void
notejscontext(in jscontextptr ajscontext, in nscctraversalcallbackref acb); void releasejscontext(in jscontextptr ajscontext, in prbool nogc); void removejsholder(in voidptr aholder); native code only!
...
note: in c++, the out jsval parameter must already be a strong gc root.
...n return value missing description exceptions thrown missing exception missing description movewrappers() void movewrappers( in jscontextptr ajscontext, in jsobjectptr aoldscope, in jsobjectptr anewscope ); parameters ajscontext missing description aoldscope missing description anewscope missing description exceptions thrown missing exception missing description
notejscontext()
note: ajscontext as a child to the cycle collector.
...And 2 more matches
Setting HTTP request headers
note: if you are making up your own http header, you must put a x- in front of the name.
...(and yes, "http-on-modify-request" is a string.)
note: there are many topics, besides just "http-on-modify-request", that you can get notifications about, for example "http-on-examine-response" and "xpcom-shutdown".
...hat adds a custom header "x-hello" to the channel passed in for http-on-modify-request notification: var {cc, ci} = require("chrome"); var httprequestobserver = { observe: function(subject, topic, data) { if (topic == "http-on-modify-request") { var httpchannel = subject.queryinterface(ci.nsihttpchannel); httpchannel.setrequestheader("x-hello", "world", false); } } };
note: the above code was changed to reflect that in a firefox add-on one can not directly access components.interfaces und components.classes anymore but must use the require line introduced to the sample code above.
...And 2 more matches
Mail composition back end
(
note: this method could easily be broken in to a few different calls.
... const struct nsmsgattachedfile *preloaded_attachments, - attachments that are already locally stored on disk (
note: both attachments and preloaded_attachments cannot be specified on a single call void *relatedpart /* nsmsgsendpart */, - a related part for multipart related operations nsimsgsendlistener **alistenerarray) = 0; - an array of listeners for the send operation.
... this can be nsnull if you want to do the delivery operation "blind" sendmessagefile the sendmessagefile method will let the caller send a message that has been created by another process (
note: createandsendmessage can accomplish this task).
...And 2 more matches
Using the Mozilla symbol server
note that because mozilla release builds are heavily optimized, debugging is not always easy.
...to use only the mozilla symbol server, add the following entry to your symbol path (
note: you can replace c:\symcache\ with any writable directory on your computer, if you'd prefer a different location for downloaded symbols): srv*c:\symcache\*https://symbols.mozilla.org/ set this string as _nt_symbol_path in the environment, using the windbg menus, or by typing the .sympath command.
... if you would like to get symbols from microsoft's symbol server as well, you should list that first (
note: you can replace c:\symcache\ with any writable directory on your computer, if you'd prefer a different location for downloaded symbols): srv*c:\symcache\*https://msdl.microsoft.com/download/symbols;srv*c:\symcache\*https://symbols.mozilla.org/ downloading symbols using symchk.exe you can also download the symbols using symchk.exe, part of microsoft's debugging tools for windows.
...And 2 more matches
Using js-ctypes
note: js-ctypes only works with c libraries; you can't use c++ methods directly.
...
note: this information comes from this article on msdn.
...
note: this example will not work on 64bit os x, see below for core foundation for 64bit os x /* build a str255 ("pascal style") string from the passed-in string */ function makestr(str) { return string.fromcharcode(str.length) + str; } components.utils.import("resource://gre/modules/ctypes.jsm"); var carbon = ctypes.open("/system/library/frameworks/carbon.framework/carbon"); stdalert = carbon.d...
...And 2 more matches
Introduction to DOM Inspector - Firefox Developer Tools
note: starting with firefox 3, the dom inspector is not included in firefox by default; instead, you must download and install it from the mozilla add-ons web site.
... (
note: this is now a dead link.) when you first start the dom inspector, you are presented with a two-pane application window that looks a little like the main mozilla browser.
... dom inspector viewers
note that these viewers are just two viewers that the dom inspector provides.
...And 2 more matches
Debugger.Object - Firefox Developer Tools
for example: function f() {} // display name: f (the given name) var g = function () {}; // display name: g o.p = function () {}; // display name: o.p var q = { r: function () {} // display name: q.r };
note that the display name may not be a proper javascript identifier, or even a proper expression: we attempt to find helpful names even when the function is not immediately assigned as the value of some variable or property.
...
note that the array only contains the promises that directly depend on the referent promise.
...
note that this returns primitive values unchanged.
...And 2 more matches
Settings - Firefox Developer Tools
note that in firefox 52 we removed the checkbox to toggle the "select element" button.
...
note that this setting is independent of the "browser styles" checkbox in the inspector's computed view.
...
note that service workers are not affected by this option.
...And 2 more matches
about:debugging (before Firefox 68) - Firefox Developer Tools
this page enables you to do two things: load an add-on temporarily from disk connect the add-on debugger to any restartless add-ons connecting the add-on debugger the add-ons page in about:debugging lists all restartless add-ons that are currently installed (
note that this list may include add-ons that came preinstalled with your firefox).
...
note that sometimes the debugger window is hidden by the main firefox window.
...
note that before firefox 48, loading the add-on again by pressing "load temporary add-on" without restarting firefox does not work.
...And 2 more matches
Attr - Web APIs
note: dom level 4 removed this property.
... gecko outputs a deprecation
note starting from gecko 7.0 (firefox 7.0 / thunderbird 7.0 / seamonkey 2.4).
... this
note was removed again in gecko 49.0 (firefox 49.0 / thunderbird 49.0 / seamonkey 2.46).
...And 2 more matches
console - Web APIs
note: this feature is available in web workers.
...
note: the actual console interface is defined as all lower case (i.e.
...formatting is supported, for example console.log("foo %.2f", 1.1) will output the number to 2 decimal places: foo 1.10
note: precision formatting doesn't work in chrome each of these pulls the next argument after the format string off the parameter list.
...And 2 more matches
Document.getElementsByTagNameNS() - Web APIs
syntax elements = document.getelementsbytagnamens(namespace, name) elements is a live nodelist (but see the
note below) of found elements in the order they appear in the tree.
...
note: while the w3c specification says elements is a nodelist, this method returns a htmlcollection both in gecko and internet explorer.
...
note: currently parameters in this method are case-sensitive, but they were case-insensitive in firefox 3.5 and before.
...And 2 more matches
Document.querySelectorAll() - Web APIs
note: this method is implemented based on the parentnode mixin's queryselectorall() method.
...
note: characters which are not part of standard css syntax must be escaped using a backslash character.
...
note: if the specified selectors include a css pseudo-element, the returned list is always empty.
...And 2 more matches
Traversing an HTML table with JavaScript and DOM Interfaces - Web APIs
extnode("cell in row "+i+", column "+j); cell.appendchild(celltext); row.appendchild(cell); } // add the row to the end of the table body tblbody.appendchild(row); } // put the <tbody> in the <table> tbl.appendchild(tblbody); // appends <table> into <body> body.appendchild(tbl); // sets the border attribute of tbl to 2; tbl.setattribute("border", "2"); }
note the order in which we created the elements and the text node: first we created the <table> element.
... myp.appendchild(mytextnode); after testing this sample,
note that the words hello and world are together: helloworld.
...another important
note is that the appendchild method will append the child after the last child, just like the word world has been added after the word hello.
...And 2 more matches
Using Fetch - Web APIs
to extract the json body content from the response, we use the json() method (defined on the body mixin, which is implemented by both the request and response objects.)
note: the body mixin also has similar methods to extract other types of body content; see the body section for more.
...s-origin, same-origin, strict-origin, strict-origin-when-cross-origin, unsafe-url body: json.stringify(data) // body data type must match "content-type" header }); return response.json(); // parses json response into native javascript objects } postdata('https://example.com/answer', { answer: 42 }) .then(data => { console.log(data); // json data parsed by `data.json()` call });
note that mode: "no-cors" only allows a limited set of headers in the request: accept accept-language content-language content-type with a value of application/x-www-form-urlencoded, multipart/form-data, or text/plain sending a request with credentials included to cause browsers to send a request with credentials included, even for a cross-origin call, add credentials: 'include' to the init o...
...
note: there is also a clone() method that creates a copy.
...And 2 more matches
Using the Gamepad API - Web APIs
var gamepads = {}; function gamepadhandler(event, connecting) { var gamepad = event.gamepad; //
note: // gamepad === navigator.getgamepads()[gamepad.index] if (connecting) { gamepads[gamepad.index] = gamepad; } else { delete gamepads[gamepad.index]; } } window.addeventlistener("gamepadconnected", function(e) { gamepadhandler(e, true); }, false); window.addeventlistener("gamepaddisconnected", function(e) { gamepadhandler(e, false); }, false); this previous example also demonst...
...
note that disconnecting a device and then connecting a new device may reuse the previous index.
...
note that this property is not currently supported in firefox.
...And 2 more matches
Recommended Drag Types - Web APIs
note: in older code, you may find text/unicode or the text types.
...
note: the url type is uri-list with an i, not an l.
...
note that the instanceof operator is used here as the mozgetdataat() method will return an nsisupports that needs to be checked and converted into an nsifile.
...And 2 more matches
databases - Web APIs
note: this feature is available in web workers.
...
note: this method is introduced in a draft of a specifications and browser compatibility is limited.
... desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetdatabases experimentalchrome full support 71edge full support 79firefox no support no
notes no support no
notes
notes see bug 934640.ie no support noopera full support 58safari no support nowebview android full support 71chrome android full support ...
...And 2 more matches
IDBObjectStore.add() - Web APIs
note: this feature is available in web workers.
...
note also the functions attached to transaction event handlers to report on the outcome of the transaction opening in the event of success or failure.
... for a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) {
note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable.
...And 2 more matches
IDBObjectStore.autoIncrement - Web APIs
note that every object store has its own separate auto increment counter.
...
note: this feature is available in web workers.
...for a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) {
note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable.
...And 2 more matches
IDBObjectStore.deleteIndex() - Web APIs
note that this method must be called only from a versionchange transaction mode callback.
...
note that this method synchronously modifies the idbobjectstore.indexnames property.
...
note: this feature is available in web workers.
...And 2 more matches
IDBObjectStore.get() - Web APIs
note: this method produces the same result for: a) a record that doesn't exist in the database and b) a record that has an undefined value.
...
note: this feature is available in web workers.
...for a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) {
note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable.
...And 2 more matches
IDBObjectStore - Web APIs
note: this feature is available in web workers.
...for a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) {
note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in db.
... db = dbopenrequest.result; }; // this event handles the event whereby a new version of // the database needs to be created either one has not // been created before, or a new version number has been // submitted via the window.indexeddb.open line above dbopenrequest.onupgradeneeded = function(event) { var db = event.target.result; db.onerror = function(event) {
note.innerhtml += '<li>error loading database.</li>'; }; // create an objectstore for this database var objectstore = db.createobjectstore("todolist", { keypath: "tasktitle" }); // define what data items the objectstore will contain objectstore.createindex("hours", "hours", { unique: false }); objectstore.createindex("minutes", "minutes", { unique: false }); objectstore.createindex("day", "day", { unique: ...
...And 2 more matches
IDBTransaction.abort() - Web APIs
note: this feature is available in web workers.
...
note also the functions attached to transaction event handlers to report on the outcome of the transaction opening in the event of success or failure.
...for a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) {
note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable.
...And 2 more matches
IDBTransaction.db - Web APIs
note: this feature is available in web workers.
...
note also the functions attached to transaction event handlers to report on the outcome of the transaction opening in the event of success or failure.
...for a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) {
note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable.
...And 2 more matches
IDBTransaction.mode - Web APIs
note: this feature is available in web workers.
...
note also the functions attached to transaction event handlers to report on the outcome of the transaction opening in the event of success or failure.
...for a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) {
note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable.
...And 2 more matches
IDBTransaction.objectStore() - Web APIs
note: this feature is available in web workers.
...
note also the functions attached to transaction event handlers to report on the outcome of the transaction opening in the event of success or failure.
... for a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) {
note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable.
...And 2 more matches
Basic concepts - Web APIs
indexeddb is useful for applications that store a large amount of data (for example, a catalog of dvds in a lending library) and applications that don't need persistent internet connectivity to work (for example, mail clients, to-do lists, and
notepads).
...
note: third party window content (e.g.
...
note: in firefox, if you wish to ensure durability for some reason (e.g.
...And 2 more matches
Key Values - Web APIs
note: this shouldn't be confused with the "mediapause" key value, which is used for media controllers, rather than to control applications and processes.
...
note: this shouldn't be confused with the "mediaplay" key value, which is used for media controllers, rather than to control applications and processes.
...
note: not all systems pass this key through to to the user agent.
...And 2 more matches
KeyboardEvent.location - Web APIs
note: when numlock is locked, gecko always returns dom_key_location_numpad for the keys on the numeric pad.
...on the other hand, if the keyboard doesn't have a keypad, such as on a
notebook computer, some keys become numpad only when numlock is locked.
...
note: numlock key's key events indicate dom_key_location_standard both on gecko and internet explorer.
...And 2 more matches
KeyboardEvent - Web APIs
note: keyboardevent events just indicate what interaction the user had with a key on the keyboard at a low level, providing no contextual meaning to that interaction.
...
note: this does not describe the locale of the data being entered.
...
note: if the key is used as a macro that inserts multiple characters, this attribute's value is the entire string, not just the first character.
...And 2 more matches
Using the Notifications API - Web APIs
note: this feature is available in web workers.
...
note: before version 37, chrome doesn't let you call notification.requestpermission() in the load event handler (see issue 274284).
... n.close(); } });
note: this api shouldn't be used just to have the notification removed from the screen after a fixed delay (on modern browsers) since this method will also remove the notification from any notification tray, preventing users from interacting with it after it was initially shown.
...And 2 more matches
ParentNode.querySelectorAll() - Web APIs
note: this method is implemented as element.queryselectorall(), document.queryselectorall(), and documentfragment.queryselectorall() syntax elementlist = parentnode.queryselectorall(selectors); parameters selectors a domstring containing one or more selectors to match against.
...
note: characters which are not part of standard css syntax must be escaped using a backslash character.
...
note: if the specified selectors include a css pseudo-element, the returned list is always empty.
...And 2 more matches
Selection API - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetselection experimentalchrome full support 1edge full support 12firefox full support 1
notes full support 1
notes
notes the globaleventhandlers.onselectionchange and globaleventhandlers.onselectstart event handlers are supported as of firefox 52.ie full support 9opera full support 9safari full support 1webview...
... android full support 1chrome android full support 18firefox android full support 4
notes full support 4
notes
notes the globaleventhandlers.onselectionchange and globaleventhandlers.onselectstart event handlers are supported as of firefox 52.opera android full support 10.1safari ios full support 1samsung internet android full support 1.0addrange experimentalchrome full support 1edge full support ...
... yessafari ios full support yessamsung internet android full support yescontainsnode experimentalchrome full support yesedge full support 12firefox full support 4
notes full support 4
notes
notes before firefox 35, the method didn't throw if node was null.ie no support noopera full support yessafari full support yeswebview android full support ...
...And 2 more matches
Using readable streams - Web APIs
note: this article assumes that you understand the use cases of readable streams, and are aware of the high-level concepts.
...
note: if you are looking for information on writable streams try using writable streams instead.
... also
note that the previous example can be reduced by one step, as response.body is synchronous and so doesn't need the promise: // fetch the original image fetch('./tortoise.png') // retrieve its body as readablestream .then(response => { const reader = response.body.getreader(); reading the stream now you’ve got your reader attached, you can read data chunks out of the stream using the rea...
...And 2 more matches
URLUtilsReadOnly - Web APIs
me for androidfirefox for androidopera for androidsafari on iossamsung interneturlutilsreadonlychrome no support noedge no support nofirefox full support 57 full support 57 no support 3.5 — 57
notes
notes firefox has a bug whereby single quotes contained in urls are escaped when accessed via url apis (see bug 1386683).ie no support noopera no support nosafari no support nowebview android no support nochrome androi...
...d no support nofirefox android full support 57 full support 57 no support 4 — 57
notes
notes firefox has a bug whereby single quotes contained in urls are escaped when accessed via url apis (see bug 1386683).opera android no support nosafari ios no support nosamsung internet android no support nohash experimentalchrome no support noedge no support nofirefox full support ...
... 38 full support 38 no support 3.5 — 38
notes
notes before firefox 38, firefox returned the hash percent encoded.
...And 2 more matches
Using textures in WebGL - Web APIs
note: it's important to
note that the loading of textures follows cross-domain rules; that is, you can only load textures from sites for which your content has cors approval.
...
note that the texture coordinates range from 0.0 to 1.0; the dimensions of textures are normalized to a range of 0.0 to 1.0 regardless of their actual size, for the purpose of texture mapping.
...
note: cors support for webgl textures and the crossorigin attribute for image elements is implemented in gecko 8.0.
...And 2 more matches
Using DTMF with WebRTC - Web APIs
note, however, that although it's possible to send dtmf using webrtc, there is currently no way to detect or receive incoming dtmf.
... webrtc currently ignores these payloads; this is because webrtc's dtmf support is primarily intended for use with legacy telephone services that rely on dtmf tones to perform tasks such as: teleconferencing systems menu systems voicemail systems entry of credit card or other payment information passcode entry
note: while the dtmf is not sent to the remote peer as audio, browsers may choose to play the corresponding tone to the local user as part of their user experience, since users are typically used to hearing their phone play the tones audibly.
...
note: this example is obviously somewhat contrived, since normally the two rtcpeerconnection objects would exist on different devices, and signaling would be done over the network instead of it all being simply linked up inline as it is here.
...And 2 more matches
Basic concepts behind Web Audio API - Web APIs
note: to get a time in seconds from a frame count, simply divide the number of frames by the sample rate.
... here's a couple of simple examples: var context = new audiocontext(); var buffer = context.createbuffer(2, 22050, 44100);
note: in digital audio, 44,100 hz (alternately represented as 44.1 khz) is a common sampling frequency.
...
note: audio resampling is very similar to image resizing.
...And 2 more matches
Web audio spatialization basics - Web APIs
note: there's also a stereopannernode designed to deal with the common use case of creating simple left and right stereo panning effects.
...
note: the experience is much better if you use headphones, or have some kind of surround sound system to plug your computer into.
... const positionx = posx; const positiony = posy; const positionz = posz; const orientationx = 0.0; const orientationy = 0.0; const orientationz = -1.0;
note the minus value on our z orientation — this sets the boombox to face us.
...And 2 more matches
Understandable - Accessibility
note: to read the w3c definitions for understandable and its guidelines and success criteria, see principle 3: understandable — information and the operation of user interface must be understandable.
... see video and audio content, and pronunciation guide for english dictionary
note: also see the wcag description for guideline 3.1 readable: make text content readable and understandable.
...
note: also see the wcag description for guideline 3.2 predictable: make web pages appear and operate in predictable ways.
...And 2 more matches
:checked - CSS: Cascading Style Sheets
note: because browsers often treat <option>s as replaced elements, the extent to which they can be styled with the :checked pseudo-class varies from browser to browser.
...
note: for an analogous effect, but based on the :hover pseudo-class and without hidden radioboxes, see this demo, taken from the :hover reference page.
... desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internet:checkedchrome full support 1
notes full support 1
notes
notes on macos, styling <option&rt; elements has no effect.edge full support 12
notes full support 12
notes
notes on macos, styling <option&rt; elements has no effect.firefox full support 1
notes ...
...And 2 more matches
:visited - CSS: Cascading Style Sheets
note: for more information on these limitations and the reasons behind them, see privacy and the :visited selector.
... full support 4opera android full support 10.1safari ios full support 1samsung internet android full support 1.0:visited no longer matches <link> elementschrome full support 1
notes full support 1
notes
notes chromium has never matched <link> elements with link pseudo-classes.edge full support 12firefox full support 70ie no support noopera full support ...
...15
notes full support 15
notes
notes chromium has never matched <link> elements with link pseudo-classes.safari full support 12webview android full support 4.4
notes full support 4.4
notes
notes chromium has never matched <link> elements with link pseudo-classes.chrome android full support 18
notes full support 18
notes
notes chromium has never matched <link> elements with link pseudo-classes.firefox android no support noopera android full support ...
...And 2 more matches
@supports - CSS: Cascading Style Sheets
the following examples are both valid: @supports not (not (transform-origin: 2px)) {} @supports (display: grid) and (not (display: inline-grid)) {}
note: there is no need to enclose the not operator between two parentheses at the top level.
...the following are both equivalent: @supports (transform-style: preserve) or (-moz-transform-style: preserve) or (-o-transform-style: preserve) or (-webkit-transform-style: preserve) {} @supports (transform-style: preserve-3d) or ((-moz-transform-style: preserve-3d) or ((-o-transform-style: preserve-3d) or (-webkit-transform-style: preserve-3d))) {}
note: when using both and and or operators, the parentheses must be used to define the order in which they apply.
...to change preferences in firefox, visit about:config.ie no support noopera full support 69safari no support no
notes no support no
notes
notes see bug 199237webview android full support 83chrome android full support 83firefox android full support 64disabled full support 64disabled disable...
...And 2 more matches
Relationship of flexbox to other layout methods - CSS: Cascading Style Sheets
note: css versions 1 and 2 were a single monolithic specification where all of css was defined in one large document.
...there is a
note in the flexbox spec stating that in the future, once it is completed, the definitions in box alignment level 3 will supersede those of flexbox: "
note: while the alignment properties are defined in css box alignment [css-align-3], flexible box layout reproduces the definitions of the relevant ones here so as to not create a normative dependency that may slow down advancement of the spec.
... horizontal-tb vertical-rl vertical-lr sideways-rl sideways-lr
note that sideways-rl and sideways-lr have support only in firefox currently.
...And 2 more matches
WebKit CSS extensions - CSS: Cascading Style Sheets
webkit-only properties
note: avoid using on websites.
... webkit-prefixed properties on the standards track -webkit-appearance -webkit-font-size-delta -webkit-mask-composite -webkit-mask-position-x -webkit-mask-position-y -webkit-mask-repeat-x -webkit-mask-repeat-y formerly proprietary properties that are now standard
note: to maximize the compatibility of your css, you should use the unprefixed standard properties instead of the prefixed ones listed below.
...
note: due to the legacy code in a multitude of web sites that used -webkit- prefixed properties, edge and firefox redirect many -webkit- prefixed properties to -moz-, -ms-, and unprefixed equivalents.
...And 2 more matches
element() - CSS: Cascading Style Sheets
ment() experimentalchrome no support noedge no support nofirefox full support 57prefixed full support 57prefixed prefixed implemented with the vendor prefix: -moz- no support 29 — 57prefixed
notes prefixed implemented with the vendor prefix: -moz-
notes -moz-element() is limited to background-image, background, border-image and border-image-source.
... no support 4 — 29prefixed
notes prefixed implemented with the vendor prefix: -moz-
notes -moz-element() is limited to background-image and background.ie no support noopera no support nosafari no support nowebview android no support nochrome android no support nofirefox android full support 60prefixed full support 60prefixed prefixed implemented with the vendor prefix: -moz- no support 29 — 60prefixed
notes prefixed implemented w...
...ith the vendor prefix: -moz-
notes -moz-element() is limited to background-image, background, border-image and border-image-source.
...And 2 more matches
image-set() - CSS: Cascading Style Sheets
21prefixed full support 21prefixed prefixed implemented with the vendor prefix: -webkit-edge full support 79prefixed full support 79prefixed prefixed implemented with the vendor prefix: -webkit-firefox no support no
notes no support no
notes
notes see bug 1107646.ie no support noopera full support 15prefixed full support 15prefixed prefixed implemented with the vendor prefix: -webkit-safari partial support 6pr...
...efixed
notes partial support 6prefixed
notes prefixed implemented with the vendor prefix: -webkit-
notes support for url images only and x is the only supported resolution unit.
... full support 4.4prefixed prefixed implemented with the vendor prefix: -webkit-chrome android full support 25prefixed full support 25prefixed prefixed implemented with the vendor prefix: -webkit-firefox android no support no
notes no support no
notes
notes see bug 1107646.opera android full support 14prefixed full support 14prefixed prefixed implemented with the vendor prefix: -webkit-safari ios partial support 6prefixed
notes partial support ...
...And 2 more matches
max-height - CSS: Cascading Style Sheets
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetmax-heightchrome full support 18edge full support 12firefox full support 1
notes full support 1
notes
notes css 2.1 leaves the behavior of max-height with table undefined.
... firefox supports applying max-height to table elements.ie full support 7opera full support 7
notes full support 7
notes
notes css 2.1 leaves the behavior of max-height with table undefined.
... 25prefixed prefixed implemented with the vendor prefix: -webkit-edge full support 79 full support 79 full support 79prefixed prefixed implemented with the vendor prefix: -webkit-firefox partial support 3prefixed
notes partial support 3prefixed
notes prefixed implemented with the vendor prefix: -moz-
notes firefox implements the definitions given in css3 basic box.
...And 2 more matches
quotes - CSS: Cascading Style Sheets
18firefox android full support 4opera android full support 14safari ios full support 9samsung internet android full support 1.0auto keywordchrome no support no
notes no support no
notes
notes this value is not supported, but the default browser behavior is to choose appropriate quotes for the user's language settingedge no support no
notes no support no
notes
notes this value is not supported, but the default browser behavior ...
...is to choose appropriate quotes for the user's language settingfirefox full support 70ie no support no
notes no support no
notes
notes this value is not supported, but the default browser behavior is to choose appropriate quotes for the user's language settingopera no support no
notes no support no
notes
notes this value is not supported, but the default browser behavior is to choose appropriate quotes for the user's language settingsafari no support no
notes no support no
notes
notes th...
...is value is not supported, but the default browser behavior is to choose appropriate quotes for the user's language settingwebview android no support no
notes no support no
notes
notes this value is not supported, but the default browser behavior is to choose appropriate quotes for the user's language settingchrome android no support no
notes no support no
notes
notes this value is not supported, but the default browser behavior is to choose appropriate quotes for the user's language settingfirefox android no support noopera android no support ...
...And 2 more matches
Adding captions and subtitles to HTML5 video - Developer guides
note: you can find the source on github, and also view the example live.
...
note: the webvtt api gives us access to all the text tracks that are defined for an html5 video using the <track> element.
...height white-space for example, to change the text colour of the text track cues you can write: ::cue { color:#ccc; } if the webvtt file uses voice spans, which allow cues to be defined as having a particular "voice": 0 00:00:00.000 --> 00:00:12.000 <v test>[test]</v> then this specific 'voice' will be stylable like so: ::cue(v[voice='test']) { color:#fff; background:#0095dd; }
note: some of the styling of cues with ::cue currently works on chrome, opera, and safari, but not yet on firefox.
...And 2 more matches
Constraint validation - Developer guides
note: html5 constraint validation doesn't remove the need for validation on the server side.
...
note that most input types don't have intrinsic constraints, as some are simply barred from constraint validation or have a sanitization algorithm transforming incorrect values to a correct default.
...
note: if the novalidate attribute is set on the <form> element, interactive validation of the constraints doesn't happen.
...And 2 more matches
<input type="password"> - HTML: Hypertext Markup Language
note: any forms involving sensitive information like passwords (e.g.
...
note: the line feed (u+000a) and carriage return (u+000d) characters are not permitted in a password value.
...
note: avoid using the placeholder attribute if you can.
...And 2 more matches
<input type="radio"> - HTML: Hypertext Markup Language
note: checkboxes are similar to radio buttons, but with an important distinction: radio buttons are designed for selecting one value out of a set, whereas checkboxes let you turn individual values on and off.
...
note: if no radio button is selected when the form is submitted, the radio group is not included in the submitted form data at all, since there is no value to report.
...
note: if you put the checked attribute on more than one radio button, later instances will override earlier ones; that is, the last checked radio button will be the one that is selected.
...And 2 more matches
<listing> - HTML: Hypertext Markup Language
note: do not use this element.
... implementation
note: up to gecko 1.9.2 inclusive, firefox implements the htmlspanelement interface for this element.
... desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetlisting deprecatedchrome no support noedge no support nofirefox no support no
notes no support no
notes
notes before firefox 4, this element implemented the htmlspanelement interface instead of the standard htmlelement interface.ie no support noopera no support nosafari no support nowebview android ...
...And 2 more matches
<thead>: The Table Head element - HTML: Hypertext Markup Language
note: do not use this attribute as it is obsolete (not supported) in the latest standard.
... = "#00ff00" gray = "#808080" olive = "#808000" white = "#ffffff" yellow = "#ffff00" maroon = "#800000" navy = "#000080" red = "#ff0000" blue = "#0000ff" purple = "#800080" teal = "#008080" fuchsia = "#ff00ff" aqua = "#00ffff" usage
note: do not use this attribute, as it is non-standard and only implemented in some versions of microsoft internet explorer: the <thead> element should be styled using css.
...
note: do not use this attribute as it is obsolete (and not supported) in the latest standard.
...And 2 more matches
<video>: The Video Embed element - HTML: Hypertext Markup Language
note: sites that automatically play audio (or videos with an audio track) can be an unpleasant experience for users, so should be avoided when possible.
...
note that the absence of this attribute does not imply that the video will always be played in fullscreen.
...
note: the autoplay attribute has precedence over preload.
...And 2 more matches
Using the application cache - HTML: Hypertext Markup Language
note that if you change any cached resources on the server, you must also change the manifest file itself, so that the browser knows it needs to fetch all the resources again.
...
note: on apache servers, the mime type for manifest (.appcache) files can be set by adding addtype text/cache-manifest .appcache to a .htaccess file within either the root directory, or the same directory as the application.
...
note: relative uris are relative to the cache manifest's uri, not to the uri of the document referencing the manifest.
...And 2 more matches
A re-introduction to JavaScript (JS tutorial) - JavaScript
one way of creating arrays is as follows: var a = new array(); a[0] = 'dog'; a[1] = 'cat'; a[2] = 'hen'; a.length; // 3 a more convenient notation is to use an array literal: var a = ['dog', 'cat', 'hen']; a.length; // 3
note that array.length isn't necessarily the number of items in the array.
... it is important to
note that wherever the rest parameter operator is placed in a function declaration it will store all arguments after its declaration, but not before.
...
note that javascript functions are themselves objects — like everything else in javascript — and you can add or change properties on them just like we've seen earlier in the objects section.
...And 2 more matches
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.
...
note: the term instance has a specific technical meaning in class-based languages.
...
note: this may not work as expected if the constructor function is called with arguments which convert to false (like 0 (zero) and empty string ("").
...And 2 more matches
Grammar and types - JavaScript
note: you might also see a third type of comment syntax at the start of some javascript files, which looks something like this: #!/usr/bin/env node.
... parseint('101', 2) // 5 an alternative method of retrieving a number from a string is with the + (unary plus) operator: '1.1' + '1.1' // '1.11.1' (+'1.1') + (+'1.1') // 2.2 //
note: the parentheses are added for clarity, not required.
... the following example creates the coffees array with three elements and a length of three: let coffees = ['french roast', 'colombian', 'kona'];
note : an array literal is a type of object initializer.
...And 2 more matches
Working with objects - JavaScript
ed by commas var myobj = new object(), str = 'mystring', rand = math.random(), obj = new object(); myobj.type = 'dot syntax'; myobj['date created'] = 'string with space'; myobj[str] = 'string value'; myobj[rand] = 'random number'; myobj[obj] = 'object'; myobj[''] = 'even an empty string'; console.log(myobj); please
note that all keys in the square bracket notation are converted to string unless they're symbols, since javascript object property names (keys) can only be strings or symbols (at some point, private names will also be added as the class fields proposal progresses, but you won't use them with [] form).
...(
note that you may need to wrap the object literal in parentheses if the object appears where a statement is expected, so as not to have the literal be confused with a block statement.) object initializers are expressions, and each object initializer results in a new object being created whenever the statement in which it appears is executed.
...
note that the engine property is also an object with its own properties.
...And 2 more matches
Functions - JavaScript
the function constructor
note: using the function constructor to create functions is not recommended since it needs the function body as a string which may prevent some js engine optimizations and can also cause other problems.
... the generatorfunction constructor
note: generatorfunction is not a global object, but could be obtained from generator function instance (see generatorfunction for more detail).
...
note: using the generatorfunction constructor to create functions is not recommended since it needs the function body as a string which may prevent some js engine optimizations and can also cause other problems.
...And 2 more matches
Date - JavaScript
note: it's important to keep in mind that while the time value at the heart of a date object is utc, the basic methods to fetch the date and time or its components all work in the local (i.e.
... it should be
noted that the maximum date is not of the same value as the maximum safe integer (number.max_safe_integer is 9,007,199,254,740,991).
...
note: parsing of strings with date.parse is strongly discouraged due to browser differences and inconsistencies.
...And 2 more matches
Object.create() - JavaScript
in obj){ console.log(prop + ": " + obj[prop] + "\n" ); } } not such simple results: (especially if silent error-trapping had hidden the error messages) ob={}; ob.po=oco; ob.pn=ocn; // create a compound object using the test objects from above as property values > showproperties( ob ) // display top-level properties - po: [object object] - error: cannot convert object to primitive value
note that only first property gets shown.
... (but if the same object is created simply in a different order -- at least in some implementations...) ob={}; ob.pn=ocn; ob.po=oco; // create same compound object again, but create same properties in different order > showproperties( ob ) // display top-level properties - error: cannot convert object to primitive value
note that neither property gets shown.
...
note that such a different order may arise statically via disparate fixed codings such as here, but also dynamically via whatever the order any such property-adding code-branches actually get executed at runtime as depends on inputs and/or random-variables.
...And 2 more matches
WebAssembly.instantiate() - JavaScript
examples
note: you'll probably want to use webassembly.instantiatestreaming() in most cases, as it is more efficient than instantiate().
... var importobject = { imports: { imported_func: function(arg) { console.log(arg); } } }; fetch('simple.wasm').then(response => response.arraybuffer() ).then(bytes => webassembly.instantiate(bytes, importobject) ).then(result => result.instance.exports.exported_func() );
note: you can also find this example at index.html on github (view it live also).
... desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jsinstantiatechrome full support 57edge full support 16firefox full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).ie no support noopera full support 44safari full support 11webview android full support ...
...And 2 more matches
Spread syntax (...) - JavaScript
copy an array const arr = [1, 2, 3]; const arr2 = [...arr]; // like arr.slice() arr2.push(4); // arr2 becomes [1, 2, 3, 4] // arr remains unaffected
note: spread syntax effectively goes one level deep while copying an array.
...without spread syntax, this is done as: const arr1 = [0, 1, 2]; const arr2 = [3, 4, 5]; // append all items from arr2 onto arr1 arr1 = arr1.concat(arr2); with spread syntax this becomes: let arr1 = [0, 1, 2]; let arr2 = [3, 4, 5]; arr1 = [...arr1, ...arr2]; // arr1 is now [0, 1, 2, 3, 4, 5] //
note: not to use const otherwise, it will give typeerror (invalid assignment) array.prototype.unshift() is often used to insert an array of values at the start of an existing array.
... without spread syntax, this is done as: const arr1 = [0, 1, 2]; const arr2 = [3, 4, 5]; // prepend all items from arr2 onto arr1 array.prototype.unshift.apply(arr1, arr2) // arr1 is now [3, 4, 5, 0, 1, 2] with spread syntax, this becomes: let arr1 = [0, 1, 2]; let arr2 = [3, 4, 5]; arr1 = [...arr2, ...arr1]; // arr1 is now [3, 4, 5, 0, 1, 2]
note: unlike unshift(), this creates a new arr1, and does not modify the original arr1 array in-place.
...And 2 more matches
alignment-baseline - SVG: Scalable Vector Graphics
note: as a presentation attribute alignment-baseline can be used as a css property.
... as a presentation attribute, it can be applied to any element but it has effect only on the following four elements: <tspan>, <tref>, <altglyph>, and <textpath> usage
notes value auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical | top | center | bottom default value auto animatable yes auto the value is the dominant-baseline of the script to which the character belongs - i.e., use the dominant-baseline of the parent.
...
note: this keyword may be mapped to text-top.
...And 2 more matches
height - SVG: Scalable Vector Graphics
value auto | <length> | <percentage> default value auto (treated as 0) animatable yes
note: starting with svg2, height is a geometry property meaning this attribute can also be used as a css property for <foreignobject>.
... value auto | <length> | <percentage> default value auto (treated as the intrinsic height of the image) animatable yes
note: starting with svg2, height is a geometry property meaning this attribute can also be used as a css property for images.
... value auto | <length> | <percentage> default value auto (treated as 0) animatable yes
note: starting with svg2, height is a geometry property meaning this attribute can also be used as a css property for rectangles.
...And 2 more matches
width - SVG: Scalable Vector Graphics
value auto | <length> | <percentage> default value auto (treated as 0) animatable yes
note: starting with svg2, width is a geometry property meaning this attribute can also be used as a css property for <foreignobject>.
... value auto | <length> | <percentage> default value auto (treated as the intrinsic width of the image) animatable yes
note: starting with svg2, width is a geometry property meaning this attribute can also be used as a css property for images.
... value auto | <length> | <percentage> default value auto (treated as 0) animatable yes
note: starting with svg2, width is a geometry property meaning this attribute can also be used as a css property for rectangles.
...And 2 more matches
x - SVG: Scalable Vector Graphics
value <length> | <percentage> default value 0 animatable yes
note: starting with svg2, x is a geometry property meaning this attribute can also be used as a css property for <foreignobject>.
... value <length> | <percentage> default value 0 animatable yes
note: starting with svg2, x is a geometry property meaning this attribute can also be used as a css property for images.
... value <length> | <percentage> default value 0 animatable yes
note: starting with svg2, x is a geometry property meaning this attribute can also be used as a css property for rectangles.
...And 2 more matches
y - SVG: Scalable Vector Graphics
value <length> | <percentage> default value 0 animatable yes
note: starting with svg2, y is a geometry property meaning this attribute can also be used as a css property for <foreignobject>.
... value <length> | <percentage> default value 0 animatable yes
note: starting with svg2, y is a geometry property meaning this attribute can also be used as a css property for images.
... value <length> | <percentage> default value 0 animatable yes
note: starting with svg2, y is a geometry property meaning this attribute can also be used as a css property for rectangles.
...And 2 more matches
Classes and Inheritance - Archive of obsolete content
the resulting constructor looks as follows: function circle(x, y, radius) { if (!this) return new circle(x, y, radius); shape.call(this, x, y); this.radius = radius; }
note that the constructor for shape is called as an ordinary function, and reuses the object created for the constructor call to circle.
...
note that the constructors created with class automatically check whether they are called as constructors, so an explicit check is no longer necessary.
...
note that this is always safe, even if there is no initialize method defined on the base class: in that case the call is forwarded to a stub implementation defined on class itself.
...
note that only properties defined on the object itself are copied: properties defined on one of its prototypes are not.
/loader - Archive of obsolete content
it can be loaded as a regular script tag in documents that have system principals (
note: this does not appear to work as of 02.2016 due to "use strict" being added to the file): <script type='application/javascript' src='resource://gre/modules/commonjs/toolkit/loader.js'></script> this will expose a single loader object containing all of the api functions described in this document.
...unless you have specific needs it's best to stick to an sdk-compatible configuration, like this: let { loader } = require('toolkit/loader'); let loader = loader({ // please
note: illustrated `paths` is expected to be a default base, // but depending on your use case you may have more mappings.
... 'toolkit/': 'resource://gre/modules/commonjs/toolkit/' }, // please
note: both `globals` and `modules` are just for illustration // purposes we don't suggest populating them with these values.
... let module = module('foo/bar', 'resource:///modules/foo/bar.js');
note that this won't actually load any module code, it just creates a placeholder for it.
jpm - Archive of obsolete content
note that unlike cfx, jpm is available in every command prompt you start, as long as you installed it with the --global flag.
...make
note of the hyphen after "test" in the filename.
...you can supply a path to a specific binary: jpm run -b /path/to/firefox/nightly as a shorthand for this, you can pass "nightly", "firefoxdeveloperedition", "aurora", "beta", or "firefox" and jpm will look in the default location for these firefox versions [
note: as of firefox 48, the shorthands "firefox" and "beta" will resolve to versions of firefox which will not run your add-on.
...for example: jpm watchpost --post-url http://localhost:8888/
note that the logging level defined for the console is different when you use this method, compared to the logging level used when an add-on is run using jpm run.
Bootstrapped extensions - Archive of obsolete content
notes on modifying the application user interface chrome.manifest in bootstrapped add-ons you can use a chrome.manifest file in bootstrapped add-ons to: make your add-on's content available via a chrome:// url (using the content, locale, and skin instructions in the manifest).
...
note: if you open the add-on manager and then click "remove" on an add-on, it will not call uninstall function right away.
...
note: the uninstall function fires on downgrade and upgrade as well so you should make sure it is an uninstall by doing this: function uninstall(adata, areason) { if (areason == addon_uninstall) { console.log('really uninstalling'); } else { console.log('not a permanent uninstall, likely an upgrade or downgrade'); } } void uninstall( data, reason ); parameters data a bootstrap data structure.
...
note: an add-on may be upgraded/downgraded at application startup, in this case the startup method reason is app_startup, and the oldversion property is not set.
JavaScript Daemons Management - Archive of obsolete content
note: a minimalistic version of it (minidaemon) is published here.
...
note: the daemon.safe constructor is not part of the base system.
...
note: the daemon.safe constructor is not part of the base system.
...
note: the stop() method is not part of the base system.
Creating custom Firefox extensions with the Mozilla build system - Archive of obsolete content
note: with the modern jit javascript engine in gecko and js-ctypes more extension code can be written only in javascript than ever before.
... one final
note: i've only tried these techniques inside firefox, but they'll probably work more or less unchanged on other gecko-based platforms like thunderbird or seamonkey.
...
note that before actually building anything, the mozilla build system invokes a configuration process that generates the actual makefiles used for the build from makefile templates called makefile.in.
...
note that the chrome directory contains a jar (i.e.
Migrating from Internal Linkage to Frozen Linkage - Archive of obsolete content
note that you don't need to promise a flat string if you already have an ns(c)(auto)string type, since they are already flat.
...
note that you must pass the radix (normally 10).
...
note: #include nsisupportsarray.h before nsmsgutils.h convenience methods that work using either api.
...
note that the external api provides lowercaseequalsliteral for nsastring, but not nsacstring.
Appendix E: DOM Building and Insertion (HTML & XUL) - Archive of obsolete content
999/xhtml", xul: "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" }; jsontodom.defaultnamespace = jsontodom.namespaces.html; function jsontodom(jsontemplate, doc, nodes) { function namespace(name) { var reelemnameparts = /^(?:(.*):)?(.*)$/.exec(name); return { namespace: jsontodom.namespaces[reelemnameparts[1]], shortname: reelemnameparts[2] }; } //
note that 'elemnameorarray' is: either the full element name (eg.
... = elem; continue; } var attrns = namespace(key); if (typeof val == "function") { // special case for function attributes; don't just add them as 'on...' attributes, but as events, using addeventlistener elem.addeventlistener(key.replace(/^on/, ""), val, false); } else { //
note that the default namespace for xml attributes is, and should be, blank (ie.
... function escapehtml(str) { return str.replace(/[&"'<>]/g, (m) => ({ "&": "&", '"': """, "'": "'", "<": "<", ">": ">" })[m]); } or slightly more verbose, but slightly more efficient: function escapehtml(str) { return str.replace(/[&"'<>]/g, (m) => escapehtml.replacements[m]); } escapehtml.replacements = { "&": "&", '"': """, "'": "'", "<": "<", ">": ">" };
note that quotation marks must be escaped in order to prevent fragments escaping attribute values.
...
note that this will not work for * xml fragments.
Handling Preferences - Archive of obsolete content
to open the preferences window in firefox, select the following from the main menu: on windows, tools > options on mac, firefox > preferences on linux, edit > preferences
note: keep in mind the usage of the terms "preferences" and "options" in different platforms.
...
note: we recommend that you include all of your extension preferences in the js defaults file.
...
note: the purpose of the defaults directory is to hold non-code files your extension needs.
...
note: always begin your preference names with "extensions", followed by some namespacing and finally the actual name of the preference.
Signing an XPI - Archive of obsolete content
note: these instructions are outdated.
...
note: these instructions are for how to test with a self-signed certificate.
...use this command to create it (
note the trailing dot is required).
... alternatives to nss/signtool there are several alternatives to using signtool that might suit your needs better, however please
note that these alternatives are unofficial third party products.
Tabbed browser - Archive of obsolete content
note that the code above does not work inside of the electrolysis (e10s) enabled tabs.
... //
note that this includes frames/iframes within the document gbrowser.addeventlistener("load", examplepageload, true); }, false); ...
...ener("tabopen", exampletabadded, false); container.addeventlistener("tabmove", exampletabmoved, false); container.addeventlistener("tabclose", exampletabremoved, false); // when no longer needed container.removeeventlistener("tabopen", exampletabadded, false); container.removeeventlistener("tabmove", exampletabmoved, false); container.removeeventlistener("tabclose", exampletabremoved, false);
note: starting in gecko 1.9.1, there's an easy way to listen on progress events on all tabs.
...
note that some http requests aren't associated with a tab; for example, rss feed updates, extension manager requests, xhr requests from xpcom components, etc.
Using Dependent Libraries In Extension Components - Archive of obsolete content
note that the "real" component is no longer in the components/ directory, it is in the libraries/ directory.
...005 benjamin smedberg <benjamin@smedbergs.us> #include "nscore.h" #include "nsmodule.h" #include "prlink.h" #include "nsilocalfile.h" #include "nsstringapi.h" #include "nscomptr.h" static char const *const kdependentlibraries[] = { // dependent1.dll on windows, libdependent1.so on linux moz_dll_prefix "dependent1" moz_dll_suffix, moz_dll_prefix "dependent2" moz_dll_suffix, nsnull //
note: if the dependent libs themselves depend on other libs, the subdependencies // should be listed first.
...#include <mach-o/loader.h> #include <mach-o/dyld.h> static char const *const kdependentlibraries[] = { // dependent1.dll on windows, libdependent1.so on linux, libdependent1.dylib on mac moz_dll_prefix "dependent1" moz_dll_suffix, moz_dll_prefix "dependent2" moz_dll_suffix, nsnull //
note: if the dependent libs themselves depend on other libs, the subdependencies // should be listed first.
...static void* lookupsymbol(const mach_header* alib, const char* asymbolname) { nssymbol sym = nsnull; if (alib) { sym = nslookupsymbolinimage(alib, asymbolname, nslookupsymbolinimage_option_bind | nslookupsymbolinimage_option_return_on_error); } if (!sym) return nsnull; return nsaddressofsymbol(sym); }
notes code samples are licensed under the mit license.
Index of archived content - Archive of obsolete content
ton/action ui/button/toggle ui/frame ui/id ui/sidebar ui/toolbar util/array util/collection util/deprecate util/list util/match-pattern util/object util/uuid window/utils release
notes tools cfx cfx to jpm console jpm jpm-mobile jpmignore package.json tutorials add a context menu item add a menu item to firefox adding a button to the ...
...ds mozilla application framework mozilla application framework in detail mozilla crypto faq mozprocess mozprofile mozrunner nsc_setpin nanojit lir new security model for web services new skin
notes overview of how downloads work plug-n-hack plug-n-hack get involved plug-n-hack phase1 plug-n-hack phase2 plug-n-hack tools supported plugin architecture porting nspr to unix platforms priority content prism ...
...cale opening a link in the default browser specifying startup chrome window using crash reporting in a xulrunner application using ldap xpcom with xulrunner using soap in xulrunner 1.9 what xulrunner provides windows and menus in xulrunner xul application packaging xulrunner 1.8.0.1 release
notes xulrunner 1.8.0.4 release
notes xulrunner 1.9 release
notes xulrunner 1.9.1 release
notes xulrunner 1.9.2 release
notes xulrunner 2.0 release
notes xulrunner faq xulrunner hall of fame xulrunner tips xulrunner/old releases toolkit.defaultchromefeatures toolkit.defau...
...web based tone generator defining cross-browser tooltips environment variables affecting crash reporting io guide images, tables, and mysterious gaps installing plugins to gecko embedding browsers on windows mcd, mission control desktop, aka autoconfig monitoring wifi access points no proxy for configuration
notes on html reflow same-origin policy for file: uris source navigator source code directories overview using xml data islands in mozilla using content preferences visualizing an audio spectrum working with bfcache cert_override.txt mozilla release faq newsgroup summaries ...
List of Mozilla-Based Applications - Archive of obsolete content
version 8 will be based on thunderbird evergreen library automation system evolution email client uses nss exe elearning xhtml editor seems to be using xul for some of their webui facebook open platform facebook open platform the fbml parser used in the platform is based on mozilla code fennec browser for mobiles as mark
notes: fennec is not firefox, it’s a completely different application findthatfont!
...unner instantbird im client xulrunner application itsnat java ajax component based web framework java software platform uses mozilla rhino javalikescript javascript extensible tooling framework uses nspr and spidermonkey jaxer ajax server jslibs javascript development runtime environment uses spidermonkey (
note: this is separate from the javascript library jslib) joybidder ebay auction tool standalone version uses xulrunner just (fr) audio a tool for setting temporal tags in audio documents jsdoc toolkit documentation tool uses mozilla rhino k-meleon gecko-based web browser for windows embeds gecko in mfc kairo.at mandelbrot creates...
...dedicated browser for french prefecture and town hall litl internet computer for home uses spidermonkey and gecko lizilayers gis application 3liz also creates some gis firefox add-ons logitech harmony remote software software for remote control device uses gre or xulrunner longman dictionary of contemporary english cd-rom lotus
notes / sametime groupware the latest version of ibm lotus
notes and sametime can embed xul applications lucidor e-book reader lx-office accounting tool looks like it makes at least some use of xul maavis simple ui & communications for accessibility framework designed for elderly people with dementia but other applications mac os x operat...
...yoono firefox add-on zap sip client status update from august 2008 zimbra desktop email and calendar application uses prism zinc video browser according to faq the standalone version is based on firefox zk web application framework makes use of xul zotero reference manager firefox extension and xulrunner application
note: this page was previously hosted on mozpad.org and the history for that page can be found on that site.
No Proxy For configuration - Archive of obsolete content
note for former-ie users: "*" is supported only at the beginning of domain filters (*.mozilla.org).
...
note: when ipv6 support is added, additional addresses will need to be added and tested.
... 127.0.0.1 proxy ports 1 127.0.0.1 proxy no port .mozilla.org www.mozilla.org:80 www.mozilla.org:81 direct direct port number .mozilla.org:80 www.mozilla.org:80 www.mozilla.org direct direct :81 www.mozilla.org:81 proxy developer
notes the no_proxy for logic is written in c++.
...so use this- dogwood.state.mo.us .intra.state.mo.us dor.intranet or dogwood.state.mo.us, .intra.state.mo.us, dor.intranet
note that you don't need to (read shouldn't) put a * for all hosts with that domain ending.
Creating a Microsummary - Archive of obsolete content
note: if you are a web site developer, and you want to create microsummaries for pages on your site, you can write generators to do so, but a simpler and more efficient approach is to create the microsummaries on the server-side using the same tools and languages you already use to generate pages.
... add the xslt transform sheet to the generator by including it within a <template> element: <?xml version="1.0" encoding="utf-8"?> <generator xmlns="http://www.mozilla.org/microsummaries/0.1" name="firefox download count"> <template> <transform xmlns="http://www.w3.org/1999/xsl/transform" version="1.0"> </transform> </template> </generator>
note that while microsummary generators can include arbitrary xslt, including xslt that produces rich text output, firefox currently only displays the text version of the xslt output.
...?> <generator xmlns="http://www.mozilla.org/microsummaries/0.1" name="firefox download count"> <template> <transform xmlns="http://www.w3.org/1999/xsl/transform" version="1.0"> <output method="text"/> <template match="/"> <value-of select="id('download-count')"/> <text> fx downloads</text> </template> </transform> </template> </generator>
note that white space between xslt tags is not included in the xslt output, unlike in html where that white space is collapsed to a single space, so make sure to prepend a space to the phrase in order to separate it from the download count.
...addgenerator(url) { if (typeof window.sidebar == "object" && typeof window.sidebar.addmicrosummarygenerator == "function") window.sidebar.addmicrosummarygenerator(url); else alert(warning); } </script> <button onclick="addgenerator('http://people.mozilla.com/~myk/microsummaries/tutorial/sfx-generator.xml')">install the spread firefox home page microsummary!</button>
note that due to bug 341283, addmicrosummarygenerator() will not accept a relative url.
Running Tamarin acceptance tests - Archive of obsolete content
note: the name of the avmshell executable varies among the build systems; use the name of the avm shell produced from the build process you used, above.
...
notes on using acceptance runtests.py threading in order to speed up the execution time of the acceptance testsuite, the runtests script automatically detects the number of cores on the machine and sets an equivalent number of threads.
...
note that avm needs to point to android_shell.py which is a proxy for running the tests on the phone.
... $ cd tamarin-redux/test/acceptance $ ./runtests.py --androidthreads
note on using an emulator: the emulator does seem to support hardware floating point but gives a buserror when running avmshell -darm_vfp.
The new nsString class implementation (1999) - Archive of obsolete content
in the meantime, try the xpcom string guide—but
note that that article bears a warning of its own!
...also
note that the new nsstring interface mimics fully the interface in the existing nsstring class found in mozilla/base/src/nsstring.h.
...since i have to acknowledge the idiom, i have made nscstring available but
note that it should be used sparingly.
...
note: the com rules imply that everyone needs to use the same allocators, that they acquire via a global com service called cogetmalloc().
Venkman Internals - Archive of obsolete content
notes on venkman source code.
...these
notes are written by such readers: as you learn please correct any errors.
...you can still set breakpoints, but they will be future breakpoints, which will be "real" breakpoints when/if the file is loaded (
note that this may never happen!).
...
note also that this is just my knowledge of venkman, which is quite limited.
Venkman Introduction - Archive of obsolete content
(
note that venkman displays usage data when it starts up: "recorded local startup x, global yyy." this data comes from a counter built in to the application.
... stop button waiting for execution also
note that when you are currently executing javascript and click the stop button, the javascript stops immediately.
... start venkman
note: at one point, the debugger needed to be started before the scripts it was going to debug.
...
note that in mozilla 1.x and netscape 7.x, the debugger contains a window menu like other major components in the application suite.
XML in Mozilla - Archive of obsolete content
other
notes a lot of the document object model (dom, w3c recommendations and drafts) applies to xml.
...the correct xhtml namespace is http://www.w3.org/1999/xhtml please
note that the xhtml entities, like ä, work only in conforming xhtml documents that have a valid xhtml formal public identifier (or in other words, a doctype section with a public identifier).
...mmendation xslt xpath w3c recommendation xslt xmlhttprequest w3c recommendation xml extras request api (no longer supported) mozilla add-on sdk domparser and xmlserializer mozilla xml extras sax sax soap (no longer supported) w3c
note web services xml-rpc (no longer supported) userland software xml-rpc rdf w3c recommendations rdf svg w3c recommendation svg animation (smil) w3c recommendation mathml w3c recommendation mathml p3p (no longer supported) w3c reco...
...mmendation p3p wsdl (no longer supported) w3c
note web services xbl mozilla's xbl reference xul mozilla's xul reference roadmap next big tasks would include support for xpointer xpointer() scheme (bug 32832), xinclude (bug 201754), xml catalogs (bug 98413), xforms (bug 97806; work being done on implementing this as an extension), validating parser (bug 196355) and xml schemas.
Creating XPI Installer Modules - Archive of obsolete content
note that the stylesheet processing instruction at the top of the xul file does not refer to any new skin, but imports communicator.css to make use of that skin's basic widget styles.
... addfile("barley grain", // displayname from contents.rdf "barley.jar", // jar source getfolder("chrome"), // target folder ""); // target subdir // registerchrome(type, location, source) registerchrome(package | delayed_chrome, getfolder("chrome","barley.jar"), "content/"); if (err==success) performinstall(); else cancelinstall(err);
note that there is no version number on barley, and so the name + version parameter has a "v" and then nothing else.
...
note also the use of resource attributes specified in the contents.rdf file in the jar.
...
notes
note: zip there exist a lot of zip archivers/unarchivers.
Index - Archive of obsolete content
3 a xul bestiary add-ons, extensions, needstechnicalreview, xul this xul
note presents some of the key concepts and terms in the xul development environment.
... 530 loaduri xul methods, xul reference
note: this is the xul method on <browser> / <tabbrowser>, not the global function in chrome://browser/content/browser.js.
... 891
notes no summary!
...
note that a scrollbox doesn't cause scrollbars to be displayed.
Extensions - Archive of obsolete content
note that the menu will not appear until it has a <menupopup>.
...for example, to add an item to the end of the tools menu, use the following: <menupopup id="menu_toolspopup"> <menuitem label="thesaurus"/> </menupopup>
note that other extensions may be adding their own items into the same menus.
... <popup id="contentareacontextmenu"> <menuitem id="thumbnail-show" label="view thumbnail" oncommand="thumbnails.view();"/> </popup>
note that the popup element is used rather than the menupopup element as this is the element that firefox uses.
...(
note: was removed from thunderbird 3 - see bug 463003 for a replacement) iscontentselected true if anything, text or otherwise, is selected.
Attribute Substitution - Archive of obsolete content
note that variable names must have a space after them as this is how the end of variable is determined.
...
note that a caret only has a special meaning at the end of a variable, thus two in a row are only needed after a variable.
...for instance, if the template contained: <description><textnode value="?description"/></description> the resulting generated content might be: <description>view from the top of the tower looking east of the doges palace</description>
note that the textnode has been replaced with the substituted value attribute.
...
note that in firefox 2 and earlier, a bug can make this appear to not work at times.
Template Builder Interface - Archive of obsolete content
note that this particular whitespace issue has been fixed in firefox 3 and later.
...
note also that the datasources attribute has been placed on an html element.
...
note that if one of the datasources is already loaded it will not be loaded again.
...one more
note: the datasources attribute may use either absolute or relative urls.
Custom toolbar button - Archive of obsolete content
note that this extension is very simplified.
...
note: there is a similar tutorial for seamonkey 1.x on the page: custom toolbar button:seamonkey earlier versions and other mozilla applications also support extensions, but some parts of this tutorial are not appropriate for them.
...
note: for information about how to find the profile directory, see: profile folder explanation: the profile directory contains information specific to a user, keeping it separate from the application.
...
note: the preference setting javascript.options.strict imposes restrictions that are not appropriate for the simple scripts in this tutorial.
Manifest Files - Archive of obsolete content
note: starting in gecko 2.0, only the file named chrome.manifest is read automatically; if you need to read multiple manifest files, use the manifest command in that file to import additional manifests.
...
note how the second field of the skin and locale lines specifies 'findfile'.
...
note: this older process does also apply to the new seamonkey 1.0 though.
...
note that the reference should always be a directory, not a file.
Skinning XUL Files by Hand - Archive of obsolete content
note that much of the style attributes in these rules have to do with borders, font information, color, margin, native appearance.
...
note that for any one class of element, there may be several pseudo-classes andattribute selector styles defined.
... loading stylesheets in xul for your custom skin, let's assume you want to skin the xul file, xul
note_sample1.xul.
... when you reload the xul file you have been working on, the box element you have used to create the navigation area in the xul file appear as follows: the skinned browser is not much to look at right now -- and you may
note that this basic skin has transgressed upon some of the skinning guidelines because it overrides color information, but you can get a sense of what the possibilities are with the combination of the xul structure and the style rules of css.
Trees and Templates - Archive of obsolete content
if you do use a content builder instead,
note that the content won't generally get built until it is needed.
...
note in the image that additional child elements below the top-level elements have been added automatically.
...sorting columns if you try the previous example, you might
note that the list of files is not sorted.
...the sortdirection attribute (
note the mixed case) is used to set the direction in which the column will be sorted by default.
Using Remote XUL - Archive of obsolete content
introduction
note: support for remote xul has long been a potential security concern; support for it was disabled in gecko 2.0.
...
note: the downside to using xul is that it only works with browsers that understand it.
... <?php header('content-type: application/vnd.mozilla.xul+xml'); ?> <!-- xul markup starts here -->
note that you don't need a web server for this tutorial; you can load the document you create on your computer via a "file" url or the "open file" function of your browser.
... [optionally add something about how flex only applies to one axis]
note that for remote xul documents you can see changes you make to the ui by reloading the document with your browser's "reload" function, just as with a typical html page.
XUL Coding Style Guidelines - Archive of obsolete content
localization
notes localization
notes are the xul writers'
notes to the localizers/translators.
... they are placed above the actual entity string in the format: <!-- localization
note (entity.name): content --> where the <var>entity.name</var> is the entity name (id) for the string (entity value) to be localized, and the content provides helpful hints to the localizers.
... for example: <!-- localization
note homebtn.label : do not translate the entity value "home".
... --> <!-- entity homebtn.label "home" --> properties files are very similar, but use the pound sign instead of <!--<var>xxxxx</var>-->: # localization
note entity name : content we recognize that translation is a subset of localization even though we've consistently referred to our
notes as "localization
note".
prefwindow - Archive of obsolete content
important
note for xulrunner-based applications: the preferences system - part of the toolkit - still relies on two browser.* preferences.
...
note for mac os x: a common way of opening modal windows on mac os x that are not attached as a sheet to the main window is to use nsiwindowwatcher.openwindow() with a null parentwindow.
...
note: if you don't want to display any buttons in the dialog box, set the value of this attribute to "," (a single comma).
...
notes usage patterns opening/initializing a prefwindow
note that you can define an initwithparams() function in your sub window - to handle parameters passed using openwindow() in case the window was already open.
tabbrowser - Archive of obsolete content
note: starting in firefox 3 (xulrunner/gecko 1.9), this is only used in the main firefox window and cannot be used in other xul windows by third-party applications or extensions.
... firefox 3.6
note the second form of this method was added in firefox 3.6; it allows you to specify the parameters by name, in any order.
... firefox 3.6
note the second form of this method was added in firefox 3.6; it adds the relatedtocurrent parameter, and allows the parameters to be specified by name, in any order.
...the properties of params are following: boolean inbackground boolean replace boolean allowthirdpartyfixup tab targettab number newindex object postdatas number usercontextid
note: this is the xul method on <browser> / <tabbrowser>, not the global function in chrome://browser/content/browser.js.
application/http-index-format specification - Archive of obsolete content
syntax every line in the file must conform to the following generic syntax: number: data where number is at least a three digit number (
note that more digits are possible in the future) and data is separated from number by a colon and a space.
...
note that multiple 200 lines override previous 200 lines.
...
note that a 201 line encountered before a 200 line should be ignored.
... valid 200 tokens
note that all tokens are case insensitive.
Why RSS Content Module is Popular - Including HTML Contents - Archive of obsolete content
then the <description> would be: <description>this is <b>bold</b>.</description>
note that the "<" has been turned into "<".
...
note: do not put anything butplain text into the rss <description> element.
...the wording of this
note should be reconsidered.
...
note: strictly speaking, the rss content module and <content:encoded> are not quite being used correctly.
Introduction to SSL - Archive of obsolete content
note: firefox 2 ships with ssl 2.0 support disabled by default, in favor of ssl 3.0.
... exportable cipher suites these cipher suites are not as strong as those listed above, but may be exported to most countries (
note that france permits them for ssl but not for s/mime).
... 1
note that for rc4 and rc2 ciphers, the phrase "40-bit encryption" means the keys are still 128 bits long, but only 40 bits have cryptographic significance.
... it's important to
note that both client and server authentication involve encrypting some piece of data with one key of a public-private key pair and decrypting it with the other key: in the case of server authentication, the client encrypts the premaster secret with the server's public key.
LiveConnect Overview - Archive of obsolete content
note: because java is a strongly typed language and javascript is weakly typed, the javascript runtime engine converts argument values into the appropriate data types for the other language when you use liveconnect.
...
note: because java is a strongly typed language and javascript is weakly typed, the javascript runtime engine converts argument values into the appropriate data types for the other language when you use liveconnect.
...
note: a more realistic example would place the call to getmember inside a try...catch statement to handle errors of type jsexception.
...
note that instances of java.lang.double and java.lang.integer are converted to javascript objects, not to javascript numbers.
Properly Using CSS and JavaScript in XHTML Documents - Archive of obsolete content
} </script>
note that this example is not well formed xhtml since the use of raw < is only allowed as a part of markup in xhtml or xml.
...
note that netscape 7.x, mozilla and opera all agree that css rules contained inline inside of comments are to be ignored.
...
note that netscape 7.x, mozilla and opera all agree that css rules contained inline inside of comments are to be ignored.
... please
note that for pure xhtml documents, you do not need to use the xml-stylesheet processing instruction, but should instead use link to reference external files containing css.
Archive of obsolete content
see the complete index of archived content
note to writers: we need to try to keep the subpages here organized instead of all dumped into one large folder.
... .htaccess ( hypertext access ) file accessing : htaccess files can be opened using any text editor, like windows
notepad, vin, sublime text editor or any other.
... gecko compatibility handbook **
notes ** - the solution quick reference needs more attention.
... using firebug and jquery (screencast)
note: this screencast is originally from: http://ejohn.org/blog/hacking-digg-w...ug-and-jquery/ using io timeout and interrupt on nt this technical memo is a cautionary
note on using netscape portable runtime's (nspr) io timeout and interrupt on windows nt 3.51 and 4.0.
What is accessibility? - Learn web development
note: the world health organization's disability and health fact sheet states that "over a billion people, about 15% of the world's population, have some form of disability", and "between 110 million and 190 million adults have significant difficulties in functioning." people with visual impairments people with visual impairments include people with blindness, low-level vision, and color blindness.
...
notes designing with cognitive accessibility will lead to good design practices.
... you can and should keep a
note of potential problem areas in your content that will need work to make it accessible, make sure it is tested thoroughly, and think about solutions/alternatives.
...
note: our handling common accessibility problems article covers accessibility specifics that should be tested in more detail.
Backgrounds and borders - Learn web development
note: the default background-position value is (0,0).
...
note: background-position is a shorthand for background-position-x and background-position-y, which allow you to set the different axis position values individually.
...
note: gradients can be happily mixed with regular background images.
...ox with border: .box { border: 1px solid black; } or we can target one edge of the box, for example: .box { border-top: 1px solid black; } the individual properties for these shorthands would be: .box { border-width: 1px; border-style: solid; border-color: black; } and for the longhands: .box { border-top-width: 1px; border-top-style: solid; border-top-color: black; }
note: these top, right, bottom, and left border properties also have mapped logical properties that relate to the writing mode of the document (e.g.
Type, class, and ID selectors - Learn web development
in the example below we have a <div> that contains a
note.
... the grey border is applied when the box has a class of
notebox.
...you'll see that the last <div> doesn't get any styling applied, as it only has the danger class; it needs
notebox as well to get anything applied.
...
note: as we learned in the lesson on specificity, an id has high specificity and will overrule most other selectors.
The box model - Learn web development
note: to read more about the values of display, and how boxes work in block and inline layout, take a look at the mdn guide to block and inline layout.
...
note: the margin is not counted towards the actual size of the box — sure, it affects the total space that the box will take up on the page, but only the space outside the box.
... html { box-sizing: border-box; } *, *::before, *::after { box-sizing: inherit; }
note: an interesting bit of history — internet explorer used to default to the alternative box model, with no mechanism available to switch.
...
note: you can find a solution for this task here.
Grids - Learn web development
{ display: grid; grid-template-columns: 2fr 1fr 1fr; } .container > div { border-radius: 5px; padding: 10px; background-color: rgb(207,232,220); border: 2px solid rgb(79,185,227); } <div class="container"> <div>one</div> <div>two</div> <div>three</div> <div>four</div> <div>five</div> <div>six</div> <div>seven</div> </div>
note: the fr unit distributes available space, not all space.
...ainer { display: grid; grid-template-columns: 2fr 1fr 1fr; grid-gap: 20px; } .container > div { border-radius: 5px; padding: 10px; background-color: rgb(207,232,220); border: 2px solid rgb(79,185,227); } <div class="container"> <div>one</div> <div>two</div> <div>three</div> <div>four</div> <div>five</div> <div>six</div> <div>seven</div> </div>
note: the *gap properties used to be prefixed by grid-, but this has been changed in the spec, as the intention is to make them usable in multiple layout methods.
...
note that the expansion happens right along the row.
...phasellus turpis est, posuere sit amet dapibus ut, facilisis sed est.</p> </aside> <footer>contact me@mysite.com</footer> </div>
note: you can also use the value -1 to target the end column or row line, and count inwards from the end using negative values.
How can we design for all types of users? - Learn web development
note: alternatively you can find a number of contrast checkers online, such as webaim's color contrast checker.
...
note: you may notice opera mini does not support font sizing in rem.
...
note: your mileage may vary.
...
note: the use and even the existence of longdesc has been debated for quite some time.
How to structure a web form - Learn web development
legend> <p> <input type="radio" name="size" id="size_1" value="small"> <label for="size_1">small</label> </p> <p> <input type="radio" name="size" id="size_2" value="medium"> <label for="size_2">medium</label> </p> <p> <input type="radio" name="size" id="size_3" value="large"> <label for="size_3">large</label> </p> </fieldset> </form>
note: you can find this example in fieldset-legend.html (see it live also).
... "i like cherry" label text in the example below will toggle the selected state of the taste_cherry checkbox: <form> <p> <input type="checkbox" id="taste_1" name="taste_cherry" value="cherry"> <label for="taste_1">i like cherry</label> </p> <p> <input type="checkbox" id="taste_2" name="taste_banana" value="banana"> <label for="taste_2">i like banana</label> </p> </form>
note: you can find this example in checkbox-label.html (see it live also).
...
note: you might get slightly different results, depending on your screenreader.
...
note: you can find this example on github as required-labels.html (see it live also).
Installing basic software - Learn web development
visual studio code,
notepad++, sublime text, atom, gnu emacs, or vim), or a hybrid editor (e.g.
...by default windows includes
notepad and macos comes with textedit.
... for web development, you can probably do better than
notepad or textedit.
...
note: internet explorer is not compatible with some modern web features and it may not be able to run your project.
Test your skills: Links - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
...
note: the first link in the example has the target="_blank" attribute set on it, so that when you click on it, it opens the page in a new tab.
...
note: the first three links in the example have the target="_blank" attribute set on them, so that when you click on them, they open the linked page in a new tab.
...
note: the first and third links in the example have the target="_blank" attribute set on them, so that when you click on them, they open the linked page in a new tab.
Build your own function - Learn web development
note: this example should work in all modern browsers fine, but the styling might look a bit funny in slightly older browsers.
...
note: for function naming conventions, you should follow the same rules as variable naming conventions.
...
note: the warning and chat icons were originally found on iconfinder.com, and designed by nazarrudin ansyari — thanks!
...
note: if you have trouble getting the example to work, feel free to check your code against the finished version on github (see it running live also), or ask us for help.
Fetching data from the server - Learn web development
note: in the early days, this general technique was known as asynchronous javascript and xml (ajax), because it tended to use xmlhttprequest to request xml data.
...
note: steps 4 - 9 will all be performed within this function.
...
note that you could also choose to store your promise in a variable and chain .then() onto that instead.
...
note: if you have trouble with this, feel free to check your code against the finished version on github (see the source here, and also see it running live).
Handling text — strings in JavaScript - Learn web development
try this: let response = one + 'i am fine — ' + two; response;
note: when you enter an actual string in your code, enclosed in single or double quotes, it is called a string literal.
...
note: try entering the below examples into your browser's javascript console, to see what results you get.
... another point to
note is that if you want to split a traditional string over multiple lines, you need to include a newline character, \n: output = 'i like the song "' + song + '".\ni gave it a score of ' + (score/highestscore * 100) + '%.'; template literals respect the line breaks in the source code, so newline characters are no longer needed.
...
note that this also requires knowledge from the next article, so you might want to read that first.
Working with JSON - Learn web development
note: converting a string to a native object is called deserialization, while converting a native object to a string so it can be transmitted across the network is called serialization.
...
note: we've made the json seen above available inside a variable in our jsontest.html example (see the source code).
... other
notes json is purely a data format — it contains only properties, no methods.
...
note: if you are having trouble getting the example to work, try referring to our heroes-finished.html source code (see it running live also.)
note: if you are having trouble following the dot/bracket notation we are using to access the javascript object, it can help to have the superheroes.json file open in another tab or your text editor, and refer to it as you look at our javascript.
Client-Server Overview - Learn web development
und server: apache x-backend-server: developer3.webapp.scl3.mozilla.com vary: cookie vary: accept-encoding content-type: text/html; charset=utf-8 date: wed, 07 sep 2016 00:38:13 gmt location: https://developer.mozilla.org/profiles/hamishwillee keep-alive: timeout=5, max=1000 connection: keep-alive x-frame-options: deny x-cache-info: not cacheable; request wasn't a get or head content-length: 0
note: the http responses and requests shown in these examples were captured using the fiddler application, but you can get similar information using web sniffers (e.g.
...
note: static sites are excellent when you have a small number of pages and you want to send the same content to every user.
...import views urlpatterns = [ # example: /best/ url(r'^$', views.index), # example: /best/junior/ url(r'^junior/$', views.junior), ]
note: the first parameters in the url() functions may look a bit odd (e.g.
... the example below gets a list of all teams that have the exact (case sensitive) team_type of "junior" —
note the format: field name (team_type) followed by double underscore, and then the type of match to use (in this case exact).
Server-side web frameworks - Learn web development
in this case we specify that we want to filter for all records where the team_level field has exactly the text 'u09' (
note below how this criteria is passed to the filter() function as an argument with field name and match type separated by double underscores: team_level__exact).
...
note: many other templating systems use a similar syntax, e.g.: jinja2 (python), handlebars (javascript), moustache (javascript), etc.
...
note: let's go to the main websites for django (python) and express (node/javascript) and check out their documentation and community.
...
note: descriptions come (partially) from the framework websites!
Ember app structure and componentization - Learn web development
to start with, delete the contents of application.hbs and replace them with the following: <section class="todoapp"> <h1>todos</h1> <input class="new-todo" aria-label="what needs to be done?" placeholder="what needs to be done?" autofocus > </section>
note: aria-label provides a label for assistive technology to make use of — for example, for a screenreader to read out.
... component groupings are as follows: the main input / "new-todo" (red in the image) the containing body of the todo list + the mark-all-complete button (purple in the image) the mark-all-complete button, explicitly highlighted for reasons given below (yellow in the image) each todo is an individual component (green in the image) the footer (blue in the image) something odd to
note is that the mark-all-complete checkbox (marked in yellow), while in the "main" section, is rendered next to the "new-todo" input.
...
note: the header.js file (shown as skipped) is for connection to a backing glimmer component class, which we don't need for now, as they are for adding interactivity and state manipulation.
...-todo" aria-label="what needs to be done?" placeholder="what needs to be done?" autofocus > todo-list.hbs should be updated to contain this chunk of code: <section class="main"> <input id="mark-all-complete" class="toggle-all" type="checkbox"> <label for="mark-all-complete">mark all as complete</label> <ul class="todo-list"> <todo /> <todo /> </ul> </section>
note: the only non-html in this new todo-list.hbs is the <todo /> component invocation.
Introduction to client-side frameworks - Learn web development
note: if you want to find out more details about web tooling concepts, have a read of our client-side tooling overview.
... framework browser support preferred dsl supported dsls angular ie9+ typescript html-based; typescript react modern (ie9+ with polyfills) jsx jsx; typescript vue ie9+ html-based html-based, jsx, pug ember modern (ie9+ in ember version 2.18) handlebars handlebars, typescript
note: dsls we've described as "html-based" do not have official names.
...there may be some bias in this comparison (which they
note), but it's a valuable resource nonetheless.
...
note: some ssr solutions are written and maintained by the community, whereas some are "official" solutions provided by the framework's maintainer.
React interactivity: Events and state - Learn web development
</button>
note: this may seem counter-intuitive regarding best-practice advice that tends to advise against use of inline event handlers on html, but remember that jsx is actually part of your javascript.
...there are a couple of other things to
note: the camel-cased nature of onclick is important — jsx will not recognize onclick (again, it is already used in javascript for a specific purpose, which is related but different — standard onclick handler properties).
...
note: we decided to name our callback prop addtask to make it easy to understand what the prop will do.
... make sure you’re in the root directory of your application and run the following terminal command: npm install nanoid
note: if you're using yarn, you'll need the following instead: yarn add nanoid now we can import nanoid into the top of app.js so we can use it to create unique ids for our new tasks.
Introduction to cross browser testing - Learn web development
note: make the web work for everyone provides more useful perspective on the different browsers people use, their market share, and related cross browser compatibility issues.
...
note: we'll cover defensive coding later in the module too.
... there are many different reasons why cross browser issues occur, and
note that here we are talking about issues where things behave different across different browsers / devices / browsing preferences.
...
note: you can find browser support information for technologies by looking up the different features on mdn — the site you're on!
Git and GitHub - Learn web development
note: git is actually a distributed version control system, meaning that a complete copy of the repository containing the codebase is made on your computer (and everyone else's).
...
note: github is not the only site/toolset you can use with git.
... guides
note that the links below take you to resources on external sites.
...
note: there is a lot more that you can do with git and github, but we feel that the above represents the minimum you need to know to start using git effectively.
Package management basics - Learn web development
note: npm is not the only package manager available.
...
note: if you have trouble with the terminal returning a "command not found" type error, try running the above command with the npx utility, i.e.
...
note: at time of writing, parcel 2 had not been released.
...
note: the npm package manager is not required to install packages from the npm registry, even though they share the same name.
Debugging on Windows
} >debug.evaluatestatement ((nsgenericelement*)0x03f0e710)->list((file*)0x10311dc0, 1) <void> >debug.evaluatestatement {,,msvcr80d}fclose((file*)0x10311dc0) 0x00000000
note that you may not see the debugging output until you flush or close the file handle.
...
note that unlike unix, the default for windows is not warn, it's to pop up a dialog.
... for example, to print curent javascript stack to stdout, evaluate this in quickwatch window: {,,xul}dumpjsstack()
note: visual c++ will show you something in the quick watch window, but not the stack, you have to look in the os console for the output.
... in a command window, run symchk.exe /r c:\windows\syswow64\ /s "srv*<your cache symbols directory>\microsoftpublicsymbols*http://msdl.microsoft.com/download/symbols"
note the "\microsoftpublicsymbols" appended to the cache directory configured in visual studio.
Simple Instantbird build
get the source
note: on windows, you won't be able to build the instantbird source code if it's under a directory with spaces in the path (e.g., don't use "documents and settings").
...
note: parts of the build process also have problems when the source code is in a directory where the path is long (nested many levels deep).
...first, cd into the comm-central subdirectory (created automatically by the previous command): cd comm-central then run: python client.py checkout
note: unless you have a very good network connection, "hg clone" might fail because it gets interrupted.
...
note that if you use an moz_objdir it cannot be a sibling folder to your source directory.
Creating Custom Events That Can Pass Data
note that starting with version 6, firefox supports dom level 3 customevent, which lets you dispatch custom events with arbitrary data from javascript.
...mozilla/content/events/src/nseventdispatcher.cpp
note: in the mozilla 1.8.x branch this code is actually in mozilla/content/events/src/nseventlistenermanager.cpp this is quite an important file since this holds the createevent method which acts as a factory method dom events.
...you will find that there is a bunch of code like: if (aeventtype.lowercaseequalsliteral("{somethingsomething}event")) return ns_{somethingsomething}event(adomevent, aprescontext, nsnull); you can either have a function like this or write the code straight in nseventlistenermanager::createevent() like this: if (aeventtype.lowercaseequalsliteral("nsmyevent")){ //
note: the lowercase is important!
... example tbp
note for extension developers in order for your event to work the way it is described here it must be derived from nsdomevent.
Multiple Firefox profiles
note: the folder containing the files for the profile is not renamed.
...
note: to access other profiles after selecting this option, you must start the profile manager first.
...do
note it's best to follow all steps in the "creating the scripts" section, including the "edit info.plist" step.
...do
note it's best to follow all steps in the "creating the scripts" section, including the "edit info.plist" step.
Limitations of chrome scripts
for each pattern we've
noted: whether a shim exists and what kind of behavior it provides how to update your add-on so you don't need the shim gbrowser.contentwindow, window.content...
...for example: // chrome code gbrowser.contentwindow; // null gbrowser.contentdocument; // null gbrowser.selectedbrowser.contentwindow; // null window.content; // null content; // null as a special
note, docshells live in the content process, so they are also inaccessible: gbrowser.docshell; // null gbrowser.selectedbrowser.docshell; // null with the shim the shim will give you a cpow for the content object in these situations.
...
note that from firefox 47 onwards, unsafe cpow usage is no longer permitted in browser code.
... also
note that unlike other shims, this shim is always active.
Frame script loading and lifetime
the script just writes "foo" to the command line: // chrome script var mm = gbrowser.selectedbrowser.messagemanager; mm.loadframescript('data:,dump("foo\\n")', true); loadframescript() takes two mandatory parameters: a url that points to the frame script you want to load a boolean flag, allowdelayedload
note: if the message manager is a global frame message manager or a window message manager, loadframescript() may load the script multiple times, once in each applicable frame.
...
note that this function will not remove any scripts which have been loaded earlier.
... 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 script is not loaded into any new tabs.
...
note: you might think that there is a race condition here due to the asynchronous nature of the message passing: your add-on is disabled for an upgrade.
Extending a Protocol
note that the file's name and the protocol name must match.
...
note that the child doesn't need to receive any messages.
...#include "mozilla/dom/pechochild.h" namespace mozilla { namespace dom { //
note that echochild extends the protocol implementation.
...
note the recvecho(), we finally get to define where a message is received, yay!: #ifndef mozilla_dom_echoparent_h #define mozilla_dom_echoparent_h #include "mozilla/dom/pechoparent.h" namespace mozilla { namespace dom { class echoparent final : public pechoparent { friend class pechoparent; ns_inline_decl_threadsafe_refcounting(echoparent, final) public: echoparent(); protected: // we...
IPDL Tutorial
note that the parent can send messages to the child, and vice versa, so 'sender' and 'receiver' in the above three cases can be either the parent or the child.
...
note that this is not a preprocessor directive, but a part of the ipdl language.
...
note: __delete__ is a built-in construct, and is the only ipdl message which does not require an overridden implementation (ie.
...
note: the following paragraphs are not yet implemented.
Assert.jsm
method overview undefined ok(value, message); undefined equal(actual, expected, message); undefined
notequal(actual, expected, message); undefined deepequal(actual, expected, message); undefined notdeepequal(actual, expected, message); undefined strictequal(actual, expected, message); undefined notstrictequal(actual, expected, message); undefined throws(block, expected, message); promise rejects(promise, expected, message); undefined gre...
... ok, equal,
notequal, deepequal, notdeepequal, strictequal, notstrictequal, throws, setreporter, report methods ok() pure assertion tests whether a value is truthy, as determined by !!guard.
... undefined equal( actual, expected, message ); parameters actual test subject to be evaluated as equivalent to expected expected test reference to evaluate against actual message short explanation of the expected result
notequal() the non-equality assertion tests for whether two objects are not equal with !=.
... undefined
notequal( actual, expected, message ); parameters actual test subject to be evaluated as not equivalent to expected expected test reference to evaluate against actual message short explanation of the expected result deepequal() the equivalence assertion tests a deep equality relation.
NetUtil.jsm
note: prior to gecko 2, the input source was required to be specified as an nsichannel.
...
note: support for specifying an nsiinputstream as the input source was added in gecko 5.
...}); remarks
note: if you specify an nsichannel as the input source, and its notification callbacks have already been set, callers are responsible for implementing nsibadcertlistener and nsisslerrorlistener.
...
note: starting in gecko 2, this method supports specifying an nsifile as the target of the uri.
Deferred
note: this function is bound to its associated promise when promise.defer() is called, and can be called with any value of this.
...
note: calling this method with a pending promise as the avalue argument, and then calling it again with another value before the promise is resolved or rejected, will have no effect the second time, as the associated promise is already resolved to the pending promise value as its resolution.
...
note: this function is bound to its associated promise when promise.defer() is called, and can be called with any value of this.
...
note: this argument should not be a promise.
Promise
note: you should always handle, forward, or report errors (rejection reasons).
...
note: calling this method with a pending promise as the avalue argument, and then calling it again with another value before the promise is fulfilled or rejected, will have no effect the second time, as the associated promise is already resolved to the pending promise.
...
note: this argument should not be a promise.
...
note: when you call the then method multiple times on the same promise, the registered callbacks are always executed independently.
Deferred
note: this function is exactly same as promise constructor's resolve argument, and can be called with any value of this.
...
note: calling this method with a pending promise as the avalue argument, and then calling it again with another value before the promise is resolved or rejected, will have no effect the second time, as the associated promise is already resolved to the pending promise value as its resolution.
...
note: this function is exactly same as promise constructor's reject argument, and can be called with any value of this.
...
note: this argument should not be a promise.
Using JavaScript code modules
for example: components.utils.import("resource://app/my_module.jsm"); alert(foo()); // displays "foo" alert(bar.size + 3); // displays "6" alert(dummy); // displays "dummy is not defined" because 'dummy' was not exported from the module
note: when you're testing changes to a code module, be sure to change the application's build id (e.g., the version) before your next test run; otherwise, you may find yourself running the previous version of your module's code.
...
note: each scope that imports a module receives a by-value copy of the exported symbols in that module.
...ce(components.interfaces.nsiresprotocolhandler); var aliasfile = components.classes["@mozilla.org/file/local;1"] .createinstance(components.interfaces.nsilocalfile); aliasfile.initwithpath("/some/absolute/path"); var aliasuri = services.io.newfileuri(aliasfile); resprot.setsubstitution("myalias", aliasuri); // assuming the code modules are in the alias folder itself
notes custom modules and xpcom components
note that prior to gecko 2.0 javascript xpcom components are loaded before chrome registration.
... packaging
notes it's important to
note that you should not typically put your javascript code modules in a jar file in your add-on.
source-editor.jsm
note: implementing actual support for debugger features such as breakpoints is up to you.
...
note: this ignores the value you specified for backwards in the original search; it always searches forward.
...
note: this ignores the value you specified for backwards in the original search; it always searches backward.
... remarks it's important to
note that the character at offset aend is not included in the selection.
QA phase
note: remember all of those pre-requisite tools we asked you to install in the initial setup?
...
note: you must have mercurial configured before you begin.
... pushing to your repository there are a couple of things you should take
note of before you push to your repository: make sure that your files have been encoded in unicode without bom (byte order mark).
...for instance, if you have finished translating all the .dtd and .properties files in your x-testing/browser/chrome/browser/ directory, then you should run these commands: $ hg status $ hg commit -m "translated browser/chrome/browser/" $ hg outgoing $ hg push http://hg.mozilla.org/l10n-central/x-testing
note that due to the distributed nature of hg, hg commit saves the changes locally (i.e., in your computer's hg repository).
powermetrics
note: the power profiling overview is worth reading at this point if you haven't already.
... other things to
note.
...run with the --show-all to see all of these at once, but
note that you'll need a very wide window to see all the data.
... also
note that powermetrics -h is a better guide to the the command-line options than man powermetrics.
Firefox Sync
general the always prolific richard newman has written a couple of
notes about bookmark syncing (first, second) and has a blog where he talks about the various challenges syncing this kind of data.
...there are also some
notes in a google document (that we really must move to its own wiki page) there's also information available to help debug and diagnose android sync issues.
... desktop
notes on how to file a good bug for desktop sync.
... there are some
notes on how to run our tps testing infrastructure.
An overview of NSS Internals
(
note that it's important to look at the number 11, as there are other pkcs standards with different numbers that define quite different topics.) a software or hardware module conforming to the pkcs#11 standard implements an interface of c calls, which allow querying the characteristics and offered services of the module.
... it's important to
note that nss requires strict cleanup for all handles returned by nss.
...when creating the network socket for data exchange,
note that you must use the operating system independent apis provided by nspr and nss.
... it should be
noted that the first database format that can be accessed simultaneously by multiple applications is key4.db/cert9.db – database files with lower numbers will most likely experience unrecoverable corruption if you access them with multiple applications at the same time.
JSS
jss source should now be checked out from the github: git clone git@github.com:dogtagpki/jss.git -- or -- git clone https://github.com/dogtagpki/jss.git all future upstream enquiries to jss should now use the pagure issue tracker system: https://pagure.io/jss/issues documentation regarding the jss project should now be viewed at: http://www.dogtagpki.org/wiki/jss
note: as much of the jss documentation is sorely out-of-date, updated information will be a work in progress, and many portions of any legacy documentation will be re-written over the course of time.
... jss offers a jce provider, "mozilla-jss" jca provider
notes.
...
note that java 1.5 claimed no fips compliance, and java 1.6 or higher needs to be used.
... release
notes 4.3.1 release
notes 4.3 release
notes older release
notes build instructions building jss 4.4.x building jss 4.3.x older build instructions download or view source download binaries, source, and javadoc view the source online testing jss tests frequently asked questions jss faq...
PKCS11 Implement
implementing pkcs #11 for nss
note: this document was originally for the netscape security library that came with netscape communicator 4.0.
... this
note will be removed once the document is updated for the current version of nss.
... c_initpin the nss calls c_initpin only in the key generation case, as
noted in this document under c_gettokeninfo, when cfk_login_required = true and cfk_user_pin_initialized = false.
... c_setpin called only in the key generation case, as
noted in this document under c_gettokeninfo, when cfk_login_required = true and cfk_user_pin_initialized = false.
NSS tools : signtool
note that with netscape signing tool version 1.1 and later this option can appear multiple times on one command line, making it possible to specify multiple file types or classes to include.
...
note that versions 1.1 and later of netscape signing tool correctly recognizes the codebase attribute, allows paths to be expressed for the class and src attributes instead of filenames only, processes link tags and parses html correctly, and offers clearer error messages.
...
note that the password entered on the command line is displayed as plain text.
...
note that with netscape signing tool version 1.1 and later this option can appear multiple times on one command line, making it possible to specify several particular directories to exclude.
Rebranding SpiderMonkey (1.8.5)
for example: ../configure --enable-ctypes --with-system-nspr
note: your desired configuration may be different.
...in the unix world we would issue the following command: find ./ -type f -exec sed -i "s/mozjs185/$brand/" {} \; windows users:
notepad++ can be used to perform the recursive find and replace text operation.
... "scroll down" a few lines until you see this line: > $@ && chmod 644 $@ that line should be modified to read back: > $brand.pc && chmod 644 $brand.pc "scroll down" a few lines until you see these lines: install:: $(pkg_config_files) @echo pkg_config_file: $(pkg_config_files) those two lines should be modified to read back: install:: $brand.pc @echo pkg_config_file: $brand.pc
note: while it is possible to automate the manual editing process, this has been discouraged due to the fact that these files are automatically generated and very little constant data can be depended upon.
...you may now perform the build and installation of your custom branded spidermonkey library: make
note: depending on your system you may need administrative rights to perform the installation: make install the following information isn't technically needed for using your library but it will help other applications use your library.
GC Rooting Guide
the main types of gc thing pointer are: js::value jsobject* jsstring* jsscript* jsid
note that js::value and jsid can contain pointers internally even though they are not a normal pointer type, hence their inclusion in this list.
... obj.set(foo()); } (
note that the above should probably check the return value and propagate an error on null), or: jsobject* somefunction(jscontext* cx) { js::rooted<jsobject*> obj(cx, foo()); { // make a scope to force the destructor to run before obj is unwrapped.
...the simplest approach is to use js::persistentrooted (usable on anything with a trace method with the appropriate signature): js::persistentrooted<myowningstruct> immortalstruct; but
note that js::persistentrooted in a struct or class is a rather dangerous thing to use -- it will keep a gc thing alive, and most gc things end up keeping their global alive, so if your class/struct is reachable in any way from that global, then nothing will ever be cleaned up by the gc.
...
note: heap<t> are not "rooted": they must be traced!
Tracing JIT
every timespidermonkey interprets a backward-jump bytecode, the monitor makes
note of the number of times the jump-target program-counter (pc) value has been jumped-to.
... some other terminology may be helpful when reading the code: the term guard de
notes a condition that is checked by an executing trace to confirm that some assumptions made during recording still hold.
... the term bail de
notes "exiting a trace due to to a failed guard".
... the term deep bail de
notes a special case of bailing: when a trace calls a native spidermonkey c function that gets part-way through executing and then forces a trace-exit (possibly due to a nested c function depending on not-yet-flushed state in the trace).
SpiderMonkey 1.8.8
these release
notes are an incomplete draft and were initially seeded from the 1.8.5 release
notes, so lots of the information here isn't actually new to spidermonkey 1.8.8 (nor is it even the case that the version number will be 1.8.8!).
... please
note that spidermonkey reserves the js:: namespace for itself.
... release
notes errata this is a list of changes which need to be made to the release
notes asap.
... don't add anything here -- this is for after the release
notes are completed.
SpiderMonkey 17
these release
notes are an incomplete draft and were initially seeded from the (now-defunct) 1.8.8 release
notes, which were themselves seeded from the 1.8.5 release
notes, so lots of the information here isn't actually new to spidermonkey 17.
... please
note that spidermonkey reserves the js:: namespace for itself.
... release
notes errata this is a list of changes which need to be made to the release
notes asap.
... don't add anything here -- this is for after the release
notes are completed.
SpiderMonkey 45
these release
notes are incomplete.
... if you are compiling with microsoft's visual studio,
note the minimum supported version is msvc 2013.
...please
note that spidermonkey reserves the js:: namespace for itself for public exports and the js:: namespace for internal use.
... release
notes errata feel free to fix any problems you spot, directly in the text above -- this is a wiki!
Animated PNG graphics
note that the second variation of the sample code is applicable.
...
note that for the first frame the two blend modes are functionally equivalent due to the clearing of the output buffer at the beginning of each play.
... as
noted earlier, the output buffer must be completely initialized to fully transparent black at the beginning of each play.
... added
note to clarify that palette animation is not supported.
Gecko object attributes
note some widgets which appear to be checkboxes might in fact be cyclers (see "cycles" below).
... applied to: state_haspopup exposed in aria: aria-haspopup
note: this is only supported on atk/at-spi.
... applied to: role_cell for the <xul:tree/>
note: it's not exposed currently table related attributes layout-guess true when gecko's heuristic determines that it is a table that is probably used for layout, not for table.
... applied to: any object that supports the hypertext interface
note: deprecated, use display attribute instead line-number the current line number of the caret, whether simply because the "browse with caret" option is on, or the caret used for editing text.
Embedded Dialog API
(
note that at time of writing this may not be strictly true; work continues on this topic.) all overrideable dialogs are implemented by gecko as a component.
...and
note that if an application chooses to replace one of gecko's default dialog components, that application must override every dialog in the component.
... however
note that the complete set of all dialogs is implemented in several different components, so an application need not override every single dialog in gecko to override some.
...(
note to self: is there decent documentation on writing factories or components?
Querying Places
24 hours and from mozilla.org var query2 = placesutils.history.getnewquery(); query2.begintimereference = query2.time_relative_now; query2.begintime = -24 * 60 * 60 * 1000000; // 24 hours ago in microseconds query2.endtimereference = query2.time_relative_now; query2.endtime = 0; // now query2.domain = "mozilla.org"; var result = placesutils.history.executequeries([query1, query2], 2, options);
note: keyword searching doesn't work correctly across or queries.
...
note: be careful when accessing nodes and do not keep references to them around.
...
note: currently unimplemented, see bug 320831.
...ainer: var container = node.queryinterface(ci.nsinavhistorycontainerresultnode); dump("remote container " + container.title + " type = " + container.remotecontainertype + "\n"); break; case node.result_type_query: var query = node.queryinterface(ci.nsinavhistoryqueryresultnode); dump("query, place uri = " + query.uri + "\n"); break; case node.result_type_folder: //
note that folder nodes are of type nsinavhistorycontainerresultnode by default, but // can be qi'd to nsinavhistoryqueryresultnode to access the query and options that // created it.
Accessing the Windows Registry Using XPCOM
finally,
note that you should close the key when you are done to avoid wasting system resources.
...
note that it is not an error to call create() on an existing key, and doing so has the same result as calling open().
...as
noted in the example above, you will need to escape backslashes within the string.
...you can use it as shown in the following example: var wss = components.classes["@mozilla.org/browser/shell-service;1"] .getservice(components.interfaces.nsiwindowsshellservice); var id = wss.getregistryentry(wss.hklm, "software\\microsoft\\windows\\currentversion", "productid");
note: there's no way to set a registry value using this interface.
Using XPCOM Components
beyond the methods that are being called on the cookiemanager itself (e.g., cookiemanager.remove, which maps to the remove() function in the nsicookiemanager interface),
note the special xpconnect objects and methods that reflect the xpcom component into javascript.
...
note: cookie-manager-ui
note that the interface is not part of the component itself.
...
note: private-xpcom-interfaces there are exceptions to this.
...
note: cookie-manager-in-tutorial the cookiemanager component is used to persist for the web locking functionality described in this tutorial.
nsIAccessNode
ildnum); obsolete since gecko 2.0 nsidomcssprimitivevalue getcomputedstylecssvalue(in domstring pseudoelt, in domstring propertyname); domstring getcomputedstylevalue(in domstring pseudoelt, in domstring propertyname); void scrollto(in unsigned long ascrolltype); void scrolltopoint(in unsigned long acoordinatetype, in long ax, in long ay); attributes
note: attempting to access the attributes of a node that is unattached from the accessible tree will result in an exception - ns_error_failure.
...
note: renamed from accessibledocument in gecko 2.0 domnode node the dom node this nsiaccessnode is associated with.
...
note: the meanings of width, height and other size measurements depend on the version of css being used.
...
note: the meanings of width, height and other size measurements depend on the version of css being used.
nsIDOMEvent
inherits from: nsisupports last changed in gecko 16.0 (firefox 16.0 / thunderbird 16.0 / seamonkey 2.13)
note: as of gecko 16.0, the nsiprivatedomevent interface was merged into this interface.
... return value getpreventdefault()
note: use the defaultprevented attribute instead.
... return value preventbubble()
note: use stoppropagation() instead.
... preventcapture()
note: use stoppropagation() instead.
nsIFeed
note: this field is rarely implemented.
...
note: this field is rarely implemented.
...
note: this field is almost never used, and is incompatible with many aggregators.
...
note: you should consider this a bit mask of values; at some point, the type may include more than one of these values ored together.
nsIHttpServer
upon which listening should happen, or -1 if no specific port is * desired * @throws ns_error_already_initialized * if this server is already started * @throws ns_error_not_available * if the server is not started and cannot be started on the desired port * (perhaps because the port is already in use or because the process does * not have privileges to do so) * @
note * behavior is undefined if this method is called after stop() has been * called on this but before the provided callback function has been * called.
... * @
note * if the error handler handles http 500 and throws, behavior is undefined.
...if it doesn't * match the field-value production in rfc 2616 * @
note * no syntax checking is done of the given type, beyond ensuring that it is * a valid header field value.
... * @
note * implementations may treat type as a trusted argument; users who fail to * generate this string from trusted data risk security vulnerabilities.
nsIInstallLocation
1.0 66 introduced gecko 1.8 obsolete gecko 2.0 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1)
note: while this api still works, firefox 4 no longer extracts xpis by default, so this will now point to the xpi file instead of to the directory.
... itemlocations nsidirectoryenumerator an enumeration of nsifiles for: locations that contain items potential dropped-in xpis
note: this enumeration resolves text links to the directories they refer to.
...
note: this is a clone of the actual location which the caller can modify freely.
...
note: this function makes no promises about whether or not this path is actually maintained by this install location.
nsILoginManager
note: default values for the nsiloginmetainfo properties are created if the specified login doesn't explicitly specify them.
...
note: this method is provided for use only by the formfillcontroller, which calls it directly.
...
note: this method will attempt to fill out the form regardless of the setting of the signon.autofillforms preference.
...
note: the specified login must exactly match a stored login.
nsIMsgMessageService
this is an async operation of course.
note: you must pass in a url listener in order to figure out when the operation is done.
...
note: this operation may be obsolete.
...
note: the uri must refer to a message and not a folder!
...
note if we're offline, then even if alocalonly is false, we won't stream over the network return the url that gets run, if any ismsginmemcache() determines whether a message is in the memory cache.
nsIScriptError
to create an instance, use: var scripterror = components.classes["@mozilla.org/scripterror;1"] .createinstance(components.interfaces.nsiscripterror);
note: the nsiscripterror2 interface was merged into this interface in gecko 12.0.
...
note: nsiconsolemessage.message will return the error formatted with file/line information.
...
note: prior to gecko 12.0, this method was provided by the nsiscripterror2 interface, which has now been merged into this one.
...
note that these are strings.
nsITaskbarPreviewController
note: although these attributes are read only, that indicates that the previews controlled by an nsitaskbarpreviewcontroller cannot alter these values.
...
note that this context is not actually attached to a canvas element.
...
note that this context is not actually attached to a canvas element.
...
note: it's guaranteed that width ÷ height will equal the thumbnailaspectratio, within the margin of rounding errors.
nsIURL
if the url de
notes a path to a directory and not a file, for example http://host/foo/bar/, then the directory attribute accesses the complete /foo/bar/ portion, and the filename is the empty string.
...if the url de
notes a path to a directory and not a file, for example http://host/foo/bar/, then the directory attribute accesses the complete /foo/bar/ portion, and the filename is the empty string.
...
note that this is purely based on searching for the last trailing slash.
...obsolete since gecko 9.0
note: this was removed in gecko 9.0 (firefox 9.0 / thunderbird 9.0 / seamonkey 2.6) because the semicolon is not actually valid for this purpose and should not have been specially handled.
nsIWindowsRegKey
note: on 32-bit windows, it is valid to pass any hkey as the rootkey parameter of this function.
...
note: on 32-bit windows, it is valid to pass any hkey as the rootkey parameter of this function.
...
note: unlike writestringvalue(), readstringvalue() will work with reg_multi_sz and reg_expand_sz types.
...
note: in gecko 2.0, readstringvalue() calls expandenvironmentstrings() on a reg_expand_sz type.
nsIXULWindow
note: that this is a docshell tree item and therefore can not be assured of what object it is.
... highestz 9 methods addchildwindow() tell this window that it has picked up a child xul window.
note that xul windows do not currently track child xul windows.
...
note: that this is a docshell tree item and therefore can not be assured of what object it is.
...
note that xul windows do not currently track child xul windows.
Reference Manual
null-dereference safeguards an nscomptr will also assert at runtime if you try to dereference it when it is void, e.g., nscomptr<nsifoo> foo; //
note: default initialized to |0| foo->dosomething(); // ns_precondition: "you can't dereference a null nscomptr with operator->()" a similar precondition intervenes on behalf of operator*.
...nscomptr<nsifoo> foo1( dont_addref(rawfoo1ptr) ); nscomptr<nsifoo> foo2 = dont_addref(rawfoo2ptr); //
note that the function form (called `direct initialization') and the // assignment form (called `copy initialization') of a constructor have // subtly different meanings; prefer direct initialization.
... nsresult getfoo( nsifoo** ); // a standard getter nsresult getfoo2( nsifoo*& ); // a non-standard getter nsresult getsomething( void** ); // an "un-typed" getter //
note: |queryinterface| is an example of a "un-typed" getter we must be able to pass nscomptrs by pointer or reference, into routines for use as "out" parameters.
... nsifoo* temp; nsresult rv = getfoo_withoutaddref(&temp); //
note to self: must report |getfoo_withoutaddref| as a bug, all getters // must |addref| nscomptr<nsifoo> foo = temp; "in/out" parameters what about "in/out" parameters?
Thunderbird Binaries
note: while beta builds have had some testing, they should be considered preview only and should not be used in a production environment.
... please read the release
notes before downloading.
... latest english trunk builds are available at: https://archive.mozilla.org/pub/thunderbird/nightly/latest-comm-central/ latest localized trunk builds are available at: https://archive.mozilla.org/pub/thunderbird/nightly/latest-comm-central-l10n/
note: please use http://ftp.stage.mozaws.net/pub/thunderbird/nightly/latest-comm-central/ because the above two links currently do not work.
...you should see a string that looks something like this: comm-central-1.9.2 branch: mozilla/5.0 (windows; u; windows nt 5.1; en-us; rv:1.9.2.2pre) gecko/20100308 lanikai/3.1b1pre comm-central-trunk: mozilla/5.0 (windows; u; windows nt 5.1; en-us; rv:1.9.3a1pre) gecko/20090826 shredder/3.1a1pre the part that you want to
note is the gecko revision number (rv) and the thunderbird version string.
Working with windows in chrome code
var ww = components.classes["@mozilla.org/embedcomp/window-watcher;1"] .getservice(components.interfaces.nsiwindowwatcher); var win = ww.openwindow(null, "chrome://myextension/content/about.xul", "aboutmyextension", "chrome,centerscreen", null); window object
note the win variable in the above section, which is assigned the return value of window.open.
...
note however, that the open() call returns before the window is fully loaded, so some calls, like win.document.getelementbyid() will fail.
...
note: if you want to pass data between privileged (chrome) and non-privileged (web page) windows, or vice-versa, read this instead.
...
note that using nsiwindowwatcher.openwindow is a bit less trivial .
Working with data
note: if type.size is undefined, creating a new object this way will throw a typeerror exception.
...
note: the source c string is assumed to be utf-8, and is assumed to be null terminated.
... if you need a utf-16 string, you can do this: var myutf16string = ctypes.jschar.array()("original string.");
note: at this time, there's no way to specify a particular encoding; you may only retrieve the string in utf-8 or utf-16 as shown above.
...
note: these 64-bit integer types are intentionally low on features, so that when javascript adds a "big number" type, we can easily upgrade to support that properly.
ctypes
note: some 64-bit values are outside the range of numeric values supported by javascript.
...
note this automatically converts to an int64 javascript object on all platforms, since it's unknown whether this is a 32-bit or 64-bit value.
...
note this automatically converts to a uint64 javascript object on all platforms, since it's unknown whether this is a 32-bit or 64-bit value.
...
note: you must use void_t, not void, since void is a keyword in javascript.
Mozilla
ges to a document originate in the content tree (from dom modification by scripting, insertion of elements from the parser, etc.) and are propogated to the layout tree through magic that primarily resides in //github.com/realityripple/uxp/blob/master/layout/base/nscssframeconstructor.cpp getting started with chat
note that on 2nd march 2020, mozilla moved away from irc to matrix for its public channels, the irc server was shut down.
... mozilla port blocking on 08/15/2001, cert issued a vulnerability
note vu#476267 for a "cross-protocol" scripting attack, known as the html form protocol attack which allowed sending arbitrary data to most tcp ports.
... using tab-modal prompts
note: this part of the documentation is outdated.
...this includes
notes about any firefox-only features, or about any experiments or other deviations from the specification that may exist in mozilla code.
Drawing and Event Handling - Plugins
note: windowless plug-ins were not supported on the x window system platform prior to gecko 1.9 alpha 7 (bug 137189).
...
note: when a plug-in is drawn to a window, the plug-in is responsible for preserving state information and ensuring that the original state is restored.
... on ms windows,
note that the coordinates for the window rectangle are in twips format.
...
note: some browsers, including firefox 4, may ignore calls to npn_forceredraw().
Accessibility Inspector - Firefox Developer Tools
note that this works correctly as of firefox 62 (bug 1467381).
...
note: the exposed information is the same across all platforms — the inspector exposes gecko's accessibility tree, rather than information from the platform accessibility layer.
...
note: some dom elements do not have accessibility properties — in that case, the inspect accessibility properties/show accessibility properties context menu item is grayed out.
...
note, however, that if you hold the shift key down when "performing a pick", you can "preview" the accessibility object in the tree (and its properties in the right-hand pane), but then continue picking as many times as you like (the picker does not get cancelled) until you release the shift key.
Debugger.Script - Firefox Developer Tools
note that spidermonkey may use the same debugger.script instances for equivalent functions or evaluated code—that is, scripts representing the same source code, at the same position in the same source file, evaluated in the same lexical environment.
... please
note at the time of this writing, support for webassembly is very preliminary.
...for example: function f() {} // display name: f (the given name) var g = function () {}; // display name: g o.p = function () {}; // display name: o.p var q = { r: function () {} // display name: q.r };
note that the display name may not be a proper javascript identifier, or even a proper expression: we attempt to find helpful names even when the function is not immediately assigned as the value of some variable or property.
...
note that, if breakpoints using other handler objects are set at the same location(s) ashandler, they remain in place.
Debugger.Object - Firefox Developer Tools
for example: function f() {} // display name: f (the given name) var g = function () {}; // display name: g o.p = function () {}; // display name: o.p var q = { r: function () {} // display name: q.r };
note that the display name may not be a proper javascript identifier, or even a proper expression: we attempt to find helpful names even when the function is not immediately assigned as the value of some variable or property.
...
note that this returns primitive values unchanged.
...
note that, ifvalue is an object, it need not be one allocated in a debuggee global, nor even a debuggee compartment; it can be any object the debugger wishes to use as a debuggee value.
...
note that, like evalinglobal, if the code passed to evalinglobalwithbindings is not strict mode code, then any declarations it contains affect the referent global object, even ascode is evaluated in an environment extended according tobindings.
Examine and edit CSS - Firefox Developer Tools
(
note that this setting is independent of the "browser styles" checkbox in the computed view.) user-agent styles are displayed against a different background, and the link to the filename and line number contains the prefix (user agent): element {} rule the element {} rule at the top of the rules list isn't actually a css rule.
...
note that the first three states of the button may be difficult to distinguish visually.
...
note: you can view changes made to the rules view only.
... also remember, as
noted above, that changes you make to the css rules are temporary and will be reset if you reload the page.
AudioBuffer() - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetaudiobuffer() constructorchrome full support 55
notes full support 55
notes
notes the context parameter was supported up until version 57, but has now been removed.edge full support ≤79firefox full support 53ie no support noopera full support ...
... 42
notes full support 42
notes
notes the context parameter was supported up until version 44, but has now been removed.safari ?
... webview android full support 55
notes full support 55
notes
notes the context parameter was supported up until version 57, but has now been removed.chrome android full support 55
notes full support 55
notes
notes the context parameter was supported up until version 57, but has now been removed.firefox android full support 53opera android full support 42
notes full support 42
notes
notes the context parameter was supported up until version 44, but has now been removed.safar...
... samsung internet android full support 6.0
notes full support 6.0
notes
notes the context parameter was supported up until samsung internet 7.0, but has now been removed.legend full support full support no support no support compatibility unknown compatibility unknownsee implementation
notes.see implementation
notes.
AudioListener - Web APIs
it is important to
note that there is only one listener per context and that it isn't an audionode.
...
note: although these methods are deprecated they are currently the only way to set the orientation and position in firefox, internet explorer and safari.
...
note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc.
... the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }
note: in terms of working out what position values to apply to the listener and panner, to make the sound appropriate to what the visuals are doing on screen, there is quite a bit of math involved, but you will soon get used to it with a bit of experimentation.
AudioProcessingEvent - Web APIs
note: as of the august 29 2014 web audio api spec publication, this feature has been marked as deprecated, and is soon to be replaced by audioworklet.
...
note the the returned audiobuffer is only valid in the scope of the onaudioprocess function.
...
note the the returned audiobuffer is only valid in the scope of the onaudioprocess function.
...
note: for a full working example, see our script-processor-node github repo (also view the source code.) var myscript = document.queryselector('script'); var mypre = document.queryselector('pre'); var playbutton = document.queryselector('button'); // create audiocontext and buffer source var audioctx = new audiocontext(); source = audioctx.createbuffersource(); // create a scriptprocessornod...
Using the CSS Typed Object Model - Web APIs
you'll
note that custom properties retain the value as written in the stylesheet, whereas computed styles will be listed as the computed value — color was listed as an rgb() value and the font-weight returned was 700 even though we use a named color and and the bold keyword.
...above output should looks something like this: property value unit padding-top 0 px margin-bottom 16 px font-size 16 px font-stretch 100 percent animation-duration 0 s animation-iteration-count 1 number width auto undefined height auto undefined you'll
note the <length> unit returned is px, the <percentage> unit returned is percent, the <time> unit is s for 'seconds', and the unitless <number> unit is number.
... it has two methods: cssstylevalue.parse() cssstylevalue.parseall() as
noted above, stylepropertymapreadonly.get('--customproperty') returns a cssunparsedvalue.
...
note the space before the 1.2rem.
Document - Web APIs
note that this is currently only implemented by chrome; other browsers still implement them directly on the document interface.
...
note that this is currently only implemented by chrome; other browsers still implement them on the document interface.
... non-standard extensions firefox
notes mozilla defines a set of non-standard properties made only for xul content: document.currentscript returns the <script> element that is currently executing.
... internet explorer
notes microsoft defines some non-standard properties: document.filesize* returns size in bytes of the document.
ExtendableEvent - Web APIs
if waituntil() is called outside of the extendableevent handler, the browser should throw an invalidstateerror;
note also that multiple calls will stack up, and the resulting promises will be added to the list of extend lifetime promises.
...
note: the behaviour described in the above paragraph was fixed in firefox 43 (see bug 1180274.) this interface inherits from the event interface.
..."/docs/web/api/extendableevent" target="_top"><rect x="116" y="1" width="150" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="191" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">extendableevent</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;}
note: this interface is only available when the global scope is a serviceworkerglobalscope.
...
note: in chrome, logging statements are visible via the "inspect" interface for the relevant service worker accessed via chrome://serviceworker-internals.
Using FormData Objects - Web APIs
var blob = new blob([content], { type: "text/xml"}); formdata.append("webmasterfile", blob); var request = new xmlhttprequest(); request.open("post", "http://foo.com/submitform.php"); request.send(formdata);
note: the fields "userfile" and "webmasterfile" both contain a file.
... retrieving a formdata object from an html form to construct a formdata object that contains the data from an existing <form>, specify that form element when creating the formdata object:
note: formdata will only use input fields that use the name attribute.
...eld", "this is some extra data"); var oreq = new xmlhttprequest(); oreq.open("post", "stash.php", true); oreq.onload = function(oevent) { if (oreq.status == 200) { ooutput.innerhtml = "uploaded!"; } else { ooutput.innerhtml = "error " + oreq.status + " occurred when trying to upload your file.<br \/>"; } }; oreq.send(odata); ev.preventdefault(); }, false);
note: if you pass in a reference to the form, the request method specified in the form will be used over the method specified in the open() call.
... formelem.addeventlistener('formdata', (e) => { console.log('formdata fired'); // get the form data from the event object let data = e.formdata; for (var value of data.values()) { console.log(value); } // submit the data via xhr let request = new xmlhttprequest(); request.open("post", "/formhandler"); request.send(data); });
note: the formdata event and formdataevent object are available in chrome from version 77 (and other equivalent chromiums), and firefox 72 (first available behind the dom.formdata.event.enabled pref in firefox 71).
GainNode() - Web APIs
note: you should typically call audiocontext.creategain() to create a gain node.
... desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetgainnode() constructorchrome full support 55
notes full support 55
notes
notes before chrome 59, the default values were not supported.edge full support ≤79firefox full support 53ie no support noopera full support 42safari...
... webview android full support 55
notes full support 55
notes
notes before chrome 59, the default values were not supported.chrome android full support 55
notes full support 55
notes
notes before chrome 59, the default values were not supported.firefox android full support 53opera android full support 42safari ios ?
... samsung internet android full support 6.0
notes full support 6.0
notes
notes before samsung internet 7.0, the default values were not supported.legend full support full support no support no support compatibility unknown compatibility unknownsee implementation
notes.see implementation
notes.
HTMLMediaElement.play() - Web APIs
note: older browsers may not return a value from play().
... usage
notes although the term "autoplay" is usually thought of as referring to pages that immediately begin playing media upon being loaded, web browsers' autoplay policies also apply to any script-initiated playback of media, including calls to play().
...
note: the play() method may cause the user to be asked to grant permission to play the media, resulting in a possible delay before the returned promise is resolved.
...
note: the whatwg and w3c versions of the specification differ (as of august, 2018) as to whether this method returns a promise or nothing at all, respectively.
HTML Drag and Drop API - Web APIs
(see performing a drop.)
note: neither dragstart nor dragend events are fired when dragging a file into the browser from the os.
...
note: dragevent and datatransfer are broadly supported on desktop browsers.
... //
note: change "example.gif" to a real image url or the image // will not be created and the default drag image will be used.
...reventdefault(); ev.datatransfer.dropeffect = "move"; } function drop_handler(ev) { ev.preventdefault(); // get the id of the target and add the moved element to the target's dom const data = ev.datatransfer.getdata("text/plain"); ev.target.appendchild(document.getelementbyid(data)); } </script> <p id="target" ondrop="drop_handler(event)" ondragover="dragover_handler(event)">drop zone</p>
note that each handler calls preventdefault() to prevent additional event processing for this event (such as touch events or pointer events).
Headers - Web APIs
note: you can find more out about the available headers by reading our http headers reference.
...
note: to be clear, the difference between headers.set() and headers.append() is that if the specified header does already exist and does accept multiple values, headers.set() will overwrite the existing value with the new one, whereas headers.append() will append the new value onto the end of the set of values.
...
note: all of the headers methods will throw a typeerror if you try to pass in a reference to a name that isn't a valid http header name.
...
note: when header values are iterated over, they are automatically sorted in lexicographical order, and values from duplicate header names are combined.
IDBCursor.update() - Web APIs
note: this feature is available in web workers.
...
note that you cannot change primary keys using cursor.update(), hence us not changing the album title; this would ruin the integrity of the data.
...
note also that you can't directly put cursor.value into an update call, hence the below example using an intermediary updatedata variable.
...also
note that in each iteration of the loop, you can grab data from the current record under the cursor object using cursor.value.foo.
IDBCursor - Web APIs
note: not to be confused with idbcursorwithvalue which is just an idbcursor interface with an additional value property.
...
note: this feature is available in web workers.
... properties
note: idbcursorwithvalue is an idbcursor interface with an additional value property.
...also
note that in each iteration of the loop, you can grab data from the current record under the cursor object using cursor.value.foo.
IDBDatabase.createObjectStore() - Web APIs
note: this feature is available in web workers.
...
note that it is possible to create an object store with an empty name.
...request.onupgradeneeded = function(event) { var db = event.target.result; db.onerror = function(event) {
note.innerhtml += "<li>error loading database.</li>"; }; // create an objectstore for this database var objectstore = db.createobjectstore("todolist", { keypath: "tasktitle" }); // define what data items the objectstore will contain objectstore.createindex("hours", "hours", { unique: false }); objectstore.createindex("minutes", "minutes", { unique: false }); objectstore.createindex("...
...day", "day", { unique: false }); objectstore.createindex("month", "month", { unique: false }); objectstore.createindex("year", "year", { unique: false }); objectstore.createindex("notified", "notified", { unique: false });
note.innerhtml += "<li>object store created.</li>"; }; specification specification status comment indexed database api 2.0the definition of 'createobjectstore()' in that specification.
IDBDatabase.onerror - Web APIs
note: consider using idbopendbrequest.onsuccess instead (see idbrequest.onsuccess, where it is inherited from).
...
note: this feature is available in web workers.
... dbopenrequest.onupgradeneeded = function(event) { var db = this.result; db.onerror = function(event) {
note.innerhtml += '<li>error opening database.</li>'; }; db.onabort = function(event) {
note.innerhtml += '<li>database opening aborted!</li>'; }; // create an objectstore for this database var objectstore = db.createobjectstore("todolist", { keypath: "tasktitle" }); // define what data items the objectstore will contain objectstore.createindex("hours", "hours", { unique: false }); objectstore.createindex("minutes", "minutes",...
... { unique: false }); objectstore.createindex("day", "day", { unique: false }); objectstore.createindex("month", "month", { unique: false }); objectstore.createindex("year", "year", { unique: false }); objectstore.createindex("notified", "notified", { unique: false });
note.innerhtml += '<li>object store created.</li>'; }; specifications specification status comment indexed database api 2.0the definition of 'onerror' in that specification.
IDBDatabase.transaction() - Web APIs
note: this feature is available in web workers.
...
note: in firefox, if you wish to ensure durability for some reason (e.g.
...for a complete example, see our to-do notifications app (view example live.) var db; // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) {
note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable.
... lot below db = dbopenrequest.result; // run the displaydata() function to populate the task list with // all the to-do list data already in the idb displaydata(); }; // open a read/write db transaction, ready for adding the data var transaction = db.transaction(["todolist"], "readwrite"); // report on the success of opening the transaction transaction.oncomplete = function(event) {
note.innerhtml += '<li>transaction completed: database modification finished.</li>'; }; transaction.onerror = function(event) {
note.innerhtml += '<li>transaction not opened due to error.
IDBFactory.open() - Web APIs
note: this feature is available in web workers.
...
note: you can find out more information on the different available storage types, and how firefox handles client-side data storage, at browser storage limits and eviction criteria.
...for a full working example, see our to-do notifications app (view example live.) var
note = document.queryselector("ul"); // in the following line, you should include the prefixes // of implementations you want to test.
....idbkeyrange = window.idbkeyrange || window.webkitidbkeyrange || window.msidbkeyrange; // (mozilla has never prefixed these objects, so we don't // need window.mozidb*) // let us open version 4 of our database var dbopenrequest = window.indexeddb.open("todolist", 4); // these two event handlers act on the database being opened // successfully, or not dbopenrequest.onerror = function(event) {
note.innerhtml += '<li>error loading database.</li>'; }; dbopenrequest.onsuccess = function(event) {
note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db // variable.
IDBFactory - Web APIs
note: this feature is available in web workers.
... 14safari ios full support 8samsung internet android full support 1.5databases experimentalchrome full support 71edge full support 79firefox no support no
notes no support no
notes
notes see bug 934640.ie no support noopera full support 58safari no support nowebview android full support 71chrome android full support ...
... 71firefox android no support no
notes no support no
notes
notes see bug 934640.opera android full support yessafari ios no support nosamsung internet android full support 10.0deletedatabasechrome full support 24 full support 24 no support 23 — 24prefixed prefixed implemented with the vendor prefix: webkitedge full support 12firefox full support ...
...expect behavior to change in the future.see implementation
notes.see implementation
notes.requires a vendor prefix or different name for use.requires a vendor prefix or different name for use.
IDBObjectStore.clear() - Web APIs
note: this feature is available in web workers.
...for a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) {
note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable.
...is used a lot below db = dbopenrequest.result; // clear all the data form the object store cleardata(); }; function cleardata() { // open a read/write db transaction, ready for clearing the data var transaction = db.transaction(["todolist"], "readwrite"); // report on the success of the transaction completing, when everything is done transaction.oncomplete = function(event) {
note.innerhtml += '<li>transaction completed.</li>'; }; transaction.onerror = function(event) {
note.innerhtml += '<li>transaction not opened due to error: ' + transaction.error + '</li>'; }; // create an object store on the transaction var objectstore = transaction.objectstore("todolist"); // make a request to clear all the data out of the object store var objectstorerequest = ob...
...jectstore.clear(); objectstorerequest.onsuccess = function(event) { // report the success of our request
note.innerhtml += '<li>request successful.</li>'; }; }; specification specification status comment indexed database api 2.0the definition of 'clear()' in that specification.
IDBObjectStore.delete() - Web APIs
note: this feature is available in web workers.
...for a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) {
note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable.
...bopenrequest.result; // run the deletedata() function to delete a record from the database deletedata(); }; function deletedata() { // open a read/write db transaction, ready for deleting the data var transaction = db.transaction(["todolist"], "readwrite"); // report on the success of the transaction completing, when everything is done transaction.oncomplete = function(event) {
note.innerhtml += '<li>transaction completed.</li>'; }; transaction.onerror = function(event) {
note.innerhtml += '<li>transaction not opened due to error: ' + transaction.error + '</li>'; }; // create an object store on the transaction var objectstore = transaction.objectstore("todolist"); // make a request to delete the specified record out of the object store var objectstorereq...
...uest = objectstore.delete("walk dog"); objectstorerequest.onsuccess = function(event) { // report the success of our request
note.innerhtml += '<li>request successful.</li>'; }; }; specification specification status comment indexed database api 2.0the definition of 'delete()' in that specification.
IDBObjectStore.indexNames - Web APIs
note: this feature is available in web workers.
...for a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) {
note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable.
...nto the idb var newitem = [ { tasktitle: "walk dog", hours: 19, minutes: 30, day: 24, month: "december", year: 2013, notified: "no" } ]; // open a read/write db transaction, ready for adding the data var transaction = db.transaction(["todolist"], "readwrite"); // report on the success of the transaction completing, when everything is done transaction.oncomplete = function(event) {
note.innerhtml += '<li>transaction completed.</li>'; }; transaction.onerror = function(event) {
note.innerhtml += '<li>transaction not opened due to error.
...cate items not allowed.</li>'; }; // create an object store on the transaction var objectstore = transaction.objectstore("todolist"); console.log(objectstore.indexnames); // make a request to add our newitem object to the object store var objectstorerequest = objectstore.add(newitem[0]); objectstorerequest.onsuccess = function(event) { // report the success of our request
note.innerhtml += '<li>request successful.</li>'; }; }; specification specification status comment indexed database api 2.0the definition of 'indexnames' in that specification.
IDBObjectStore.keyPath - Web APIs
note: this feature is available in web workers.
...for a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) {
note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable.
...nto the idb var newitem = [ { tasktitle: "walk dog", hours: 19, minutes: 30, day: 24, month: "december", year: 2013, notified: "no" } ]; // open a read/write db transaction, ready for adding the data var transaction = db.transaction(["todolist"], "readwrite"); // report on the success of the transaction completing, when everything is done transaction.oncomplete = function(event) {
note.innerhtml += '<li>transaction completed.</li>'; }; transaction.onerror = function(event) {
note.innerhtml += '<li>transaction not opened due to error.
...plicate items not allowed.</li>'; }; // create an object store on the transaction var objectstore = transaction.objectstore("todolist"); console.log(objectstore.keypath); // make a request to add our newitem object to the object store var objectstorerequest = objectstore.add(newitem[0]); objectstorerequest.onsuccess = function(event) { // report the success of our request
note.innerhtml += '<li>request successful.</li>'; }; }; specification specification status comment indexed database api 2.0the definition of 'keypath' in that specification.
IDBObjectStore.name - Web APIs
note: this feature is available in web workers.
...for a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) {
note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable.
...nto the idb var newitem = [ { tasktitle: "walk dog", hours: 19, minutes: 30, day: 24, month: "december", year: 2013, notified: "no" } ]; // open a read/write db transaction, ready for adding the data var transaction = db.transaction(["todolist"], "readwrite"); // report on the success of the transaction completing, when everything is done transaction.oncomplete = function(event) {
note.innerhtml += '<li>transaction completed.</li>'; }; transaction.onerror = function(event) {
note.innerhtml += '<li>transaction not opened due to error.
... duplicate items not allowed.</li>'; }; // create an object store on the transaction var objectstore = transaction.objectstore("todolist"); console.log(objectstore.name); // make a request to add our newitem object to the object store var objectstorerequest = objectstore.add(newitem[0]); objectstorerequest.onsuccess = function(event) { // report the success of our request
note.innerhtml += '<li>request successful.</li>'; }; }; specification specification status comment indexed database api 2.0the definition of 'name' in that specification.
IDBObjectStore.transaction - Web APIs
note: this feature is available in web workers.
...for a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) {
note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable.
...nto the idb var newitem = [ { tasktitle: "walk dog", hours: 19, minutes: 30, day: 24, month: "december", year: 2013, notified: "no" } ]; // open a read/write db transaction, ready for adding the data var transaction = db.transaction(["todolist"], "readwrite"); // report on the success of the transaction completing, when everything is done transaction.oncomplete = function(event) {
note.innerhtml += '<li>transaction completed.</li>'; }; transaction.onerror = function(event) {
note.innerhtml += '<li>transaction not opened due to error.
...ate items not allowed.</li>'; }; // create an object store on the transaction var objectstore = transaction.objectstore("todolist"); console.log(objectstore.transaction); // make a request to add our newitem object to the object store var objectstorerequest = objectstore.add(newitem[0]); objectstorerequest.onsuccess = function(event) { // report the success of our request
note.innerhtml += '<li>request successful.</li>'; }; }; specification specification status comment indexed database api 2.0the definition of 'transaction' in that specification.
IDBTransaction.commit() - Web APIs
note that commit() doesn't normally have to be called — a transaction will automatically commit when all outstanding requests have been satisfied and no new requests have been made.
...
note: this feature is available in web workers.
... examples // open a read/write db transaction, ready for adding the data var transaction = db.transaction(["mydb"], "readwrite"); // report on the success of opening the transaction transaction.oncomplete = function(event) {
note.innerhtml += '<li>transaction completed: database modification finished.</li>'; }; transaction.onerror = function(event) {
note.innerhtml += '<li>transaction not opened due to error.
...an object store on the transaction var objectstore = transaction.objectstore("myobjstore"); // add our newitem object to the object store var objectstorerequest = objectstore.add(newitem[0]); objectstorerequest.onsuccess = function(event) { // report the success of the request (this does not mean the item // has been stored successfully in the db - for that you need transaction.onsuccess)
note.innerhtml += '<li>request successful.</li>'; }; // force the changes to be committed to the database asap transaction.commit(); specification specification status comment indexed database api draftthe definition of 'idbtransaction.commit()' in that specification.
Checking when a deadline is due - Web APIs
when the form's submit button is pressed, we run the adddata() function, which starts like this: function adddata(e) { e.preventdefault(); if(title.value == '' || hours.value == null || minutes.value == null || day.value == '' || month.value == '' || year.value == null) {
note.innerhtml += '<li>data not submitted — form incomplete.</li>'; return; } in this segment, we check to see if the form fields have all been filled in.
...inutes : minutes.value, day : day.value, month : month.value, year : year.value, notified : "no" } ]; // open a read/write db transaction, ready for adding the data var transaction = db.transaction(["todolist"], "readwrite"); // report on the success of opening the transaction transaction.oncomplete = function(event) {
note.innerhtml += '<li>transaction opened for task addition.</li>'; }; transaction.onerror = function(event) {
note.innerhtml += '<li>transaction not opened due to error.
...
note: the db variable stores a reference to the indexeddb database instance; we can then use various properties of this variable to manipulate the data.
... request.onsuccess = function(event) {
note.innerhtml += '<li>new item added to database.</li>'; title.value = ''; hours.value = null; minutes.value = null; day.value = 01; month.value = 'january'; year.value = 2020; }; } this next section creates a log message to say the new item addition is successful, and resets the form so it's ready for the next task to be entered.
MediaDevices.getUserMedia() - Web APIs
note: it's possible for the returned promise to neither resolve nor reject, as the user is not required to make a choice at all and may simply ignore the request.
... let stream = null; try { stream = await navigator.mediadevices.getusermedia(constraints); /* use the stream */ } catch(err) { /* handle the error */ } } similarly, using the raw promises directly, the code looks like this: navigator.mediadevices.getusermedia(constraints) .then(function(stream) { /* use the stream */ }) .catch(function(err) { /* handle the error */ });
note: if the current document isn't loaded securely, navigator.mediadevices will be undefined, and you cannot use getusermedia().
...
note: the security model for getusermedia() is still somewhat in flux.
...
note that this polyfill does not correct for legacy differences in constraints syntax, which means constraints won't work well across browsers.
MediaStreamAudioSourceNode - Web APIs
usage
notes typically, you should probably not use this type of node.
... however, it's important to
note that the rule establishing this ordering was added long after this interface was first introduced into the web audio api.
...
note: you can see this example running live, or view the source.
... mouse is moved // then set new gain value range.oninput = function() { biquadfilter.gain.value = range.value; } }) .catch(function(err) { console.log('the following gum error occured: ' + err); }); } else { console.log('getusermedia not supported on your browser!'); } // dump script to pre element pre.innerhtml = myscript.innerhtml;
note: as a consequence of calling createmediastreamsource(), audio playback from the media stream will be re-routed into the processing graph of the audiocontext.
Using the MediaStream Recording API - Web APIs
instead, the problem was solved by making the third container's height equal to 100% of the parent height, minus the heights and padding of the other two: .sound-clips { box-shadow: inset 0 3px 4px rgba(0,0,0,0.7); background-color: rgba(0,0,0,0.1); height: calc(100% - 240px - 0.7rem); overflow: scroll; }
note: calc() has good support across modern browsers too, even going back to internet explorer 9.
...
note: all of the code below is placed inside the getusermedia success callback.
...we register an event handler to do this using mediarecorder.ondataavailable: let chunks = []; mediarecorder.ondataavailable = function(e) { chunks.push(e.data); }
note: the browser will fire dataavailable events as needed, but if you want to intervene you can also include a timeslice when invoking the start() method — for example start(10000) — to control this interval, or call mediarecorder.requestdata() to trigger an event when you need it.
... stop.onclick = function() { mediarecorder.stop(); console.log(mediarecorder.state); console.log("recorder stopped"); record.style.background = ""; record.style.color = ""; }
note that the recording may also stop naturally if the media stream ends (e.g.
Transcoding assets for Media Source Extensions - Web APIs
note: the prebuilt ffmpeg does not include libfdk_aac due to licensing reasons.
...
note: the fragmented version is slightly larger than the original, due to additional metadata spread throughout the file.
...ideo_00500.mp4 splitting media file (video) video_00875.mp4 splitting media file (video) video_01250.mp4 splitting media file (video) video_01625.mp4 splitting media file (video) video_02000.mp4 $ tree -l 2 output output ├── audio │ └── und ├── stream.mpd └── video ├── 1 ├── 2 ├── 3 ├── 4 └── 5 8 directories, 1 file
note: mp4-dash-encode.py does not display ffmpeg error messages.
...
note: if "invalid duration specification for force_key_frames: 'expr:eq(mod(n" is displayed as an error message, modify mp4-dash-encode.py and remove two "'" from "-force_key_frames 'expr:eq(mod(n,%d),0)'".
Node.insertBefore() - Web APIs
note: the node.clonenode() can be used to make a copy of the node before appending it under the new parent.
...
note that the copies made with clonenode() will not be automatically kept in sync.
...
note: referencenode is not an optional parameter.
... example 2 <div id="parentelement"> <span id="childelement">foo bar</span> </div> <script> // create a new, plain <span> element let sp1 = document.createelement("span") // get the reference element let sp2 = document.getelementbyid("childelement") // get the parent element let parentdiv = sp2.parentnode // insert the new element into before sp2 parentdiv.insertbefore(sp1, sp2) </script>
note: there is no insertafter() method.
OfflineAudioCompletionEvent.OfflineAudioCompletionEvent() - Web APIs
note: you wouldn't generally use the constructor manually.
... desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetofflineaudiocompletionevent() constructorchrome full support 57
notes full support 57
notes
notes before chrome 59, the default values were not supported.edge full support ≤79firefox full support 53ie no support noopera full support 42safari...
... webview android full support 57
notes full support 57
notes
notes before version 59, the default values were not supported.chrome android full support 57
notes full support 57
notes
notes before chrome 59, the default values were not supported.firefox android full support 53opera android full support 42safari ios ?
... samsung internet android full support 6.0
notes full support 6.0
notes
notes before samsung internet 7.0, the default values were not supported.legend full support full support no support no support compatibility unknown compatibility unknownsee implementation
notes.see implementation
notes.
Page Visibility API - Web APIs
notes: the page visibility api is especially useful for saving resources and improving performance by letting a page avoid performing unnecessary tasks when the document isn't visible.
...
note: while onblur and onfocus will tell you if the user switches windows, it doesn't necessarily mean it's hidden.
...
note: not all browsers support prerendering.
...
note: not all browsers support the unloaded value.
PaymentRequest.canMakePayment() - Web APIs
note: if you call this too often, the browser may reject the returned promise with a domexception.
... desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcanmakepayment()chrome full support 61edge full support 16firefox full support 55
notes disabled full support 55
notes disabled
notes available only in nightly builds.disabled from version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
...no support noopera no support nosafari full support 11.1webview android no support nochrome android full support 53firefox android full support 55
notes disabled full support 55
notes disabled
notes available only in nightly builds.disabled from version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
...android no support nosafari ios full support 11.3samsung internet android full support 6.0legend full support full support no support no supportsee implementation
notes.see implementation
notes.user must explicitly enable this feature.user must explicitly enable this feature.
PaymentResponse.complete() - Web APIs
note: in older versions of the specification, an empty string, "", was used instead of unknown to indicate a completion without a known result state.
... desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcomplete()chrome full support 61edge full support 15firefox full support 56
notes disabled full support 56
notes disabled
notes available only in nightly builds.disabled from version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
...to change preferences in chrome, visit chrome://flags.firefox android full support 56
notes disabled full support 56
notes disabled
notes available only in nightly builds.disabled from version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
... android no support nosafari ios full support yessamsung internet android full support 6.0legend full support full support no support no supportsee implementation
notes.see implementation
notes.user must explicitly enable this feature.user must explicitly enable this feature.
PushEvent.PushEvent() - Web APIs
note that the this constructor is exposed only to a service worker context.
... full support 17firefox full support 44
notes full support 44
notes
notes extended support releases (esr) before firefox 78 esr do not support service workers and the push api.ie no support noopera full support 37safari no support nowebview android ...
... no support nochrome android full support 42firefox android full support 44 full support 44 full support 48
notes
notes push enabled by default.opera android full support 37safari ios no support nosamsung internet android full support 4.0legend full support full support no support no supportexperimental.
...expect behavior to change in the future.see implementation
notes.see implementation
notes.user must explicitly enable this feature.user must explicitly enable this feature.
Request() - Web APIs
note the following behavioural updates to retain security while making the constructor less likely to throw exceptions: if this object exists on another origin to the constructor call, the request.referrer is stripped out.
...
note that a request using the get or head method cannot have a body.
...});
note that you could also pass the init object into the fetch call to get the same effect, e.g.: fetch(myrequest,myinit).then(function(response) { ...
...', headers: { 'content-type': 'image/jpeg' }, mode: 'cors', cache: 'default' }; var myrequest = new request('flowers.jpg', myinit); you may also pass a request object to the request() constructor to create a copy of the request (this is similar to calling the clone() method.) var copy = new request(myrequest);
note: this last usage is probably only useful in serviceworkers.
SVGPathElement - Web APIs
="/docs/web/api/svgpathelement" target="_top"><rect x="-99" y="65" width="140" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="-29" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgpathelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;}
note: in svg 2 the getpathsegatlength() and createsvgpathseg* methods were removed and the pathlength property and the gettotallength() and getpointatlength() methods were moved to svggeometryelement.
...
note: in svg 2 this property was moved to the svggeometryelement interface, from which this interface inherits it.
...
note: in svg 2 this method was moved to the svggeometryelement interface, from which this interface inherits it.
...
note: in svg 2 this method was moved to the svggeometryelement interface, from which this interface inherits it.
Using server-sent events - Web APIs
note: you can find a full example that uses the code shown in this article on github — see simple sse demo using php.
...
note: the comment line can be used to prevent connections from timing out; a server can send a comment periodically to keep the connection alive.
...
note: if a line doesn't contain a colon, the entire line is treated as the field name with an empty value string.
...
note the newline special character in the value.
Service Worker API - Web APIs
note: service workers win over previous attempts in this area such as; appcache because they don't make assumptions about what you are trying to do, and then break when those assumptions are not exactly right; you have granular control over everything.
...
note: service workers make heavy use of promises, as generally they will wait for responses to come through, after which they will respond with a success or failure action.
...
note: because oninstall/onactivate could take a while to complete, the service worker spec provides a waituntil method, once this is called oninstall or onactivate, it passes a promise.
...
note that this interface is deprecated in modern browsers.
SubtleCrypto.decrypt() - Web APIs
examples
note: you can try the working examples on github.
...
note that counter must match the value that was used for encryption.
...
note that iv must match the value that was used for encryption.
...
note that iv must match the value that was used for encryption.
Compressed texture formats - Web APIs
note that this advantage doesn't translate to network bandwidth: while the formats are better than uncompressed data, they are in general far worse than standard image formats such as png and jpg.
...
note that webgl makes no functionality available to compress or decompress textures: they must already be in a compressed format and can then be directly uploaded to video memory.
...which formats support texture_2d_array and texture_3d targets (in combination with compressedteximage3d) are
noted in the following table.
... extension
notes texture_2d_array texture_3d webgl_compressed_texture_astc yes yes webgl_compressed_texture_atc not usable with compressedtexsubimage2d/copytexsubimage2d.
Visualizations with Web Audio API - Web APIs
note: you can find working examples of all the code snippets in our voice-change-o-matic demo.
...or example: var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var analyser = audioctx.createanalyser(); this node is then connected to your audio source at some point between your source and your destination, for example: source = audioctx.createmediastreamsource(stream); source.connect(analyser); analyser.connect(distortion); distortion.connect(audioctx.destination);
note: you don't need to connect the analyser's output to another node for it to work, as long as the input is connected to the source, either directly or via another node.
... the analyser node will then capture audio data using a fast fourier transform (fft) in a certain frequency domain, depending on what you specify as the analysernode.fftsize property value (if no value is specified, the default is 2048.)
note: you can also specify a minimum and maximum power value for the fft data scaling range, using analysernode.mindecibels and analysernode.maxdecibels, and different data averaging constants using analysernode.smoothingtimeconstant.
... draw(); this code gives us a result like the following:
note: the examples listed in this article have shown usage of analysernode.getbytefrequencydata() and analysernode.getbytetimedomaindata().
Window.event - Web APIs
note: this property can be fragile, in that there may be situations in which the returned event is not the expected value.
... desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung interneteventchrome full support 1edge full support 12firefox full support 63
notes disabled full support 63
notes disabled
notes this was briefly enabled by default in 65, then removed again while related compatibility issues are sorted out (see bug 1520756).disabled from version 63: this feature is behind the dom.window.event.enabled preference (needs to be set to true).
...ll support 4opera full support 7safari full support 1.1webview android full support 1chrome android full support 18firefox android full support 63
notes disabled full support 63
notes disabled
notes this was briefly enabled by default in 65, then removed again while related compatibility issues are sorted out (see bug 1520756).disabled from version 63: this feature is behind the dom.window.event.enabled preference (needs to be set to true).
...ange preferences in firefox, visit about:config.opera android full support 10.1safari ios full support 1samsung internet android full support 1.0legend full support full supportsee implementation
notes.see implementation
notes.user must explicitly enable this feature.user must explicitly enable this feature.
Window.print() - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetprintchrome full support 1
notes full support 1
notes
notes starting with chrome 46, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.edge full support 12firefox full support 1ie full support 5opera ...
... full support 6
notes full support 6
notes
notes starting with opera 33, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.safari full support 1.1webview android full support 1
notes full support 1
notes
notes starting with webview 46, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.chrome android full support 18
notes full support 18
notes
notes starting with chrome 46, this method is blocked i...
...nside an <iframe> unless its sandbox attribute has the value allow-modals.firefox android no support no
notes no support no
notes
notes see bug 1247609.opera android full support 10.1
notes full support 10.1
notes
notes starting with opera 33, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.safari ios full support 1samsung internet android full support 1.0
notes full support 1.0
notes
notes starting with samsung internet 5.0, this method ...
...is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.legend full support full support no support no supportsee implementation
notes.see implementation
notes.
window.requestIdleCallback() - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetrequestidlecallback experimentalchrome full support 47edge full support 79firefox full support 55
notes full support 55
notes
notes enabled by default.
... no support 53 — 55
notes
notes implemented but disabled by default.ie no support noopera full support 34safari no support nowebview android full support 47chrome android full support 47firefox android full support 55
notes full support 55
notes
notes enabled by default.
... no support 53 — 55
notes
notes implemented but disabled by default.opera android full support 34safari ios no support nosamsung internet android full support 5.0legend full support full support no support no supportexperimental.
...expect behavior to change in the future.see implementation
notes.see implementation
notes.
Window.showModalDialog() - Web APIs
note: firefox does not implement the dialoghide, edge, status, or unadorned arguments.
...
notes showmodaldialog() was briefly standardized as part of html5.
...— 43edge no support nofirefox no support 3 — 56ie full support 4opera no support nosafari full support 5.1
notes full support 5.1
notes
notes see webkit bug 151885 for possible future removal from safari.webview android no support nochrome android no support nofirefox android no support noopera android no support ...
...not for use in new websites.see implementation
notes.see implementation
notes.
WindowOrWorkerGlobalScope.fetch() - Web APIs
note: the fetch() method's parameters are identical to those of the request() constructor.
...
note that the origin header is not set on fetch requests with a method of head or get.
...
note that some names are forbidden.
...
note that a request using the get or head method cannot have a body.
WindowOrWorkerGlobalScope.setInterval() - Web APIs
note: passing additional arguments to setinterval() in the first syntax does not work in internet explorer 9 and earlier.
...
note: the delay argument is converted to a signed 32-bit integer.
...'hidden' : 'visible'; } } var fadeinout = new minidaemon(document.getelementbyid('sample_div'), opacity, 300, 8); </script> </body> </html> view this example in action usage
notes the setinterval() function is commonly used to set a delay for functions that are executed again and again, such as animations.
...
note also that the actual amount of time that elapses between calls to the callback may be longer than the given delay; see reasons for delays longer than specified in windoworworkerglobalscope.settimeout() for examples.
Sending and Receiving Binary Data - Web APIs
note that this will not decode the image and read the pixels.
... var oreq = new xmlhttprequest(); oreq.open("get", "/myfile.png", true); oreq.responsetype = "arraybuffer"; oreq.onload = function (oevent) { var arraybuffer = oreq.response; //
note: not oreq.responsetext if (arraybuffer) { var bytearray = new uint8array(arraybuffer); for (var i = 0; i < bytearray.bytelength; i++) { // do something with each byte in the array } } }; oreq.send(null); you can also read a binary file as a blob by setting the string "blob" to the responsetype property.
...
note: support for sending arraybuffer objects using xmlhttprequest was added to gecko 9.0 (firefox 9.0 / thunderbird 9.0 / seamonkey 2.6).
...
note: this non-standard sendasbinary method is considered deprecated as of gecko 31 (firefox 31 / thunderbird 31 / seamonkey 2.28) and will be removed soon.
Using the alert role - Accessibility
note: opinons may differ on how assistive technology should handle this technique.
... let myalert = document.createelement("p"); myalert.setattribute("role", "alert"); let myalerttext = document.createtextnode("you must agree with our terms of service to create an account."); myalert.appendchild(myalerttext); document.body.appendchild(myalert);
note: the same result can be achieved with less code when using a script library like jquery: $("<p role='alert'>you must agree with our terms of service to create an account.</p>").appendto(document.body); example 3: adding alert role to an existing element sometimes it's useful to add an alert role to an element that is already visible on the page rather than creating a new element.
...
note: in most cases this approach is not recommended, because it's not ideal to hide error or alert text that is currently not applicable.
...one; } <p id="expirationwarning" role="alert" class="hidden">your log in session will expire in 2 minutes</p> // removing the 'hidden' class makes the element visible, which will make the screen reader announce the alert: document.getelementbyid("expirationwarning").classname = ""; working examples: alert role example using an aria alert box alert example using a modal aria dialog box
notes using the alert role on an element implies that element has aria-live="assertive".
Using the aria-invalid attribute - Accessibility
note: opinions may differ on how assistive technology should handle this technique.
...
note that since the default value for aria-required is false, it is not strictly necessary to add the attribute to input.
... <input name="name" id="name" aria-required="true" aria-invalid="false" onblur="checkvalidity('name', ' ', 'invalid name entered (requires both first and last name)');"/> <br /> <input name="email" id="email" aria-required="true" aria-invalid="false" onblur="checkvalidity('email', '@', 'invalid e-mail address');"/>
note that it is not necessary to validate the fields immediately on blur; the application could wait until the form is submitted (though this is not necessarily recommended).
...ementbyid("alert"); if (oldalert) { document.body.removechild(oldalert); } if (msg) { var newalert = document.createelement("div"); newalert.setattribute("role", "alert"); newalert.setattribute("id", "alert"); var content = document.createtextnode(msg); newalert.appendchild(content); document.body.appendchild(newalert); } }
note that the alert has the aria role attribute set to "alert." working examples: alert role example (uses the aria-invalid attribute)
notes when aria-invalid is used in conjunction with the aria-required attribute, aria-invalid should not be set to true before the form is submitted - only in response to validation.
Using the link role - Accessibility
note: where possible, it is recommended that you use a native <a> element rather than the link role, as native elements are more widely supported by older user agents and assistive technology.
...
note: opinons may differ on how assistive technology should handle this technique.
... you should however
note that there are still problems with this approach: it is very difficult to detect whether the target of the fake link has been visited before, and therefore use :visited styles (e.g.
...e.target : e.srcelement; if (ref) { window.open(ref.getattribute('data-href'), '_blank'); } } } spanelem.addeventlistener('click', navigatelink); spanelem.addeventlistener('keydown', navigatelink); result
notes if pressing the link triggers an action but does not change browser focus or navigate to a new page, you might wish to consider using the button role instead of the link role.
Using the progressbar role - Accessibility
note: assistive technologies generally will render the value of aria-valuenow as a percent of the range between the value of aria-valuemin and aria-valuemax, unless aria-valuetext is specified.
...
note: elements with the role progressbar have an implicit aria-readonly value of true.
...
note: opinions may differ on how assistive technology should handle this.
...</div> working examples:
notes aria attributes used progressbar aria-valuenow aria-valuemin aria-valuemax aria-valuetext related aria techniques compatibility tbd: add support information for common ua and at product combinations additional resources ...
WAI-ARIA Roles - Accessibility
elements containing role="checkbox" must also include the aria-checked attribute to expose the checkbox's state to assistive technology.aria: comment rolethe comment landmark role semantically de
notes a comment/reaction to some content on the page, or to a previous comment.aria: complementary rolethe complementary landmark role is used to designate a supporting section that relates to the main content, yet can stand alone when separated.
...the main content area consists of content that is directly related to or expands upon the central topic of a document, or the central functionality of an application.aria: mark rolethe mark landmark role semantically de
notes html elements containing text that is marked/highlighted for reference purposes.
...a rowgroup contains one or more rows of cells, grid cells, column headers, or row headers within a grid, table or treegrid.aria: search rolethe search landmark role is used to identify a section of the page used to search the page, site, or collection of sites.aria: suggestion rolethe suggestion landmark role semantically de
notes a single proposed change to an editable document.
... alertdialog banner combobox command columnheader (estelle) complementary composite definition directory feed gridcell (eric e) group input landmark link - old page listbox log - old page marquee math menu menubar menuitem menuitemcheckbox menuitemradio none
note option presentation progressbar - old page radio - old page radiogroup range region roletype rowheader(estelle) scrollbar searchbox section sectionhead select separator slider - old page spinbutton status - old page structure tab tablist (michiel) tabpanel (michiel) term timer toolbar tooltip tree treegrid treeitem widget window ...
Basic form hints - Accessibility
note that each <input> element has an id, and each <label> element has a for attribute, indicating the id of the associated <input>.
...
note that on line 3, the <ul> element sets the aria-labelledby attribute to rg1_label, the id of the <h3> element on line 1, which is the label for the radio group.
... <button aria-describedby="descriptionrevert">revert</button> <div id="descriptionrevert">reverting will undo any changes that have been made since the last save.</div>
note: the aria-describedby attribute is used for other purposes, in addition to form controls.
... required and invalid fields
note: now that required is available to more than 97% of users globally, it is no longer recommended that you use both required and aria-required.
:has() - CSS: Cascading Style Sheets
/* selects any <a>, as long as it has an <img> element directly inside it */ /*
note that this is not supported in any browser yet */ let test = document.queryselector('a:has(> img)'); syntax :has( <relative-selector-list> )where <relative-selector-list> = <relative-selector>#where <relative-selector> = <combinator>?
... desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internet:has()chrome no support no
notes no support no
notes
notes see bug 669058edge no support no
notes no support no
notes
notes see bug 669058firefox no support no
notes no support no
notes
notes see bug 418039ie...
... no support noopera no support nosafari no support nowebview android no support nochrome android no support nofirefox android no support no
notes no support no
notes
notes see bug 418039opera android no support nosafari ios no support nosamsung internet android no support nolegend no support no supportsee implem...
...entation
notes.see implementation
notes.
:host() - CSS: Cascading Style Sheets
note: this has no effect when used outside a shadow dom.
...to change preferences in firefox, visit about:config.ie no support noopera full support 41safari full support 10
notes full support 10
notes
notes certain css selectors do not work (:host > .local-child) and styling slotted content (::slotted) is buggy.webview android full support 54chrome android full support 54firefox android full support ...
...to change preferences in firefox, visit about:config.opera android full support 41safari ios full support 10
notes full support 10
notes
notes certain css selectors do not work (:host > .local-child) and styling slotted content (::slotted) is buggy.samsung internet android full support 6.0legend full support full support no support ...
... no supportsee implementation
notes.see implementation
notes.user must explicitly enable this feature.user must explicitly enable this feature.
Using CSS custom properties (variables) - CSS: Cascading Style Sheets
like any other property, this is written inside a ruleset, like so: element { --main-bg-color: brown; }
note that the selector given to the ruleset defines the scope that the custom property can be used in.
...
note: custom property names are case sensitive — --my-color will be treated as a separate custom property to --my-color.
...
note: the syntax of the fallback, like that of custom properties, allows commas.
...
note: while a syntax error in a css property / value pair will lead to the line being ignored, using a cascaded value, invalid substitution -- using a custom property value that is invalid -- is not ignored, leading to the value to be inherited.
Value definition syntax - CSS: Cascading Style Sheets
note: juxtaposition has precedence over the double ampersand, meaning that bold thin && <length> is equivalent to [ bold thin ] && <length>.
...
note: the double ampersand has precedence over the double bar, meaning that bold || thin && <length> is equivalent to bold || [ thin && <length> ].
...
note: the double bar has precedence over the single bar, meaning that bold | thin || <length> is equivalent to bold | [ thin || <length> ].
...
note that multipliers cannot be added and have all precedence over combinators.
aspect-ratio - CSS: Cascading Style Sheets
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetaspect-ratio experimentalchrome partial support 79
notes partial support 79
notes
notes chrome 79 adds internal support only for mapped valuesedge partial support 79
notes partial support 79
notes
notes edge 79 adds internal support only for mapped valuesfirefox partial support 71
notes partial support 71
notes
notes firefox ...
...71 adds internal support only for mapped values no support 69 — 71
notes disabled
notes firefox 69 adds internal support only for mapped valuesdisabled from version 69 until version 71 (exclusive): this feature is behind the layout.css.width-and-height-map-to-aspect-ratio.enabled preference (needs to be set to true).
... to change preferences in firefox, visit about:config.ie no support noopera no support nosafari no support nowebview android partial support 79
notes partial support 79
notes
notes webview 79 adds internal support only for mapped valueschrome android partial support 79
notes partial support 79
notes
notes chrome 79 adds internal support only for mapped valuesfirefox android no support noopera android no support nosafari ios no support ...
...expect behavior to change in the future.see implementation
notes.see implementation
notes.user must explicitly enable this feature.user must explicitly enable this feature.
border-left-style - CSS: Cascading Style Sheets
note: the specification doesn't define how borders of different styles connect in the corners.
... desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetborder-left-stylechrome full support 1edge full support 12firefox full support 1
notes full support 1
notes
notes prior to firefox 50, border styles of rounded corners (with border-radius) were always rendered as if border-bottom-style was solid.
...upport 5.5opera full support 9.2safari full support 1webview android full support 2.3chrome android full support 18firefox android full support 14
notes full support 14
notes
notes prior to firefox 50, border styles of rounded corners (with border-radius) were always rendered as if border-bottom-style was solid.
... this has been fixed in firefox 50.opera android full support 14safari ios full support 1samsung internet android full support 1.0legend full support full supportsee implementation
notes.see implementation
notes.
border-right-style - CSS: Cascading Style Sheets
note: the specification doesn't define how borders of different styles connect in the corners.
... desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetborder-right-stylechrome full support 1edge full support 12firefox full support 1
notes full support 1
notes
notes prior to firefox 50, border styles of rounded corners (with border-radius) were always rendered as if border-bottom-style was solid.
...port 5.5opera full support 9.2safari full support 1webview android full support ≤37chrome android full support 18firefox android full support 14
notes full support 14
notes
notes prior to firefox 50, border styles of rounded corners (with border-radius) were always rendered as if border-bottom-style was solid.
... this has been fixed in firefox 50.opera android full support 14safari ios full support 1samsung internet android full support 1.0legend full support full supportsee implementation
notes.see implementation
notes.
box-decoration-break - CSS: Cascading Style Sheets
note that the hypothetical box can be different for each fragment since it uses its own height if the break occurs in the inline direction, and its own width if the break occurs in the block direction.
...
note that if you stack the rendering of the two fragments horizontally next to each other it will result in the non-fragmented rendering.
... block box fragments a block element with similar styles as above and no fragmentation results in: fragmenting the above block into three columns results in:
note that stacking these pieces vertically will result in the non-fragmented rendering.
... now, the same example but styled with box-decoration-break: clone results in:
note here that each fragment has an identical replicated border, box-shadow, and background.
font-variant-ligatures - CSS: Cascading Style Sheets
note that the keyword normal activates these ligatures.
...
note that the keyword normal usually deactivates these ligatures.
...
note that the keyword normal usually deactivates these ligatures.
...
note that the keyword normal usually activates these ligatures too.
<length> - CSS: Cascading Style Sheets
note: although <percentage> values are also css dimensions, and are usable in some of the same properties that accept <length> values, they are not themselves <length> values.
...
note: some properties allow negative <length>s, while others do not.
...
note: these units, especially em and rem, are often used to create scalable layouts, which maintain the vertical rhythm of the page even when the user changes the font size.
...
note: many users increase their user agent's default font size to make text more legible.
Creating a cross-browser video player - Developer guides
note: you can see the example running live, or check out the source code on github.
...
note: ie9 behaves differently than most other browsers when a poster attribute is set.
...this can be taken advantage of to set the progress element's max attribute if it is currently not set: video.addeventlistener('timeupdate', function() { if (!progress.getattribute('max')) progress.setattribute('max', video.duration); progress.value = video.currenttime; progressbar.style.width = math.floor((video.currenttime / video.duration) * 100) + '%'; });
note: for more information and ideas on progress bars and buffering feedback, read media buffering, seeking, and time ranges.
...
note the different letter casing in the various values.
Mouse gesture events - Developer guides
note: these gesture events are available to add-ons and other browser chrome code, but are never sent to regular web page content.
...
note: some operating systems, including mac os x and windows 7, provide default actions when gesture events occur.
...
note: this event is sent whenever the movement of the user's fingers exceeds the number of pixels indicated by the browser.gesture.pinch.threshold preference.
...
note: this event is sent whenever the movement of the user's fingers exceeds the number of pixels indicated by the browser.gesture.pinch.threshold preference.
Overview of events and handlers - Developer guides
note that the handler has access to the ev object since it is passed as an argument; the object has information about the event, notably the time at which the event occurred.
...
note that in this example, the code does not even name the event argument to the function because the code never needs to use the data structure describing the event; rather, the code merely needs to wait to run until after then event has happened.
... some notable events are:
note: this list of events will need work to make relevant; that work is awaiting some global reorganization work on the documents.
... a partial diagram of the class hierarchy of event objects is:
note: this diagram is incomplete.
<div>: The Content Division element - HTML: Hypertext Markup Language
note: the align attribute is obsolete; do not use it anymore.
... usage
notes the <div> element should be used only when no other semantic element (such as <article> or <nav>) is appropriate.
...
note the use of the class attribute on the <div> to apply the style named "shadowbox" to the element.
... html <div class="shadowbox"> <p>here's a very interesting
note displayed in a lovely shadowed box.</p> </div> css .shadowbox { width: 15em; border: 1px solid #333; box-shadow: 8px 8px 5px #444; padding: 8px 12px; background-image: linear-gradient(180deg, #fff, #ddd 40%, #ccc); } result specifications specification status comment html living standardthe definition of '<div>' in that specification.
<input type="checkbox"> - HTML: Hypertext Markup Language
note: radio buttons are similar to checkboxes, but with an important distinction — radio buttons are grouped into a set in which only one radio button can be selected at a time, whereas checkboxes allow you to turn single values on and off.
...
note: if a checkbox is unchecked when its form is submitted, there is no value submitted to the server to represent its unchecked state (e.g.
...(only the htmlinputelement’s checked idl attribute is updated.)
note: unlike other input controls, a checkboxes value is only included in the submitted data if the checkbox is currently checked.
...length; i++) { if(ingredients[i].checked) { checkedcount++; } } if(checkedcount === 0) { overall.checked = false; overall.indeterminate = false; } else if(checkedcount === ingredients.length) { overall.checked = true; overall.indeterminate = false; } else { overall.checked = false; overall.indeterminate = true; } }
note: if you submit a form with an indeterminate checkbox, the same thing happens as if the checkbox were unchecked — no data is submitted to represent the checkbox.
<input type="month"> - HTML: Hypertext Markup Language
you can set a default value for the input control by including a month and year inside the value attribute, like so: <label for="bday-month">what month were you born in?</label> <input id="bday-month" type="month" name="bday-month" value="2017-06"> one thing to
note is that the displayed date format differs from the actual value; most user agents display the month and year in a locale-appropriate form, based on the set locale of the user's operating system, whereas the date value is always formatted yyyy-mm.
...
note: because a read-only field cannot have a value, required does not have any effect on inputs with the readonly attribute also specified.
...
note: when the data entered by the user doesn't adhere to the stepping configuration, the user agent may round to the nearest valid value, preferring numbers in the positive direction when there are two equally close options.
... hardcoded) populateyears(); } function populateyears() { // get the current year as a number var date = new date(); var year = date.getfullyear(); // make this year, and the 100 years before it available in the year <select> for(var i = 0; i <= 100; i++) { var option = document.createelement('option'); option.textcontent = year-i; yearselect.appendchild(option); } }
note: remember that some years have 53 weeks in them (see weeks per year)!
<input type="range"> - HTML: Hypertext Markup Language
see the range control with hash marks below for an example of how the options on a range are de
noted in supported browsers max the greatest value in the range of permitted values.
...
note: when the data entered by the user doesn't adhere to the stepping configuration, the user agent may round to the nearest valid value, preferring numbers in the positive direction when there are two equally close options.
...
note: the following input attributes do not apply to the input range: accept, alt, checked, dirname, formaction, formenctype, formmethod, formnovalidate, formtarget, height, maxlength, minlength, multiple, pattern, placeholder, readonly, required, size, src, and width.
... value="10"></option> <option value="20"></option> <option value="30"></option> <option value="40"></option> <option value="50" label="50%"></option> <option value="60"></option> <option value="70"></option> <option value="80"></option> <option value="90"></option> <option value="100" label="100%"></option> </datalist> screenshot live
note: currently, no browser fully supports these features.
<input type="week"> - HTML: Hypertext Markup Language
you can set a default value for the input by including a value inside the value attribute, like so: <label for="week">what week would you like to start?</label> <input id="week" type="week" name="week" value="2017-w01"> one thing to
note is that the displayed format may differ from the actual value, which is always formatted yyyy-www.
...
note: because a read-only field cannot have a value, required does not have any effect on inputs with the readonly attribute also specified.
...
note: when the data entered by the user doesn't adhere to the stepping configuration, the user agent may round to the nearest valid value, preferring numbers in the positive direction when there are two equally close options.
...("0" + i) : i; weekselect.appendchild(option); } }
note: remember that some years have 53 weeks in them (see weeks per year)!
Standard metadata names - HTML: Hypertext Markup Language
note: browsers may use this to identify the application.
...
notes: dynamically inserting <meta name="referrer"> (with document.write() or appendchild()) makes the referrer behaviour unpredictable.
...
notes: though unstandardized, this declaration is respected by most mobile browsers due to de-facto dominance.
... bing
notes: only cooperative robots follow these rules.
<rb>: The Ruby Base element - HTML: Hypertext Markup Language
usage
notes ruby annotations are for showing pronunciation of east asian characters, like using japanese furigana or taiwanese bopomofo characters.
... examples in this example, we provide an annotation for the original character equivalent of "kanji": <ruby> <rb>漢<rb>字 <rp>(</rp><rt>kan<rt>ji<rp>)</rp> </ruby>
note how we've included two <rb> elements, to delimit the two separate parts of the ruby base text.
...
note that we could also write this example with the two base text parts annotated completely separately.
...d to include <rb> elements: <ruby> 漢 <rp>(</rp><rt>kan</rt><rp>)</rp> 字 <rp>(</rp><rt>ji</rt><rp>)</rp> </ruby> <ruby> <rb>漢<rb>字 <rp>(</rp><rt>kan<rt>ji<rp>)</rp> </ruby> body { font-size: 22px; } the output looks like so: the html above might look something like this when rendered by a browser without ruby support: 漢字 (kan ji) body { font-size: 22px; }
note: see the article about the <ruby> element for further examples.
<script>: The Script element - HTML: Hypertext Markup Language
see browser compatibility for
notes on browser support.
...
note: an empty string value ("") is both the default value, and a fallback value if referrerpolicy is not supported.
...developers must use a valid mime type that is not a javascript mime type to de
note data blocks.
...
notes scripts without async , defer or type="module" attributes, as well as inline scripts, are fetched and executed immediately, before the browser continues to parse the page.
<section>: The Generic Section element - HTML: Hypertext Markup Language
note: if the contents of the element would make sense syndicated as a standalone piece, the <article> element may be a better choice.
...
note that a <section> element must not be a descendant of an <address> element.
... implicit aria role region if the element has an accessible name, otherwise no corresponding role permitted aria roles alert, alertdialog, application, banner, complementary, contentinfo, dialog, document, feed, log, main, marquee, navigation, none,
note, presentation, search, status, tabpanel dom interface htmlelement attributes this element only includes the global attributes.
... usage
notes each <section> should be identified, typically by including a heading (<h1>-<h6> element) as a child of the <section> element.
<sub>: The Subscript element - HTML: Hypertext Markup Language
usage
notes the <sub> element should be used only for typographical reasons—that is, to change the position of the text to comply with typographical conventions or standards, rather than solely for presentation or appearance purposes.
... appropriate use cases for <sub> include (but aren't necessarily limited to): marking up foot
note numbers.
... see foot
note numbers for an example.
... examples foot
note numbers traditional foot
notes are de
noted using numbers which are rendered in subscript.
Browser detection using the user agent - HTTP
also
note that there is a huge difference between the media queries (max-width: 25em), not all and (min-width: 25em), and (max-width: 24.99em): (max-width: 25em) excludes (max-width: 25em), whereas not all and (min-width: 25em) includes (max-width: 25em).
...but
note that some browsers are lying: chrome for example reports both as chrome and safari.
... presto opera/xyz
note: presto is no longer used in opera browser builds >= version 15 (see 'blink') trident trident/xyz internet explorer put this token in the comment part of the user agent string edgehtml edge/xyz the non-chromium edge puts its engine version after the edge/ token, not the application version.
...
note: edgehtml is no longer used in edge browser builds >= version 79 (see 'blink').
Configuring servers for Ogg media - HTTP
note: of course, the more key frames you use, the larger your video file is, so you may need to experiment a bit to get the right balance between file size and seek performance.
... configuration for older firefox versions serve x-content-duration headers
note: as of firefox 41, the x-content-duration header is no longer supported.
...me: 0.000 basetime: 0.000 theora: serialno 0170995062 1790 packets in 1068 pages, 1.7 packets/page, 1.049% ogg overhead video-framerate: 29.983 fps video-width: 640 video-height: 360 vorbis: serialno 0708996688 4531 packets in 167 pages, 27.1 packets/page, 1.408% ogg overhead audio-samplerate: 44100 hz audio-channels: 2
note that you can't simply serve up the reported content-duration line reported by oggz-info, because it's reported in hh:mm:ss format.
... it's important to
note that it appears that oggz-info makes a read pass of the media in order to calculate its duration, so it's a good idea to store the duration value in order to avoid lengthy delays while the value is calculated for every http request of your ogg media.
Using HTTP cookies - HTTP
get /sample_page.html http/2.0 host: www.example.org cookie: yummy_cookie=choco; tasty_cookie=strawberry
note: here's how to use the set-cookie header in various server-side applications: php node.js python ruby on rails define the lifetime of a cookie the lifetime of a cookie can be defined in two ways: session cookies are deleted when the current session ends.
... for example: set-cookie: id=a3fwa; expires=wed, 31 oct 2021 07:28:00 gmt;
note: when an expires date is set, the time and date set is relative to the client the cookie is being set on, not the server.
...
note that this ensures that if a subdomain were to create a cookie with a prefix, it would either be confined to the subdomain or be ignored completely.
... please
note the security issues in the security section below.
Enumerability and ownership of properties - JavaScript
enumerable nonenumerable enumerable and nonenumerable for..in (excluding symbols) not available without extra code not available without extra code not available without extra code obtaining properties by enumerability/ownership
note that this is not the most efficient algorithm for all cases, but useful for a quick demonstration.
...op) {}); (or use filter(), map(), etc.) var simplepropertyretriever = { getownenumerables: function(obj) { return this._getpropertynames(obj, true, false, this._enumerable); // or could use for..in filtered with hasownproperty or just this: return object.keys(obj); }, getownnonenumerables: function(obj) { return this._getpropertynames(obj, true, false, this._
notenumerable); }, getownenumerablesandnonenumerables: function(obj) { return this._getpropertynames(obj, true, false, this._enumerableand
notenumerable); // or just use: return object.getownpropertynames(obj); }, getprototypeenumerables: function(obj) { return this._getpropertynames(obj, false, true, this._enumerable); }, getprototypenonenumerables: func...
...tion(obj) { return this._getpropertynames(obj, false, true, this._
notenumerable); }, getprototypeenumerablesandnonenumerables: function(obj) { return this._getpropertynames(obj, false, true, this._enumerableand
notenumerable); }, getownandprototypeenumerables: function(obj) { return this._getpropertynames(obj, true, true, this._enumerable); // or could use unfiltered for..in }, getownandprototypenonenumerables: function(obj) { return this._getpropertynames(obj, true, true, this._
notenumerable); }, getownandprototypeenumerablesandnonenumerables: function(obj) { return this._getpropertynames(obj, true, true, this._enumerableand
notenumerable); }, // private static property checker callbacks _enumerable: fun...
...ction(obj, prop) { return obj.propertyisenumerable(prop); }, _
notenumerable: function(obj, prop) { return !obj.propertyisenumerable(prop); }, _enumerableand
notenumerable: function(obj, prop) { return true; }, // inspired by http://stackoverflow.com/a/8024294/271577 _getpropertynames: function getallpropertynames(obj, iterateselfbool, iterateprototypebool, includepropcb) { var props = []; do { if (iterateselfbool) { object.getownpropertynames(obj).foreach(function(prop) { if (props.indexof(prop) === -1 && includepropcb(obj, prop)) { props.push(prop); } }); } if (!iterateprototypebool) { ...
Indexed collections - JavaScript
let arr = new array(arraylength) // ...results in the same array as this let arr = array(arraylength) // this has exactly the same effect let arr = [] arr.length = arraylength
note: in the above code, arraylength must be a number.
...
note: you can also use property accessors to access other properties of the array, like with an object.
...for example: let emp = [] emp[0] = 'casey jones' emp[1] = 'phil lesh' emp[2] = 'august west'
note: if you supply a non-integer value to the array operator in the code above, a property will be created in the object representing the array, instead of an array element.
...
note that the elements of an array that are omitted when the array is defined are not listed when iterating by foreach, but are listed when undefined has been manually assigned to the element: let array = ['first', 'second', , 'fourth'] array.foreach(function(element) { console.log(element) }) // first // second // fourth if (array[2] === undefined) { console.log('array[2] is undefined') // tr...
Regular expressions - JavaScript
note: if you are already familiar with the forms of a regular expression, you may also read the cheatsheet for a quick lookup for a specific pattern/construct.
...\s, \t, \v, \w, \w, \0, \xhh, \uhhhh, \uhhhhh, [\b] character classes ^, $, x(?=y), x(?!y), (?<=y)x, (?<!y)x, \b, \b assertions (x), (?:x), (?<name>x), x|y, [xyz], [^xyz], \number groups and ranges *, +, ?, x{n}, x{n,}, x{n,m} quantifiers \p{unicodeproperty}, \p{unicodeproperty} unicode property escapes
note: a larger cheatsheet is also available (only aggregating parts of those individual articles).
... regexp.prototype.sticky to include a flag with the regular expression, use this syntax: var re = /pattern/flags; or var re = new regexp('pattern', 'flags');
note that the flags are an integral part of a regular expression.
... examples
note: several examples are also available in: the reference pages for exec(), test(), match(), matchall(), search(), replace(), split() this guide articles': character classes, assertions, groups and ranges, quantifiers, unicode property escapes using special characters to verify input in the following example, the user is expected to enter a phone number.
JSON.stringify() - JavaScript
note: you cannot use the replacer function to remove values from an array.
...
note: if you wish the replacer to distinguish an initial object from a key with an empty string property (since both would give the empty string as key and potentially an object as value), you will have to keep track of the iteration count (if it is beyond the first iteration, it is a genuine empty string key).
...// '{"obj":"now i am a nested object under key 'obj'"}' json.stringify([ obj ]); // '["now i am a nested object under key '0'"]' issue with json.stringify() when serializing circular references
note that since the json format doesn't support object references (although an ietf draft exists), a typeerror will be thrown if one attempts to encode an object with circular references.
..., b: string.fromcharcode(0x2029) }; try { eval('(' + json.stringify(s) + ')'); } catch (e) { console.log(e); // "syntaxerror: unterminated string literal" } // no need for a catch eval('(' + jsfriendlyjsonstringify(s) + ')'); // console.log in firefox unescapes the unicode if // logged to console, so we use alert alert(jsfriendlyjsonstringify(s)); // {"a":"\u2028","b":"\u2029"}
note: properties of non-array objects are not guaranteed to be stringified in any particular order.
Symbol - JavaScript
note that symbol("foo") does not coerce the string "foo" into a symbol.
...
note that every object is initialized with no own symbol properties, so that this array will be empty unless you've set symbol properties on the object.
... typeof symbol() === 'symbol' typeof symbol('foo') === 'symbol' typeof symbol.iterator === 'symbol' symbol type conversions some things to
note when working with type conversion of symbols.
... the "safer" string(sym) conversion works like a call to symbol.prototype.tostring() with symbols, but
note that new string(sym) will throw.
WebAssembly.CompileError - JavaScript
desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jscompileerrorchrome full support 57edge full support 16firefox full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).ie no support noopera full support 44safari full support 11webview android full support ...
... 57chrome android full support 57firefox android full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).opera android full support 43safari ios full support 11samsung internet android full support 7.0nodejs full support 8.0.0compileerror() constructorchrome full support 57edge full support 16firefox full support ...
... 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).ie no support noopera full support 44safari full support 11webview android full support 57chrome android full support 57firefox android full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).opera android full support 43safari ios ...
...t 11samsung internet android full support 7.0nodejs full support 8.0.0legend full support full support no support no supportsee implementation
notes.see implementation
notes.
WebAssembly.Instance.prototype.exports - JavaScript
var importobject = { imports: { imported_func: function(arg) { console.log(arg); } } }; webassembly.instantiatestreaming(fetch('simple.wasm'), importobject) .then(obj => obj.instance.exports.exported_func());
note: you can also find this example as instantiate-streaming.html on github (view it live also).
... desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jsexportschrome full support 57edge full support 16firefox full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).ie no support noopera full support 44safari full support 11webview android full support ...
... 57chrome android full support 57firefox android full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).opera android full support 43safari ios full support 11samsung internet android full support 7.0nodejs full support 8.0.0legend full support full support no support no supportsee implementation n...
...otes.see implementation
notes.
WebAssembly.LinkError - JavaScript
desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jslinkerrorchrome full support 57edge full support 16firefox full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).ie no support noopera full support 44safari full support 11webview android full support ...
... 57chrome android full support 57firefox android full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).opera android full support 43safari ios full support 11samsung internet android full support 7.0nodejs full support 8.0.0linkerror() constructorchrome full support 57edge full support 16firefox full support ...
... 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).ie no support noopera full support 44safari full support 11webview android full support 57chrome android full support 57firefox android full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).opera android full support 43safari ios ...
...t 11samsung internet android full support 7.0nodejs full support 8.0.0legend full support full support no support no supportsee implementation
notes.see implementation
notes.
WebAssembly.Memory() constructor - JavaScript
note: a webassembly page has a constant size of 65,536 bytes, i.e., 64kib.
... desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jsmemory() constructorchrome full support 57edge full support 16firefox full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).ie no support noopera full support 44safari full support 11webview android full support ...
... 57chrome android full support 57firefox android full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).opera android full support 43safari ios full support 11samsung internet android full support 7.0nodejs full support 8.0.0shared flagchrome full support 74edge full support 79firefox full support 78i...
...ort nosamsung internet android no support nonodejs full support 12.0.0legend full support full support no support no supportsee implementation
notes.see implementation
notes.
WebAssembly.Memory.prototype.grow() - JavaScript
var memory = new webassembly.memory({initial:1, maximum:10}); we can then grow the instance by one page like so: const bytesperpage = 64 * 1024; console.log(memory.buffer.bytelength / bytesperpage); // "1" console.log(memory.grow(1)); // "1" console.log(memory.buffer.bytelength / bytesperpage); // "2"
note the return value of grow() here is the previous number of webassembly pages.
... desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jsgrowchrome full support 57edge full support 16firefox full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).ie no support noopera full support 44safari full support 11webview android full support ...
... 57chrome android full support 57firefox android full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).opera android full support 43safari ios full support 11samsung internet android full support 7.0nodejs full support 8.0.0legend full support full support no support no supportsee implementation n...
...otes.see implementation
notes.
WebAssembly.Module.customSections() - JavaScript
note that the webassembly text format currently doesn't have a syntax specified for adding new custom sections; you can however add a name section to your wasm during conversion from text format over to .wasm.
... desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jscustomsectionschrome full support 57edge full support 16firefox full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).ie no support noopera full support 44safari full support 11webview android full support ...
... 57chrome android full support 57firefox android full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).opera android full support 43safari ios full support 11samsung internet android full support 7.0nodejs full support 8.0.0legend full support full support no support no supportsee implementation n...
...otes.see implementation
notes.
WebAssembly.RuntimeError - JavaScript
desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jsruntimeerrorchrome full support 57edge full support 16firefox full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).ie no support noopera full support 44safari full support 11webview android full support ...
... 57chrome android full support 57firefox android full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).opera android full support 43safari ios full support 11samsung internet android full support 7.0nodejs full support 8.0.0runtimeerror() constructorchrome full support 57edge full support 16firefox full support ...
... 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).ie no support noopera full support 44safari full support 11webview android full support 57chrome android full support 57firefox android full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).opera android full support 43safari ios ...
...t 11samsung internet android full support 7.0nodejs full support 8.0.0legend full support full support no support no supportsee implementation
notes.see implementation
notes.
WebAssembly.Table() constructor - JavaScript
webassembly.instantiatestreaming(fetch('table2.wasm'), importobject) .then(function(obj) { console.log(tbl.length); console.log(tbl.get(0)()); console.log(tbl.get(1)()); });
note how you've got to include a second function invocation operator at the end of the accessor to actually invoke the referenced function and log the value stored inside it (e.g.
... desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jstable() constructorchrome full support 57edge full support 16firefox full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).ie no support noopera full support 44safari full support 11webview android full support ...
... 57chrome android full support 57firefox android full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).opera android full support 43safari ios full support 11samsung internet android full support 7.0nodejs full support 8.0.0legend full support full support no support no supportsee implementation n...
...otes.see implementation
notes.
WebAssembly.Table.prototype.get() - JavaScript
webassembly.instantiatestreaming(fetch('table.wasm')) .then(function(obj) { var tbl = obj.instance.exports.tbl; console.log(tbl.get(0)()); // 13 console.log(tbl.get(1)()); // 42 });
note how you've got to include a second function invocation operator at the end of the accessor to actually retrieve the value stored inside the reference (e.g.
... desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jsgetchrome full support 57edge full support 16firefox full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).ie no support noopera full support 44safari full support 11webview android full support ...
... 57chrome android full support 57firefox android full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).opera android full support 43safari ios full support 11samsung internet android full support 7.0nodejs full support 8.0.0legend full support full support no support no supportsee implementation n...
...otes.see implementation
notes.
WebAssembly.Table.prototype.set() - JavaScript
le length, and invoke the two referenced functions that are now stored in the table (the table2.wasm module (see text representation) adds two function references to the table, both of which print out a simple value): webassembly.instantiatestreaming(fetch('table2.wasm'), importobject) .then(function(obj) { console.log(tbl.length); console.log(tbl.get(0)()); console.log(tbl.get(1)()); });
note how you've got to include a second function invocation operator at the end of the accessor to actually invoke the referenced function and log the value stored inside it (e.g.
... desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jssetchrome full support 57edge full support 16firefox full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).ie no support noopera full support 44safari full support 11webview android full support ...
... 57chrome android full support 57firefox android full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).opera android full support 43safari ios full support 11samsung internet android full support 7.0nodejs full support 8.0.0legend full support full support no support no supportsee implementation n...
...otes.see implementation
notes.
WebAssembly.compile() - JavaScript
var worker = new worker("wasm_worker.js"); fetch('simple.wasm').then(response => response.arraybuffer() ).then(bytes => webassembly.compile(bytes) ).then(mod => worker.postmessage(mod) );
note: you'll probably want to use webassembly.compilestreaming() in most cases, as it is more efficient than compile().
... desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jscompilechrome full support 57edge full support 16firefox full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).ie no support noopera full support 44safari full support 11webview android full support ...
... 57chrome android full support 57firefox android full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).opera android full support 43safari ios full support 11samsung internet android full support 7.0nodejs full support 8.0.0legend full support full support no support no supportsee implementation n...
...otes.see implementation
notes.
encodeURIComponent() - JavaScript
t2)); // -_.!~*'() console.log(encodeuri(set3)); // # console.log(encodeuri(set4)); // abc%20abc%20123 (the space gets encoded as %20) console.log(encodeuricomponent(set1)); // %3b%2c%2f%3f%3a%40%26%3d%2b%24 console.log(encodeuricomponent(set2)); // -_.!~*'() console.log(encodeuricomponent(set3)); // %23 console.log(encodeuricomponent(set4)); // abc%20abc%20123 (the space gets encoded as %20)
note that a urierror will be thrown if one attempts to encode a surrogate which is not part of a high-low pair, e.g., // high-low pair ok console.log(encodeuricomponent('\ud800\udfff')); // lone high surrogate throws "urierror: malformed uri sequence" console.log(encodeuricomponent('\ud800')); // lone low surrogate throws "urierror: malformed uri sequence" console.log(encodeuricomponent('\udfff'));...
... //
note that although rfc3986 reserves "!", rfc5987 does not, // so we do not need to escape it replace(/['()]/g, escape).
... //
note that although rfc3986 reserves "!", rfc5987 does not, // so we do not need to escape it replace(/['()*]/g, c => "%" + c.charcodeat(0).tostring(16)).
... // i.e., %27 %28 %29 %2a (
note that valid encoding of "*" is %2a // 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.
var - JavaScript
'use strict'; console.log(x); // undefined (
note: not referenceerror) console.log('still going...'); // still going...
...
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.
... so you can just type: function foo() { string('s') //
note the function `string` is implicitly visible } ...because globalthis.hasownproperty('string') // true so the global object will ultimately be searched for unqualified identifiers.
...
note that the implication of the above, is that, contrary to popular misinformation, javascript does not have implicit or undeclared variables, it merely has a syntax that looks like it does.
Authoring MathML - MathML
note that by design, mathml is well-integrated in html5 and in particular you can use usual web features like css, dom, javascript or svg.
...to use it, just insert one line in your document header: <script src="https://fred-wang.github.io/mathml.css/mspace.js"></script> if you need more complex constructions, you might instead consider using the heavier mathjax library as a mathml polyfill: <script src="https://fred-wang.github.io/mathjax.js/mpadded-min.js"></script>
note that these two scripts perform feature detection of the mspace or mpadded elements (see the browser compatibility table on these pages).
...
note that ua string sniffing is not the most reliable method and might break from version to version: var ua = navigator.useragent; var isgecko = ua.indexof("gecko") > -1 && ua.indexof("khtml") === -1 && ua.indexof('trident') === -1; var iswebkit = ua.indexof('applewebkit') > -1 && ua.indexof('chrome') === -1; mathematical fonts in order to get a good layout or to allow different style, it's impor...
...this command will generate an xhtml+mathml document foo.xml from a foo.tex latex source: mk4ht mzlatex foo.tex # linux/mac platforms mzlatex foo.tex # windows platform
note that tex4ebook relies on tex4ht to generate epub documents.
Autoplay guide for media and Web Audio APIs - Web media technologies
note: put another way, playback of any media that includes audio is generally blocked if the playback is programmatically initiated in a tab which has not yet had any user interaction.
...
note: this approach doesn't differentiate between autoplay and the user starting playback manually.
...
note: it is strongly recommended that you use the autoplay attribute whenever possible, because support for autoplay preferences are more widespread for the autoplay attribute than for other means of playing media automatically.
...
note: the specified feature policy applies to the document and every <iframe> nested within it, unless those frames include an allow, which sets a new feature policy for that frame and all frames nested within it.
Digital audio concepts - Web media technologies
note: it's worth noting that some codecs will actually separate the left and right channels, storing them in separate blocks within their data structure.
...
note: network bandwidth is obviously not the same thing as audio bandwidth, which is discussed in sampling audio, above.
...
note: while a high-quality lossy compression algorithm's effect on sound quality may be difficult for the average person to detect, certain people have exceptionally good hearing, or are particularly adept at noticing the kinds of changes introduced to music by lossy compression techniques.
...
note: for a more detailed guide to choosing audio codecs, see choosing a codec in web audio codec guide.
OpenSearch description format
note: for icons loaded remotely (that is, from https:// uris as opposed to data: uris), firefox will reject icons larger than 10 kilobytes.
...
note: since this element is firefox-specific, and not part of the opensearch specification, we use the moz: xml namespace prefix in the example above to ensure that other user agents that don't support this element can safely ignore it.
... for example: <url type="application/opensearchdescription+xml" rel="self" template="https://example.com/mysearchdescription.xml" />
note: at this time, addons.mozilla.org (amo) doesn't support automatic updating of opensearch plugins.
... reference material opensearch documentation safari 8.0 release
notes: quick website search microsoft edge dev guide: search provider discovery the chromium projects: tab to search imdb.com has a working osd.xml opensearch plugin generator ready2search - create opensearch plugins.
baseline-shift - SVG: Scalable Vector Graphics
note: as a presentation attribute baseline-shift can be used as a css property.
...
note: this property is going to be deprecated and authors are advised to use vertical-align instead.
... as a presentation attribute, it can be applied to any element but it has effect only on the following four elements: <altglyph>, <textpath>, <tref>, and <tspan> usage
notes value <length-percentage> | sub | super default value 0 animatable yes sub the dominant-baseline is shifted to the default position for subscripts.
... candidate recommendation refers to the definition in css inline layout and
notes that vertical-align should be preferred.
stop-color - SVG: Scalable Vector Graphics
note: with respect to gradients, svg treats the transparent keyword differently than css.
...
note: as a presentation attribute, stop-color can be used as a css property.
... as a presentation attribute, it can be applied to any element but it has effect only on the following element: <stop> usage
notes value currentcolor | <color> <icccolor> default value black animatable yes currentcolor this keyword de
notes the current fill color and can be specified in the same manner as within a <paint> specification for the fill and stroke attributes.
... candidate recommendation added a
note that in svg the transparent keyword is treated differently than in css.
stroke-linejoin - SVG: Scalable Vector Graphics
note: as a presentation attribute stroke-linejoin can be used as a css property.
..."pink" /> <circle cx="5" cy="5.5" r="0.05" fill="pink" /> </g> <use xlink:href="#highlight" x="6" /> <use xlink:href="#highlight" x="12" /> <use xlink:href="#highlight" x="2" y="6" /> <use xlink:href="#highlight" x="8" y="6" /> </svg> usage context value arcs | bevel |miter | miter-clip | round default value miter animatable yes arcs
note: the arcs value as been introduced in svg2 and it isn't widely supported yet, see browser compatibility bellow for details.
...
note: if the stroke-miterlimit is exceeded, the line join falls back to bevel.
... r="0.05" fill="pink" /> <circle cx="3" cy="2" r="0.05" fill="pink" /> <circle cx="5" cy="5" r="0.05" fill="pink" /> <path d="m7,5 l0.75,-3 l0.75,3" stroke="pink" fill="none" stroke-width="0.025" /> <circle cx="7" cy="5" r="0.05" fill="pink" /> <circle cx="7.75" cy="2" r="0.05" fill="pink" /> <circle cx="8.5" cy="5" r="0.05" fill="pink" /> </g> </svg> miter-clip
note: the miter-clip value as been introduced in svg2 and it isn't widely supported yet, see browser compatibility bellow for details.
Using shadow DOM - Web Components
note: shadow dom is supported by default in firefox (63 and onwards), chrome, opera, and safari.
...
note that the shadow dom is not a new thing by any means — browsers have used it for a long time to encapsulate the inner structure of an element.
...
note: as this blog post shows, it is actually fairly easy to work around closed shadow doms, and the hassle to completely hide them is often more than it's worth.
... for example, take a look at this code from our popup-info-box-external-stylesheet example (see the source code): // apply external styles to the shadow dom const linkelem = document.createelement('link'); linkelem.setattribute('rel', 'stylesheet'); linkelem.setattribute('href', 'style.css'); // attach the created element to the shadow dom shadow.appendchild(linkelem);
note that <link> elements do not block paint of the shadow root, so there may be a flash of unstyled content (fouc) while the stylesheet loads.
Compiling a New C/C++ Module to WebAssembly - WebAssembly
it is enabled by default in firefox 52+ and chrome 57+/latest opera (you can also run wasm code in firefox 47+ by enabling the javascript.options.wasm flag in about:config, or chrome (51+) and opera (38+) by going to chrome://flags and enabling the experimental webassembly flag.)
note: if you try to open generated html file (hello.html) directly from your local hard drive (e.g.
...
note: you could specify outputting just the javascript "glue" file* rather than the full html by specifying a .js file instead of an html file in the -o flag, e.g.
...
note: we are including the #ifdef blocks so that if you are trying to include this in c++ code, the example will still work.
...(
note that we need to compile with no_exit_runtime, which is necessary as otherwise when main() exits the runtime would be shut down — necessary for proper c emulation, e.g., atexits are called — and it wouldn't be valid to call compiled code.) emcc -o hello3.html hello3.c -o3 -s wasm=1 --shell-file html_template/shell_minimal.html -s no_exit_runtime=1 -s "extra_exported_runtime_methods=['ccall...
Loading and running WebAssembly code - WebAssembly
the object looks like this: { module : module // the newly compiled webassembly.module object, instance : instance // a new webassembly.instance of the module object }
note: usually we only care about the instance, but it’s useful to have the module in case we want to cache it, share it with another worker or window via postmessage(), or simply create more instances.
...
note: the second overload form takes a webassembly.module object as an argument, and returns a promise directly containing the instance object as the result.
....instantiatestreaming(fetch('mymodule.wasm'), importobject) .then(obj => { // call an exported function: obj.instance.exports.exported_func(); // or access the buffer contents of an exported memory: var i32 = new uint32array(obj.instance.exports.memory.buffer); // or access the elements of an exported table: var table = obj.instance.exports.table; console.log(table.get(0)()); })
note: for more information on how exporting from a webassembly module works, have a read of using the webassembly javascript api, and understanding webassembly text format.
... the final code looks like this: request = new xmlhttprequest(); request.open('get', 'simple.wasm'); request.responsetype = 'arraybuffer'; request.send(); request.onload = function() { var bytes = request.response; webassembly.instantiate(bytes, importobject).then(results => { results.instance.exports.exported_func(); }); };
note: you can see an example of this in action in xhr-wasm.html.
Compiling from Rust to WebAssembly - WebAssembly
note: pay attention to the post-install
note about needing cargo's bin directory in your system path.
...$ mkdir site $ cd site $ npm link hello-wasm create a new file, package.json, and put the following code in it: { "scripts": { "serve": "webpack-dev-server" }, "dependencies": { "hello-wasm": "^0.1.0" }, "devdependencies": { "webpack": "^4.25.1", "webpack-cli": "^3.1.2", "webpack-dev-server": "^3.1.10" } }
note that you need to fill in your own username, after the @, in the dependencies section.
...e it the following contents: <!doctype html> <html> <head> <meta charset="utf-8"> <title>hello-wasm example</title> </head> <body> <script src="./index.js"></script> </body> </html> finally, create the index.js referenced in the html file and give it these contents: const js = import("./node_modules/hello-wasm/hello_wasm.js"); js.then(js => { js.greet("webassembly"); });
note that you need to fill in your npm username again.
...
note how there's nothing special here, yet we're calling into rust code.
Private Properties - Archive of obsolete content
however,
note that weakmaps might not be supported by all implementations yet.
...s another common technique, is to define private properties as variables and their getter and setter functions as a closure over these variables: function point(_x, _y) { this.getx = function () { return _x; }; this.setx = function (x) { _x = x; }; this.gety = function () { return _y; }; this.sety = function (y) { _y = y; }; }
note that this technique requires member functions that need access to private properties to be defined on the object itself, instead of its prototype.
...amespace"); var internal = ns(); function point(x, y) { internal(this).x = x; internal(this).y = y; } point.prototype.getx = function () { return internal(this).x; }; point.prototype.setx = function (x) { internal(this).x = x; }; point.prototype.gety = function () { return internal(this).y; }; point.prototype.sety = function () { internal(this).y = y; }; as a final
note, the function ns returns a namespace that uses the namespace associated with the prototype of the object as its prototype.
context-menu - Archive of obsolete content
for example, this item appears whenever the context menu is invoked on a page that contains at least one image: require("sdk/context-menu").item({ label: "this page has images", contentscript: 'self.on("context", function (node) {' + ' return !!document.queryselector("img");' + '});' });
note that the listener function has a parameter called node.
... therefore, to handle an item click, listen for the "click" event in that item's content script like so: require("sdk/context-menu").item({ label: "my item", contentscript: 'self.on("click", function (node, data) {' + ' console.log("item clicked!");' + '});' });
note that the listener function has parameters called node and data.
...
note that when you have a hierarchy of menu items the click event will be sent to the content script of the item clicked and all ancestors so be sure to verify that the data value passed matches the item you expect.
core/heritage - Archive of obsolete content
to do that we need to freeze constructor's prototype chain to make sure functions are frozen: object.freeze(dog.prototype); object.freeze(pet.prototype);
note: also, this is not quite enough as object.prototype stays mutable & in fact we do little bit more in sdk to address that, but it's not in the scope of this documentation.
...ruff!' } });
note: we use term class to refer an exemplar constructs in a form of constructor functions with a proper prototype chain setup.
...ruff!' please
note that class is just an utility function which we use in sdk, and recommend our users to use it, but it's in no way enforced.
core/promise - Archive of obsolete content
note: a promise can be rejected or resolved only once.
...in the following example we implement functions that take multiple promises and return one that resolves to first one being fulfilled: function race() { let { promise, resolve } = defer(); array.slice(arguments).foreach(function(promise) { promise.then(resolve); }); return promise; } var asyncaorb = race(readasync(urla), readasync(urlb));
note: that this implementation forgives failures and would fail if all promises fail to resolve.
...in such cases it's usually easier to wrap value into promise than branch on value type: function or(a, b) { var second = resolve(b).then(function(bvalue) { return !!bvalue }); return resolve(a).then(function(avalue) { return !!avalue || second; }, function() { return second; }) }
note: we could not use promised function here, as they reject returned promise if any of the given arguments is rejected.
dev/panel - Archive of obsolete content
note that at the moment you can't debug remote targets (for example, firefox os, the firefox os simulator, or firefox for android) using tools developed with this api.
...from the add-on"); } }); // export the constructor exports.mypanel = mypanel; // create a new tool, initialized // with the new constructor const mytool = new tool({ panels: { mypanel: mypanel } }); in the panel document script: // my-panel.js window.addeventlistener("message", function(event) { var content = document.getelementbyid("content"); content.textcontent = event.data; });
note that at the moment you have to pass an array of ports into postmessage, even if you don't need to use them: // main.js // require the sdk modules const { panel } = require("dev/panel"); const { tool } = require("dev/toolbox"); const { class } = require("sdk/core/heritage"); const mypanel = class({ extends: panel, label: "my panel", tooltip: "my new devtool's panel", icon: "./my-icon.pn...
...
note that at the moment volcan.js does not support the complete remote debugging protocol.
test/assert - Archive of obsolete content
notequal(actual, expected, message) tests that two objects are not equal, using !=: assert.
notequal(1, 2, "test that one is not two"); parameters actual : object the actual result.
...
note: this accounts for both named and indexed properties on arrays.
... notstrictequal(actual, expected, message) tests that two objects are not equal, using the negation of the strict equality operator ===: // this test will fail, because "==" will perform type conversion exports["test coercive equality"] = function(assert) { assert.
notequal(1, "1", "test coercive equality between 1 and '1'"); } // this test will pass, because the types are different exports["test strict equality"] = function(assert) { assert.notstrictequal(1, "1", "test strict equality between 1 and '1'"); } parameters actual : object the actual result.
Forms related code snippets - Archive of obsolete content
date picker (before implementing it in a working environment, please read the
note about the const statement compatibility) <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>datepicker example - mdn</title> <script type="text/javascript"> /*\ |*| |*| datepicker example mdndeveloper network |*| |*| https://developer.mozilla.org/docs/code_snippets/forms |*| https://developer.mozilla.org/user:fusionchess |*| |*| this snippet is released under the gnu public license, version 3 or later.
... center; vertical-align: middle; } td.zdp-active-cell:hover { background-color: #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.
...
note: the filereader() constructor was not supported by internet explorer for versions before 10.
QuerySelector - Archive of obsolete content
along the lines of other frameworks such as jquery or prototype, shortening the "queryselector" name can be convenient: function $ (selector, el) { if (!el) {el = document;} return el.queryselector(selector); } function $$ (selector, el) { if (!el) {el = document;} return el.queryselectorall(selector); //
note: the returned object is a nodelist.
... // if you'd like to convert it to a array for convenience, use this instead: // return array.prototype.slice.call(el.queryselectorall(selector)); } alert($('#myid').id); (
note that while using the firefox web console, the above functions are available automatically.) both xul and even xml can be easily made supportable (an alternative approach to the following would be to add chromewindow.prototype or window.prototype, accessing this.document.queryselector, or following the jquery style of chaining by returning 'this' within each prototype method of $()): htmldocument.prototype.$ = function (selector) { // only for html return this.queryselector(selector); }; example: <h1>test!</h1> <script> htmldocument.prototype.$ = function (selector) { return this.queryselector(select...
...e.$ = function (selector) { return this.queryselector(selector); }; var xulns = 'http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'; alert(document.getelementsbytagnamens(xulns, 'hbox')[0].$('vbox').nodename); // vbox ]]></script> xml example: <foo xmlns="somens"><bar/></foo> in document earlier var foo = document.getelementsbytagnamens('somens', 'foo')[0]; alert(foo.$('bar'));
note that for plain xml, the # 'id' selector will not work with an 'id' attribute (since a such-named attribute need not necessarily be of type id in xml, though it is in html and xul), nor will it work with xml:id.
How to convert an overlay extension to restartless - Archive of obsolete content
(
note that the usage of an octal integer literal, while standard for handling permissions, is dangerous and deprecated; usage of use es5 strict mode to disable this and other foot-guns is recommended) if you need to read/manipulate binary data, a nsibinaryinputstream instance is what you'll use on that stream (e.g.
...) { logerrormessage("error attempting to load: " + url); returnresult(null); }; request.onload = function(event) { if (request.response) returnresult(request.response); else request.onerror(event); }; request.send(); } loadfile("chrome://myaddon/content/filename.ext",datatype,function(data) { /* do stuff with data */ });
note: when using xmlhttprequest to access a file:// url the request.status is not properly set to 200 to indicate success.
... also
note that once you do get this all up and running, your users will still have to restart firefox once to install your first restartless update.
Inline options - Archive of obsolete content
here is an example of an options.xul file: <?xml version="1.0"?> <!doctype mydialog system "chrome://myaddon/locale/mydialog.dtd"> <vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <setting type="bool" pref="extensions.myaddon.bool" title="boolean" desc="stored as a boolean preference" /> </vbox>
note that it's limited to <setting> tags.
... <setting pref="extensions.throbberrestored.showtxtontoolbar" title="show text on toolbar button" type="bool" oninputchanged="alert('new value is = ' + this.value); this.style.backgroundcolor='red';"> if labels on other toolbar buttons are visible (like by using add-on "classic theme restorer") then show label on throbber toolbar button </setting>
note in order for the oninputchanged to execute, the setting must have a pref attribute, otherwise the oninputchanged will not trigger.
...
note: starting in gecko 13.0, you can also listen for the addon-options-hidden notification, which has the same subject and data as above, to find out when the ui is about to be removed.
Appendix C: Avoiding using eval in Add-ons - Archive of obsolete content
note: do not use json parsers implemented in javascript.
...
note: it is not safe to remove such an override again, as this method constitutes in a single-linked function chain.
...
note: there are still some scenarios where incompatibilities may arise, such as trying to cancel the function call under a certain set of conditions when other add-ons have overridden the same function.
Connecting to Remote Content - Archive of obsolete content
note: requests can take a long time to process and you don't want users to be stuck waiting while a request is obtained and processed.
...
note: security should be your number one priority when handling remote content.
...
note: you should always test your connection code to cover edge cases, like when there is no internet connection, or the computer is connected to a local network with no internet access (like at an airport or hotel room).
Intercepting Page Loads - Archive of obsolete content
note: performance is very important when it comes to add-ons and page loads.
...
notes on usage: efficiency is very important when adding http observers.
...in this case, your best bet is to use onstatechange, and filter to when the state flags indicate a document has begun being loaded: if ((astateflags & components.interfaces.nsiwebprogresslistener.state_start) && (astateflags & components.interfaces.nsiwebprogresslistener.state_is_document))
note the use of the binary mask & operator.
Local Storage - Archive of obsolete content
« previousnext »
note: you may rather be looking for dom storage (localstorage, etc.), unless you really are doing xul development.
...appender = new log4moz.rotatingfileappender(logfile, formatter); appender.level = log4moz.level["all"]; root.addappender(appender); after that, you can create a logger object for any object in your project like this: this._logger = log4moz.repository.getlogger("xulschool.someobject"); this._logger.level = log4moz.level["all"];
note: we recommend that you create a logger instance in the constructor of every object and store it in a private variable.
...
note: we recommend that all exception catch blocks include some logging at the error or warn levels, and in general you should use logging freely in order to have as much information as possible to fix bugs and know what is going on.
The Box Model - Archive of obsolete content
note that this is not always the case.
...
note that, again, this can depend on the contents of the elements, in this case, the labels and paddings in the buttons.
...
note that this is not really what you would expect from an extension, it's more like a theme.
XPCOM Objects - Archive of obsolete content
it is particularly important to
note that, for every member in the component, you'll see in what interface this member is defined.
...
note the metadata included in the square brackets, indicating that the parameter is an array, and that its size is determined by the acount parameter.
... } }; finally, here's a table summarizing the types you will most likely encounter in xpcom interfaces, and how to handle them: js type idl types
notes strings autf8string, string, wstring, char*, others historically there have been several string types in xpcom.
Firefox addons developer guide - Archive of obsolete content
rules: file and directory names: italic method and variable names: class name if you want to add a fixme, add: fixme: a message
notes: the original document is in japanese and distributed via the xuldev.org website.
... instead of using foot
notes, we should inline these
notes into the body of the article.
... todo: all fixme
notes inside the documents; add abbreviation definition to acronyms; add some link to the internal mdc documentation when it makes sense; indent source code; make sure documentation is relevant for all platforms: gnu/linux, macos, windows; add anchor links to figures & listings; add credits to original authors and license; completed sometimes, interfaces names are misspelled: s/nsl/nsi; talk a...
Using the Stylesheet Service - Archive of obsolete content
note that ua stylesheets are allowed to do certain unsafe things that user stylesheets are not allowed to do.
...s = components.classes["@mozilla.org/content/style-sheet-service;1"] .getservice(components.interfaces.nsistylesheetservice); var ios = components.classes["@mozilla.org/network/io-service;1"] .getservice(components.interfaces.nsiioservice); var uri = ios.newuri("chrome://myext/content/myext.css", null, null); sss.loadandregistersheet(uri, sss.user_sheet);
note: loadandregistersheet will load the stylesheet synchronously, so you should only call this method using local uris.
... usage
notes stylesheets added using this service get applied to both chrome and content documents.
Adding preferences to an extension - Archive of obsolete content
please
note that if you are using code from this tutorial to add to an existing extension, you must uninstall and reinstall your extension to enable the preferences button for your extension in the add-ons list.
...
note that this call results in our stockwatcher.observe() method being invoked and displayed stock information being updated.
...chg: " + fieldarray[4] + " | " + "open: " + fieldarray[5] + " | " + "low: " + fieldarray[6] + " | " + "high: " + fieldarray[7] + " | " + "vol: " + fieldarray[8]; } } var httprequest = new xmlhttprequest(); httprequest.open("get", fullurl, true); httprequest.onload = inforeceived; httprequest.send(null); } }
note that we use stockwatcher.tickersymbol here instead of this.tickersymbol to get the stock symbol to watch.
Locked config settings - Archive of obsolete content
this file also needs to be "called" from c:\program files\mozilla.org\mozilla\defaults\pref\all.js by appending the following line at the end: pref("general.config.filename", "mozilla.cfg");
note: newer versions of mozilla or firefox store the all.js file in greprefs rather than defaults\pref the moz-byteshift.pl script allows to encode...: moz-byteshift.pl -s 13 <mozilla.cfg.txt >mozilla.cfg ...
...
note that the file must start with //, or else it is not recognized by mozilla.
...
note: in recent versions of mozilla (tested on windows and linux, with 1.5, 1.6 and 1.7b), the mozilla.cfg file needs to be placed in mozilla's root directory, rather than default\pref where all.js resides.
Automatically Handle Failed Asserts in Debug Builds - Archive of obsolete content
the valid values are: 0x5 automatically ignore 0x4 automatically retry 0x3 automatically abort
note that you can also force windbgdlg to prompt, by setting a value of 0xfffffffe.
...as an example, consider the following failed assertion: assertion: no document: 'mdocument != nsnull', file d:/cvs-1.11.4/mozilla/content/xul/content/src/nsxulelement.cpp, line 3173 (
note that i have my source tree in d:/cvs-1.11.4/mozilla) if you have a dword in hkcu\software\mozilla.org\windbgdlg\ named "d:/cvs-1.11.5/mozilla/content/xul/content/src/nsxulelement.cpp," (with the comma - matches are whole-word only) and value 0x5, the assert would automatically be ignored.
...
note that double quotes which delimit an item (") are ignored in value names and the assertion string, so "silly" and silly will both be matched by a value named silly.
Repackaging Firefox - Archive of obsolete content
note that you must know which preferences are localizable and which ones aren't.
...
note that the app.partner.'name' setting uses the same value for both the name and the value of the preference.
...
note that this does not change the order of the search engines in the drop-down, only selects the default.
Using microformats - Archive of obsolete content
note: if a microformat by the specified name already exists, it is replaced by the new one.
...
note: you can simply call debug() on a microformat object: microformatobject.debug() instead of using this method if you prefer.
...
note: this method doesnot return true if the node is a child of a microformat.
JavaScript Client API - Archive of obsolete content
please
note that usage of the sync apis is governed by a terms of service: by accessing or using the firefox sync apis in connection with the development of your own client software to access the firefox sync services (a “third party client”), you acknowledge that you will need to install and use a local version of the firefox sync server for multiple account testing and that any use of mozilla’s hosted firefox syn...
...depending of what type of data you're working with, you might already have guids built into your data that you can make use of (
note that guids must be allowed to change and should be url friendly).
...
note that this may unnecessarily slow down // things for users who don't use sync.
Introducing the Audio API extension - Archive of obsolete content
please
note that this document describes a non-standard experimental api.
...it's important to
note that the samples are not separated by channels; they are all delivered together.
...it's important to
note that not all the samples might get written in the stream.
Makefile.mozextension.2 - Archive of obsolete content
note that the original makefile.mozextention merely repeats the steps in getting started with extension development - mozillazine knowledge base (2008).
...
note: unfortunately, this wiki system at developer.mozilla.org will try to parse xml declarations - even if they are within a pre tag!!
...efile.mozextension2 ## file: makefile.mozextension2 ## based on http://kb.mozillazine.org/makefile_for_packaging_an_extension ## "this makefile.mozextention is for the test extension" ## the original makefile.mozextention reconstructs http://kb.mozillazine.org/getting_started_with_extension_development # call with: # make -f makefile.mozextension2 make_structure ## (without args for 'all') #
note: @echo silent; without @ the command is written in stdout project=test project_name=testworld #~ project_id={xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} project_id=test@testworld.ext project_version=1.0 project_desc="a $(project_name) project with advanced features" project_author=author name # mkdir=$(shell which mkdir) mkdir=/bin/mkdir zipprog=/usr/bin/zip shell = /bin/sh noop = $(shell) -c tru...
Microsummary XML grammar reference - Archive of obsolete content
note: although the <template> element must be in the microsummaries namespace (http://www.mozilla.org/microsummaries/0.1), its <stylesheet>/<transform> child element must be in the xslt namespace (http://www.w3.org/1999/xsl/transform).
...the following example identifies a generator as being able to summarize all pages on the www.example.com web site except pages named about.html: <pages> <include> ^http://www\.example\.com/ </include> <exclude>/about\.html</exclude> </pages>
note: regular expressions intended to match the beginnings of page urls should start with the caret (^) to ensure they do not inadvertently match urls which merely contain the urls they intend to match.
...
notes: regardless of the absolute or conditional update interval specified by this element, firefox will never update microsummaries more frequently than once per minute; because firefox checks for expired microsummaries every 15 seconds, it is possible for a microsummary update to begin up to 15 seconds later than its interval indicates; firefox respects the browser cache when updating microsu...
PyDOM - Archive of obsolete content
note that we don't actually 'import' anything here - the scripts and event handlers do not exist in a python module.
...
note that you can stick arbitrary values on any dom object - this is what js calls 'expandos'.
... for example, let's say you have xul similar to pyxultest: top-level script code says something like: button = document.getelementbyid("some-button") button.foo = 0 and the button itself might look like: <button id="some-button" label="click here" onclick="event.target.foo += 1; print 'foo is now', event.target.foo"/>
note that (a) we have stuck an arbitrary attribute on a dom element and (b) in all cases (e.g., event handler and top-level script), the dom node needs to be explicitly specified - the globals are the window itself.
Frequently Asked Questions - Archive of obsolete content
note: this page is extremely out of date.
...
note that this capability was added to support legacy content.
...if you don't have an irc client then install chatzilla into mozilla/mozilla firefox (
note it may already be built in).
Space Manager Detailed Design - Archive of obsolete content
*/ nsiframe* getframe() const { return mframe; } implementation
notes algorithm 1: getbanddata getbanddata is used to provide information to clients about what space if available and unavailable in a band of space.
... check if the occupied space rect (adjusted) is empty, if so, return an error (
note: this could be done earlier, or prevented by the caller) allocate a new bandrect instance with the rect and frame as constructor arguments, and insert it into the collection via insertbandrect insertbandrect: internal method to insert a band rect into the bandlist in the correct location.
... cross-component algorithms tech
notes original document information author(s): marc attinasi other contributors: david baron, josh soref last updated date: november 25, 2005 ...
Standalone XPCOM - Archive of obsolete content
the contents of this standalone xpcom in general are: nspr : mozilla/nsprpub xpcom : mozilla/xpcom
note 1: xpcom apis are not frozen yet.
...
note 2: xpcom standalone differs from the xpcom built with mozilla.
...(
note the dot).
Using cross commit - Archive of obsolete content
if you don't, however, then from the parent directory of your source dir, do: cvs co mozilla/tools/cross-commit
note that you will need to have $cvsroot and such set up correctly for this to work.
...nk # update to the first branch you want to land on cvs update -rmozilla_1_8_branch layout/base/nscaret.h # modify the files (probably by applying the patch) patch -p0 < ~/caret.patch # commit on all the branches at once # make sure to use -m "commit message" when doing so tools/cross-commit --moz18 --branch mozilla_1_8_0_branch -m "fix some sort of security bug" layout/base/nscaret.h
notes
note that you must use a -m option with a cvs checkin message.
...(although it works without specifying -m on the command line if you are using x-enabled emacs on linux.) also
note that if you don't specify any branches to commit on, cross-commit will commit to the trunk and the mozilla_1_8_branch by default.
Writing textual data - Archive of obsolete content
the example above passes 0 as the third argument, which disables buffering (
note: the implementation of the converter stream might not support buffering).
...
note: if the replacement character is not a supported character in the chosen character encoding, attempts to write unsupported characters will fail with ns_error_loss_of_significant_data.
...
note that not many character encodings need it, but for those that do calling this is important for proper output.
Using XPInstall to Install Plugins - Archive of obsolete content
here is an example: var plid = "myplugin.plug/version=6.5"; err = initinstall(software_name, plid, version); if (err != 0) { // install may have failed because of n6 and = // replace plid with a simple string err = initinstall(software_name, "mypluginstring", version); if (err != 0) cancelinstall(err); }
note that above, the plid contains an "=" and in case the xpi package is running on browsers that treat "=" as an illegal token, the workaround is to handle the error and invoke initinstall again.
...
note: xpi packages (files with the xpi extension) use the application/x-xpinstall mime type.
...
note: xpi packages (files with the xpi extension) use the application/x-xpinstall mime type.
confirm - Archive of obsolete content
see the
notes at the end of this document for a safe way to implement a fallback.
...
note that this only applies to buttons 0 and 2, not button 1 (the "cancel" button).
...
notes the preferred method for detecting support for custom dialog boxes is querying the existence of the button constants.
Properties - Archive of obsolete content
note that spaces in the arg string are legal.
...
note that due to branching (different versions of gecko with different feature sets might be built on the same day), using this property to "detect" the application version may produce false results.
...
note, even if triggered using relative urls this will show the full url (after qualification).
A XUL Bestiary - Archive of obsolete content
this xul
note presents some of the key concepts and terms in the xul development environment.
...
note that when no file name is specified after the chrome directory path, a file name with the same name as the package is assumed.
...
note that the menu element includes both the opening tag at the top and the closing tag at the bottom of the example.
sizemode - Archive of obsolete content
note: when a window is minimized, the sizemode attribute is not updated.
...
note: prior to gecko 13.0, this did not work on mac os x.
...
note: prior to gecko 1.9.2, this was not always reliable.
Building accessible custom components in XUL - Archive of obsolete content
note: the row and column headers are de
noted by description elements, and individual cells are de
noted by label elements.
...
note that when we recreate the label element after editing, we need to explicitly restore the role attribute of the label, so that assistive technologies will continue to treat it as a cell within the spreadsheet.
...
note that the role is once again "cell", since we explicitly set it when we recreated the label element.
XUL Events - Archive of obsolete content
if you capture this event at the document level, you can be notified of document changes warning: it should be
noted that the addition of any mutation event listeners to a document degrades the performance of subsequent dom operations in that document, and that removing the listeners later does not mitigate or reverse the effect.
...
note that the close event is only fired when the user presses the close button on the titlebar; (i.e.
...
note: this event may fire several times or while resizing the window (for example, see bug 715867), so always check if the window state changed by inspecting window.windowstate in the event.
Tooltips - Archive of obsolete content
note that tooltips can only be activated using the mouse, so they should never contain important information that isn't available elsewhere.
...
note that the tooltip text 'file buttons' isn't a good tooltip to use either.
...
note that when using a specialized tooltip element, any labels used inside it are not populated based on what the tooltip applies to, so you may need to set the content in a tooltip if you wish to use the same tooltip for several elements.
Building Trees - Archive of obsolete content
note: while a tree builder can only be used with trees, a content builder can be used with any type of content.
...id="name" label="name" flex="1"/> <treecol id="date" label="date" flex="1"/> </treecols> <template> <treechildren> <treeitem uri="rdf:*"> <treerow> <treecell label="rdf:http://purl.org/dc/elements/1.1/title"/> <treecell label="rdf:http://purl.org/dc/elements/1.1/date"/> </treerow> </treeitem> </treechildren> </template> </tree>
note: the tree columns (treecols) are declared outside the template as static content, since they only need to be declared once.
...
note: if you want to have the state of the disclosure triangles ("twisties") be persistent, be sure to give each node a unique "id" attribute.
Multiple Rules - Archive of obsolete content
note that only the first rule, in the order that the rules appear in the template, that matches for a result is used, not all of them that match.
...
note that the full query syntax must be used to use conditions within rules.
...
note the assign element in the example above, used to calculate the '?letters' variable from the length of the name, minus one for the space character.
Special Condition Tests - Archive of obsolete content
note the parent attribute on the rule element, set to the value vbox.
...
note that leaving out the iscontainer attribute is not the same as setting it to either true or false.
...
note that both the iscontainer and isempty attributes are only available for rdf datasources and for rules that use the simple syntax.
XML Templates - Archive of obsolete content
note: if you want to have the state of the disclosure triangles ("twisties") be persistent, be sure to give each node a unique "id" attribute.
... <vbox datasources="people.xml" ref="*" querytype="xml"> <template> <query expr="person"/> <action> <hbox uri="?" align="center"> <button label="?name"/> <label value="?gender"/> </hbox> </action> </template> </vbox>
note how two attributes are substituted here, the label on the button and the value on the label.
...
note the only change is that the addition of the xmlns attribute on the data; this is used to clear the namespace used for the elements in the data, otherwise they become xul elements.
Accesskey display rules - Archive of obsolete content
and also
note that there are no spaces between the original labels and accesskey text in the above japanese example.
...
note that using '&' in label text is bad way.
...for this issue, we recommend the following format if you use .properties: <command-name>.label=cancel <command-name>.accesskey=c
note that apis of nsipromptservice are using the bad way.
Adding Buttons - Archive of obsolete content
note: buttons support more attributes than those listed above.
... <button id="find-button" label="find"/>
note: firefox does not allow you to open chrome windows from web pages, so the view links in the tutorial will open in normal browser windows.
...
note: you should not put text labels directly in the xul file.
Box Objects - Archive of obsolete content
*
note that x, y refers to the portion of the element that is just inside any borders, which is inconsistent with the other four boxobject position and size references, which include borders as part of the element.
...
note that retrieving these values will return the size only if it was explicitly specified.
... oncommand="document.getelementbyid('thelabel').hidden = false;"/> <button label="collapse" oncommand="document.getelementbyid('thelabel').collapsed = true;"/> <button label="uncollapse" oncommand="document.getelementbyid('thelabel').collapsed = false;"/> <button label="show position/size" oncommand="showpositionandsize();"/> <label id="thelabel" value="i am a label"/>
note that if you hide and collapse the label, it will be treated as hidden.
Creating a Window - Archive of obsolete content
note that you would normally import the global style sheet from within your own style sheet file.
...
note that this url is never actually downloaded.
...
note: the local xul document can be opened in the browser as mentioned above only if |dom.allow_xul_xbl_for_file| preference in "about:config" has been set to |true| .
Custom Tree Views - Archive of obsolete content
note: the tree-related interfaces changed in gecko 1.8.
... one thing to
note is that the getcelltext() function is only called when necessary to display the contents.
...
note that the view object is also available for trees using the built-in content view.
Keyboard Shortcuts - Archive of obsolete content
the key attribute (
note that it has the same name as the element itself) can be used to indicate which key should be pressed, in this case r.
...
note that textboxes have the clipboard shortcuts built-in so you don't have to implement them yourself.
...
note that the event will be called as soon as the key is pressed, even if it hasn't been released yet.
Localization - Archive of obsolete content
note: you should encode dtd files as utf-8 for non-ascii characters.
...
note that entity declarations do not have a trailing slash at the end of them.
...
note that the name of the entity is not important.
More Button Features - Archive of obsolete content
note that you really should put the style declarations in a separate style sheet.
...
note that the two attributes are not specified when the default value can be used.
...
note that selecting one of these menu items does not change the label on the button, unlike a menulist.
More Event Handlers - Archive of obsolete content
note that preventing the default action is not the same as stopping event propagation with the stoppropagation method.
...
note that once propagation or the default action has been prevented, neither may be re-enabled again for that event.
...
note that the event argument must be passed to the updatemousecoordinates function.
Popup Menus - Archive of obsolete content
also
note that it is possible to open context menus without using the mouse, for example by pressing the menu key on a keyboard.
...
note that the tooltip element is still placed inside a popupset element like other popup types.
...
note that the textbox has its own built-in popup menu which will override the one we specified.
Tree Selection - Archive of obsolete content
for example, the following code will select the row at index 5: tree.view.selection.select(5);
note that you should not just change the tree's currentindex property to change the selection.
...
note that rows nested inside containers that are not open will not be selected.
...
note that rows 2 and 7 will also be selected.
Using nsIXULAppInfo - Archive of obsolete content
note that while firefox 1.5, thunderbird 1.5, and xulrunner 1.8-based applications support nsixulappinfo, older applications, such as firefox and thunderbird 1.0, do not support it.
...-4b8e-4d2a-b7eb-24ecf4f6b63a}"; var appinfo = components.classes["@mozilla.org/xre/app-info;1"] .getservice(components.interfaces.nsixulappinfo); if(appinfo.id == firefox_id) { // running under firefox } else if(appinfo.id == thunderbird_id) { // running under thunderbird } else if(appinfo.id == seamonkey_id) { // running under seamonkey } else { // another app }
note: you could also use nsixulappinfo.name, which is a human-readable name for the application, such as "firefox", "thunderbird" or "seamonkey", but who knows, maybe they'll rename it again!
...
note: nsixulappinfo provides information about the application and the platform, be careful to use the right one, especially when dealing with xulrunner-based applications.
XML - Archive of obsolete content
note that our language doesn't suffice to describe the content of the memo, which is written in english.
...an actual memo using the memoml to represent itself might look like this: <memo> <from>ian oeschger</from> <to>steve rudman</to> <body>i think the first draft of the guide is done!</body> </memo>
note how the memo element -- the root element in our brief definition, ordeclaration, above -- surrounds the other three elements.
...html -- which is a derived language like our memoml (see the appendix
notes for information on the geneology of markup languages) -- has been created for the purposes of representing hypertext documents and the basic relationships between them.
scrollbox - Archive of obsolete content
note that a scrollbox doesn't cause scrollbars to be displayed.
...
note that this example doesn't use a scrollbox tag; you only need that tag if you want to programmatically scroll in addition to the automatic scroll bars.
...
note: avoid nested scroll boxes; it's maddening for the experienced user and confusing for the less experienced user.
Debugging a XULRunner Application - Archive of obsolete content
note that -console goes after the application.ini argument: e.g.
...
note: if you are not using the stub executable to launch the application, the -jsconsole argument is after the application.ini argument: e.g.
...
note the "new in firefox 3" attribute "contentaccessible" on https://developer.mozilla.org/en/chrome_registration so as per http://markmail.org/message/ezbomhkw3bgqjllv#query:x-jsd+page:1+mid:xvlr7odilbyhn6v7+state:results change the manifest to have this line: content venkman jar:venkman.jar!/content/venkman/ contentaccessible=yes i get errors about not being able to open contentareautils.js, cont...
XUL Application Packaging - Archive of obsolete content
note: for instructions on deploying your applications see deploying xulrunner.
... optional - default is 0
note: this option does not add menu items that make the extension/theme manager available in the ui; that is the responsibility of the application author.
... optional - default is 0
note: the application author is responsible for implementing the nsiprofilemigrator interface; if an implementation is not found no migration will be performed.
Gecko Compatibility Handbook - Archive of obsolete content
**
notes ** - the solution quick reference needs more attention.
... <style type="text/css"> #id1 { text-decoration: line-through; } #id1 { text-decoration: underline; } </style> <div id="id1"> should be line-through </div> <div id="id1"> should be underline </div> -(example removed)-
note that the w3c's html validator will flag html id attributes as duplicates if they only differ due to case.
... for more detail on this issue, please read
notes on tls - ssl 3.0 intolerant servers.
Mozilla release FAQ - Archive of obsolete content
webpages mozilla project homepage netscape developer program website mozillazine (news service) mozilla evangelism effort mozdev projects irc server: irc.mozilla.org channel #mozillazine
note that recent versions of mozilla include an irc client.
...netscape.public.mozilla.patches
note that context-sensitive patches (diff -c) are preferred over other formats.
...drop a
note to pat gunn .
2006-10-13 - Archive of obsolete content
(meeting
notes) bon echo status meeting a bon echo status meeting was held on oct.
... 10 (meeting
notes) gecko 1.9/gran paradiso status meeting a gecko 1.9/gran paradiso status meeting was held on oct.
... 11 (
notes) ...
NPP_NewStream - Archive of obsolete content
implementation
note: some plugins, notably silverlight, do not set this outparam, and rely on the outparam being initialized to a default np_normal value.
...
note: most plug-ins that need the stream saved to a file should use the more efficient mode np_asfileonly (above); this mode is preserved for compatibility only.
...
note: in any mode other than np_seek, the application should call npp_destroystream once all data in the stream has been written to the plug-in.
What is RSS - Archive of obsolete content
note: if you provide a non-password-protected rss feed, you are implicitly giving everyone permission to use the contents in you rss feed in almost any way they see fit.
...t, 14 may 2005 09:55:59 -0500</pubdate> <link>http://joe-blow.example.net/log/19</link> </item> <item> <title>black cat spotted</title> <guid>http://joe-blow.example.net/log/18</guid> <pubdate>fri, 13 may 2005 13:13:13 -0500</pubdate> <link>http://joe-blow.example.net/log/18</link> </item> </channel> </rss>
note: broadcasting of internet radio is sometimes call podcasting, ipradio, and audio blogging.
...
note: these rss examples are very very simple.
Version - Archive of obsolete content
note: in the list below, although rss 1.0 seems to be out of place, it is actually in the correct place chronologically.
...
note: there are 3 different versions of rss 0.91.
...
note: rss 0.93 and rss 0.94 were only ever released as "drafts" and never became "final" and thus were not meant to actually be used.
Using the W3C DOM - Archive of obsolete content
object properties are not supported in the w3c document object model: document.layers[] id_attribute_value document.all document.all.id_attribute_value document.all[id_attribute_value] the following form related properties (originally from internet explorer) are not supported in the w3c document object model: formname.inputname.value inputname.value formctrlname document.forms(0) (
note: document.forms[0] (using square brackets) uses the dom standard forms collection) scripts that use these properties will throw errors in most standards-compliant browsers.
...for example, the following short sample dynamically sets the left margin of a <div> element with an id of "inset" to half an inch: // in the html: <div id="inset">sample text</div> document.getelementbyid("inset").style.marginleft = ".5in";
note: internet explorer 5 through 7 have a flawed implementation of getelementbyid(), which returns the first element with a matching name or id (id versus name when using getelementbyid, msdn: getelementbyid method).
...cument.forms["formname"].inputname.value or document.forms["formname"].elements["inputname"].value formctrlname document.forms["formname"].formctrlname or document.forms["formname"].elements["formctrlname"] document.forms(0) document.forms[0] more on accessing forms and form elements: referencing forms and form controls by comp.lang.javascript newsgroup faq
notes dom 2 specification on accessing forms and form elements referencing forms and form elements correctly, javascript best practices, by matt kruse for accessing a group of elements, the dom specification also includes getelementsbytagname, which returns a nodelist of all the elements with the given tag name in the order they appear in the document: var arrcollection_of_pargs = document.getelem...
Processing XML with E4X - Archive of obsolete content
this node has one attribute, type, which can be accessed and updated in a number of ways: alert(languages.@type); // alerts "dynamic" languages.@type = "agile"; alert(languages.@type); // alerts "agile" alert(languages.tostring()); /* alerts: <languages type="agile"><lang>javascript</lang><lang>python</lang></languages> */
note that if one wishes to make comparisons of retrieved attributes with other strings, it is necessary to convert the attribute first, even though the attribute may be converted to a string when used in other contexts (such as insertion into a textbox).
...continuing the above example, we can access an xmllist of the <lang> elements in the page as follows: var langs = languages.lang; xmllist provides a length() method which can be used to find the number of contained elements: alert(languages.lang.length());
note that unlike javascript arrays length is a method, not a property, and must be called using length().
... it is possible to create an xmllist using xml literal syntax without needing to create a well-formed xml document, using the following syntax: var xmllist = <> <lang>javascript</lang> <lang>python</lang> </>; the += operator can be used to append new elements to an xmllist within a document: languages.lang += <lang>ruby</lang>;
note that unlike node lists returned by regular dom methods, xmllists are static and are not automatically updated to reflect changes in the dom.
XForms Custom Controls - Archive of obsolete content
note you should take care to make sure that the embedded xforms controls are able to work with the data type of the instance node that your control is bound to.
... */ string getcurrentvalue(); }
notes: getcurrentvalue() should return the current value of the control as seen by a user.
... */ void setcontent(in nsidomnode anode, in boolean aforceupdate); }
note: setcontent() can be used to set place complexcontent (mixture of text and element nodes) under the control's bound node.
Issues Arising From Arbitrary-Element hover - Archive of obsolete content
this tech
note explains the source of the problems and how to avoid encountering them.
...in order to avoid this problem, authors should use the combined pseudo-class syntax described by css2: a:link:hover {color: red;} a:visited:hover {color: maroon;}
note that, with this syntax, it is possible to style visited and unvisited links differently when they are hovered.
...
note: this reprinted article was originally part of the devedge site.
Windows Media in Netscape - Archive of obsolete content
note that the classids must be passed in curly braces "{}".
...it is important to
note that in netscape 7.1, only the classid for windows media player is supported, and no other control can be created.
...} </script>
note that if the control is correctly instantiated, you will know that it is a version of windows media player 7 and up, since the clsid used with the object element reflects the unique component in this version range.
Building up a basic demo with the PlayCanvas engine - Game development
note: an entity is any object used in the scene — it can be an object like a box, cylinder or cone, but it can also be a camera, light or sound source.
...
note: the distance values (e.g.
...
note: in playcanvas, the color channel values are provided as floats in the range 0-1, instead of integers of 0-255 as you might be used to using on the web.
2D maze game with device orientation - Game development
note: you can read the building monster wants candy article for the in-depth introduction to the basic phaser-specific functions and methods.
...in particular, take
note of the update() function (executed at every frame), which updates things such as the ball position.
...
note: to find more out about implementing device orientation and what raw code would look like, read keep it level: responding to device orientation changes.
Gecko FAQ - Gecko Redirect 1
by the end of calendar year 2000, gecko is expected to support the following recommended open internet standards fully except for the areas
noted below and open bugs documented in bugzilla: html 4.0 - full support except for: elements: bdo, basefont attributes: shape attribute on the a element, abbr, axis, headers, scope-row, scope-col, scope-rowgroup, scope-colgroup, charoff, datasrc, datafld, dataformat, datapagesize, summary, event, dir, align on table columns, label attribute of option, alternate text of area elements, lon...
...as robert o'callahan
notes in bug 25707, "full html4/css1 compliance can't mean '100% bug free'.
...ter (javascript engine) http 1.1 compliance bugs should generally be found on the networking, networking - general, and networking: cache components oji imagelib image library (see also jpeg image handling and png image handling) ssl-related bugs are filed on the crypto component for information about the known bugs of a specific commercial product based on gecko, see that product's release
notes.
Index - MDN Web Docs Glossary: Definitions of Web-related terms
57 css pixel css, css pixel, glossary, height, length, pixel, size, unit, width the css pixel—de
noted in css with the suffix px—is a unit of length which roughly corresponds to the width or height of a single dot that can be comfortably seen by the human eye without strain, but is otherwise as small as possible.
...
note that the ios version of chrome uses that platform's webview, not blink.
... 291 normative glossary, infrastructure, specification, standardization normative is a word commonly used in software specifications to de
note sections that are standardized and must be followed as a rule.
Assessment: Accessibility troubleshooting - Learn web development
note: if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page.
...
note: you'll need to update the css rule selectors that style the tags to their proper equivalents for the semantic headings.
...
note that you'll need to update some of the css rule as well.
Flexbox - Learn web development
note also that you can use a display value of inline-flex if you wish to lay out an element's children as flex items, but have that element behave like an inline element.
...
note: you can also lay out flex items in a reverse direction using the row-reverse and column-reverse values.
...take special
note of the 2nd rule here — we are setting the third <article> to have its children laid out like flex items too, but this time we are laying them out like a column.
Beginner's guide to media queries - Learn web development
@media print { body { font-size: 12pt; } }
note: the media type here is different from the so-called mime type.
...
note: there were a number of other media types defined in the level 3 media queries specification; these have been deprecated and should be avoided.
...
note: media types are optional; if you do not indicate a media type in your media query then the media query will default to being for all media types.
Getting started with CSS - Learn web development
it contains an <em>emphasized</em> element.</p> <ul> <li>item one</li> <li>item two</li> <li>item <em>three</em></li> </ul> </body> </html>
note: if you are reading this on a device or an environment where you can't easily create files, then don't worry — live code editors are provided below to allow you to write example code right here in the page.
...
note: as you can see, css gives us several ways to target elements, and we've only scratched the surface so far!
...
note: you will often see mention of accessibility in these lessons and across mdn.
How do you upload your files to a web server? - Learn web development
note: of course there are lots of other options.
... let's first look at http://demozilla.examplehostingprovider.net/ — as you can see, so far there is nothing there:
note: depending on your hosting provider, most of the time you'll see a page saying something like “this website is hosted by [hosting service].” when you first go to your web address.
...
note: make sure your hosting provider offers sftp (secure ftp) connection to your hosting space.
What is a URL? - Learn web development
note: there are some extra parts and some extra rules regarding urls, but they are not relevant for regular users or web developers.
...
note: when specifying urls to load resources as part of a page (such as when using the <script>, <audio>, <img>, <video>, and the like), you should generally only use http and https urls, with few exceptions (one notable one being data:; see data urls).
...
note: it isn't possible to omit the domain name without omitting the protocol as well.
Sending forms through JavaScript - Learn web development
note: the fetch api is often used in place of xhr these days — it is a modern, updated version of xhr, which works in a similar fashion but has some advantages.
... xhr.send( urlencodeddata ); } btn.addeventlistener( 'click', function() { senddata( {test:'ok'} ); } ) here's the live result:
note: this use of xmlhttprequest is subject to the same-origin policy if you want to send data to a third party web site.
...
note that formdata objects are "write only", which means you can change them, but not retrieve their contents.
Styling web forms - Learn web development
note: there are some proprietary css pseudo-elements available that allow you to style internal components of these form controls, such as ::-moz-range-track, but these are not consistent across browsers, so can't be relied upon.
...
note: you could also use the transform property to help you with positioning your <legend>.
...your form should now look like this:
note: if your example does not work quite like you expected and you want to check it against our version, you can find it on github — see it running live (also see the source code).
HTML basics - Learn web development
here, class is the attribute name and editor-
note is the attribute value.
...
note: simple attribute values that don't contain ascii whitespace (or any of the characters " ' ` = < > ) can remain unquoted, but it is recommended that you quote all attribute values, as it makes the code more consistent and understandable.
...
note: you'll see that your heading level 1 has an implicit style.
What will your website look like? - Learn web development
note: complex projects need detailed guidelines that go into all the details of colors, fonts, spacing between items on a page, appropriate writing style, and so on.
...
note: even on real, complex websites, the design teams usually start out with rough sketches on paper and later on build digital mockups using a graphics editor or web technologies.
...
note that most images on the web, including in google images, are copyrighted.
Tips for authoring fast-loading HTML pages - Learn web development
<img href="./images/footerlogo.jpg" loading="lazy">
note that lazily-loaded images may not be available when the load event is fired.
...
note, however, that many of the tips listed in this article are common-sense techniques which apply to any user agent, and can be applied to any web page, regardless of browser-support requirements.
...
note: even though these attributes do help a lot the first time a page is loaded, you should use them but not assume they will work in all browsers.
Advanced text formatting - Learn web development
note that it is permitted to have a single term with multiple descriptions, for example: <dl> <dt>aside</dt> <dd>in drama, where a character shares a comment only with the audience for humorous or dramatic effect.
...rm (included inside a title attribute.) let's look at a couple of examples: <p>we use <abbr title="hypertext markup language">html</abbr> to structure our web documents.</p> <p>i think <abbr title="reverend">rev.</abbr> green did it in the kitchen with the chainsaw.</p> these will come out looking something like this (the expansion will appear in a tooltip when the term is hovered over):
note: there is another element, <acronym>, which basically does the same thing as <abbr>, and was intended specifically for acronyms rather than abbreviations.
...your contact details, for example: <address> <p>chris mills, manchester, the grim north, uk</p> </address> it could also include more complex markup, and other forms of contact information, for example: <address> <p> chris mills<br> manchester<br> the grim north<br> uk </p> <ul> <li>tel: 01234 567 890</li> <li>email: me@grim-north.co.uk</li> </ul> </address>
note that something like this would also be ok, if the linked page contained the contact information: <address> <p>page written by <a href="../authors/chris-mills/">chris mills</a>.</p> </address> superscript and subscript you will occasionally need to use superscript and subscript when marking up items like dates, chemical formulae, and mathematical equations so they have the correct meaning.
Adding vector graphics to the Web - Learn web development
note: this article doesn't intend to teach you svg; just what it is, and how to add it to web pages.
...
note: the images above are actually all pngs — with the left-hand star in each case representing a raster image, and the right-hand star representing a vector image.
...
note: in inkscape, save your files as plain svg to save space.
Mozilla splash page - Learn web development
note: the example html file contains quite a lot of css, to style the page.
...
note: you should optimise your jpg and png images to make them as small as possible, while still looking ok.
...
note: to properly test the srcset/sizes examples, you'll need to upload your site to a server (using github pages is an easy and free solution), then from there you can test whether they are working properly using browser developer tools such as the firefox network monitor.
Making asynchronous programming easier with async and await - Learn web development
you'll
note that we've wrapped the code inside a function, and we've included the async keyword before the function keyword.
...
note: it is also possible to use a sync finally block within an async function, in place of a .finally() async block, to show a final report on how the operation went — you can see this in action in our live example (see also the source code).
... async/await class methods as a final
note before we move on, you can even add async in front of class/object methods to make them return promises, and await promises inside them.
Test your skills: Arrays - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
...
note: in the examples below, if there is an error in your code it will be outputted into the results panel on the page, to help you try to figure out the answer (or into the browser's javascript console, in the case of the downloadable version).
...
note that we don't teach how to do this in the arrays article, so you'll have to do some research.
Useful string methods - Learn web development
retrieving a specific string character on a related
note, you can return any character inside a string by using square bracket notation — this means you include square brackets ([]) on the end of your variable name.
...
note: the second parameter of slice() is optional: if you don't include it, the slice ends at the end of the original string.
...
note: a hint — the parameters of the string methods don't have to be string literals; they can also be variables, or even variables with a method being invoked on them.
JavaScript object basics - Learn web development
note: if you are having trouble getting this to work, try comparing your code against our version — see oojs-finished.html (also see it running live).
...
note that built in objects and apis don't always create object instances automatically.
...
note: it is useful to think about the way objects communicate as message passing — when an object needs another object to perform some kind of action often it sends a message to another object via one of its methods, and waits for a response, which we know as a return value.
Ember Interactivity: Footer functionality, conditional rendering - Learn web development
note that here we need this.incomplete.length, not this.todos.incomplete.length, because we are doing this inside the service, where the incomplete() getter is available directly (in the template, the contents of the service has been made available as todos via the @service('todo-data') todos; line inside the footer class, hence it being this.todos.incomplete.length there).
...
note that this is the block form of if in ember; you could also use the the inline form: {{if this.todos.todocountisone "todo" "todos"}} completing todos as with the other components, we need a class to access the service.
...{{ if @todo.iscompleted 'completed' }}"> next, find the following line: <input aria-label="toggle the completion of this todo" class="toggle" type="checkbox" > and replace it with this: <input class="toggle" type="checkbox" aria-label="toggle the completion of this todo" checked={{ @todo.iscompleted }} {{ on 'change' (fn this.todos.togglecompletion @todo) }} >
note: the above snippet uses a new ember-specific keyword — fn.
Componentizing our React app - Learn web development
-label" htmlfor="todo-0"> eat </label> </div> <div classname="btn-group"> <button type="button" classname="btn"> edit <span classname="visually-hidden">eat</span> </button> <button type="button" classname="btn btn__danger"> delete <span classname="visually-hidden">eat</span> </button> </div> </li> ); }
note: components must always return something.
...
note: all_caps constant names have no special meaning in javascript; they’re a convention that tells other developers "this data will never change after being defined here”.
... the file should read like this: import react from "react"; function filterbutton(props) { return ( <button type="button" classname="btn toggle-btn" aria-pressed="true"> <span classname="visually-hidden">show </span> <span>all </span> <span classname="visually-hidden"> tasks</span> </button> ); } export default filterbutton;
note: you might notice that we are making the same mistake here as we first made for the <todo /> component, in that each button will be the same.
Beginning our React todo list - Learn web development
note: if you need to check your code against our version, you can find a finished version of the sample react app code in our todo-react repository.
...
notes: two of the files we’re deleting are for testing the application.
...
notes: to use boolean values (true and false) in jsx attributes, you must enclose them in curly braces.
Starting our Svelte Todo list app - Learn web development
note: you can put your components anywhere inside the src folder, but the components folder is a recognized convention to follow, allowing you to find your components easily.
... moreover, our editor can display this warning even before calling the compiler: you can tell svelte to ignore this warning for the next block of markup with a comment beginning with svelte-ignore, like this: <!-- svelte-ignore a11y-missing-attribute --> <img height="32" width="88" src="https://udn.realityripple.com/samples/b0/98dase3c7d.png">
note: with vscode you can automatically add this ignore comment by clicking on the quick fix...
...
note: you should only disable these warnings if you have good reasons to do so, for example while building a quick prototype.
Vue conditional rendering: editing existing todos - Learn web development
if; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; color: #0b0c0c; display: block; margin-bottom: 5px; } input { display: inline-block; margin-top: 0.4rem; width: 100%; min-height: 4.4rem; padding: 0.4rem 0.8rem; border: 2px solid #565656; } form { display: flex; flex-direction: row; flex-wrap: wrap; } form > * { flex: 0 0 100%; } </style>
note: walk through the above code then read the below description to make sure you understand everything the component is doing before moving on.
... it's important to
note that v-else and v-else-if blocks need to be the first sibling of a v-if/v-else-if block, otherwise vue will not recognize them.
...
note the state of the checkbox after you cancel — not only has the app forgotten the state of the checkbox, but the done status of that todo item is now out of whack.
omni.ja (formerly omni.jar)
note: starting with firefox 10 and thunderbird 10, the file extension .ja is used because windows system restore does not back up files with the .jar extension, but it does back up .ja files.
... inspecting and repacking omni.ja
note: when extracting omni.ja, you may incorrectly get false warnings from some virus protection software.
...
note: prior to firefox 10 and thunderbird 10, omni.ja was called omni.jar.
Mozilla accessibility architecture
please
note, the documentation for implementing an msaa server has moved.
...
note: this chart is not complete, consult the handleevent() method to see the rest.
...side
note: we do not fire the event indicating the new document is ready, until the new document is displayed.
Adding a new CSS property
(which set the property is in is given in the specification, which says "inherited: yes" or "inherited: no" in the property's definition.) also
note that some of the style structs intentionally contain only properties set/reset by a particular common shorthand property; this improves the effectiveness of some of the performance and memory optimizations done with the rule tree, and thus we should avoid adding a property not reset by that shorthand to such a struct.
... (
note that when the longhand property css_property_parse_value_list, the shorthand property parser would be assumed to be reusing the longhand parser once per item, not for a whole list, as for properties like background-image or transform-timing-function.) if the property takes a list of keywords other than inherit/initial/etc., auto, none, or normal (which can be expressed using the variant_* flags)...
...
note that use of setcoord (if the resulting value needs to be a tagged union) or setdiscrete is preferred when it's possible to use those functions.
Continuous Integration
be - b2g build jobs for engineering builds; user builds are de
noted with b, the same as for desktop and android builds.
... talos performance tests all performance tests displayed in treeherder are run using the talos framework, and de
noted by the letter t.
... talos is used to execute several suites for desktop firefox and firefox for android; these suites are de
noted using lower-case letters, e.g., t(c d g1 o s tp).
Creating reftest-based unit tests
running reftest-based unit tests
note: mach is a python2 script.
...to run: moz_layers_force_shmem_surfaces=1 make -c $(objdir) reftest-ipc
note: right now, automation currently only runs layout/reftests/reftest-sanity/reftest.list!
... other comparisons
note that it should also be possible to create a reftest that tests markup against an actual graphic image of the visual construct that should result.
Old Thunderbird build
windows build prerequisites gnu/linux build prerequisites mac os x build prerequisites get the source
note: on windows, you won't be able to build the thunderbird source code if it's under a directory with spaces in the path (e.g., don't use "documents and settings").
...
note: parts of the build process also have problems when the source code is in a directory where the path is long (nested many levels deep).
...
note that if you use an moz_objdir it cannot be a sibling folder to your source directory.
pymake
please
note that python 2.7 is strongly recommended.
...
note: on windows, you must take special care to be able to switch back and forth between gmake and pymake on the same object dir.
...
note: on windows, if using an absolute path moz_objdir in your .mozconfig, it must be a windows-style (i.e.
Gecko Logging
note: log module names can only contain specific characters.
...
note: this option disables 'append' and forces 'timestamp'.
... e10s
note when a content process is in sandbox, it cannot write to stderr or any file.
Listening to events on all tabs
note: these notifications will only occur if a security package is installed.
...
note: astatus may be a success code even for server generated errors, such as the http 404 file not found error.
...
note: some status values are defined by nsitransport and nsisockettransport.
Linux compatibility matrix
distribution kernel glibc glib gtk+2 gtk+3 pixman stdc++ gcc clang python3 released eol
notes red backgrounds de
note lack of compatibility with current versions of firefox.
... in the eol column, they de
note distribution versions past their end of life.
... yellow backgrounds de
note compatibility with esr78 green backgrounds de
note compatibility with the current release (as of writing, 78) greener backgrounds de
note compatibility with the current mozilla-central (as of writing, 80).
Browser API
note that this method is available for touch enabled devices only.
...
note that this is obsolete.
...
note that this is obsolete, and newer implementations use mozbrowsercaretstatechanged instead.
HTTP Cache
ead as the first open read: any normal priority content, such as images are open and read here write: writes are processed as last, we cache data in memory in the mean time management: level for the memory pool and cacheentry background operations close: file closing level index: index is being rebuild here evict: files overreaching the disk space consumption limit are being evicted here
note: special case for eviction - when an eviction is scheduled on the io thread, all operations pending on the open level are first merged to the open_priority level.
...
note: cachestorage keeps a thread-safe copy of nsiloadcontextinfo passed to a *storage method on nsicachestorageservice.
...d) for the writer state == ready: oncacheentrycheck with the entry is invoked on the first opener in fifo - on the caller thread if demanded result == recheck_after_write_finished: opener is left in the fifo with a flag recheckafterwrite such openers are skipped until the output stream on the entry is closed, then oncacheentrycheck is re-invoked on them
note: here is a potential for endless looping when recheck_after_write_finished is abused result == entry_needs_revalidation: state = revalidating, this prevents invocation of any callback until cacheentry::setvalid is called continue as in state entry_wanted (just bellow) result == entry_wanted: consumer reference ++ (dropped back when the consumer rel...
PerfMeasurement.jsm
note: the perfmeasurement.jsm javascript code module can only be used from chrome -- that is, from within the application itself or an add-on.
...
note: at present, perfmeasurement.jsm is only functional on linux, but it is planned to add support for windows (bug 583322) and osx (bug 583323) as well, and we welcome patches for other operating systems.
...
note: these values are all zeroed (or set to -1, for events not being measured) when you initialize the perfmeasurement object, then they are not zeroed again unless you explicitly call the reset() method.
Examples
newpromise.then(null, components.utils.reporterror);
note: more examples for consuming promises are available in the promise object documentation.
...
note: this warning is generated some time after the error occurred, and may provide less information about the error location.
...
note that this may, in some cases, cause an error to be reported more than once.
WebRequest.jsm
note that you can't pass "blocking" for this event, so you can't modify or cancel the request from this event: it's informational only.
...
note that you can't pass "blocking" for this event, so you can't modify or cancel the request from this event: it's informational only.
...
note that you can't pass "blocking" for this event, so you can't modify or cancel the request from this event: it's informational only.
Localizing with Koala
note that you don't have to edit the location field, it automatically fills in when you check the "mercurial" checkbox: "c:\mozilla\l10n\application\firefox\3.6".
...user: type your name and your e-mail address in the form: "firstname lastname <me@example.com>" (be sure to type the wrapping quotes: "")
note that you no longer have to edit the location now, it automatically fills in when you check the "mercurial" checkbox (e.g.
...
note how koala is smart enough to insert this entity before searchendcap.label.
Fonts for Mozilla 2.0's MathML engine
note: these instructions are for gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) until gecko 30.0 (firefox 30.0 / thunderbird 30.0 / seamonkey 2.27).
...
note that some web sites may provide the required mathematical fonts as web fonts.
...
note that currently, only the fonts in /fonts/stix-general/ are used for stretching mathematical operators with stix fonts.
tools/power/rapl
note: the power profiling overview is worth reading at this point if you haven't already.
...
note that if you do change this file, its contents may reset when the machine is next rebooted.
... + 4.04 w #04 10.02 w = 6.15 ( 2.62 + 0.43 + 3.10) + 3.86 w #05 14.63 w = 10.43 ( 4.41 + 0.81 + 5.22) + 4.19 w #06 11.16 w = 6.90 ( 1.91 + 1.68 + 3.31) + 4.26 w #07 5.40 w = 1.97 ( 0.20 + 0.10 + 1.67) + 3.44 w #08 5.17 w = 1.76 ( 0.07 + 0.08 + 1.60) + 3.41 w #09 5.17 w = 1.76 ( 0.09 + 0.08 + 1.58) + 3.42 w #10 8.13 w = 4.40 ( 1.55 + 0.11 + 2.74) + 3.73 w things to
note include the following.
A brief guide to Mozilla preferences
note the application never changes user.js, so on launch user.js overrides conflicting preferences from the previous application session.
...
note that, because a user typically has access privilege to his or her profile directory, he or she can change the default values if he or she knows how.
...
note: because of abuse of user.js preferences, support for user.js may be removed in a future version of firefox.
A guide to searching crash reports
note that because the proto signature includes the entire signature, things aren't grouped all that well.
...one way to learn about them is to read lots of individual crash reports;
note that all fields shown in the details tab of an individual crash report have a tool-tip that indicates its key for search.
...see the api documentation for full details;
note that it uses the term "aggregation" for grouping/faceting.
L20n HTML Bindings
it is important to
note that applying translations doesn't replace dom elements, but only modifies their text nodes and their attributes.
...
note that this still only works for a single language.
... <script type="application/l20n" src="../locales/strings.l20n"></script>
note that you currently cannot use the manifest file and manually add resources via script tags at the same time (bug 923670).
Necko walkthrough
note: nsconnectionentry has a single nshttpconnectioninfo object attached, a pending queue of nshttptransactions, and 3 arrays for connections: active nshttpconnections idle nshttpconnections nshalfopensockets nshttpconnectionmgr::trydispatchtransaction there is a series of decisions about whether dispatchtransaction is called, along with good code comments: be...
...
note: from what i can tell, there are some cases where the transaction is queued up to be written to the socket later if it's not writable now, or in the case of pipelining or spdy where it's done in batches.
...
note: this callback may be a proxy object, nsinputstreamreadyevent: it is a runnable that dispatches itself to a previously set target thread, and calls its internal mcallback->oninputstreamready function.
Installing Pork
svn co https://mcpp.svn.sourceforge.net/svnroot/mcpp/trunk mcpp cd mcpp ./configure --enable-replace-cpp make sudo make install
note: if you followed the dehydra installation instructions for linux and compiled your own gcc, then you should not need to "sudo" make install.
...
note: once you do this, you can only use this version of gcc in -m32 mode.
... apply this patch:
note: this doesn't seem necessary in the latest version; cppflags is already an argument.
Scripting Java
note that the ecma standard doesn't cover communication with java (or with any external object system for that matter).
... it's important to
note that java imports java.lang.* implicitly, while rhino does not.
...using the javascript for..in construct, we can print out all these values: js> for (i in f) { print(i) } exists parentfile mkdir tostring wait [44 others]
note that not only the methods of the file class are listed, but also the methods inherited from the base class java.lang.object (like wait).
Rhino shell
note if the shell is invoked with the system property rhino.use_java_policy_security set to true and with a security manager installed, the shell restricts scripts permissions based on their urls according to java policy settings.
... usage: runcommand(command) runcommand(command, arg1, ..., argn) runcommand(command, arg1, ..., argn, options) all except the last arguments to runcommand are converted to strings and de
note command name and its arguments.
...mand 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
instead, spidermonkey has a convenient suite of c++ raii classes to do this for you, called js::rootedt: rootedstring str1(cx, js_valuetostring(cx, val)); rootedstring str2(rt, js_valuetostring(cx, val));
note 1: c++ insists that an initializing assignment (e.g., the default constructor followed by operator=) must have a copy constructor available, even if it is not used.
...
note 2: in c++, destructors are required to run in declaration order, nicely maintaining our lifo property.
...
note: spidermonkey can gc because of any error, gc because of timers, gc because we are low on memory, gc because of environment variables, gc because of cosmic rays, etc.
SpiderMonkey Internals
the emitter does some constant folding and a few codegen optimizations; about the fanciest thing it does is to attach source
notes to the script for the decompiler's benefit.
...it translates postfix bytecode into infix source by consulting a separate byte-sized code, called source
notes, to disambiguate bytecodes that result from more than one grammatical production.
...source
notes generated by jsparse.cpp and jsemit.cpp are used in jsscript.cpp to map line number to program counter and back.
JSAPI Cookbook
note: the foss wiki page contains a few links to other libraries and programs that can make life easier when using spidermonkey and jsapi.
...ting function: // javascript var v = computesomevalue(); var isstring = typeof v === "string"; var isnumber = typeof v === "number"; var isnull = v === null; var isboolean = typeof v === "boolean"; var isobject = typeof v === "object" && v !== null; /* jsapi */ js::rootedvalue v(cx, computesomevalue()); bool isstring = v.isstring(); bool isnumber = v.isnumber(); bool isint32 = v.isint32(); //
note: internal representation, not numeric value bool isnull = v.isnull(); bool isboolean = v.isboolean(); bool isobject = v.isobject(); //
note: not broken like typeof === "object" is :-) to set a value use a correspondingly named member mutator function, or assign the result of the correspondingly named standalone function: // javascript var v; v = 0; v = 0.5; v = somestring; v = null; v = undefi...
...
note that javascript exceptions are not the same thing as c++ exceptions.
JSAPI reference
note: the foss wiki page contains a few links to other libraries and programs that can make life easier when using spidermonkey and the jsapi.
... a
note on versioning: up until the release of firefox 4, spidermonkey, and thus the jsapi, was versioned in an ad-hoc way, with releases happening at times that roughly, but not really, corresponded to firefox releases.
...
note: js_threadsafe is now permanently on and the jsruntime is single-threaded.
Thread Sanitizer
public builds
note: no public builds are available at this time yet.
... manual build build prerequisites
note: this section assumes you're using linux to build.
...#
note: the use of this flag causes clang to automatically link the tsan runtime :) export ldflags="-fsanitize=thread -fpic -pie" # these three are required by tsan ac_add_options --disable-jemalloc ac_add_options --disable-crashreporter ac_add_options --disable-elf-hack # keep symbols to symbolize tsan traces export moz_debug_symbols=1 ac_add_options --enable-debug-symbols ac_add_options --disable-in...
Redis Tips
note that if one of your commands crashes, the others still all execute!
...
note also that it's not an error for a transaction to be aborted, so err will be null in either case.
...
note that you get -1 both when there's no expiration and when there's no key.
Using the Places keywords API
note this is the same feature previously known as bookmark keywords, the key difference is that keywords are not bound to a specific bookmark, but to a specific url.
... placesutils.keywords.insert({ keyword: "my_keyword", url: "http://www.example.com/" postdata: "post+data=1&test=2" }).then(() => { /* success */ }, e => { /* failure */ });
note that setting an already existing keyword to a different url, will silently update the existing keyword to the new url.
...
note that fetch() always resolves to a single entry, to fetch all of the entries it's necessary to provide a callback function.
XPCOM glue
frozen linkage: standalone glue (no dll dependencies)
note: support for locating a standalone glue was removed in gecko 6.0.
...table_path,/path/to/xulrunner-bin -lxpcomglue_s -lxpcom -lnspr4 where 'xulrunner-bin' is either /library/frameworks/xul.framework/versions/current/ or /path/to/xulrunner-build/[platform]/dist/bin -l/path/to/sdk/lib -lxpcomglue linux -l/path/to/sdk/lib -l/path/to/sdk/bin -wl,-rpath-link,/path/to/sdk/bin -lxpcomglue_s -lxpcom -lnspr4 write it exactly as stated, see
notes.
... -l/path/to/sdk/lib -lxpcomglue
notes never link against xpcomglue.lib and xpcomglue_s.lib at the same time.
XPCOM changes in Gecko 2.0
note that nsigenericfactory.h has been removed.
...
note: binary xpcom components must be recompiled for every new major release of firefox starting with firefox 4.
...also
note that extensions using binary components must now use the unpack property in the install manifest.
Component Internals
note, we describe the three ways you can register components with xpcom.
... the unstoppable shutdown
note that shutdown observation is unstoppable.
...
note also that xpcom services may deny you access once you have received the shutdown notification.
Creating the Component Code
note that whatever you do in registerself should be undone in unregisterself.
...(
note that registerself method above does not register a contract id - it simply passes null.
... nsimodule** return_cobj) { nsresult rv = ns_ok; // create and initialize the module instance samplemodule *m = new samplemodule(); if (!m) { return ns_error_out_of_memory; } // increase refcnt and store away nsimodule interface to m in return_cobj rv = m->queryinterface(kimoduleiid, (void**)return_cobj); if (ns_failed(rv)) { delete m; } return rv; }
note: non-null-out the createinstance method guarantees that if the out variable is non-null, it is valid.
Packaging WebLock
note: the emphasis of this tutorial is on the component development itself, so this section on packaging and installing extensions to gecko is necessarily brief.
...the archive, its subdirectory structure, and its contents should look like this: weblock.xpi archive viewed in winzip
note that the top level of the archive holds the install.js installation file, an rdf manifest for the package as a whole, and the component files (weblock.xpt and weblock4.dll).
...
note: install-object-methods the methods are available on the main install object, which is implied in the script below in the same way that the window object is implied in javascript manipulation of the dom of a web page.
Setting up the Gecko SDK
there is now separate archive with gecko-sdk, just xul-runner-sdk.): linux: http://ftp.mozilla.org/pub/mozi....8.0.4.tar.bz2 windows: http://ftp.mozilla.org/pub/mozi...vc-1.8.0.4.zip mac: http://ftp.mozilla.org/pub/mozi...ac-1.8.0.4.zip
note that the version number for the archives above is 1.8.
...
note that mozilla-config.h may be need to be included before other includes in your component's source code.
...althing.obj cspecialthingmodule.obj link cspecialthing.obj: $(cc) $(ccparms) /c cspecialthing.cpp cspecialthingmodule.obj: $(cc) $(ccparms) /c cspecialthingmodule.cpp link: link.exe /dll /out:"cspecialthing.dll" /implib:"cspecialthing.lib" /machine:i386 xpcom.lib xpcomglue_s.lib nspr4.lib "cspecialthing.obj" "cspecialthingmodule.obj" clean: del *.lib *.dll *.obj *.exp please
note, this makefile is only for compiling the sample, you will probably have more .lib files if you are linking against winapi functions like kernel32.lib, user32.lib, etc.
imgIContainer
note: -1 means forever.
...(
note that we might not actually be drawing the full image -- we might be restricted by asubimage -- but we still need the full image's viewport-size in order for svg images with the "viewbox" attribute to position their content correctly.) aflags flags of the flag_* variety.
...
note that it is still possible for the image to be undecoded if decode-on-draw() is enabled and the image was never drawn.
imgIRequest
note that this might not be the actual uri for the image (for example if http redirects happened during the load).
...
note: you should not use this in any new code; instead, use cancel().
...
note that cancel() is asynchronous, which means that some time after you call it, the listener/observer will get an onstoprequest().
mozIStorageService
note: the connection object returned by this function is not threadsafe.
...
note: you should only access the profile database from the main thread since other callers may also be using it.
...
note: the connection object returned by this function is not threadsafe.
nsIAccessibleRelation
1.0 66 introduced gecko 1.9 inherits from: nsisupports last changed in gecko 1.9 (firefox 3)
note: be carefull, do not change constants until atk has a structure to map gecko constants into atk constants.
...
note: the label and description (see relation_described_by) relations may be used to prevent redundant information from being presented by the screen reader, since the label and description can occur both on their own, and in the name or description fields of an nsiaccessible.
...
note: the label (see relation_labelled_by) and description relations may be used to prevent redundant information from being presented by the screen reader, since the label and description can occur both on their own, and in the name or description fields of an nsiaccessible.
nsIAlertsService
note: prior firefox 22, the alerts service was only supported on windows in gecko 1.7, had no effect on mac os x in gecko 1.8, but was fully supported in mac os x in gecko 1.9.
...
note: since gecko 22, the notifications are provided by firefox and have become platform-independent.
...
note: if you are calling this function from javascript, you should wrap it in a try/catch because it can fail on mac os x prior to firefox 22.
nsIAppStartup
note: size_to_content may be used for width or height.
...
note: only available with libxul builds.
...
note: only available with libxul builds.
nsIConsoleService
note: see the code samples below for how to call getmessagearray.
...
note: to guard against stack overflows from listeners which could log messages (this could be done inadvertently through listeners implemented in javascript), we do not call any listeners when another error is already being logged.
...
note: console listeners expect you to log an empty string message before calling reset, so they too can clear their message buffers.
nsICookieService
note: this function is redundant and will most likely be removed in a future revision of this interface.
...
note: should be able to allow null aprompt, since nsiprompt can be queried from achannel.
...
note: this function is redundant and will most likely be removed in a future revision of this interface.
nsICycleCollectorListener
1.0 66 introduced gecko 2.0 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) the order of calls will be call to begin(); then for every node in the graph a call to
noteobject() and calls to
noteedge() for every edge starting at that node; then a call to begindescriptions(); then for every black node in the cycle collector graph a call to either describerefcountedobject() or to describegcedobject(); and then a call to end().
...method overview void begin(); void begindescriptions(); void describegcedobject(in unsigned long long aaddress, in boolean amarked); void describerefcountedobject(in unsigned long long aaddress, in unsigned long aknownedges, in unsigned long atotaledges); void end(); void
noteedge(in unsigned long long afromaddress, in unsigned long long atoaddress, in string aedgename); void
noteobject(in unsigned long long aaddress, in string aobjectdescription); methods begin() void begin(); parameters none.
...
noteedge() void
noteedge( in unsigned long long afromaddress, in unsigned long long atoaddress, in string aedgename ); parameters afromaddress atoaddress aedgename
noteobject() void
noteobject( in unsigned long long aaddress, in string aobjectdescription ); parameters aaddress aobjectdescription ...
nsIDOMOfflineResourceList
note: this method has been deprecated.
...
note: this method is deprecated in firefox 3.5; you should instead access the list directly using the items attribute.
...
note: versioned application caches are not yet supported; this method will throw an exception.
nsIDOMWindowInternal
note: because most of nsidomwindowinternal's functions and attributes are well documented in window, those articles are linked to rather than re-documented.
... method overview firefox 3.5
note the prompt() and find() methods changed in firefox 3.5 to make all their parameters optional; in previous versions, all parameters were required.
...
note: prior to gecko 7.0 (firefox 7.0 / thunderbird 7.0 / seamonkey 2.4), this attribute was part of nsidomwindow_2_0_branch.
nsIEffectiveTLDService
note: it is strongly recommended that you use getbasedomain() if a suitable nsiuri is available.
... remarks
note: prior to gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1), this method worked if you passed host strings starting with a period (".").
...
note: it is strongly recommended to use getbasedomain() if a suitable nsiuri is available.
nsIFilePicker
note: only works with modeopenmultiple mode.
... void appendfilters( in long filtermask ); parameters
note: if appendfilters is the first (or only) call to set the file filters the filter with the smallest code will be used as default filter when displaying the nsifilepicker dialog.
...
note that you usually won't // need to work with the string paths.
nsIHTTPHeaderListener
inherits from: nsisupports last changed in gecko 1.9 (firefox 3)
note: the plugin author must provide an instance to {geturl,posturl}() that implements both nsipluginstreamlistener and nsihttpheaderlistener.
...
note: you must copy the values of the params.
...
note: you must copy this value.
nsIIdleService
note: the idle service is for computer-wide idle detection, not just application idle detection.
... gecko 1.9.2
note starting in gecko 1.9.2, there is a once a day notification sent out if the user remains idle for an extended period: 'idle-daily'.
...
note: removing an observer will remove it once, for the idle time you specify.
nsILoginManagerStorage
note: extensions that simply want to access/store logins should use the login manager service and nsiloginmanager interface instead.
... gecko 1.9.1
note default values for the nsiloginmetainfo properties are created if the specified login doesn't explicitly specify them.
... gecko 1.9.1
note the values of any nsiloginmetainfo properties are ignored.
nsIMemoryReporter
note: this interface is undergoing heavy development, and is subject to rapid changes.
...
note: this attribute was called memoryused prior to gecko 7.0 (firefox 7.0 / thunderbird 7.0 / seamonkey 2.4), and its type was long long.
...
note: the amount field should be given a value 100 times the actual percentage; this number will be divided by 100 when shown.
nsIMsgFolder
note: does not persist across sessions.
...
note: do not call from js with resultsize > 1.
...
note: even if the folder doesn't currently exist, a nsimsgfolder may be returned.
nsIMsgIdentity
signaturedate long escapedvcard astring dofcc boolean fccfolder astring fccfolderpickermode astring fccreplyfollowsparent boolean draftsfolderpickermode astring tmplfolderpickermode astring bccself boolean
note: don't call bccself, bccothers, and bcclist directly, they are only used for migration and backward compatability.
... methods clearallvalues()
note: this is really dangerous!
...
note: these attributes persist across sessions.
nsINavBookmarkObserver
in long long aparentid, in acstring aguid, in acstring aparentguid); void onseparatoradded(in print64 parent, in print32 index); obsolete since gecko 1.9 void onseparatorremoved(in print64 parent, in print32 index); obsolete since gecko 1.9 methods onbeforeitemremoved() obsolete since gecko 21.0 (firefox 21.0 / thunderbird 21.0 / seamonkey 2.18)
note: this method was removed in gecko 21.0 as part of bug 826409.
...
notes this table indicates what anewvalue should be depending on property specified by aproperty: property string value "cleartime" empty string; this property means the history was deleted, so there's no last visit date.
...
note: the reported time is the time of the visit that was added, which may be well in the past since the visit time can be specified.
nsINavHistoryResultObserver
1.0 66 introduced gecko 2.0 inherits from: nsisupports last changed in gecko 11.0 (firefox 11.0 / thunderbird 11.0 / seamonkey 2.8)
note: in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1), this interface replaced the older nsinavhistoryresultviewer interface, which only allowed one client at a time.
...
note: this method was deprecated in gecko 2.0 and removed in gecko 11.0 (firefox 11.0 / thunderbird 11.0 / seamonkey 2.8).
...
note: this method was deprecated in gecko 2.0 and removed in gecko 11.0 (firefox 11.0 / thunderbird 11.0 / seamonkey 2.8).
nsIPlacesImportExportService
importhtmlfromfile() obsolete since gecko 14.0 (firefox 14.0 / thunderbird 14.0 / seamonkey 2.11)
note: this method has been removed; use the bookmarkhtmlutils.jsm javascript code module instead.
... importhtmlfromfiletofolder() obsolete since gecko 14.0 (firefox 14.0 / thunderbird 14.0 / seamonkey 2.11)
note: this method has been removed; use the bookmarkhtmlutils.jsm javascript code module instead.loads the given bookmarks.html file and puts it in the given folder.
...
note: this method has been removed; use the bookmarkhtmlutils.jsm javascript code module instead.
nsIPrefService
note: few consumers will want to create default branch objects.
...
note: if nsnull is passed in for the afile parameter the default preferences file(s) [prefs.js, user.js] will be read and processed.
...
note: if nsnull is passed in for the afile parameter the preference data is written out to the current preferences file (usually prefs.js.) void savepreffile( in nsifile afile ); parameters afile the file to be written.
nsIProxyInfo
note: prior to gecko 1.8 host was available by the host method.
...
note: prior to gecko 1.8 port was available by the port method.
...
note: prior to gecko 1.8 type was available by the type method.
nsIScriptableIO
file and stream guide: [ nsiscriptableio | accessing files | getting file information | reading from files | writing to files | moving, copying and deleting files | uploading and downloading files | working with directories ] important
note: the pages from the file and stream guide use the io object (nsiscriptableio), which was not available in any released version of the platform (pending some fixes).
...
note: the filename may only be the name of a file.
...
note: you should avoid using this method, since file paths are platform-dependent and non-portable.
nsISocketTransport
inherits from: nsitransport last changed in gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3)
note: connection setup is triggered by opening an input or output stream, it does not start on its own.
...
note: this attribute cannot be changed once a stream has been opened.
... nsitransporteventsink status codes
note: although these constants look like xpcom error codes and are passed in an nsresult variable, they are not error codes.
nsISocketTransportService
note: this function may only be called from an event dispatch on the socket thread.
...
note: this function can be called from any thread.
...
note: this function may only be called from an event dispatch on the socket thread.
nsISound
note that nsisound instances may play the sounds using another thread; however, this is not controlled by the caller.
...
note: this function is not supported on the macintosh.
...
note: this second usage is obsolete starting in gecko 1.9.2.
nsITaskbarWindowPreview
note that even while the preview is hidden, its thumbnails and/or previews may still be requested by other parts of the operating system through the nsitaskbarwindowpreview's controller.
...
note: this interface will never invoke the controller's nsitaskbarpreviewcontroller.onclose() or nsitaskbarpreviewcontroller.onactivate() methods, since handling them may conflict with other internal gecko state management.
...
note: by default, all buttons are hidden.
nsITimer
note that the delay is approximate: the timer can be fired before the requested time has elapsed.
...
note: re-setting the delay on a one-shot timer that has already fired doesn't restart the timer.
...the timer period will ideally be at least the time between when processing for last firing the callback completes and when the next firing occurs, but
note that this is not guaranteed: the timer can fire at any time.
nsIWebBrowser
note: the implementation should not refcount the supplied chrome object; it should assume that a non nsnull value is always valid.
...
note: nsiinterfacerequestor and nsiweakreference might also need to be implemented by the chrome object.
...
note: if this attribute is set to an object that implements nsisupportsweakreference, the implementation should get the nsiweakreference and hold that.
nsIWebNavigationInfo
note: this is guaranteed not to change, so that boolean tests can be done on the return value if istypesupported to detect whether a type is supported at all.
... other 1 << 15
note: other return types may be added here in the future as they become relevant.
...
note: this method may cause plug-ins to be rescanned in order to ensure they are properly registered for the types they support.
nsIZipReader
to create an instance, use: var zipreader = components.classes["@mozilla.org/libjar/zip-reader;1"] .createinstance(components.interfaces.nsizipreader); about character sets and code pages
note: nsizipreader has a code page problem; that is, in the zip specification, filenames are supposed to use 7-bit ascii; however, most modern filesystems use 8 bit code pages, such as utf-8.
...
note that a pattern may not use '~' multiple times, so a string such as '*~*z*~*y*' is not a valid pattern.
...
note: prior to gecko 1.9 you first had to call init()"." void open( in nsifile zipfile ); parameters zipfile the zip file to open.
nsIAbCard/Thunderbird3
note: this interface has been overhauled completely for thunderbird 3.
...same as home, but with `work' instead of `home' other contact: faxnumber, faxnumbertype pagernumber, pagernumbertype cellularnumber, cellularnumbertype jobtitle, department, company _aimscreenname dates: anniversaryyear, anniversarymonth, anniversaryday birthyear, birthmonth, birthday webpage1 (work), webpage2 (home) custom1, custom2, custom3, custom4
notes integral properties: lastmodifieddate popularityindex prefermailformat (see nsiabprefermailformat) boolean properties: allowremotecontent inherits from: nsiabitem method overview nsivariant getproperty(in autf8string name, in nsivariant defaultvalue); [noscript] astring getpropertyasastring(in string name); [noscript] autf8string ge...
...of particular
note is that boolean variables are converted to integers as in c/c++ (true is a non-zero value), so that false will be converted to a string of 0 and not false<code>.
Xptcall Porting Status
status status platform contributors and <font color="red">?</font> possible contributors
notes <font color="white">done</font> win32 x86 john bandhauer <jband@netscape.com> win32 <font color="white">done</font> linux x86 john bandhauer <jband@netscape.com> ulrich drepper <drepper@cygnus.com> unix <font color="white">done</font> freebsd and netbsd x86 christoph toshok <toshok@hungry.com>, john bandhauer <jband@netscape.com> unix (same as linux 86 code) <font color="white">done...
...he
notes that the vtbl scheme is different.
...- -
note: i've used the symbol (<font color="red">?</font>) to indicate people who have expressed an interest in possibly contributing code.
LDAP Support
it should be
noted that all of this information applies to both thunderbird and the seamonkey application suite.
...some
notes about the relationship: there is a many to one relationship between ldap attributes and its address book counterpart.
...ent department department departmentnumber company o company company workcountry countryname _aimscreenname nscpaimscreenname webpage1 workurl webpage2 homeurl birthyear birthyear custom1 custom1 custom2 custom2 custom3 custom3 custom4 custom4
notes
notes
notes description prefermailformat xmozillausehtmlmail lastmodifieddate modifytimestamp custom ldap attributes thunderbird supports custom ldap attributes for various address book attributes.
MailNews fakeserver
a handler will contain the following methods: <caption> handler methods </caption> name arguments returns
notes [command] rest of sent line server's response the name is normalized to be uppercase.
...the following comprises the api of the news fakeserver itself: nntpdaemon api name arguments returns
notes [constructor] daemon flags n/a flags are defined below addgroup group name (string), is postable nothing adds the group (resetting if it exists) addarticle newsarticle object nothing adds the message to all groups in the article's group list addarticletogroup newsarticle object, group (string), integral key for group nothing adds the message to the specified group with the specified key...
... getarticle message id newsarticle object pretty self-explanatory newsarticle api name arguments returns
notes [constructor] text (as a string) n/a initializes all fields headers (property) map of header (lower-case) -> value body (property) text of body messageid (property) message id fulltext (property) full text as message without modification except added headers.
Standard OS Libraries
components.utils.import("resource://gre/modules/ctypes.jsm"); var lib = ctypes.open("user32.dll"); /*
note: if you go to getcursorpos page on msdn, it says first argument is of structure point, so lets create that structure, * the link here shows that that x and y are type long which is ctypes.long */ // https://msdn.microsoft.com/en-us/library/windows/desktop/dd162805%28v=vs.85%29.aspx var point = new ctypes.structtype("tagpoint", [ { "x": ctypes.long }, { "y": ctypes.long } ]); /* declare the...
...
note: you cannot use carbon routines from your add-on; firefox is a 64-bit application, and you cannot use carbon from 64-bit code.
...ctypes.float : ctypes.double; // 64bit its double, in 32bit its float let nspoint = new ctypes.structtype("nspoint", [ { "x" : cgfloat }, { "y" : cgfloat } ]); //
note: [nsevent mouselocation] returns nspoint struct, // which is small enough to return in register, // so we don't need to use objc_msgsend_stret.
ArrayType
ctype arraytype() type[ length] ); parameters type: it represents the type of the elements or variable which is going to be present in an array length optional it de
notes the number of entries present in an array or the number of elements that an array should contain.
...
note: ctypes.void_t.size is undefined.
...
note: this is never ctypes.void_t or an array type with an unspecified length.
StructType
note: at this time, there isn't a way to de
note a packed structure (that is, one created in c using #pragma pack).
...
note: ctypes.void_t.size is undefined.
...
note: this is never ctypes.void_t or an array type with an unspecified length.
Streams - Plugins
note: a plug-in can also use the npn_geturl method to request a stream for an arbitrary url.
...
note: if you want to be sure that the npn_*stream functions are called in the order you want and behave the way you expect, combine npn_newstream, npn_write, and npn_destroy_stream in the same callback.
...
note: most plug-ins that need the stream saved to a file should use np_asfileonly mode rather than the older np_asfile; this mode is less efficient because it uses successive calls to npp_write.
Browser Toolbox - Firefox Developer Tools
note: if you want to debug a specific add-on that is restartless or sdk-based then try the add-on debugger.
...altogether you will have access to the following developer tools: debugger (
note: if you want to debug a specific add-on that is restartless or sdk-based then try the add-on debugger.) console style editor performance network monitor page inspector accessibility inspector you can debug chrome: and about: pages using the normal debugger, just as if they were ordinary content pages.
...
note: this change is not persistent across browser restarts.
Debugger.Frame - Firefox Developer Tools
note that frames only become inactive at times that are predictable for the debugger: when the debuggee runs, or when the debugger removes frames from the stack itself.
... (
note that the debuggee is not considered an “immediate caller” of handler methods it triggers.
...
note that, like eval, declarations in thecode passed to evalwithbindings affect the environment of this frame, even as that environment is extended by bindings visible withincode.
Debugger.Source - Firefox Developer Tools
please
note at the time of this writing, support for webassembly is very preliminary.
... (
note that code passed to eval, the function constructor, or a similar function isnot considered to be loaded from a url; the url accessor on debugger.source instances for such sources should return undefined.) if the instance refers to webassembly code, the url of the script that called new webassembly.module with the string "> wasm" appended.
...(
note that one may assign both strings and functions to dom elements’ event handler idl attributes.
Examine and edit HTML - Firefox Developer Tools
note: there are some useful keyboard shortcuts that can be used in the html tree — see the html pane keyboard shortcuts list.
...
note: shadow dom inspection was implemented in firefox 61, but was hidden behind the dom.webcomponents.shadowdom.enabled pref until firefox 63.
...
note that this button is disabled if the selected element's type is such that adding a last-child would have no effect (for example, if is is an <html> or <iframe> element).
CSS Grid Inspector: Examine grid layouts - Firefox Developer Tools
note: the examples shown in the screenshots appearing in this article are jen simmons' futurismo and variations on a grid experiments, and a live named grid area example from rachel andrew.
...
note: the layout view can be found underneath the layout tab on the right-hand pane of the page inspector.
...
note: your grid preferences such as overlay color and display settings choices are persisted across page loads for each separate page.
Animation inspector example: Web Animations API - Firefox Developer Tools
html content <div class="channel"> <img src="https://udn.realityripple.com/samples/e6/a96484b5c3.png" id="icon"/> <span id="
note">firefox developer edition</span> </div> css content .channel { padding: 2em; margin: 0.5em; box-shadow: 1px 1px 5px #808080; margin: 1.5em; } .channel > * { vertical-align: middle; line-height: normal; } #icon { width: 50px; height: 50px; filter: grayscale(100%); } #
note { margin-left: 1em; font: 1.5em "open sans",arial,sans-serif; overflow: hidden; white-space: nowrap; display: inline-block; opacity: 0; width: 0; } javascript content var iconkeyframeset = [ { transform: 'scale(1)', filter: 'grayscale(100%)'}, { filter: 'grayscale(100%...
...)', offset: 0.333}, { transform: 'scale(1.5)', offset: 0.666 }, { transform: 'scale(1.5)', filter: 'grayscale(0%)'} ]; var
notekeyframeset = [ { opacity: '0', width: '0'}, { opacity: '1', width: '300px'} ]; var iconkeyframeoptions = { duration: 750, fill: 'forwards', easing: 'ease-in', enddelay: 100 } var
notekeyframeoptions = { duration: 500, fill: 'forwards', easing: 'ease-out', delay: 150 } var icon = document.getelementbyid("icon"); var
note = document.getelementbyid("
note"); var iconanimation = icon.animate(iconkeyframeset, iconkeyframeoptions); var
noteanimation =
note.animate(
notekeyframeset,
notekeyframeoptions); iconanimation.pause();
noteanimation.pause(); var firsttime = true; function animatechannel(e) { if (e.button != 0) { return; } if (e...
....target.id != "icon") { return; } if (firsttime) { iconanimation.play();
noteanimation.play(); firsttime = false; } else { iconanimation.reverse();
noteanimation.reverse(); } } document.addeventlistener("click", animatechannel); ...
UI Tour - Firefox Developer Tools
the select element button is one way you can select an element for inspection:
note that it's actually part of the main toolbox toolbar, so it's immediately accessible from any tool, not just the inspector.
...
note that before firefox 50, the box model view did not appear in the "computed view" tab, but had its own tab.
...it shows icons for the browsers that do support the properties, and
notes properties that are experimental or deprecated.
Toolbox - Firefox Developer Tools
this is what it looks like when it's docked: the window itself is split into two parts: a toolbar along the top, and a main pane underneath:
note: since firefox 62, you can drag and drop tabs in the main toolbar of the toolbox to reorder your tools as you wish (bug 1226272).
...the array may include the following tools: web console javascript debugger page inspector style editor profiler network monitor
note that not all the hosted tools are always listed here: only the tools actually available in this context are shown (for example, not all tools support remote debugging yet, so if the debugging target is not the firefox instance that launched the window, not all the hosted tools will be shown).
... the following tools are not included in the toolbar by default, but you can add them in the settings: highlight painted area 3d view (
note that this is not available in firefox 40) scratchpad grab a color from the page take a screenshot of the entire page: take a screenshot of the complete web page and saves it in your downloads directory toggle rulers for the page measure a portion of the page: measure a part of the website by selecting areas within the page toolbox controls finally there's a row of buttons to: close the...
Firefox Developer Tools
note: if you are just getting started with web development and using developer tools, our learning docs will help you — see getting started with the web and what are browser developer tools?
...(
note: this feature is not turned on by default and must be enabled in settings before the icon will appear.) toggles responsive design mode.
...
note: the collective term for the ui inside which the devtools all live is the toolbox.
AudioBufferSourceNode.AudioBufferSourceNode() - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetaudiobuffersourcenode() constructorchrome full support 55
notes full support 55
notes
notes before version 59, the default values were not supported.edge full support ≤79firefox full support 53ie no support noopera full support 42safar...
... webview android full support 55
notes full support 55
notes
notes before version 59, the default values were not supported.chrome android full support 55
notes full support 55
notes
notes before version 59, the default values were not supported.firefox android full support 53opera android full support 42safari ios ?
... samsung internet android full support 6.0
notes full support 6.0
notes
notes before samsung internet 7.0, the default values were not supported.legend full support full support no support no support compatibility unknown compatibility unknownsee implementation
notes.see implementation
notes.
AudioListener.forwardX - Web APIs
note: the parameter is a-rate when used with a pannernode whose panningmodel is set to equalpower, or k-rate otherwise.
...
note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc.
... the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }
note: in terms of working out what position values to apply to the listener and panner, to make the sound appropriate to what the visuals are doing on screen, there is quite a bit of math involved, but you will soon get used to it with a bit of experimentation.
AudioListener.forwardY - Web APIs
note: the parameter is a-rate when used with a pannernode whose panningmodel is set to equalpower, or k-rate otherwise.
...
note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc.
... the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }
note: in terms of working out what position values to apply to the listener and panner, to make the sound appropriate to what the visuals are doing on screen, there is quite a bit of math involved, but you will soon get used to it with a bit of experimentation.
AudioListener.forwardZ - Web APIs
note: the parameter is a-rate when used with a pannernode whose panningmodel is set to equalpower, or k-rate otherwise.
...
note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc.
... the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }
note: in terms of working out what position values to apply to the listener and panner, to make the sound appropriate to what the visuals are doing on screen, there is quite a bit of math involved, but you will soon get used to it with a bit of experimentation.
AudioListener.positionX - Web APIs
note: the parameter is a-rate when used with a pannernode whose pannernode is set to equalpower, or k-rate otherwise.
...
note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc.
... the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }
note: in terms of working out what position values to apply to the listener and panner, to make the sound appropriate to what the visuals are doing on screen, there is quite a bit of math involved, but you will soon get used to it with a bit of experimentation.
AudioListener.positionY - Web APIs
note: the parameter is a-rate when used with a pannernode whose pannernode is set to equalpower, or k-rate otherwise.
...
note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc.
... the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }
note: in terms of working out what position values to apply to the listener and panner, to make the sound appropriate to what the visuals are doing on screen, there is quite a bit of math involved, but you will soon get used to it with a bit of experimentation.
AudioListener.positionZ - Web APIs
note: the parameter is a-rate when used with a pannernode whose pannernode is set to equalpower, or k-rate otherwise.
...
note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc.
... the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }
note: in terms of working out what position values to apply to the listener and panner, to make the sound appropriate to what the visuals are doing on screen, there is quite a bit of math involved, but you will soon get used to it with a bit of experimentation.
AudioListener.speedOfSound - Web APIs
the speedofsound property's default value is 343.3 m/s and is used to calculate the doppler shift appropriate for the speed the panner is travelling at (as defined by pannernode.setvelocity.)
note: bear in mind that no propagation delay is automatically applied to a sound far from the listener.
...
note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc.
... the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }
note: in terms of working out what position values to apply to the listener and panner, to make the sound appropriate to what the visuals are doing on screen, there is quite a bit of math involved, but you will soon get used to it with a bit of experimentation.
AudioListener.upX - Web APIs
note: the parameter is a-rate when used with a pannernode whose pannernode is set to equalpower, or k-rate otherwise.
...
note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc.
... the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }
note: in terms of working out what position values to apply to the listener and panner, to make the sound appropriate to what the visuals are doing on screen, there is quite a bit of math involved, but you will soon get used to it with a bit of experimentation.
AudioListener.upY - Web APIs
note: the parameter is a-rate when used with a pannernode whose pannernode is set to equalpower, or k-rate otherwise.
...
note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc.
... the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }
note: in terms of working out what position values to apply to the listener and panner, to make the sound appropriate to what the visuals are doing on screen, there is quite a bit of math involved, but you will soon get used to it with a bit of experimentation.
AudioListener.upZ - Web APIs
note: the parameter is a-rate when used with a pannernode whose pannernode is set to equalpower, or k-rate otherwise.
...
note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc.
... the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }
note: in terms of working out what position values to apply to the listener and panner, to make the sound appropriate to what the visuals are doing on screen, there is quite a bit of math involved, but you will soon get used to it with a bit of experimentation.
BaseAudioContext.createBuffer() - Web APIs
note: createbuffer() used to be able to take compressed data and give back decoded samples, but this ability was removed from the spec, because all the decoding was done on the main thread, therefore createbuffer() was blocking other code execution.
... syntax var buffer = baseaudiocontext.createbuffer(numofchannels, length, samplerate); parameters
note: for an in-depth explanation of how audio buffers work, and what these parameters mean, read audio buffers: frames, samples and channels from our basic concepts guide.
...
note: audio resampling is very similar to image resizing: say you've got a 16 x 16 image, but you want it to fill a 32x32 area: you resize (resample) it.
BaseAudioContext.createScriptProcessor() - Web APIs
note: as of the august 29 2014 web audio api spec publication, this feature has been marked as deprecated, and was replaced by audioworklet (see audioworkletnode).
...
note: it is invalid for both numberofinputchannels and numberofoutputchannels to be zero.
...
note: for a full working example, see our script-processor-node github repo (also view the source code.) var myscript = document.queryselector('script'); var mypre = document.queryselector('pre'); var playbutton = document.queryselector('button'); // create audiocontext and buffer source var audioctx = new audiocontext(); source = audioctx.createbuffersource(); // create a scriptprocessornod...
BasicCardRequest.supportedNetworks - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetsupportednetworkschrome no support noedge no support ≤18 — 79firefox full support 56
notes disabled full support 56
notes disabled
notes available only in nightly builds.disabled from version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
... webview android no support nochrome android full support 57firefox android full support 56
notes disabled full support 56
notes disabled
notes available only in nightly builds.disabled from version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
... samsung internet android full support 7.0legend full support full support no support no support compatibility unknown compatibility unknownsee implementation
notes.see implementation
notes.user must explicitly enable this feature.user must explicitly enable this feature.
BasicCardResponse.billingAddress - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetbillingaddresschrome no support noedge no support ≤18 — 79firefox full support 56
notes disabled full support 56
notes disabled
notes available only in nightly builds.disabled from version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
... webview android no support nochrome android full support 57firefox android full support 56
notes disabled full support 56
notes disabled
notes available only in nightly builds.disabled from version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
... samsung internet android full support 7.0legend full support full support no support no support compatibility unknown compatibility unknownsee implementation
notes.see implementation
notes.user must explicitly enable this feature.user must explicitly enable this feature.
BasicCardResponse.cardNumber - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcardnumberchrome no support noedge no support ≤18 — 79firefox full support 56
notes disabled full support 56
notes disabled
notes available only in nightly builds.disabled from version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
... webview android no support nochrome android full support 57firefox android full support 56
notes disabled full support 56
notes disabled
notes available only in nightly builds.disabled from version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
... samsung internet android full support 7.0legend full support full support no support no support compatibility unknown compatibility unknownsee implementation
notes.see implementation
notes.user must explicitly enable this feature.user must explicitly enable this feature.
BasicCardResponse.cardSecurityCode - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcardsecuritycodechrome no support noedge no support ≤18 — 79firefox full support 56
notes disabled full support 56
notes disabled
notes available only in nightly builds.disabled from version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
... webview android no support nochrome android full support 57firefox android full support 56
notes disabled full support 56
notes disabled
notes available only in nightly builds.disabled from version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
... samsung internet android full support 7.0legend full support full support no support no support compatibility unknown compatibility unknownsee implementation
notes.see implementation
notes.user must explicitly enable this feature.user must explicitly enable this feature.
BasicCardResponse.cardholderName - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcardholdernamechrome no support noedge no support ≤18 — 79firefox full support 56
notes disabled full support 56
notes disabled
notes available only in nightly builds.disabled from version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
... webview android no support nochrome android full support 57firefox android full support 56
notes disabled full support 56
notes disabled
notes available only in nightly builds.disabled from version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
... samsung internet android full support 7.0legend full support full support no support no support compatibility unknown compatibility unknownsee implementation
notes.see implementation
notes.user must explicitly enable this feature.user must explicitly enable this feature.
BasicCardResponse.expiryMonth - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetexpirymonthchrome no support noedge no support ≤18 — 79firefox full support 56
notes disabled full support 56
notes disabled
notes available only in nightly builds.disabled from version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
... webview android no support nochrome android full support 57firefox android full support 56
notes disabled full support 56
notes disabled
notes available only in nightly builds.disabled from version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
... samsung internet android full support 7.0legend full support full support no support no support compatibility unknown compatibility unknownsee implementation
notes.see implementation
notes.user must explicitly enable this feature.user must explicitly enable this feature.
BasicCardResponse.expiryYear - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetexpiryyearchrome no support noedge no support ≤18 — 79firefox full support 56
notes disabled full support 56
notes disabled
notes available only in nightly builds.disabled from version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
... webview android no support nochrome android full support 57firefox android full support 56
notes disabled full support 56
notes disabled
notes available only in nightly builds.disabled from version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
... samsung internet android full support 7.0legend full support full support no support no support compatibility unknown compatibility unknownsee implementation
notes.see implementation
notes.user must explicitly enable this feature.user must explicitly enable this feature.
Using dynamic styling information - Web APIs
note also that, as with individual element's dom styles, when speaking of manipulating the stylesheets, this is not actually manipulating the physical document(s), but merely the internal representation of the document.
... more important than the two properties
noted here is the use of the style object to set individual style properties on an element: <!doctype html> <html> <head> <title>style property example</title> <link rel="stylesheet" href="example.css" type="text/css"> <script type="text/javascript"> function stilo() { document.getelementbyid('d').style.color = 'orange'; } function resetstyle() { document.getelementbyi...
... using the setattribute method
note that you can also change style of an element by getting a reference to it and then use its setattribute method to specify the css property and its value.
Cache.put() - Web APIs
fetch(url).then(function(response) { if (!response.ok) { throw new typeerror('bad response status'); } return cache.put(url, response); })
note: put() will overwrite any key/value pair previously stored in the cache that matches the request.
...
note: cache.add/cache.addall do not cache responses with response.status values that are not in the 200 range, whereas cache.put lets you store any request/response pair.
...
note: the promise will reject with a typeerror if the url scheme is not http or https.
CacheStorage - Web APIs
note: chrome and safari only expose `cachestorage` to the windowed context over https.
...
note: cachestorage always rejects with a securityerror on untrusted origins (i.e.
...
note: cachestorage.match() is a convenience method.
ClipboardItem() - Web APIs
note: image format support varies by browser.
...
note: to work with text see the clipboard.readtext() and clipboard.writetext() methods of the clipboard interface.
...
note: you can only pass in one clipboard item at a time.
Console.table() - Web APIs
note that (in firefox) console.table is limited to displaying 1000 rows (first row is the labeled index).
...
note: this feature is available in web workers.
.../ an array of arrays var people = [["john", "smith"], ["jane", "doe"], ["emily", "jones"]] console.table(people); // an array of objects function person(firstname, lastname) { this.firstname = firstname; this.lastname = lastname; } var john = new person("john", "smith"); var jane = new person("jane", "doe"); var emily = new person("emily", "jones"); console.table([john, jane, emily]);
note that if the array contains objects, then the columns are labeled with the property name.
CustomElementRegistry.define() - Web APIs
note that custom element names must contain a hyphen.
...
note: you'll often get notsupportederrors thrown that seem like define() is failing, but instead it is likely a problem with element.attachshadow().
...appendchild(wrapper); wrapper.appendchild(icon); wrapper.appendchild(info); } } // define the new element customelements.define('popup-info', popupinfo); <popup-info img="img/alt.png" text="your card validation code (cvc) is an extra security feature — it is the last 3 or 4 numbers on the back of your card.">
note: constructors for autonomous custom elements must extend htmlelement.
DataTransfer.mozCursor - Web APIs
note: if any value other than default is set, auto is assumed.
...
note: this property is currently only implemented on windows.
...
note: this property is gecko-specific.
DelayNode() - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetdelaynode() constructorchrome full support 55
notes full support 55
notes
notes before version 59, the default values were not supported.edge full support ≤79firefox full support 53ie no support noopera full support 42safar...
... webview android full support 55
notes full support 55
notes
notes before version 59, the default values were not supported.chrome android full support 55
notes full support 55
notes
notes before version 59, the default values were not supported.firefox android full support 53opera android full support 42safari ios ?
... samsung internet android full support 6.0
notes full support 6.0
notes
notes before samsung internet 7.0, the default values were not supported.legend full support full support no support no support compatibility unknown compatibility unknownsee implementation
notes.see implementation
notes.
Document.createTouch() - Web APIs
note: before gecko 25.0, this method was defined on the documenttouch mixin.
... syntax var touch = documenttouch.createtouch(view, target, identifier, pagex, pagey, screenx, screeny); parameters
note: all parameters are optional.
...
note: previous versions of this method included the following additional parameters but those parameters are not included in either of the standards listed below.
Document.execCommand() - Web APIs
note: only returns true if part of a user interaction.
...
note that internet explorer uses this to set the text background color.
...
note: this argument is logically backwards (i.e.
Document.importNode() - Web APIs
note: in the dom4 specification, deep was an optional argument with a default value of true.
...
note: importednode's node.parentnode is null, since it has not yet been inserted into the document tree!
... example const iframe = document.queryselector("iframe"); const oldnode = iframe.contentwindow.document.getelementbyid("mynode"); const newnode = document.importnode(oldnode, true); document.getelementbyid("container").appendchild(newnode);
notes before they can be inserted into the current document, nodes from external documents should either be: cloned using document.importnode(); or adopted using document.adoptnode().
Document.querySelector() - Web APIs
note: the matching is done using depth-first pre-order traversal of the document's nodes starting with the first element in the document's markup and iterating through sequential nodes by order of the number of child nodes.
...
note: characters that are not part of standard css syntax must be escaped using a backslash character.
... usage
notes if the specified selector matches an id that is incorrectly used more than once in the document, the first element with that id is returned.
DynamicsCompressorNode() - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetdynamicscompressornode() constructorchrome full support 55
notes full support 55
notes
notes before chrome 59, the default values were not supported.edge full support ≤79firefox full support 53ie no support noopera full support 42safari...
... webview android full support 55
notes full support 55
notes
notes before version 59, the default values were not supported.chrome android full support 55
notes full support 55
notes
notes before chrome 59, the default values were not supported.firefox android full support 53opera android full support 42safari ios ?
... samsung internet android full support 6.0
notes full support 6.0
notes
notes before samsung internet 7.0, the default values were not supported.legend full support full support no support no support compatibility unknown compatibility unknownsee implementation
notes.see implementation
notes.
Element.getAttributeNS() - Web APIs
if the named attribute does not exist, the value returned will either be null or "" (the empty string); see
notes for details.
...
note: earlier versions of the dom specification had this method described as returning an empty string for non-existent attributes, but it was not typically implemented this way since null makes more sense.
...xample.com/2014/test" width="40" height="40"> <circle id="target" cx="12" cy="12" r="10" stroke="#444" stroke-width="2" fill="none" test:foo="foo value"/> </svg> <script type="text/javascript"> var ns = 'http://www.example.com/2014/test'; var circle = document.getelementbyid( 'target' ); console.log('attribute value: ' + circle.getattribute('test:foo')); </script> </body> </html>
notes namespaces are only supported in xml documents.
Element.innerHTML - Web APIs
note: if a <div>, <span>, or <noembed> node has a child text node that includes the characters (&), (<), or (>), innerhtml returns these characters as the html entities "&", "<" and ">" respectively.
... usage
notes the innerhtml property can be used to examine the current html source of the page, including any changes that have been made since the page was initially loaded.
...
note: the returned html or xml fragment is generated based on the current contents of the element, so the markup and formatting of the returned fragment is likely not to match the original page markup.
Element: scroll event - Web APIs
bubbles no cancelable no interface event event handler property onscroll
note: in ios uiwebviews, scroll events are not fired while scrolling is taking place; they are only fired after the scrolling has completed.
...
note, however, that input events and animation frames are fired at about the same rate, and therefore the optimization below is often unnecessary.
..._known_scroll_position = 0; let ticking = false; function dosomething(scroll_pos) { // do something with the scroll position } window.addeventlistener('scroll', function(e) { last_known_scroll_position = window.scrolly; if (!ticking) { window.requestanimationframe(function() { dosomething(last_known_scroll_position); ticking = false; }); ticking = true; } });
note: you can find more examples on the resize event page.
Event.initEvent() - Web APIs
— 17
notes
notes before firefox 17, a call to this method after the dispatching of the event raised an exception instead of doing nothing.ie full support yesopera full support yessafari full support yeswebview android full support ...
...— 17
notes
notes before firefox 17, a call to this method after the dispatching of the event raised an exception instead of doing nothing.opera android full support yessafari ios full support yessamsung internet android full support yeslegend full support full supportdeprecated.
...not for use in new websites.see implementation
notes.see implementation
notes.
EventTarget.dispatchEvent() - Web APIs
notes unlike "native" events, which are fired by the dom and invoke event handlers asynchronously via the event loop, dispatchevent() invokes event handlers synchronously.
...n iossamsung internetdispatcheventchrome full support 4edge full support 12firefox full support 2ie full support 9 full support 9 no support 6 — 11
notes alternate name
notes older versions of ie supported an equivalent, proprietary eventtarget.fireevent() method.alternate name uses the non-standard name: fireeventopera full support 9safari full support 3.2webview android full support 4chrome android ...
... full support 4opera android full support 10.1safari ios full support 3samsung internet android full support 1.0legend full support full supportsee implementation
notes.see implementation
notes.uses a non-standard name.uses a non-standard name.
FetchEvent.respondWith() - Web APIs
note that navigation requests for windows and iframes do not use the final url.
... exceptions exception
notes networkerror a network error is triggered on certain combinations of fetchevent.request.mode and response.type values, as hinted at in the "global rules" listed above.
... return fetch(event.request); }()); });
note: caches.match() is a convenience method.
FileSystemDirectoryEntry.getDirectory() - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetgetdirectory experimentalchrome full support 8edge full support 79firefox full support 50
notes full support 50
notes
notes in firefox, the errorcallback's input parameter is a domexception rather than a fileerror object.ie no support noopera no support nosafari full support 11.1webview android fu...
...ll support ≤37chrome android full support 18firefox android full support 50
notes full support 50
notes
notes in firefox, the errorcallback's input parameter is a domexception rather than a fileerror object.opera android no support nosafari ios full support 11.3samsung internet android full support yeslegend full support full support no support no supportexperimen...
...expect behavior to change in the future.see implementation
notes.see implementation
notes.
FileSystemDirectoryEntry.getFile() - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetgetfile experimentalchrome full support 8edge full support 79firefox full support 50
notes full support 50
notes
notes in firefox, the errorcallback's input parameter is a domexception rather than a fileerror object.ie no support noopera no support nosafari full support 11.1webview android fu...
...ll support ≤37chrome android full support 18firefox android full support 50
notes full support 50
notes
notes in firefox, the errorcallback's input parameter is a domexception rather than a fileerror object.opera android no support nosafari ios full support 11.3samsung internet android full support yeslegend full support full support no support no supportexperimen...
...expect behavior to change in the future.see implementation
notes.see implementation
notes.
FileSystemDirectoryEntry.removeRecursively() - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetremoverecursively deprecatednon-standardchrome full support 8edge full support 79firefox no support 50 — 52
notes no support 50 — 52
notes
notes while the removerecursively() method existed, it immediately called the error callback with ns_error_dom_security_err.ie no support noopera no support nosafari no support nowebview android ...
... full support ≤37chrome android full support 18firefox android no support 50 — 52
notes no support 50 — 52
notes
notes while the removerecursively() method existed, it immediately called the error callback with ns_error_dom_security_err.opera android no support nosafari ios no support nosamsung internet android full support yeslegend full support full support no support no supportnon-standard.
...not for use in new websites.see implementation
notes.see implementation
notes.
FileSystemFileEntry.createWriter() - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcreatewriter deprecatednon-standardchrome full support 8edge full support 79firefox no support 50 — 52
notes no support 50 — 52
notes
notes while the createwriter() method existed, it immediately called errorcallback with the ns_error_dom_security_err error.ie no support noopera no support nosafari no support nowebview android ...
... full support ≤37chrome android full support 18firefox android no support 50 — 52
notes no support 50 — 52
notes
notes while the createwriter() method existed, it immediately called errorcallback with the ns_error_dom_security_err error.opera android no support nosafari ios no support nosamsung internet android full support yeslegend full support full support no support no supportnon-standard.
...not for use in new websites.see implementation
notes.see implementation
notes.
FileSystemFileEntry - Web APIs
full support yesprefixed full support yesprefixed prefixed implemented with the vendor prefix: webkitcreatewriter deprecatednon-standardchrome full support 8edge full support 79firefox no support 50 — 52
notes no support 50 — 52
notes
notes while the createwriter() method existed, it immediately called errorcallback with the ns_error_dom_security_err error.ie no support noopera no support nosafari no support nowebview android ...
... full support ≤37chrome android full support 18firefox android no support 50 — 52
notes no support 50 — 52
notes
notes while the createwriter() method existed, it immediately called errorcallback with the ns_error_dom_security_err error.opera android no support nosafari ios no support nosamsung internet android full support yesfilechrome full support 8edge full support 79firefox full support 50ie ...
...not for use in new websites.see implementation
notes.see implementation
notes.uses a non-standard name.uses a non-standard name.requires a vendor prefix or different name for use.requires a vendor prefix or different name for use.
FileSystemFlags.create - Web APIs
13prefixed full support 13prefixed prefixed implemented with the vendor prefix: webkitedge full support ≤79prefixed full support ≤79prefixed prefixed implemented with the vendor prefix: webkitfirefox partial support 50
notes partial support 50
notes
notes for security reasons, firefox does not support creating files.
...esprefixed full support yesprefixed prefixed implemented with the vendor prefix: webkitchrome android full support yesprefixed full support yesprefixed prefixed implemented with the vendor prefix: webkitfirefox android partial support 50
notes partial support 50
notes
notes for security reasons, firefox does not support creating files.
...expect behavior to change in the future.see implementation
notes.see implementation
notes.requires a vendor prefix or different name for use.requires a vendor prefix or different name for use.
FileSystemFlags.exclusive - Web APIs
13prefixed full support 13prefixed prefixed implemented with the vendor prefix: webkitedge full support ≤79prefixed full support ≤79prefixed prefixed implemented with the vendor prefix: webkitfirefox partial support 50
notes partial support 50
notes
notes for security reasons, firefox does not support creating files.
...esprefixed full support yesprefixed prefixed implemented with the vendor prefix: webkitchrome android full support yesprefixed full support yesprefixed prefixed implemented with the vendor prefix: webkitfirefox android partial support 50
notes partial support 50
notes
notes for security reasons, firefox does not support creating files.
...expect behavior to change in the future.see implementation
notes.see implementation
notes.requires a vendor prefix or different name for use.requires a vendor prefix or different name for use.
Guide to the Fullscreen API - Web APIs
note that the fullscreenchange event doesn't provide any information itself as to whether the document is entering or exiting fullscreen mode, but if the document has a non null fullscreenelement, you know you're in fullscreen mode.
...
note: fullscreen requests need to be called from within an event handler or otherwise they will be denied.
... prefixing
note: currently, only firefox 64 and chrome 71 supports this unprefixed.
File drag and drop - Web APIs
note: html drag and drop defines two different apis to support dragging and dropping files.
...in this example, the drop target element uses the following styling: #drop_zone { border: 5px solid blue; width: 200px; height: 100px; }
note that dragstart and dragend events are not fired when dragging a file into the browser from the os.
...
note that in this example, any drag item that is not a file is ignored.
IDBCursor.direction - Web APIs
note: this feature is available in web workers.
...within each iteration we log the direction of the cursor, something like this: prev
note: we can't change the direction of travel of the cursor using the direction property, as it is read-only.
...also
note that in each iteration of the loop, you can grab data from the current record under the cursor object using cursor.value.foo.
IDBDatabase.onabort - Web APIs
note: this feature is available in web workers.
... dbopenrequest.onupgradeneeded = function(event) { var db = event.target.result; db.onerror = function() {
note.innerhtml += '<li>error opening database.</li>'; }; db.onabort = function() {
note.innerhtml += '<li>database opening aborted!</li>'; }; // create an objectstore for this database var objectstore = db.createobjectstore("todolist", { keypath: "tasktitle" }); // define what data items the objectstore will contain objectstore.createindex("hours", "hours", { unique: false }); objectstore.createindex("minutes", "minutes", ...
...{ unique: false }); objectstore.createindex("day", "day", { unique: false }); objectstore.createindex("month", "month", { unique: false }); objectstore.createindex("year", "year", { unique: false }); objectstore.createindex("notified", "notified", { unique: false });
note.innerhtml += '<li>object store created.</li>'; }; specifications specification status comment indexed database api 2.0the definition of 'onabort' in that specification.
IDBDatabase.onclose - Web APIs
note: this feature is available in web workers.
... desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetonclosechrome full support 31
notes full support 31
notes
notes approxedge full support ≤18firefox full support 50ie ?
... yessafari ios full support 10.3samsung internet android full support 2.0legend full support full support compatibility unknown compatibility unknownsee implementation
notes.see implementation
notes.
IDBDatabase.onversionchange - Web APIs
note: this feature is available in web workers.
... request.onupgradeneeded = function(event) { var db = event.target.result; db.onerror = function(event) {
note.innerhtml += '<li>error opening database.</li>'; }; db.onabort = function(event) {
note.innerhtml += '<li>database opening aborted!</li>'; }; // create an objectstore for this database var objectstore = db.createobjectstore("todolist", { keypath: "tasktitle" }); // define what data items the objectstore will contain objectstore.createindex("hours", "hours", { unique: false ...
...}); objectstore.createindex("minutes", "minutes", { unique: false }); objectstore.createindex("day", "day", { unique: false }); objectstore.createindex("month", "month", { unique: false }); objectstore.createindex("year", "year", { unique: false }); objectstore.createindex("notified", "notified", { unique: false });
note.innerhtml += '<li>object store created.</li>'; db.onversionchange = function(event) {
note.innerhtml += '<li>a database change has occurred; you should refresh this browser window, or close it down and use the other open version of this application, wherever it exists.</li>'; }; }; specifications specification status comment indexed database api 2.0the definition of 'onversionchange'...
IDBOpenDBRequest.onblocked - Web APIs
note: this feature is available in web workers.
...}; example var db; // let us open our database var request = indexeddb.open("todolist", 4); // these two event handlers act on the database being opened // successfully, or not request.onerror = function(event) {
note.innerhtml += '<li>error loading database.</li>'; }; request.onsuccess = function(event) {
note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable.
...either one has not been created // before, or a new version number has been submitted via the // window.indexeddb.open line above //it is only implemented in recent browsers request.onupgradeneeded = function(event) { var db = event.target.result; db.onerror = function(event) {
note.innerhtml += '<li>error loading database.</li>'; }; // create an objectstore for this database var objectstore = db.createobjectstore("todolist", { keypath: "tasktitle" }); ...
IDBOpenDBRequest.onupgradeneeded - Web APIs
note: this feature is available in web workers.
...request.onupgradeneeded = function(event) { db = request.result; db.onerror = function(errorevent) {
note.innerhtml += '<li>error loading database.</li>'; }; if (event.oldversion < 1) { // version 1 is the first version of the database.
... var magazines = db.createobjectstore("magazines"); var publisherindex = magazines.createindex("by_publisher", "publisher"); var frequencyindex = magazines.createindex("by_frequency", "frequency"); } }; request.onerror = function(event) {
note.innerhtml += '<li>error loading database.</li>'; }; request.onsuccess = function(event) {
note.innerhtml += '<li>database initialised.</li>'; db = request.result; populateanddisplaydata(); }; specifications specification status comment indexed database api 2.0the definition of 'onupgradeneeded' in that specification.
IDBOpenDBRequest - Web APIs
note: this feature is available in web workers.
...dbopenrequest.onerror = function(event) {
note.innerhtml += '<li>error loading database.</li>'; }; dbopenrequest.onsuccess = function(event) {
note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db // variable.
... displaydata(); }; // this event handles the event whereby a new version of // the database needs to be created either one has not // been created before, or a new version number has been // submitted via the window.indexeddb.open line above // it is only implemented in recent browsers dbopenrequest.onupgradeneeded = function(event) { var db = this.result; db.onerror = function(event) {
note.innerhtml += '<li>error loading database.</li>'; }; // create an objectstore for this database var objectstore = db.createobjectstore("todolist", { keypath: "tasktitle" }); // define what data items the objectstore will contain objectstore.createindex("hours", "hours", { unique: false }); objectstore.createindex("minutes", "minutes", { unique: false }); objectstore.createinde...
IDBVersionChangeEvent.newVersion - Web APIs
note: this feature is available in web workers.
...for a full working example, see our to-do notifications app (view example live.) var
note = document.queryselector("ul"); // in the following line, you should include the prefixes of // implementations you want to test.
...msidbtransaction; window.idbkeyrange = window.idbkeyrange || window.webkitidbkeyrange || window.msidbkeyrange; // (mozilla has never prefixed these objects, // so we don't need window.mozidb*) // let us open version 4 of our database var dbopenrequest = window.indexeddb.open("todolist", 4); // these two event handlers act on the database being opened dbopenrequest.onerror = function(event) {
note.innerhtml += '<li>error loading database.</li>'; }; dbopenrequest.onsuccess = function(event) {
note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable.
IDBVersionChangeEvent - Web APIs
note: this feature is available in web workers.
...for a full working example, see our to-do notifications app (view example live.) var
note = document.queryselector("ul"); // in the following line, you should include the prefixes of implementations you want to test.
... window.idbkeyrange = window.idbkeyrange || window.webkitidbkeyrange || window.msidbkeyrange; // (mozilla has never prefixed these objects, so we don't need window.mozidb*) // let us open version 4 of our database var dbopenrequest = window.indexeddb.open("todolist", 4); // these two event handlers act on the database being opened successfully, or not dbopenrequest.onerror = function(event) {
note.innerhtml += '<li>error loading database.</li>'; }; dbopenrequest.onsuccess = function(event) {
note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable.
IIRFilterNode() - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetiirfilternode() constructorchrome full support 55
notes full support 55
notes
notes before version 59, the default values were not supported.edge full support ≤79firefox full support 53ie no support noopera full support 42safar...
... webview android full support 55
notes full support 55
notes
notes before version 59, the default values were not supported.chrome android full support 55
notes full support 55
notes
notes before version 59, the default values were not supported.firefox android full support 53opera android full support 42safari ios ?
... samsung internet android full support 6.0
notes full support 6.0
notes
notes before samsung internet 7.0, the default values were not supported.legend full support full support no support no support compatibility unknown compatibility unknownsee implementation
notes.see implementation
notes.
IndexedDB API - Web APIs
note: this feature is available in web workers.
...
note: indexeddb api is powerful, but may seem too complicated for simple cases.
...
note: like most web storage solutions, indexeddb follows a same-origin policy.
Timing element visibility with the Intersection Observer API - Web APIs
the sidebar is represented using an <aside> element, and is styled as follows: aside { grid-column: 1; grid-row: 2; background-color: cornsilk; padding: 5px 10px; } aside ul { padding-left: 0; } aside ul li { list-style: none; } aside ul li a { text-decoration: none; } the most important thing to
note here is that the grid-column is set to 1, to place the sidebar on the left-hand side of the screen.
...
note the use of parsefloat() here; because these values are strings, javascript tries to do a string concatenation instead of addition without it.
...also
note that each ad is replaced after one minute of visibility, and how the timers pause while the document is tabbed into the background.
MediaDeviceInfo.deviceId - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetdeviceidchrome full support 55
notes full support 55
notes
notes for earlier versions, this interface is available through the adapter.js polyfilledge full support 12firefox full support 39ie no support noopera no support ...
... no
notes no support no
notes
notes this property can be used in opera by using the adapter.js polyfill.safari no support nowebview android full support 55
notes full support 55
notes
notes for earlier versions, this interface is available through the adapter.js polyfillchrome android full support 55
notes full support 55
notes
notes for earlier versions, this interface is available through the adapter.js polyfillfirefox android full support 39opera android no ...
...support no
notes no support no
notes
notes this property can be used in opera by using the adapter.js polyfill.safari ios no support nosamsung internet android full support 6.0
notes full support 6.0
notes
notes for earlier versions, this interface is available through the adapter.js polyfilllegend full support full support no support no supportsee implementation
notes.see implementation
notes.
MediaDeviceInfo.kind - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetkindchrome full support 55
notes full support 55
notes
notes for earlier versions, this interface is available through the adapter.js polyfilledge full support 12firefox full support 39ie no support noopera no support ...
... no
notes no support no
notes
notes this property can be used in opera by using the adapter.js polyfill.safari no support nowebview android full support 55
notes full support 55
notes
notes for earlier versions, this interface is available through the adapter.js polyfillchrome android full support 55
notes full support 55
notes
notes for earlier versions, this interface is available through the adapter.js polyfillfirefox android full support 39opera android no ...
...support no
notes no support no
notes
notes this property can be used in opera by using the adapter.js polyfill.safari ios no support nosamsung internet android full support 6.0
notes full support 6.0
notes
notes for earlier versions, this interface is available through the adapter.js polyfilllegend full support full support no support no supportsee implementation
notes.see implementation
notes.
MediaStreamTrack.enabled - Web APIs
note: if the track has been disconnected, the value of this property can be changed, but has no effect.
...
note: when implementing a mute/unmute feature, you should use the enabled property.
... usage
notes if the mediastreamtrack represents the video input from a camera, disabling the track by setting enabled to false also updates device activity indicators to show that the camera is not currently recording or streaming.
Navigator.getBattery() - Web APIs
note: in some browsers access to this feature is controlled by feature-policy directive battery.
...
note: old versions of some user agents might allow use of this feature in insecure contexts.
... notallowederror
note: no user agent currently throws this exception, but the specification describes the following behaviors: this document is not allowed to use this feature.
Navigator.registerProtocolHandler() - Web APIs
syntax navigator.registerprotocolhandler(scheme, url, title);
note: recently updated to navigator.registerprotocolhandler(scheme, url), but no browsers currently support this version.
...
note: the handler url must us the https scheme.
...
note: the title has been removed from the spec due to spoofing concerns, but all current browsers still require it.
Node.localName - Web APIs
syntax name = element.localname name is the local name as a string (see
notes below for details) example (must be served with xml content type, such as text/xml or application/xhtml+xml.) <html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg"> <head> <script type="application/javascript"><![cdata[ function test() { var text = document.getelementbyid('text'); var circle = document.getelementbyid('circle'); text.value = "<svg:circle> has:\n" + "localname = '" + circle.localname + "'\n" + "namespaceuri = '" + circle.names...
...paceuri + "'"; } ]]></script> </head> <body onload="test()"> <svg:svg version="1.1" width="100px" height="100px" viewbox="0 0 100 100"> <svg:circle cx="50" cy="50" r="30" style="fill:#aaa" id="circle"/> </svg:svg> <textarea id="text" rows="4" cols="55"/> </body> </html>
notes the local name of a node is that part of the node's qualified name that comes after the colon.
...for example, in the qualified name ecomm:partners, partners is the local name and ecomm is the prefix: <ecomm:business id="soda_shop" type="brick_n_mortar" xmlns:ecomm="http://example.com/ecomm"> <ecomm:partners> <ecomm:partner id="1001">tony's syrup warehouse </ecomm:partner> </ecomm:partners> </ecomm:business>
note: in gecko 1.9.2 and earlier, the property returns the upper-cased version of the local name for html elements in html doms (as opposed to xhtml elements in xml doms).
Node - Web APIs
note: in firefox 3.5 and earlier, the property upper-cases the local name for html elements (but not xhtml elements).
...
note: in firefox 3.5 and earlier, html elements are in no namespace.
...<span> tag in a <div> element named "box": <div id="box"> <span>foo</span> <span>bar</span> <span>baz</span> </div> const box = document.getelementbyid("box") eachnode(box, function(node) { if (null != node.textcontent) { console.log(node.textcontent) } }) the above will result in the following strings printing to the user's console: "\n\t", "foo", "\n\t", "bar", "\n\t", "baz"
note: whitespace forms part of a text node, meaning indentation and newlines form separate text between the element nodes.
Notification.requestPermission() - Web APIs
note: this feature is available in web workers.
...
note: this feature is not available in sharedworker
note: safari still uses the callback syntax to get the permission.
...to see a example in action, check out our to-do list example (also see the app running live.)
note: in the above example we spawn notifications in response to a user gesture (clicking a button).
Notifications API - Web APIs
note: this feature is available in web workers.
...
note: as of firefox 44, the permissions for notifications and push have been merged.
...
note: to find out more about using notifications in your own app, read using the notifications api.
OfflineAudioContext - Web APIs
note: the resume() method is still available — it is now defined on the baseaudiocontext interface (see baseaudiocontext.resume()) and thus can be accessed by both the audiocontext and offlineaudiocontext interfaces.
...
note: for a working example, see our offline-audio-context-promise github repo (see the source code too.) // define online and offline audio context var audioctx = new audiocontext(); var offlinectx = new offlineaudiocontext(2,44100*40,44100); source = offlinectx.createbuffersource(); // use xhr to load an audio track, and // decodeaudiodata to decode it and offlineaudiocontext to render it func...
...rendering().then(function(renderedbuffer) { console.log('rendering completed successfully'); var song = audioctx.createbuffersource(); song.buffer = renderedbuffer; song.connect(audioctx.destination); play.onclick = function() { song.start(); } }).catch(function(err) { console.log('rendering failed: ' + err); //
note: the promise should reject when startrendering is called a second time on an offlineaudiocontext }); }); } request.send(); } // run getdata to start the process off getdata(); specifications specification status comment web audio apithe definition of 'offlineaudiocontext' in that specification.
ParentNode.querySelector() - Web APIs
note: this method is implemented as document.queryselector(), documentfragment.queryselector() and element.queryselector().
...
note: characters which are not part of standard css syntax must be escaped using a backslash character.
...
note: if the specified selectors include a css pseudo-element, the returned value is always null.
PaymentAddress.toJSON() - Web APIs
to change preferences in chrome, visit chrome://flags.edge full support 15firefox full support 62
notes disabled full support 62
notes disabled
notes available only in nightly builds.
...to change preferences in chrome, visit chrome://flags.firefox android full support 62
notes disabled full support 62
notes disabled
notes available only in nightly builds.
...rt nosafari ios full support yessamsung internet android no support nolegend full support full support no support no supportsee implementation
notes.see implementation
notes.user must explicitly enable this feature.user must explicitly enable this feature.
PaymentRequest.abort() - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetabort()chrome full support 61edge full support 15firefox full support 55
notes disabled full support 55
notes disabled
notes available only in nightly builds.disabled from version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
...no support noopera no support nosafari full support 11.1webview android no support nochrome android full support 53firefox android full support 55
notes disabled full support 55
notes disabled
notes available only in nightly builds.disabled from version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
...android no support nosafari ios full support 11.3samsung internet android full support 6.0legend full support full support no support no supportsee implementation
notes.see implementation
notes.user must explicitly enable this feature.user must explicitly enable this feature.
PaymentRequest.prototype.id - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetidchrome full support 61edge full support 16firefox full support 55
notes disabled full support 55
notes disabled
notes available only in nightly builds.disabled from version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
...no support noopera no support nosafari full support 11.1webview android no support nochrome android full support 60firefox android full support 55
notes disabled full support 55
notes disabled
notes available only in nightly builds.disabled from version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
... nosafari ios full support 11.3samsung internet android full support 8.0legend full support full support no support no supportsee implementation
notes.see implementation
notes.user must explicitly enable this feature.user must explicitly enable this feature.
PaymentRequest.onshippingaddresschange - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetonshippingaddresschangechrome full support 61edge full support 15firefox full support 55
notes disabled full support 55
notes disabled
notes available only in nightly builds.disabled from version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
...no support noopera no support nosafari full support 11.1webview android no support nochrome android full support 53firefox android full support 55
notes disabled full support 55
notes disabled
notes available only in nightly builds.disabled from version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
...android no support nosafari ios full support 11.3samsung internet android full support 6.0legend full support full support no support no supportsee implementation
notes.see implementation
notes.user must explicitly enable this feature.user must explicitly enable this feature.
PaymentRequest.onshippingoptionchange - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetonshippingoptionchangechrome full support 61edge full support 15firefox full support 55
notes disabled full support 55
notes disabled
notes available only in nightly builds.disabled from version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
...no support noopera no support nosafari full support 11.1webview android no support nochrome android full support 53firefox android full support 55
notes disabled full support 55
notes disabled
notes available only in nightly builds.disabled from version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
...android no support nosafari ios full support 11.3samsung internet android full support 6.0legend full support full support no support no supportsee implementation
notes.see implementation
notes.user must explicitly enable this feature.user must explicitly enable this feature.
PaymentRequest.shippingOption - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetshippingoptionchrome full support 61edge full support 15firefox full support 55
notes disabled full support 55
notes disabled
notes available only in nightly builds.disabled from version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
...no support noopera no support nosafari full support 11.1webview android no support nochrome android full support 53firefox android full support 55
notes disabled full support 55
notes disabled
notes available only in nightly builds.disabled from version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
...android no support nosafari ios full support 11.3samsung internet android full support 6.0legend full support full support no support no supportsee implementation
notes.see implementation
notes.user must explicitly enable this feature.user must explicitly enable this feature.
PaymentRequest.shippingType - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetshippingtypechrome full support 61edge full support 15firefox full support 55
notes disabled full support 55
notes disabled
notes available only in nightly builds.disabled from version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
...no support noopera no support nosafari full support 11.1webview android no support nochrome android full support 55firefox android full support 55
notes disabled full support 55
notes disabled
notes available only in nightly builds.disabled from version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
... nosafari ios full support 11.3samsung internet android full support 6.0legend full support full support no support no supportsee implementation
notes.see implementation
notes.user must explicitly enable this feature.user must explicitly enable this feature.
PaymentResponse.details - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetdetailschrome full support 61edge full support 15firefox full support 56
notes disabled full support 56
notes disabled
notes available only in nightly builds.disabled from version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
...to change preferences in chrome, visit chrome://flags.firefox android full support 56
notes disabled full support 56
notes disabled
notes available only in nightly builds.disabled from version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
... android no support nosafari ios full support yessamsung internet android full support 6.0legend full support full support no support no supportsee implementation
notes.see implementation
notes.user must explicitly enable this feature.user must explicitly enable this feature.
PaymentResponse.payerEmail - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetpayeremailchrome full support 61edge full support 15firefox full support 56
notes disabled full support 56
notes disabled
notes available only in nightly builds.disabled from version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
...to change preferences in chrome, visit chrome://flags.firefox android full support 56
notes disabled full support 56
notes disabled
notes available only in nightly builds.disabled from version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
... android no support nosafari ios full support yessamsung internet android full support 6.0legend full support full support no support no supportsee implementation
notes.see implementation
notes.user must explicitly enable this feature.user must explicitly enable this feature.
PaymentRequest.payerName - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetpayernamechrome full support 61edge full support 15firefox full support 56
notes disabled full support 56
notes disabled
notes available only in nightly builds.disabled from version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
... no support noopera no support nosafari full support yeswebview android no support nochrome android full support 58firefox android full support 56
notes disabled full support 56
notes disabled
notes available only in nightly builds.disabled from version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
... android no support nosafari ios full support yessamsung internet android full support 7.0legend full support full support no support no supportsee implementation
notes.see implementation
notes.user must explicitly enable this feature.user must explicitly enable this feature.
PaymentResponse.requestId - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetrequestidchrome full support 61edge full support 16firefox full support 56
notes disabled full support 56
notes disabled
notes available only in nightly builds.disabled from version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
... no support noopera no support nosafari full support yeswebview android no support nochrome android full support 60firefox android full support 56
notes disabled full support 56
notes disabled
notes available only in nightly builds.disabled from version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
... nosafari ios full support yessamsung internet android full support 8.0legend full support full support no support no supportsee implementation
notes.see implementation
notes.user must explicitly enable this feature.user must explicitly enable this feature.
PaymentResponse.shippingAddress - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetshippingaddresschrome full support 61edge full support 15firefox full support 56
notes disabled full support 56
notes disabled
notes available only in nightly builds.disabled from version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
...to change preferences in chrome, visit chrome://flags.firefox android full support 56
notes disabled full support 56
notes disabled
notes available only in nightly builds.disabled from version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
... android no support nosafari ios full support yessamsung internet android full support 6.0legend full support full support no support no supportsee implementation
notes.see implementation
notes.user must explicitly enable this feature.user must explicitly enable this feature.
PaymentResponse.shippingOption - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetshippingoptionchrome full support 61edge full support 15firefox full support 56
notes disabled full support 56
notes disabled
notes available only in nightly builds.disabled from version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
...to change preferences in chrome, visit chrome://flags.firefox android full support 56
notes disabled full support 56
notes disabled
notes available only in nightly builds.disabled from version 56: this feature is behind the dom.payments.request.enabled preference (needs to be set to true).
... android no support nosafari ios full support yessamsung internet android full support 6.0legend full support full support no support no supportsee implementation
notes.see implementation
notes.user must explicitly enable this feature.user must explicitly enable this feature.
PerformanceLongTaskTiming - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetperformancelongtasktiming experimentalchrome full support 58edge full support ≤79firefox no support no
notes no support no
notes
notes see bug 1348405.ie ?
... webview android full support 58chrome android full support 58firefox android no support no
notes no support no
notes
notes see bug 1348405.opera android full support yessafari ios ?
...expect behavior to change in the future.see implementation
notes.see implementation
notes.
PopStateEvent - Web APIs
note: just calling history.pushstate() or history.replacestate() won't trigger a popstate event.
...
note: browsers used to handle the popstate event differently on page load, but now they behave the same.
...e 1", "?page=1"); history.pushstate({page: 2}, "title 2", "?page=2"); history.replacestate({page: 3}, "title 3", "?page=3"); history.back(); // alerts "location: http://example.com/example.html?page=1, state: {"page":1}" history.back(); // alerts "location: http://example.com/example.html, state: null history.go(2); // alerts "location: http://example.com/example.html?page=3, state: {"page":3}
note that even though the original history entry (for http://example.com/example.html) has no state object associated with it, a popstate event is still fired when we activate that entry after the second call to history.back().
PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable() - Web APIs
note: this method may only be used in top-level contexts and will not be available in an <iframe> for example.
...
note: this is a static method which is directly called on the publickeycredential interface and not on an instance.
...
note: in earlier versions of the specification, the boolean also conveyed the consent of the user to disclose such an authenticator existed.
PushEvent.data - Web APIs
full support 17firefox full support 44
notes full support 44
notes
notes extended support releases (esr) before firefox 78 esr do not support service workers and the push api.ie no support noopera full support 44safari no support nowebview android ...
... no support nochrome android full support 57firefox android full support 44 full support 44 full support 48
notes
notes push enabled by default.opera android full support 43safari ios no support nosamsung internet android full support 4.0legend full support full support no support no supportexperimental.
...expect behavior to change in the future.see implementation
notes.see implementation
notes.user must explicitly enable this feature.user must explicitly enable this feature.
PushManager.hasPermission() - Web APIs
full support 17firefox full support 44
notes full support 44
notes
notes extended support releases (esr) before firefox 78 esr do not support service workers and the push api.ie no support noopera full support 29safari no support nowebview android ...
... no support nochrome android full support 42firefox android full support 48
notes full support 48
notes
notes push enabled by default.opera android full support 29safari ios no support nosamsung internet android full support 4.0legend full support full support no support no supportexperimental.
...expect behavior to change in the future.see implementation
notes.see implementation
notes.user must explicitly enable this feature.user must explicitly enable this feature.
PushManager.supportedContentEncodings - Web APIs
full support 17firefox full support 44
notes full support 44
notes
notes extended support releases (esr) before firefox 78 esr do not support service workers and the push api.ie no support noopera full support 47safari no support nowebview android ...
... no support nochrome android full support 60firefox android full support 48
notes full support 48
notes
notes push enabled by default.opera android full support 44safari ios no support nosamsung internet android full support 4.0legend full support full support no support no supportexperimental.
...expect behavior to change in the future.see implementation
notes.see implementation
notes.user must explicitly enable this feature.user must explicitly enable this feature.
PushSubscription.getKey() - Web APIs
specifications specification status comment push api working draft this is the push api spec, but
note that getkey() is not currently specified in here.
... desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetgetkey()chrome full support 42edge full support 16firefox full support 44
notes full support 44
notes
notes extended support releases (esr) before firefox 78 esr do not support service workers and the push api.ie no support noopera full support 29safari no support nowebview android ...
...a android full support 29safari ios no support nosamsung internet android full support 4.0legend full support full support no support no supportsee implementation
notes.see implementation
notes.
RTCIceCandidate.address - Web APIs
note: if port is null — and port is supported by the user agent — passing the candidate to addicecandidate() will fail, throwing an operationerror exception.
... security
notes it's important to
note here that although webrtc does not require the two peers on an rtcpeerconnection to know one another's true ip addresses, the address property on rtcicecandidate can expose more information about the source of the remote peer than the user expects.
... usage
notes consider this sdp attribute line (a-line) which describes an ice candidate: a=candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host the fifth field, "192.168.0.56" is the ip address in this candidate's a-line string.
RTCIceCandidate.usernameFragment - Web APIs
note that 24 bits of the username fragment are required to be randomized by the browser.
... usage
notes ice uses the usernamefragment and password to ensure message integrity.
...
note: there is no api to obtain the ice password, for what should be fairly obvious security reasons.
RTCPeerConnection.addTrack() - Web APIs
note: adding a track to a connection triggers renegotiation by firing a negotiationneeded event.
...
note: every rtcrtpsender is paired with an rtcrtpreceiver to make up an rtcrtptransceiver.
... usage
notes adding tracks to multiple streams after the track parameter, you can optionally specify one or more mediastream objects to add the track to.
RTCPeerConnection.createOffer() - Web APIs
note: you shouldn't use this legacy property.
...
note: you shouldn't use this legacy property.
...
note: keep in mind that this is part of the signaling process, the transport layer for which is an implementation detail that's entirely up to you.
RTCPeerConnection.setRemoteDescription() - Web APIs
note: the process of changing descriptions actually involves intermediary steps handled by the webrtc layer to ensure that an active connection can be changed without losing the connection if the change does not succeed.
... usage
notes when you call setremotedescription(), the ice agent checks to make sure the rtcpeerconnection is in either the stable or have-remote-offer signalingstate.
...
note: earlier implementations of webrtc would throw an exception if an offer was set outside a stable or have-remote-offer state.
RTCRtpTransceiver.stop() - Web APIs
note: until recently, the stopped property was provided to return true if the connection is stopped.
... usage
notes when you call stop() on a transceiver, the sender immediately stops sending media and each of its rtp streams are closed using the rtcp "bye" message.
...
note: stopping the transceiver causes a negotiationneeded event to be sent to the transceiver's rtcpeerconnection, so the connection can adapt to the change.
SVGCircleElement - Web APIs
it is de
noted by the cx attribute of the element.
...it is de
noted by the cy attribute of the element.
...it is de
noted by the r of the element.
SVGLengthList - Web APIs
note: starting in gecko 5.0,the svglengthlist dom interface is now indexable and can be accessed like arrays interface overview also implement none methods void clear() svglength initialize(in svglength newitem) svglength getitem(in unsigned long index) svglength insertitembefore(in svglength newitem, in unsigned long index) svglength replaceitem(in svglength newitem, in unsigned long index) svglength removeitem(in unsigned long index) svglength appenditem(in svglength newitem) properties ...
...if the item is already in this list,
note that the index of the item to insert before is before the removal of the item.
...if the item is already in this list,
note that the index of the item to replace is before the removal of the item.
SVGNumberList - Web APIs
note: starting in gecko 5.0,the svgnumberlist dom interface is now indexable and can be accessed like arrays.
...if the item is already in this list,
note that the index of the item to insert before is before the removal of the item.
...if the item is already in this list,
note that the index of the item to replace is before the removal of the item.
SVGTextContentElement - Web APIs
note that this method only accounts for the widths of the glyphs in the substring and any extra spacing inserted by the css 'letter-spacing' and 'word-spacing' properties.
...
note: in svg 1.1 this method returned an svgpoint.
...
note: in svg 1.1 this method returned an svgpoint.
SVGTransformList - Web APIs
note: starting in gecko 9.0,the svgtransformlist dom interface is now indexable and can be accessed like arrays interface overview also implement none methods void clear() svgtransform initialize(in svgtransform newitem) svgtransform getitem(in unsigned long index) svgtransform insertitembefore(in svgtransform newitem, in unsigned long index) svgtransform replaceitem(in svgtransform newitem, in unsigned long index) svgtransform removeitem(in unsigned long index) svgtransform appenditem(in...
...if the item is already in this list,
note that the index of the item to insert before is before the removal of the item.
...if the item is already in this list,
note that the index of the item to replace is before the removal of the item.
Screen.lockOrientation() - Web APIs
note: this method only works for installed web apps or for web pages in full-screen mode.
...
note: it's possible to set several locks at the same time.
...
note that the return value doesn't indicate that the screen orientation is indeed locked: there may be a delay.
Selection - Web APIs
notes string representation of a selection calling the selection.tostring() method returns the text contained within the selection, e.g.: var selobj = window.getselection(); window.alert(selobj);
note that using a selection object as the argument to window.alert will call the object's tostring method.
...typically, it holds only one range, accessed as follows: var selobj = window.getselection(); var range = selobj.getrangeat(0); selobj is a selection object range is a range object as the selection api specification
notes, the selection api was initially created by netscape and allowed multiple ranges (for instance, to allow the user to select a column from a <table>).
...
note: the selection api methods may only move focus to an editing host, not to other focusable elements (e.g., <a>).
StereoPannerNode.StereoPannerNode() - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetstereopannernode() constructorchrome full support 55
notes full support 55
notes
notes before chrome 59, the default values were not supported.edge full support ≤79firefox full support 53ie no support noopera full support 42safari...
... no support nowebview android full support 55
notes full support 55
notes
notes before chrome 59, the default values were not supported.chrome android full support 55
notes full support 55
notes
notes before chrome 59, the default values were not supported.firefox android full support 53opera android full support 42safari ios no support nosamsung internet android full support 6.0
notes ...
... full support 6.0
notes
notes before samsung internet 7.0, the default values were not supported.legend full support full support no support no supportsee implementation
notes.see implementation
notes.
Streams API concepts - Web APIs
if you want another reader to start reading your stream, you typically need to cancel the first reader before you do anything else (although you can tee streams, see the teeing section below)
note that there are two different types of readable stream.
...
note: this functionality isn't fully thought through yet, or available in many browsers.
...
note: what happens in the case of zero or negative desired size hasn’t really been defined in the spec so far.
TextEncoder - Web APIs
note: there is a polyfill implementation to support non-utf-8 text encodings on github.
...finally,
note that you should run the below code through a minifier (especially closure compiler) to turn sequences like 0x1e << 3 into 0xf0.
...tcode=0, i = 0; i !== len; ) { point = str.charcodeat(i), i += 1; if (point >= 0xd800 && point <= 0xdbff) { if (i === len) { resarr[respos += 1] = 0xef/*0b11101111*/; resarr[respos += 1] = 0xbf/*0b10111111*/; resarr[respos += 1] = 0xbd/*0b10111101*/; break; } // https://mathiasbynens.be/
notes/javascript-encoding#surrogate-formulae nextcode = str.charcodeat(i); if (nextcode >= 0xdc00 && nextcode <= 0xdfff) { point = (point - 0xd800) * 0x400 + nextcode - 0xdc00 + 0x10000; i += 1; if (point > 0xffff) { resarr[respos += 1] = (0x1e/*0b11110*/<<3) | (point>>>18); ...
TextRange - Web APIs
note that this interface is not supported in non ie browsers.
... var range = document.selection.createrange(); var element = document.getelementbyid("test"); range.movetoelementtext(element); range.select(); // selected "sometexttobeselected" <!doctype html> <html> <head> <title>textrange example</title> </head> <body> <p id="test">sometexttobeselected</p> </body> </html>
notes use textrange to operate the selection valid only under ie9.
... var sel = document.selection; var range = sel.createrange(); alert(range.text); // output plaintext of the selection
note that the createrange method does not create a reference.
URL.createObjectURL() - Web APIs
note: this feature is available in web workers.
...
note: this feature is not available in service workers due to its potential to create memory leaks.
... usage
notes memory management each time you call createobjecturl(), a new object url is created, even if you've already created one for the same object.
URLSearchParams.toString() - Web APIs
note: this method returns the query string without the question mark.
...
note: this feature is available in web workers.
...params.append('foo', 4); console.log(params.tostring()); //prints 'foo=1&bar=2&foo=4' //
note: params can also be directly created let url = new url('https://example.com?foo=1&bar=2'); let params = url.searchparams; // or even simpler let params = new urlsearchparams('foo=1&bar=2'); specifications specification status comment urlthe definition of 'tostring() (see "stringifier")' in that specification.
URLUtilsReadOnly.hash - Web APIs
e for androidfirefox for androidopera for androidsafari on iossamsung internethash experimentalchrome no support noedge no support nofirefox full support 38 full support 38 no support 3.5 — 38
notes
notes before firefox 38, firefox returned the hash percent encoded.
... nosafari no support nowebview android no support nochrome android no support nofirefox android full support 38 full support 38 no support 4 — 38
notes
notes before firefox 38, firefox returned the hash percent encoded.
...expect behavior to change in the future.see implementation
notes.see implementation
notes.
WaveShaperNode.WaveShaperNode() - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetwaveshapernode() constructorchrome full support 55
notes full support 55
notes
notes before chrome 59, the default values were not supported.edge full support ≤79firefox full support 53ie no support noopera full support 42safari...
... webview android full support 55
notes full support 55
notes
notes before chrome 59, the default values were not supported.chrome android full support 55
notes full support 55
notes
notes before chrome 59, the default values were not supported.firefox android full support 53opera android full support 42safari ios ?
... samsung internet android full support 6.0
notes full support 6.0
notes
notes before samsung internet 7.0, the default values were not supported.legend full support full support no support no support compatibility unknown compatibility unknownsee implementation
notes.see implementation
notes.
WebGL constants - Web APIs
returns never, always, less, equal, lequal, greater, gequal, or
notequal.
...returns never, always, less, equal, lequal, greater, gequal, or
notequal.
...
notequal 0x0205 passed to depthfunction or stencilfunction to specify depth or stencil tests will pass if the new depth value is not equal to the stored value.
Introduction to the Real-time Transport Protocol (RTP) - Web APIs
note: webrtc actually uses srtp (secure real-time transport protocol) to ensure that the exchanged data is secure and authenticated as appropriate.
...some of the more
noteworthy things rtp doesn't include: editor's
note: we should add information about where these deficiencies are compensated for, if they are at all.
...
note: this example makes use of modern javascript features including async functions and the await expression.
A simple RTCDataChannel sample - Web APIs
note: even though both ends of our connection will be on the same page, we're going to refer to the one that starts the connection as the "local" one, and to the other as the "remote" end.
...
note: in a real-world scenario in which the two peers aren't running in the same context, the process is a bit more involved; each side provides, one at a time, a suggested way to connect (for example, udp, udp with a relay, tcp, etc.) by calling rtcpeerconnection.addicecandidate(), and they go back and forth until agreement is reached.
...
note: once again, this process is not a real-world implementation; in normal usage, there's two chunks of code running on two machines, interacting and negotiating the connection.
Viewpoints and viewers: Simulating cameras in WebXR - Web APIs
note: most diagrams used in this article to show how the camera moves while performing standard movements was taken from an article on the filmmakeriq web site; namely, from this image which is found all over the web, however, and though we assume these are under a permissive license due to their frequent reuse, ownership is not certain.
...this affects the way certain values work, which will be
noted as they come up below.
... to move the camera left and right, translate the view matrix along the x axis in the opposite direction from the desired camera movement: mat4.translate(viewmatrix, viewmatrix, [-truckdistance, 0, 0]);
note the vector [-truckdistance, 0, 0].
Geometry and reference spaces in WebXR - Web APIs
const radians_per_degree = math.pi / 180.0; let degreestoradians = (deg) => deg * radians_per_degree; let radianstodegrees = (rad) => rad / radians_per_degree; times and durations
note that for security reasons, domhighrestimestamp usually introduces a small amount of imprecision to the clock in order to prevent it from being used in fingerprinting and timing-based attacks.
...
note that when we say that a transform applies to a point, it also, by extension, can be applied to a collection of points.
...
note: at this time, the reference space to use or to prefer is the only option available when creating an xrsession.
Inputs and input sources - Web APIs
note: this doesn't mean your app needs to decide upon a primary controller.
...
note: if an input source doesn't have a primary action, the input source is considered to be an auxiliary input source.
...
note: while gamepad is defined by the gamepad api, it is not managed by the gamepad api, so you must not attempt to use any gamepad api methods with it.
Starting up and shutting down a WebXR session - Web APIs
emulator issues and
notes while this isn't the place for a full article about the extension, there are some specific things worth mentioning.
...fundamentally, that looks like this: xr.requestsession("immersive-vr").then((session) => { xrsession = session; /* continue to set up the session */ });
note the parameter passed into requestsession() in this code snippet: immersive-vr.
...
note that the reset event is fired at the xrreferencespace, not the xrsession!
Using the Web Speech API - Web APIs
note: on some browsers, like chrome, using speech recognition on a web page involves a server-based recognition engine.
...
note how each is separated by a pipe character.
...speechrecognition.onnomatch seems to be supposed to handle the first case mentioned, although
note that at the moment it doesn't seem to fire correctly; it just returns whatever was recognised anyway: recognition.onnomatch = function(event) { diagnostic.textcontent = 'i didnt recognise that color.'; } speechrecognition.onerror handles cases where there is an actual error with the recognition successfully — the speechrecognitionerror.error property contains the actual error returned: rec...
window.dump() - Web APIs
notes a common use of dump() is to debug javascript.
...
note that dump output from xpcom components goes to stderr, while dump called elsewhere will output to stdout.
...
note: this preference is not listed in about:config by default, you may need to create it (right-click the content area -> new -> boolean).
Window.openDialog() - Web APIs
note that this also means the user won't be able to interact with the opener window until he closes the modal dialog.
... example var win = opendialog("http://example.tld/zzz.xul", "dlg", "", "pizza", 6.98);
notes new features all - initially activates (or deactivates ("all=no")) all chrome (except the behavior flags chrome, dialog and modal).
... to access these extra parameters from within dialog code, use the following scheme: var food = window.arguments[0]; var price = window.arguments[1];
note that you can access this property from within anywhere in the dialog code.
Window: popstate event - Web APIs
note that just calling history.pushstate() or history.replacestate() won't trigger a popstate event.
...
note: when writing functions that process popstate event it is important to take into account that properties like window.location will already reflect the state change (if it affected the current url), but document might still not.
...title 1", "?page=1"); history.pushstate({page: 2}, "title 2", "?page=2"); history.replacestate({page: 3}, "title 3", "?page=3"); history.back(); // logs "location: http://example.com/example.html?page=1, state: {"page":1}" history.back(); // logs "location: http://example.com/example.html, state: null" history.go(2); // logs "location: http://example.com/example.html?page=3, state: {"page":3}"
note that even though the original history entry (for http://example.com/example.html) has no state object associated with it, a popstate event is still fired when we activate that entry after the second call to history.back().
Window.scrollBy() - Web APIs
examples to scroll down one page: window.scrollby(0, window.innerheight); to scroll up: window.scrollby(0, -window.innerheight); using options: window.scrollby({ top: 100, left: 100, behavior: 'smooth' });
notes window.scrollby() scrolls by a particular amount, whereas window.scroll() scrolls to an absolute position in the document.
...ktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetscrollbychrome full support 1edge full support 79 full support 79 no support 12 — 79
notes
notes only scrollby(x-coord, y-coord) is supported.firefox full support 1ie partial support 11
notes partial support 11
notes
notes only scrollby(x-coord, y-coord) is supported.opera full support 3safari full support ...
...nosamsung internet android full support 5.0legend full support full support partial support partial support no support no supportsee implementation
notes.see implementation
notes.
Synchronous and asynchronous requests - Web APIs
note: support for timeout was added in gecko 12.0.
... synchronous request
note: starting with gecko 30.0 (firefox 30.0 / thunderbird 30.0 / seamonkey 2.27), blink 39.0, and edge 13, synchronous requests on the main thread have been deprecated due to their negative impact on the user experience.
... mytask.js (the worker): self.onmessage = function (event) { if (event.data === "hello") { var xhr = new xmlhttprequest(); xhr.open("get", "myfile.txt", false); // synchronous request xhr.send(null); self.postmessage(xhr.responsetext); } };
note: the effect is asynchronous, because of the use of the worker.
ARIA live regions - Accessibility
note: assistive technologies will announce dynamic changes in the content of a live region.
... here is a screenshot of voiceover on mac announcing the update (via subtitles) to the live region: preferring specialized live region roles in the following well-known predefined cases it is better to use a specific provided "live region role": role description compatibility
notes log chat, error, game or other type of log to maximize compatibility, add a redundant aria-live="polite" when using this role.
... <div id="clock" role="timer" aria-live="polite" aria-atomic="true"></div>
note: as observed, setting/updating the innerhtml again would cause the whole text to be read again, whether or not you set aria-atomic="true", so the above clock example does not work as expected.
Using the alertdialog role - Accessibility
note: this role should only be used for alert messages that have associated interactive controls.
...
note: opinions may differ on how assistive technology should handle this technique.
... <div role="alertdialog" aria-labelledby="dialog1title" aria-describedby="dialog1desc"> <div role="document" tabindex="0"> <h2 id="dialog1title">your login session is about to expire</h2> <p id="dialog1desc">to extend your session, click the ok button</p> <button>ok</button> </div> </div> working examples: tbd
notes aria attributes used alertdialog aria-labelledby aria-describedby related aria techniques using the dialog role using the alert role compatibility tbd: add support information for common ua and at product combinations additional resources ...
Using the aria-required attribute - Accessibility
note that this attribute will not automatically change the presentation of the field.
...
note: opinions may differ on how assistive technology should handle this technique.
.../label> <input id="firstname" type="text" aria-required="true" /> <br/> <label for="lastname">last name:</label> <input id="lastname" type="text" aria-required="true" /> <br/> <label for="streetaddress">street address:</label> <input id="streetaddress" type="text" /> </form> working examples: tooltip example (includes the use of the aria-required attribute)
notes used in aria roles combobox gridcell listbox radiogroup spinbutton textbox tree related aria techniques using the aria-invalid attribute compatibility tbd: add support information for common ua and at product combinations additional resources wai-aria specification for aria-required wai-aria authoring practices for forms constraint validation in html5 ...
ARIA: List role - Accessibility
for example, our above example should be rewritten as follows: <ul> <li>list item 1</li> <li>list item 2</li> <li>list item 3</li> </ul> or use an ordered list if the order of the list items matters: <ol> <li>list item 1</li> <li>list item 2</li> <li>list item 3</li> </ol>
note: the aria list/listitem roles don't distinguish between ordered and unordered lists.
... as an aside,
note that if you are using the semantic html elements of ol or ul and apply a role of presentation, each child li element inherits the presentation role because aria requires the listitem elements to have the parent list element.
...
note: if you are marking up a list of items that will function as a tabbed interface, you should instead use the tab, tabpanel, and tablist roles.
ARIA: button role - Accessibility
<div id="savechanges" tabindex="0" role="button" aria-pressed="false">save</div> the above example creates a simple button which is first in the focus order, though <button> or <input> with type="button" should be used for buttons: <button id="savechanges">save</button>
note: if using role="button" instead of the semantic <button> or <input type="button"> elements, you will need to make the element focusable and have to define event handlers for click and keydown events, including the enter and space keys, in order to process the user's input.
...(
note not the deprecated onkeypress) changing attribute values aria-pressed the value of aria-pressed defines the state of a toggle button.
... working draft
notes aria attributes used button aria-pressed aria-expanded aria-haspopup additional resources strong native semantics in html5
notes on using aria in html official wai-aria example code aria menubutton role ...
ARIA: dialog role - Accessibility
note that for non-modal dialogs there will have to be a global keyboard shortcut that allows focus to be moved between opened dialogs and the main page.
...
note: opinions may differ on how assistive technology should handle this technique, and the order of announcements may differ depending on the assistive technolgy used.
...d="lastname" type="text"/> </p> <p> <label for="interests">interests</label> <textarea id="interests"></textarea> </p> <p> <input type="checkbox" id="autologin"/> <label for="autologin">auto-login?</label> </p> <p> <input type="submit" value="save information"/> </p> </form> </div> working examples: jquery-ui dialog
notes
note: while it is possible to prevent keyboard users from moving focus to elements outside of the dialog, screen reader users may still be able to navigate to that content using their screen reader's virtual cursor.
Web applications and ARIA FAQ - Accessibility
browsers aria is supported in the following browsers: browser minimum version
notes firefox 3.0+ works with nvda, jaws 10+, and orca chrome latest screen reader support still experimental as of chrome 15 safari 4+ safari 5 support is much improved.
... no live region support currently
note: early versions of these tools often had partial or buggy aria implementations.
... for
notes on jaws support for aria as of jaws 10, see this article from the paciello group: jaws support for aria.
Accessibility documentation index - Accessibility
for a full list of roles, see using aria: roles, states, and properties 42 aria: comment role aria, aria role, comment, reference, annotations the comment landmark role semantically de
notes a comment/reaction to some content on the page, or to a previous comment.
... 47 aria: mark role aria, aria role, reference, annotations, mark the mark landmark role semantically de
notes html elements containing text that is marked/highlighted for reference purposes.
... 50 aria: suggestion role aria, aria role, reference, annotations, suggestion the suggestion landmark role semantically de
notes a single proposed change to an editable document.
Keyboard-navigable JavaScript widgets - Accessibility
tabindex="0") yes in tab order relative to element's position in document (
note that interactive elements like <a> have this behavior by default, they don't need the attribute).
...
note that disabled items within a grouped widget (such as menu items in a menu) should remain navigable using arrow keys.
...
note that updating the tabindex to "0" requires also updating the previously selected item to tabindex="-1".
-moz-force-broken-image-icon - CSS: Cascading Style Sheets
note: even if the value is set to 1 the alt attribute will still be displayed, alongside the broken image icon.
... formal definition initial value0applies toimagesinheritednocomputed valueas specifiedanimation typediscrete formal syntax <integer> examples html <img src='/broken/image/link.png' alt='broken image link'> css img { -moz-force-broken-image-icon: 1; height: 100px; width: 100px; } result screenshotlive sample
note: unless the image has a specified height and width the broken image icon will not be displayed but the alt attribute will also be hidden if -moz-force-broken-image-icon is set to 1.
...
notes this property will only work in gecko-based browsers.
-moz-user-input - CSS: Cascading Style Sheets
note: -moz-user-input was one of the proposals leading to the proposed css 3 user-input property, which has not yet reached candidate recommendation (call for implementations).
...please
note that this value is no longer supported in firefox 60 onwards (bug 1405087).
...please
note that this value is no longer supported in firefox 60 onwards (bug 1405087).
::before (:before) - CSS: Cascading Style Sheets
/* add a heart before links */ a::before { content: "♥"; }
note: the pseudo-elements generated by ::before and ::after are contained by the element's formatting box, and thus don't apply to replaced elements such as <img>, or to <br> elements.
... syntax /* css3 syntax */ ::before /* css2 syntax */ :before
note: css3 introduced the ::before notation (with two colons) to distinguish pseudo-classes from pseudo-elements.
...
note that there are no icons used, and the check-mark is actually the ::before that has been styled in css.
:host-context() - CSS: Cascading Style Sheets
note: this has no effect when used outside a shadow dom.
... desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internet:host-context()chrome full support 54edge full support 79firefox no support no
notes no support no
notes
notes see bug 1082060.ie no support noopera full support 41safari no support nowebview android full support 54chrome android full support...
... 54firefox android no support no
notes no support no
notes
notes see bug 1082060.opera android full support 41safari ios no support nosamsung internet android full support 6.0legend full support full support no support no supportsee implementation
notes.see implementation
notes.
:lang() - CSS: Cascading Style Sheets
/* selects any <p> in english (en) */ p:lang(en) { quotes: '\201c' '\201d' '\2018' '\2019'; }
note: in html, the language is determined by a combination of the lang attribute, the <meta> element, and possibly by information from the protocol (such as http headers).
...
note that this doesn't illustrate the only way to do this, and that the best method to use depends on the type of document.
... also
note that unicode values are used to specify some of the special quote characters.
:scope - CSS: Cascading Style Sheets
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internet:scopechrome full support 27edge full support 79firefox full support 32
notes full support 32
notes
notes firefox 55 removes support for <style scoped> but not for the :scope pseudo-class, which is still supported.
...upport noopera full support 15safari full support 7webview android full support ≤37chrome android full support 27firefox android full support 32
notes full support 32
notes
notes firefox 55 removes support for <style scoped> but not for the :scope pseudo-class, which is still supported.
... android full support 15safari ios full support 7samsung internet android full support 1.5legend full support full support no support no supportsee implementation
notes.see implementation
notes.user must explicitly enable this feature.user must explicitly enable this feature.
:where() - CSS: Cascading Style Sheets
note: you can also find this example on github; see is-where.
...to change preferences in chrome, visit chrome://flags.edge no support nofirefox full support 78 full support 78 full support 77
notes disabled
notes enabled by default in firefox nightly.disabled from version 77: this feature is behind the layout.css.is-where-selectors.enabled preference (needs to be set to enabled).
...oopera android no support nosafari ios no support nosamsung internet android no support nolegend full support full support no support no supportsee implementation
notes.see implementation
notes.user must explicitly enable this feature.user must explicitly enable this feature.
forced-colors - CSS: Cascading Style Sheets
note: this feature is not supported by any user agent and its specifics are subject to change.
... usage
notes properties affected by forced-color mode in forced colors mode, the values of the following properties are treated as if they have no author-level values specified.
... examples
note: no browser currently implements this feature so the following example will not work.
Coordinate systems - CSS: Cascading Style Sheets
note that this is unlike most mathematical models, where the origin is at the bottom-left corner, with positive y-coordinate values being above the origin.
...
note that within the <div> with the id "log", we have a paragraph for each coordinate system, with span used for each of the elements to receive and display the coordinates in each model.
...
note also the effect of scrolling the example horizontally upon the values returned and how the value of clientx doesn't change.
Backwards Compatibility of Flexbox - CSS: Cascading Style Sheets
note also that internet explorer 11 supports the modern display: flex specification however it has a number of bugs in the implementation.
... “
note: some values of display normally trigger the creation of anonymous boxes around the original box.
... feature queries and flexbox you can use feature queries to detect flexbox support: @supports (display: flex) { // code for supporting browsers }
note that internet explorer 11 does not support feature queries yet does support flexbox.
Cross-browser Flexbox mixins - CSS: Cascading Style Sheets
+, edge, opera) this was inspired by: http://dev.opera.com/articles/view/advanced-cross-browser-flexbox/ with help from: http://w3.org/tr/css3-flexbox/ http://the-echoplex.net/flexyboxes/ http://msdn.microsoft.com/en-us/library/ie/hh772069(v=vs.85).aspx http://css-tricks.com/using-flexbox/ a complete guide to flexbox | css-tricks visual guide to css3 flexbox: flexbox playground |
note: mixins are not currently supported natively in browsers.
...
note: space-* values not supported in older syntaxes.
...
note that this property has no effect when the flexbox has only a single line.
OpenType font features guide - CSS: Cascading Style Sheets
note: the examples below show the properties and some example combinations, along with the lower-level syntax equivalents.
...it should be
noted that if letter-spacing is also set on your text, that is applied after kerning.
...
note: these glyphs were copied out of a font sample and are not intended as prose.
Basic Concepts of grid layout - CSS: Cascading Style Sheets
round-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; padding: 1em; color: #d9480f; } <div class="wrapper"> <div>one</div> <div>two <p>i have some more content in.</p> <p>this makes me taller than 100 pixels.</p> </div> <div>three</div> <div>four</div> <div>five</div> </div> grid lines it should be
noted that when we define a grid we define the grid tracks, not the lines.
... .wrapper { display: grid; grid-template-columns: repeat(3, 1fr); column-gap: 10px; row-gap: 1em; }
note: when grid first shipped in browsers the column-gap, row-gap and gap were prefixed with the grid- prefix as grid-column-gap, grid-row-gap and grid-gap respectively.
...
note: this feature shipped in firefox 71, which is currently the only browser to implement subgrid.
Line-based placement with CSS Grid - CSS: Cascading Style Sheets
note that grid is indexed according to the writing mode of the document.
...
note that we can leave cells empty if we wish.
...
note: when grid first shipped in browsers the column-gap, row-gap and gap properties were prefixed with the grid- prefix as grid-column-gap, grid-row-gap and grid-gap respectively.
Logical properties for margins, borders and padding - CSS: Cascading Style Sheets
.box { margin-block: 5px 10px; }
note: the shorthand properties margin-inline and margin-block shipped in firefox 66.
... in a horizontal writing-mode this css would apply 5px of padding to the top of the box and 10px of padding to the bottom: .box { padding-block: 5px 10px; }
note: the shorthand properties padding-inline and padding-block shipped in firefox 66.
... .box { border-block: 2px solid green; border-inline-width: 4px; border-inline-style: dotted; border-inline-color: rebeccapurple; }
note: these two value shorthands shipped in firefox 66, check browser support before using as other browsers may not have implemented them yet.
The stacking context - CSS: Cascading Style Sheets
note: the hierarchy of stacking contexts is a subset of the hierarchy of html elements because only certain elements create stacking contexts.
...the hierarchy of stacking contexts is organized as follows: root div #1 div #2 div #3 div #4 div #5 div #6 it is important to
note that div #4, div #5 and div #6 are children of div #3, so stacking of those elements is completely resolved within div#3.
...
notes: div #4 is rendered under div #1 because div #1's z-index (5) is valid within the stacking context of the root element, while div #4's z-index (6) is valid within the stacking context of div #3.
Using CSS transitions - CSS: Cascading Style Sheets
note: the set of properties that can be animated is changing as the specification develops.
... you can control the individual components of the transition with the following sub-properties: (
note that these transitions loop infinitely only for the purpose of our examples; css transitions only visualize a property change from start to finish.
...the addeventlistener() method to monitor for this event: el.addeventlistener("transitionend", updatetransition, true); you detect the beginning of a transition using transitionrun (fires before any delay) and transitionstart (fires after any delay), in the same kind of fashion: el.addeventlistener("transitionrun", signalstart, true); el.addeventlistener("transitionstart", signalstart, true);
note: the transitionend event doesn't fire if the transition is aborted before the transition is completed because either the element is made display: none or the animating property's value is changed.
Layout and the containing block - CSS: Cascading Style Sheets
contain: paint;)
note: the containing block in which the root element (<html>) resides is a rectangle called the initial containing block.
... calculating percentage values from the containing block as
noted above, when certain properties are given a percentage value, the computed value depends on the element's containing block.
... <body> <section> <p>this is a paragraph!</p> </section> </body> body { background: beige; } section { display: inline; background: lightgray; } p { width: 50%; /* == half the body's width */ height: 200px; /*
note: a percentage would be 0 */ background: cyan; } example 3 in this example, the paragraph's containing block is <section> because the latter's position is absolute.
Shorthand properties - CSS: Cascading Style Sheets
note that the values are in clockwise order, beginning at the top: top, right, bottom, then left (trbl, the consonants in "trouble").
...
note: there is also a newer value, revert, which has limited browser support.
...
note: see origin of css declarations in introducing the css cascade for more information on each of these and how they work.
animation-delay - CSS: Cascading Style Sheets
note: when you specify multiple comma-separated values on an animation-* property, they will be assigned to the animations specified in the animation-name property in different ways depending on how many there are.
...etanimation-delaychrome full support 43 full support 43 full support 3prefixed prefixed implemented with the vendor prefix: -webkit-edge full support 12firefox full support 16
notes full support 16
notes
notes before firefox 57, firefox does not repaint elements outside the viewport that are animated into the viewport with a delay.
...-webkit-samsung internet android full support 4.0 full support 4.0 full support 1.0prefixed prefixed implemented with the vendor prefix: -webkit-legend full support full supportsee implementation
notes.see implementation
notes.user must explicitly enable this feature.user must explicitly enable this feature.requires a vendor prefix or different name for use.requires a vendor prefix or different name for use.
background-image - CSS: Cascading Style Sheets
if a specified image cannot be drawn (for example, when the file de
noted by the specified uri cannot be loaded), browsers handle it as they would a none value.
...
note: even if the images are opaque and the color won't be displayed in normal circumstances, web developers should always specify a background-color.
...olor-stop> = <color> <color-stop-length>?<linear-color-hint> = <length-percentage><length-percentage> = <length> | <percentage><angular-color-stop> = <color> && <color-stop-angle>?<angular-color-hint> = <angle-percentage>where <color-stop-length> = <length-percentage>{1,2}<color-stop-angle> = <angle-percentage>{1,2}<angle-percentage> = <angle> | <percentage> examples layering background images
note that the star image is partially transparent and is layered over the cat image.
border-radius - CSS: Cascading Style Sheets
note: as with any shorthand property, individual sub-properties cannot inherit, such as in border-radius:0 0 inherit inherit, which would partially override existing definitions.
... <length> de
notes the size of the circle radius, or the semi-major and semi-minor axes of the ellipse, using length values.
... <percentage> de
notes the size of the circle radius, or the semi-major and semi-minor axes of the ellipse, using percentage values.
column-count - CSS: Cascading Style Sheets
12 full support 12 full support 12prefixed prefixed implemented with the vendor prefix: -webkit-firefox full support 52 full support 52 no support 1.5 — 74prefixed
notes prefixed implemented with the vendor prefix: -moz-
notes prior to version 37, multiple columns didn't work with display: table-caption elements.ie full support 10opera full support 11.1 full support 11.1 full support 15...
... 50 full support 50 full support 18prefixed prefixed implemented with the vendor prefix: -webkit-firefox android full support 52 full support 52 full support 4prefixed
notes prefixed implemented with the vendor prefix: -moz-
notes prior to version 37, multiple columns didn't work with display: table-caption elements.opera android full support 11.1 full support 11.1 full support 14prefixed prefixed implemented with the vendor prefix: -...
...-webkit-samsung internet android full support 5.0 full support 5.0 full support 1.0prefixed prefixed implemented with the vendor prefix: -webkit-legend full support full supportsee implementation
notes.see implementation
notes.requires a vendor prefix or different name for use.requires a vendor prefix or different name for use.
font-size-adjust - CSS: Cascading Style Sheets
79disabled full support 79disabled disabled from version 79: this feature is behind the enable experimental web platform features preference.firefox full support 40 full support 40 full support 3
notes
notes before firefox 40, font-size-adjust: 0 was incorrectly interpreted as font-size-adjust: none (bug 1144885).
... full support 1
notes
notes before firefox 3, font-size-adjust was supported on windows only.ie no support noopera full support 30disabled full support 30disabled disabled from version 30: this feature is behind the enable experimental web platform features preference.safari no support nowebview android no support nochrome android full support 43disabled full support 43disabled disabled from version 43: this feature is behind the enable ex...
...tal web platform features preference.safari ios no support nosamsung internet android no support nolegend full support full support no support no supportsee implementation
notes.see implementation
notes.user must explicitly enable this feature.user must explicitly enable this feature.
font-size - CSS: Cascading Style Sheets
note: to maximize accessibility, it is generally best to use values that are relative to the user's default font size.
...
note: defining font sizes in px is not accessible, because the user cannot change the font size in some browsers.
...
note that the value 2 is essentially a multiplier of the current em size.
font-stretch - CSS: Cascading Style Sheets
however,
note that the <percentage> syntax is not yet supported by all browsers: check the browser compatibility table for details.
...it also applies to ::first-letter and ::first-line.inheritedyescomputed valueas specifiedanimation typea font stretch formal syntax <font-stretch-absolute>where <font-stretch-absolute> = normal | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded | <percentage> examples setting font stretch percentages
note that this example will only work in browsers that support <percentage> values.
...
note: the font-stretch property was initially defined in css 2, but dropped in css 2.1 due to the lack of browser implementation.
font-variation-settings - CSS: Cascading Style Sheets
note that this doesn't mean that the author has to include all of these in their font.
...
note: registered axis tags are identified using lower-case tags, whereas custom axes should be given upper-case tags.
...
note that font designers aren't forced follow this practice in any way, and some won't.
font-weight - CSS: Cascading Style Sheets
note that only four font weights are considered for relative weight calculation; see the meaning of relative weights section below.
...
note that only four font weights are considered for relative weight calculation; see the meaning of relative weights section below.
...
note that when using relative weights, only four font weights are considered — thin (100), normal (400), bold (700), and heavy (900).
justify-items - CSS: Cascading Style Sheets
note that justify-items is ignored in flexbox layouts.
...
note that justify-items is ignored in flexbox layouts.
...
note that if a descendant has a justify-self: auto value, the legacy keyword is not considered by the descend, only the left, right, or center value associated to it.
mix-blend-mode - CSS: Cascading Style Sheets
valueas specifiedanimation typediscretecreates stacking contextyes formal syntax <blend-mode>where <blend-mode> = normal | multiply | screen | overlay | darken | lighten | color-dodge | color-burn | hard-light | soft-light | difference | exclusion | hue | saturation | color | luminosity examples effect of different mix-blend-mode values <div class="grid"> <div class="col"> <div class="
note">blending in isolation (no blending with the background)</div> <div class="row isolate"> <div class="cell"> normal <div class="container normal"> <div class="group"> <div class="item firefox"></div> <svg viewbox="0 0 150 150"> <defs> <lineargradient id="red"> <stop offset="0" stop-color="hsl(0,1...
...ss="item firefox"></div> <svg viewbox="0 0 150 150"> <ellipse class="item r" cx="75" cy="75" rx="25" ry="70"></ellipse> <ellipse class="item g" cx="75" cy="75" rx="25" ry="70"></ellipse> <ellipse class="item b" cx="75" cy="75" rx="25" ry="70"></ellipse> </svg> </div> </div> </div> </div> <div class="
note">blending globally (blend with the background)</div> <div class="row"> <div class="cell"> normal <div class="container normal"> <div class="group"> <div class="item firefox"></div> <svg viewbox="0 0 150 150"> <ellipse class="item r" cx="75" cy="75" rx="25" ry="70"></ellipse> <ellipse class="item g" cx="75" cy="75" rx=...
...border-box; background: #eee; } .grid { width: 100%; display: flex; font: 1em monospace; } .row { display: flex; flex: 1 auto; flex-direction: row; flex-wrap: wrap; height: auto; } .col { display: flex; flex: 1 auto; flex-direction: column; height: auto; } .cell { margin: .5em; padding: .5em; background-color: #fff; overflow: hidden; text-align: center; } .
note { background: #fff3d4; padding: 1em; margin: .5em .5em 0; font: .8em sans-serif; text-align: left; white-space: nowrap; } .
note + .row .cell { margin-top: 0; } .container { position: relative; background: linear-gradient(to right, #000 0%, transparent 50%, #fff 100%), linear-gradient(to bottom, #ff0 0%, #f0f 50%, #0ff 100%); width: 150px; height: 150px; mar...
page-break-after - CSS: Cascading Style Sheets
user agents may also apply it to other elements like table-row elements.inheritednocomputed valueas specifiedanimation typediscrete formal syntax auto | always | avoid | left | right | recto | verso examples setting a page break after foot
notes /* move to a new page after foot
notes */ div.foot
notes { page-break-after: always; } specifications specification status comment css logical properties and values level 1the definition of 'recto and verso' in that specification.
... desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetpage-break-afterchrome full support 1edge full support 12firefox full support 1
notes full support 1
notes
notes the values avoid, left, and right are unsupported.ie full support 4opera full support 7safari full support 1.2webview android full support 37chrom...
...e android full support 18firefox android full support 4
notes full support 4
notes
notes the values avoid, left, and right are unsupported.opera android full support 14safari ios full support 1samsung internet android full support 1.0legend full support full supportsee implementation
notes.see implementation
notes.
page-break-before - CSS: Cascading Style Sheets
user agents may also apply it to other elements like table-row elements.inheritednocomputed valueas specifiedanimation typediscrete formal syntax auto | always | avoid | left | right | recto | verso examples avoid a page break before the dic /* avoid page break before the div */ div.
note { page-break-before: avoid; } specifications specification status comment css logical properties and values level 1the definition of 'recto and verso' in that specification.
... desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetpage-break-beforechrome full support 1edge full support 12firefox full support 1
notes full support 1
notes
notes the values avoid, left, and right are unsupported.ie full support 4opera full support 7safari full support 1.2webview android full support 37chrom...
...e android full support 18firefox android full support 4
notes full support 4
notes
notes the values avoid, left, and right are unsupported.opera android full support 14safari ios full support 1samsung internet android full support 1.0legend full support full supportsee implementation
notes.see implementation
notes.
<position> - CSS: Cascading Style Sheets
the <position> (or <bg-position>) css data type de
notes a two-dimensional coordinate used to set a location relative to an element box.
...
note: the final position described by the <position> value does not need to be inside the element's box.
...| [ [ left | right ] [ <length> | <percentage> ] ] && [ [ top | bottom ] [ <length> | <percentage> ] ] ]
note: the background-position property also accepts a three-value syntax.
ruby-position - CSS: Cascading Style Sheets
foxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetruby-position experimentalchrome no support noedge no support 12 — 79firefox full support 38ie no support no
notes no support no
notes
notes internet explorer 9 and later support an old draft values: inline (equivalent of having display: inline on the ruby), and above (synonym of the modern over).opera no support nosafari no support no
notes no support ...
... no
notes
notes safari implements a non-standard, prefixed, version of ruby-position, -webkit-ruby-position: it has two properties: before and after (both equivalent, for ltr and rtl scripts to the standard over value used with ruby-align: start).webview android no support nochrome android no support nofirefox android full support 38opera android no support nosafari ios no support no
notes no support no
notes
notes safari implements a non-standard, prefixed, version of ruby-position, -webkit-ruby-position: it ...
...expect behavior to change in the future.see implementation
notes.see implementation
notes.
<shape> - CSS: Cascading Style Sheets
note: <shape> and rect() work in conjunction with clip, which has been deprecated in favor of clip-path.
...port 1samsung internet android full support 1.0rect() deprecatedchrome full support 1edge full support 12firefox full support 1ie full support 5.5
notes full support 5.5
notes
notes for internet explorer versions 5.5 through 7, the rect() function uses spaces (instead of commas) to separate parameters.
...not for use in new websites.see implementation
notes.see implementation
notes.
rotateX() - CSS: Cascading Style Sheets
note: rotatex(a) is equivalent to rotate3d(1, 0, 0, a).
...
note: unlike rotations in the 2d plane, the composition of 3d rotations is usually not commutative.
...a positive angle de
notes a clockwise rotation, a negative angle a counter-clockwise one.
rotateY() - CSS: Cascading Style Sheets
note: rotatey(a) is equivalent to rotate3d(0, 1, 0, a).
...
note: unlike rotations in the 2d plane, the composition of 3d rotations is usually not commutative.
...a positive angle de
notes a clockwise rotation, a negative angle a counter-clockwise one.
rotateZ() - CSS: Cascading Style Sheets
note: rotatez(a) is equivalent to rotate(a) or rotate3d(0, 0, 1, a).
...
note: unlike rotations in the 2d plane, the composition of 3d rotations is usually not commutative.
...a positive angle de
notes a clockwise rotation, a negative angle a counter-clockwise one.
user-select - CSS: Cascading Style Sheets
-select: all; /* webkit-specific values */ -webkit-user-select: none; -webkit-user-select: text; -webkit-user-select: all; /* doesn't work in safari; use only "none" or "text", or else it will allow typing in the <html> container */ /* microsoft-specific values */ -ms-user-select: none; -ms-user-select: text; -ms-user-select: element;
note: user-select is not an inherited property, though the initial auto value makes it behave like it is inherited most of the time.
...
note that the selection object can contain these elements.
...
note: css ui 4 renames user-select: element to contain.
Media buffering, seeking, and time ranges - Developer guides
note: you can see the timerange code running live on js bin.
...we can find this point in the media using the following line of code: var seekableend = myaudio.seekable.end(myaudio.seekable.length - 1);
note: myaudio.seekable.end(myaudio.seekable.length - 1) actually tells us the end point of the last time range that is seekable (not all seekable media).
... this should give you results similar to the following, where the light grey bar represents the buffered progress and green bar shows the played progress:
note: you can see the buffering code running live on js bin.
Rich-Text Editing in Mozilla - Developer guides
note: this document is out-of-date; you are advised to consult the more up-to-date document available at making content editable.
... examples please
note: the example files are still being migrated from another site.
...4xd5r+b0ddaenbxbhbhn2dgwdaqfjjyvhcqyrfgoidgiqjawtcqmriwwmfgicnvcaaamoak+blaortluyt7i5uiuhads=" /> </div> <div id="textbox" contenteditable="true"><p>lorem ipsum</p></div> <p id="editmode"><input type="checkbox" name="switchmode" id="switchbox" onchange="setdocmode(this.checked);" /> <label for="switchbox">show html</label></p> <p><input type="submit" value="send" /></p> </form> </body> </html>
note: if you want to see how to standardize the creation and the insertion of your editor in your page, please see our more complete rich-text editor example.
Making content editable - Developer guides
note: in firefox 63 beta/dev edition, some of the rich-text editing features have been disabled by default, for better cross-browser compatibility.
...
note: internet explorer, which is no longer being developed, uses <p> elements instead of <div>.
...x4xd5r+b0ddaenbxbhbhn2dgwdaqfjjyvhcqyrfgoidgiqjawtcqmriwwmfgicnvcaaamoak+blaortluyt7i5uiuhads=" /> </div> <div id="textbox" contenteditable="true"><p>lorem ipsum</p></div> <p id="editmode"><input type="checkbox" name="switchmode" id="switchbox" onchange="setdocmode(this.checked);" /> <label for="switchbox">show html</label></p> <p><input type="submit" value="send" /></p> </form> </body> </html>
note: if you want to see how to standardize the creation and the insertion of your editor in your page, please see our more complete rich-text editor example.
Applying color to HTML elements using CSS - HTML: Hypertext Markup Language
(0.15turn, 90%, 75%)</code></td> <td style="background-color: hsl(0.15turn, 90%, 75%);"> </td> </tr> <tr> <td><code>hsl(0.15turn, 90%, 50%)</code></td> <td style="background-color: hsl(0.15turn, 90%, 50%);"> </td> </tr> <tr> <td><code>hsl(270deg, 90%, 50%)</code></td> <td style="background-color: hsl(270deg, 90%, 50%);"> </td> </tr> </tbody> </table>
note that when you omit the hue's unit, it's assumed to be in degrees (deg).
...
note the use of the darkred keyword when specifying the color.
...
note: there is no guarantee, though, that color-adjust: exact will result in your css being used exactly as given.
HTML attribute: accept - HTML: Hypertext Markup Language
because a given file type may be identified in more than one manner, it's useful to provide a thorough set of type specifiers when you need files of specific type, or use the wild card to de
note a type of any format is acceptable.
... <p> <label for="soundfile">select an audio file:</label> <input type="file" id="soundfile" accept="audio/*"> </p> <p> <label for="videofile">select a video file:</label> <input type="file" id="videofile" accept="video/*"> </p> <p> <label for="imagefile">select some images:</label> <input type="file" id="imagefile" accept="image/*" multiple> </p>
note the last example allows you to select multiple iamges.
..., might look like this: <input type="file" accept="image/*,.pdf"> using file inputs a basic example <form method="post" enctype="multipart/form-data"> <div> <label for="file">choose file to upload</label> <input type="file" id="file" name="file" multiple> </div> <div> <button>submit</button> </div> </form> div { margin-bottom: 10px; } this produces the following output:
note: you can find this example on github too — see the source code, and also see it running live.
The HTML autocomplete attribute - HTML: Hypertext Markup Language
note: in most modern browsers, setting autocomplete to "off" will not prevent a password manager from asking the user if they would like to save username and password information, or from automatically filling in those values in a site's login form.
...
note: the autocomplete attribute also controls whether firefox will — unlike other browsers — persist the dynamic disabled state and (if applicable) dynamic checkedness of an <input> element, <textarea> element, or entire <form> across page loads.
...
note that you can actually use just the postcode and address-line1 to sucessfully deliver mail in the uk, so they should be the only mandatory items, but usually people tend to provide more details.
<article>: The Article Contents element - HTML: Hypertext Markup Language
note that an <article> element must not be a descendant of an <address> element.
... usage
notes each <article> should be identified, typically by including a heading (<h1>-<h6> element) as a child of the <article> element.
...
note that the pubdate attribute of <time> is no longer a part of the w3c html5 standard.
<aside>: The Aside element - HTML: Hypertext Markup Language
note that an <aside> element must not be a descendant of an <address> element.
... implicit aria role complementary permitted aria roles feed, none,
note, presentation, region, search dom interface htmlelement attributes this element only includes the global attributes.
... usage
notes do not use the <aside> element to tag parenthesized text, as this kind of text is considered part of the main flow.
<colgroup> - HTML: Hypertext Markup Language
note: this attribute is applied on the attributes of the column group, it has no effect on the css styling rules associated with it or, even more, to the cells of the column's members of the group.
...
note: do not try to set the text-align property on a selector giving a <colgroup> element.
...
note: do not try to set the vertical-align property on a selector giving a <colgroup> element.
<dfn>: The Definition element - HTML: Hypertext Markup Language
in html5, the title attribute has special meaning, as
noted below.
... usage
notes there are some not-entirely-obvious aspects to using the <dfn> element.
...it has been in orbit for over 20 years, scanning the sky and returning data and photographs of unprecedented quality and detail.</p> <p>indeed, the <abbr title="hubble space telescope">hst</abbr> has arguably done more to advance science than any device ever built.</p>
note the <abbr> element nested inside the <dfn>.
<input type="button"> - HTML: Hypertext Markup Language
note: while <input> elements of type button are still perfectly valid html, the newer <button> element is now the favored way to create buttons.
...cument.queryselector('input'); const paragraph = document.queryselector('p'); button.addeventlistener('click', updatebutton); function updatebutton() { if (button.value === 'start machine') { button.value = 'stop machine'; paragraph.textcontent = 'the machine has started!'; } else { button.value = 'start machine'; paragraph.textcontent = 'the machine is stopped.'; } }
note: the problem with the above example of course is that the user will not know what the access key is!
...ue="button 1"> <input type="button" value="button 2"> <input type="button" value="button 3"> </fieldset> const button = document.queryselector('input'); const fieldset = document.queryselector('fieldset'); button.addeventlistener('click', disablebutton); function disablebutton() { fieldset.disabled = true; window.settimeout(function() { fieldset.disabled = false; }, 2000); }
note: firefox will, unlike other browsers, by default, persist the dynamic disabled state of a <button> across page loads.
<input type="date"> - HTML: Hypertext Markup Language
note: when the data entered by the user doesn't adhere to the stepping configuration, the user agent may round to the nearest valid value, preferring numbers in the positive direction when there are two equally close options.
...
note: you should be able to use the step attribute to vary the number of days jumped each time the date is incremented (e.g.
...case the change affected the number of available days yearselect.onchange = function() { populatedays(monthselect.value); } monthselect.onchange = function() { populatedays(monthselect.value); } //preserve day selection var previousday; // update what day has been set to previously // see end of populatedays() for usage dayselect.onchange = function() { previousday = dayselect.value; }
note: remember that some years have 53 weeks in them (see weeks per year)!
<input type="hidden"> - HTML: Hypertext Markup Language
note: there is a live example below the following line of code — if it is working correctly, you should see nothing!
...
note: the input and change events do not apply to this input type.
... the output looks like this:
note: you can also find the example on github (see the source code, and also see it running live).
<input type="time"> - HTML: Hypertext Markup Language
note: because a read-only field cannot have a value, required does not have any effect on inputs with the readonly attribute also specified.
...
note: when the data entered by the user doesn't adhere to the stepping configuration, the user agent may round to the nearest valid value, preferring numbers in the positive direction when there are two equally close options.
...n: relative; } input[type="number"] { width: 100px; } input + span { padding-right: 30px; } input:invalid+span:after { position: absolute; content: '✖'; padding-left: 5px; } input:valid+span:after { position: absolute; content: '✓'; padding-left: 5px; } the result here is that: only times between 12:00 and 18:00 will be seen as valid; times outside that range will be de
noted as invalid.
<kbd>: The Keyboard Input element - HTML: Hypertext Markup Language
usage
notes other elements can be used in tandem with <kbd> to represent more specific scenarios: nesting a <kbd> element within another <kbd> element represents an actual key or other unit of input as a portion of a larger input.
... html <p>you can also create a new document using the keyboard shortcut <kbd><kbd>ctrl</kbd>+<kbd>n</kbd></kbd>.</p> this wraps the entire key sequence in an outer <kbd> element, then each individual key within its own, in order to de
note the components of the sequence.
...
note: you don't need to do all this wrapping; you can choose to simplify it by leaving out the external <kbd> element.
<mark>: The Mark Text element - HTML: Hypertext Markup Language
usage
notes typical use cases for <mark> include: when used in a quotation (<q>) or block quote (<blockquote>), it generally indicates text which is of special interest but is not marked in the original source material, or material which needs special scrutiny even though the original author didn't think it was of particular importance.
... don't confuse <mark> with the <strong> element; <mark> is used to de
note content which has a degree of relevance, while <strong> indicates spans of text of importance.
... short
note on making your mark (more accessible) | the paciello group tweaking text level styles | adrian roselli specifications specification status comment html living standardthe definition of '<mark>' in that specification.
<samp>: The Sample Output element - HTML: Hypertext Markup Language
usage
notes you can use a css rule to override the browser's default font face for the <samp> element; however, it's possible that the browser's preferences may take precedence over any css you specify.
...for example, consider this text presenting a transcript of a linux (or macos) console session: html <pre> <samp><span class="prompt">mike@interwebz:~$</span> <kbd>md5 -s "hello world"</kbd> md5 ("hello world") = 3e25960a79dbc69b674cd4ec67a72c62 <span class="prompt">mike@interwebz:~$</span> <span class="cursor">█</span></samp></pre>
note the use of <span> to allow customization of the appearance of specific portions of the sample text such as the shell prompts and the cursor.
...
note also the use of <kbd> to represent the command the user entered at the prompt in the sample text.
<select>: The HTML Select element - HTML: Hypertext Markup Language
note: according to the html5 specification, the default value for size should be 1; however, in practice, this has been found to break some web sites, and no other browser currently does that, so mozilla has opted to continue to return 0 for the time being with firefox.
... usage
notes selecting multiple options on a desktop computer, there are a number of ways to select multiple options in a <select> element with a multiple attribute: mouse users can hold the ctrl, command, or shift keys (depending on what makes sense for your operating system) and then click multiple options to select/deselect them.
... also
note: on macos, the ctrl + up and ctrl + down shortcuts conflict with the os default shortcuts for mission control and application windows, so you'll have to turn these off before it will work.
<tbody>: The Table Body element - HTML: Hypertext Markup Language
note: the equivalent text-align property for the align="char" is not implemented in any browsers yet.
... usage
notes if the table includes a <thead> block (to semantically identify header rows), the <tbody> block must come after it.
...
note that all of the body cells including information about students are contained within a single <tbody> element.
<xmp> - HTML: Hypertext Markup Language
note: do not use this element.
...
note that you will need to escape the '<' character as '<' to make sure it is not interpreted as markup.
... implementation
note: up to gecko 1.9.2 inclusive, firefox implements the htmlspanelement interface for this element.
HTML documentation index - HTML: Hypertext Markup Language
note that it is recommended for styles to be defined in a separate file or files.
...usually, this is rendered visually by indentation (see
notes for how to change it).
... 199 <sub>: the subscript element baseline, element, foot
notes, html, html text-level semantics, html:flow content, html:palpable content, html:phrasing content, reference, subscript, web, sub the html subscript element (<sub>) specifies inline text which should be displayed as subscript for solely typographical reasons.
Microdata - HTML: Hypertext Markup Language
note: more about itemtype attributes can be found at http://schema.org/thing microdata vocabularies provide the semantics or meaning of an item.
... commonly used vocabularies: creative works: creativework, book, movie, musicrecording, recipe, tvseries embedded non-text objects: audioobject, imageobject, videoobject event health and medical types:
notes on the health and medical types under medicalentity organization person place, localbusiness, restaurant product, offer, aggregateoffer review, aggregaterating action thing intangible major search engine operators like google, microsoft, and yahoo!
...rop applicationcategory gameapplication (http://schema.org/gameapplication) itemscope itemprop[itemtype] aggregaterating [aggregaterating] itemprop ratingvalue 4.6 itemprop ratingcount 8864 itemscope itemprop[itemtype] offers [offer] itemprop price 1.00 itemprop pricecurrency usd result
note: a handy tool for extracting microdata structures from html is google's structured data testing tool.
Data URLs - HTTP
note: data urls are treated as unique opaque origins by modern browsers, rather than inheriting the origin of the settings object responsible for the navigation.
...
note the use of percent-encoding (url-encoding) for the quote and space characters.
...
note that the closing script tag is required.
MIME types (IANA media types) - HTTP
note that text/plain does not mean "any kind of textual data." if they expect a specific kind of textual data, they will likely not consider it a match.
...
note: use application/xml or application/xhtml+xml if you want xml’s strict parsing rules, <![cdata[…]]> sections, or elements that aren't from html/svg/mathml namespaces.
... 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 use text/javascript.
CSP: script-src - HTTP
when generating the hash, don't include the <script> or <style> tags and
note that capitalization and whitespace matter, including leading or trailing whitespace.
... examples violation case given this csp header: content-security-policy: script-src https://example.com/ the following script is blocked and won't be loaded or executed: <script src="https://not-example.com/js/library.js"></script>
note that inline event handlers are blocked as well: <button id="btn" onclick="dosomething()"> you should replace them with addeventlistener calls: document.getelementbyid("btn").addeventlistener('click', dosomething); unsafe inline script
note: disallowing inline styles and inline scripts is one of the biggest security wins csp provides.
... content-security-policy: script-src 'sha256-b2yphkaxnvfwtrchibabymubfzdvfkkxhbwtwiddvf8=' when generating the hash, don't include the <script> tags and
note that capitalization and whitespace matter, including leading or trailing whitespace.
CSP: style-src - HTTP
when generating the hash, don't include the <script> or <style> tags and
note that capitalization and whitespace matter, including leading or trailing whitespace.
... unsafe inline styles
note: disallowing inline styles and inline scripts is one of the biggest security wins csp provides.
... content-security-policy: style-src 'sha256-a330698cbe9dc4ef1fb12e2ee9fc06d5d14300262fa4dc5878103ab7347e158f' when generating the hash, don't include the <style> tags and
note that capitalization and whitespace matter, including leading or trailing whitespace.
X-Frame-Options - HTTP
note: the content-security-policy http header has a frame-ancestors directive which obsoletes this header for supporting browsers.
...
note that in the legacy firefox implementation this still suffered from the same problem as sameorigin did — it doesn't check the frame ancestors to see if they are in the same origin.
... examples
note: setting x-frame-options inside the <meta> element is useless!
Closures - JavaScript
note that the displayname() function has no local variables of its own.
...
note that these closures follow the module design pattern.
... <p id="help">helpful
notes will appear here</p> <p>e-mail: <input type="text" id="email" name="email"></p> <p>name: <input type="text" id="name" name="name"></p> <p>age: <input type="text" id="age" name="age"></p> function showhelp(help) { document.getelementbyid('help').innerhtml = help; } function setuphelp() { var helptext = [ {'id': 'email', 'help': 'your e-mail address'}, {'id': 'name', 'help': 'yo...
Functions - JavaScript
note: this works only when defining the function using the above syntax (i.e.
...', 'sage', 'basil', 'oregano', 'pepper', 'parsley');
note: the arguments variable is "array-like", but not an array.
...
note: coercion inside the isnan function has interesting rules; you may alternatively want to use number.isnan(), as defined in ecmascript 2015, or you can use typeof to determine if the value is not-a-number.
Unicode property escapes - JavaScript
note: for unicode property escapes to work, a regular expression must use the u flag which indicates a string must be considered as a series of unicode code points.
...
note: some unicode properties encompasses much more characters than some character classes (such as \w which matches only latin letters, a to z) but the latter is better supported among browsers (as of january 2020).
...
note: as there are many properties and values available, we will not describe them exhaustively here but rather provide various examples rationale before es2018 there was no performance-efficient way to match characters from different sets based on scripts (like macedonian, greek, georgian etc.) or propertyname (like emoji etc) in javascript.
Using Promises - JavaScript
mple: new promise((resolve, reject) => { console.log('initial'); resolve(); }) .then(() => { throw new error('something failed'); console.log('do this'); }) .catch(() => { console.error('do that'); }) .then(() => { console.log('do this, no matter what happened before'); }); this will output the following text: initial do that do this, no matter what happened before
note: the text do this is not displayed because the something failed error caused a rejection.
....then(() => morecriticalstuff()) .catch(e => console.error("critical failure: " + e.message));
note that the optional steps here are nested, not from the indentation, but from the precarious placement of the outer ( and ) around them.
... a good rule-of-thumb is to always either return or terminate promise chains, and as soon as you get a new promise, return it immediately, to flatten things: dosomething() .then(function(result) { return dosomethingelse(result); }) .then(newresult => dothirdthing(newresult)) .then(() => dofourththing()) .catch(error => console.error(error));
note that () => x is short for () => { return x; }.
The arguments object - JavaScript
description
note: if you're writing es6 compatible code, then rest parameters should be preferred.
...
note: “array-like” means that arguments has a length property and properties indexed from zero, but it doesn't have array's built-in methods like foreach() or map().
...
note: you cannot write a "use strict"; directive in the body of a function definition that accepts rest, default, or destructured parameters.
getter - JavaScript
note the following when working with the get syntax: it can have an identifier which is either a number or a string; it must have exactly zero parameters (see incompatible es5 change: literal getter and setter functions must now have exactly zero or one arguments for more information); it must not appear in an object literal with another get or with a data entry for the same property ({ get x() {...
... const obj = { log: ['example','test'], get latest() { if (this.log.length === 0) return undefined; return this.log[this.log.length - 1]; } } console.log(obj.latest); // "test"
note that attempting to assign a value to latest will not change it.
...
note that getters are not “lazy” or “memozied” by nature; you must implement this technique if you desire this behavior.
Array.prototype.forEach() - JavaScript
converting a for loop to foreach const items = ['item1', 'item2', 'item3'] const copyitems = [] // before for (let i = 0; i < items.length; i++) { copyitems.push(items[i]) } // after items.foreach(function(item){ copyitems.push(item) }) printing the contents of an array
note: in order to display the content of an array in the console, you can use console.table(), which prints a formatted version of the array.
...[2, 5, , 9].foreach(logarrayelements) // logs: // a[0] = 2 // a[1] = 5 // a[3] = 9 using thisarg the following (contrived) example updates an object's properties from each entry in the array: function counter() { this.sum = 0 this.count = 0 } counter.prototype.add = function(array) { array.foreach((entry) => { this.sum += entry ++this.count }, this) // ^----
note } const obj = new counter() obj.add([2, 5, 9]) obj.count // 3 obj.sum // 16 since the thisarg parameter (this) is provided to foreach(), it is passed to callback each time it's invoked.
...
note: if passing the callback function uses an arrow function expression, the thisarg parameter can be omitted, since all arrow functions lexically bind the this value.
Array.prototype.lastIndexOf() - JavaScript
note that even when the index is negative, the array is still searched from back to front.
...math.min(n, len - 1) : len - math.abs(n); k >= 0; k--) { if (k in t && t[k] === searchelement) { return k; } } return -1; }; } again,
note that this implementation aims for absolute compatibility with lastindexof in firefox and the spidermonkey javascript engine, including in several cases which are arguably edge cases.
...array.lastindexof(element, idx - 1) : -1); } console.log(indices); // [4, 2, 0]
note that we have to handle the case idx == 0 separately here because the element will always be found regardless of the fromindex parameter if it is the first element of the array.
Array.prototype.sort() - JavaScript
note that the array is sorted in place, and no copy is made.
...
note : in utf-16, unicode characters above \uffff are encoded as two surrogate code units, of the range \ud800-\udfff.
...
note: the ecmascript standard does not guarantee this behavior, thus, not all browsers (e.g.
Date() constructor - JavaScript
syntax new date() new date(value) new date(datestring) new date(year, monthindex [, day [, hours [, minutes [, seconds [, milliseconds]]]]])
note: the only correct way to instantiate a new date object is by using the new operator.
...(these formats are ietf-compliant rfc 2822 timestamps, and also strings in a version of iso8601.)
note: parsing of date strings with the date constructor (and date.parse(), which works the same way) is strongly discouraged due to browser differences and inconsistencies.
... examples several ways to create a date object the following examples show several ways to create javascript dates:
note: parsing of date strings with the date constructor (and date.parse, they are equivalent) is strongly discouraged due to browser differences and inconsistencies.
FinalizationRegistry - JavaScript
(cleanup callbacks are sometimes called finalizers.)
note: cleanup callbacks should not be used for essential program logic.
... see
notes on cleanup callbacks for details.
...
notes on cleanup callbacks some
notes on cleanup callbacks: developers shouldn't rely on cleanup callbacks for essential program logic.
Number.prototype.toFixed() - JavaScript
examples using tofixed let numobj = 12345.6789 numobj.tofixed() // returns '12346':
note rounding, no fractional part numobj.tofixed(1) // returns '12345.7':
note rounding numobj.tofixed(6) // returns '12345.678900':
note added zeros (1.23e+20).tofixed(2) // returns '123000000000000000000.00' (1.23e-10).tofixed(2) // returns '0.00' 2.34.tofixed(1) // returns '2.3' 2.35.tofixed(1) // returns '2.4'.
...
note it rounds up 2.55.tofixed(1) // returns '2.5'.
...
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.
Object.freeze() - JavaScript
note that values that are objects can still be modified, unless they are also frozen.
...int8array(1)) // has elements typeerror: cannot freeze array buffer views with elements > object.freeze(new dataview(new arraybuffer(32))) // no elements dataview {} > object.freeze(new float64array(new arraybuffer(64), 63, 0)) // no elements float64array [] > object.freeze(new float64array(new arraybuffer(64), 32, 2)) // has elements typeerror: cannot freeze array buffer views with elements
note that; as the standard three properties (buf.bytelength, buf.byteoffset and buf.buffer) are read-only (as are those of an arraybuffer or sharedarraybuffer), there is no reason for attempting to freeze these properties.
...
note that strings, numbers, and booleans are always immutable and that functions and arrays are objects.
Object.prototype.hasOwnProperty() - JavaScript
note hasownproperty returns true even if the value of the property is null or undefined.
...
note that the for...in loop is already only iterating enumerable items, so one should not assume based on the lack of non-enumerable properties shown in the loop that hasownproperty itself is confined strictly to enumerable items (as with object.getownpropertynames()).
...tion() { return false; }, bar: 'here be dragons' }; foo.hasownproperty('bar'); // always returns false // use another object's hasownproperty // and call it with 'this' set to foo ({}).hasownproperty.call(foo, 'bar'); // true // it's also possible to use the hasownproperty property // from the object prototype for this purpose object.prototype.hasownproperty.call(foo, 'bar'); // true
note that in the last case there are no newly created objects.
Promise - JavaScript
note: a promise is said to be settled if it is either fulfilled or rejected, but not pending.
...
note that promises are guaranteed to be asynchronous.
...
note that function troublewithgetnumber() ends with a throw().
String.prototype.replace() - JavaScript
note that this is 1-indexed.
...(
note: the above-mentioned special replacement patterns do not apply in this case.)
note that the function will be invoked multiple times for each full match to be replaced if the regular expression in the first parameter is global.
...
note: see this guide for more explanations about regular expressions.
String - JavaScript
note that a == b compares the strings in a and b for being equal in the usual case-sensitive way.
... string primitives and string objects
note that javascript distinguishes between string objects and primitive string values.
... (the same is true of boolean and numbers.) string literals (de
noted by double or single quotes) and strings returned from string calls in a non-constructor context (that is, called without using the new keyword) are primitive strings.
WebAssembly.CompileError() constructor - JavaScript
desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jscompileerror() constructorchrome full support 57edge full support 16firefox full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).ie no support noopera full support 44safari full support 11webview android full support ...
... 57chrome android full support 57firefox android full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).opera android full support 43safari ios full support 11samsung internet android full support 7.0nodejs full support 8.0.0legend full support full support no support no supportsee implementation n...
...otes.see implementation
notes.
WebAssembly.Instance() constructor - JavaScript
desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jsinstance() constructorchrome full support 57edge full support 16firefox full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).ie no support noopera full support 44safari full support 11webview android full support ...
... 57chrome android full support 57firefox android full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).opera android full support 43safari ios full support 11samsung internet android full support 7.0nodejs full support 8.0.0legend full support full support no support no supportsee implementation n...
...otes.see implementation
notes.
WebAssembly.LinkError() constructor - JavaScript
desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jslinkerror() constructorchrome full support 57edge full support 16firefox full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).ie no support noopera full support 44safari full support 11webview android full support ...
... 57chrome android full support 57firefox android full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).opera android full support 43safari ios full support 11samsung internet android full support 7.0nodejs full support 8.0.0legend full support full support no support no supportsee implementation n...
...otes.see implementation
notes.
WebAssembly.Memory.prototype.buffer - JavaScript
desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jsbufferchrome full support 57edge full support 16firefox full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).ie no support noopera full support 44safari full support 11webview android full support ...
... 57chrome android full support 57firefox android full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).opera android full support 43safari ios full support 11samsung internet android full support 7.0nodejs full support 8.0.0legend full support full support no support no supportsee implementation n...
...otes.see implementation
notes.
WebAssembly.Module() constructor - JavaScript
desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jsmodule() constructorchrome full support 57edge full support 16firefox full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).ie no support noopera full support 44safari full support 11webview android full support ...
... 57chrome android full support 57firefox android full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).opera android full support 43safari ios full support 11samsung internet android full support 7.0nodejs full support 8.0.0legend full support full support no support no supportsee implementation n...
...otes.see implementation
notes.
WebAssembly.Module.exports() - JavaScript
desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jsexportschrome full support 57edge full support 16firefox full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).ie no support noopera full support 44safari full support 11webview android full support ...
... 57chrome android full support 57firefox android full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).opera android full support 43safari ios full support 11samsung internet android full support 7.0nodejs full support 8.0.0legend full support full support no support no supportsee implementation n...
...otes.see implementation
notes.
WebAssembly.Module.imports() - JavaScript
desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jsimportschrome full support 57edge full support 16firefox full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).ie no support noopera full support 44safari full support 11webview android full support ...
... 57chrome android full support 57firefox android full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).opera android full support 43safari ios full support 11samsung internet android full support 7.0nodejs full support 8.0.0legend full support full support no support no supportsee implementation n...
...otes.see implementation
notes.
WebAssembly.RuntimeError() constructor - JavaScript
desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jsruntimeerror() constructorchrome full support 57edge full support 16firefox full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).ie no support noopera full support 44safari full support 11webview android full support ...
... 57chrome android full support 57firefox android full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).opera android full support 43safari ios full support 11samsung internet android full support 7.0nodejs full support 8.0.0legend full support full support no support no supportsee implementation n...
...otes.see implementation
notes.
WebAssembly.Table.prototype.grow() - JavaScript
desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jsgrowchrome full support 57edge full support 16firefox full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).ie no support noopera full support 44safari full support 11webview android full support ...
... 57chrome android full support 57firefox android full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).opera android full support 43safari ios full support 11samsung internet android full support 7.0nodejs full support 8.0.0legend full support full support no support no supportsee implementation n...
...otes.see implementation
notes.
WebAssembly.Table.prototype.length - JavaScript
desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jslengthchrome full support 57edge full support 16firefox full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).ie no support noopera full support 44safari full support 11webview android full support ...
... 57chrome android full support 57firefox android full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).opera android full support 43safari ios full support 11samsung internet android full support 7.0nodejs full support 8.0.0legend full support full support no support no supportsee implementation n...
...otes.see implementation
notes.
WebAssembly.validate() - JavaScript
desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jsvalidatechrome full support 57edge full support 16firefox full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).ie no support noopera full support 44safari full support 11webview android full support ...
... 57chrome android full support 57firefox android full support 52
notes full support 52
notes
notes disabled in the firefox 52 extended support release (esr).opera android full support 43safari ios full support 11samsung internet android full support 7.0nodejs full support 8.0.0legend full support full support no support no supportsee implementation n...
...otes.see implementation
notes.
Operator precedence - JavaScript
note that both op1 and op2 are fill-in-the-blanks for operators.
...it is interesting to
note that, the order of evaluation is always left-to-right irregardless of associativity.
...
note on grouping and short-circuiting in the table below, grouping is listed as having the highest precedence.
async function - JavaScript
async function foo() { const result1 = await new promise((resolve) => settimeout(() => resolve('1'))) const result2 = await new promise((resolve) => settimeout(() => resolve('2'))) } foo()
note how the promise chain is not built-up in one go.
... error handling
note that functions concurrentstart and concurrentpromise are not functionally equivalent.
...it returns null if processdatainworker rejects with an error: async function getprocesseddata(url) { let v try { v = await downloaddata(url) } catch(e) { v = await downloadfallbackdata(url) } try { return await processdatainworker(v) //
note the `return await` vs.
export - JavaScript
but a default export can be imported with any name for example: // file test.js let k; export default k = 12; // some other file import m from './test'; //
note that we have the freedom to use import m instead of import k, because k was default export console.log(m); // will log 12 you can also rename named exports to avoid naming conflicts: export { myfunction as function1, myvariable as variable }; re-exporting / aggregating it is also possible to "import/export" from different modules in a parent module so that they are available...
...
note: the following is syntactically invalid despite its import equivalent: import defaultexport from 'bar.js'; // valid export defaultexport from 'bar.js'; // invalid the correct way of doing this is to rename the export: export { default as defaultexport } from 'bar.js'; examples using named exports in a module my-module.js, we could include the following code: // module "my-module.js" fu...
... }, draw: function() { console.log('from graph draw function'); } } export { cube, foo, graph }; then in the top-level module included in your html page, we could have: import { cube, foo, graph } from './my-module.js'; graph.options = { color:'blue', thickness:'3px' }; graph.draw(); console.log(cube(3)); // 27 console.log(foo); // 4.555806215962888 it is important to
note the following: you need to include this script in your html with a <script> element of type="module", so that it gets recognised as a module and dealt with appropriately.
Web audio codec guide - Web media technologies
common codecs the list below de
notes the codecs most commonly used on the web and which containers (file types) support them.
...
note: compatibility information described here is generally correct as of the time this article was written; however, there may be caveats and exceptions.
...
note: for more about webrtc and the codecs it can use, see codecs used by webrtc.
The "codecs" parameter in common media types - Web media technologies
as
noted elsewhere, this format was once commonly used on the web but no longer is, since it required a plugin to use.
... as is the case with any mime type parameter, codecs must be changed to codecs* (
note the asterisk character, *) if any of the properties of the codec use special characters which must be percent-encoded per rfc 2231, section 4: mime parameter value and encoded word extensions.
...
note: the specification originally mandated that the audio object type number in the third component be only one decimal digit.
Mobile first - Progressive web apps (PWAs)
note: starting with very little and working up as the need arises usually makes more sense than starting with everything and then covering up things if they aren't needed!
...
note: firefox's responsive design view is a great way to get a quick idea of how your media queries are behaving themselves.
... if(!modernizr.mq('only all')) { require('respond'); } editorial
note: this currently doesn't work, and i'm not sure why.
clip-path - SVG: Scalable Vector Graphics
note: as a presentation attribute clip-path can be used as a css property.
...this is the same as having a custom clipping path with a clippathunits set to userspaceonuse --> <rect x="11" y="11" width="8" height="8" stroke="green" clip-path="circle() view-box" /> </svg> usage
notes value <url> | [ <basic-shape> || <geometry-box> ] | none default value none animatable yes <geometry-box> an extra information to tell how a <basic-shape> is applied to an element: fill-box indicates to use the object bounding box; stroke-box indicates to use the object bounding box extended with the stroke; view-box indicates to use the nearest svg...
...
note: for more details on the clip-path syntax, see the css property clip-path reference page.
color-interpolation-filters - SVG: Scalable Vector Graphics
notes: this property just has an affect on filter operations.
...
note: as a presentation attribute, color-interpolation can be used as a css property.
...n attribute, it can be applied to any element but it only has an effect on the following eighteen elements: <fespotlight>, <feblend>, <fecolormatrix>, <fecomponenttransfer>, <fecomposite>, <feconvolvematrix>, <fediffuselighting>, <fedisplacementmap>, <fedropshadow>, <feflood>, <fegaussianblur>, <feimage>, <femerge>, <femorphology>, <feoffset>, <fespecularlighting>, <fetile>, <feturbulence> usage
notes value auto | srgb | linearrgb default value linearrgb animatable yes auto indicates that the user agent can choose either the srgb or linearrgb spaces for color interpolation.
color-interpolation - SVG: Scalable Vector Graphics
note: for filter effects, the color-interpolation-filters property controls which color space is used.
...
note: as a presentation attribute, color-interpolation can be used as a css property.
...an be applied to any element but it only has an effect on the following 29 elements: <a>, <animate>, <animatecolor>, <circle>, <clippath>, <defs>, <ellipse>, <foreignobject>, <g>, <glyph>, <image>, <line>, <lineargradient>, <marker>, <mask>, <missing-glyph>, <path>, <pattern>, <polygon>, <polyline>, <radialgradient>, <rect>, <svg>, <switch>, <symbol>, <text>, <textpath>, <tspan>, and <use> usage
notes value auto | srgb | linearrgb default value srgb animatable yes auto indicates that the user agent can choose either the srgb or linearrgb spaces for color interpolation.
color - SVG: Scalable Vector Graphics
note: as a presentation attribute, color can be used as a css property.
... as a presentation attribute, it can be applied to any element, but as
noted above, it has no direct effect on svg elements.
... usage
notes value <color> | inherit default value depends on user agent animatable yes example html, body, svg { height: 100%; } <svg viewbox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <g color="green"> <rect width="50" height="50" fill="currentcolor" /> <circle r="25" cx="70" cy="70" stroke="currentcolor" fill="none" stroke-width="5" /> </g> </svg> specifications specification status comment scalable vector graphics (svg) 2the definition of 'color' in that specification.
glyph-orientation-vertical - SVG: Scalable Vector Graphics
note: as a presentation attribute, glyph-orientation-vertical can be used as a css property.
... as a presentation attribute, it can be applied to any element but it has effect only on the following five elements: <altglyph>, <textpath>, <text>, <tref>, and <tspan> context
notes value auto | <angle> default value auto animatable no auto fullwidth ideographic and fullwidth latin text will be set with a glyph orientation of 0 degrees.
...
note: text set in this "rotated" manner may contain ligatures or other glyph combining and reordering common to the language and script.
href - SVG: Scalable Vector Graphics
note: specifications before svg 2 defined an xlink:href attribute, which is now rendered obsolete by the href attribute.
...
note: unlike other animation elements, the <discard> element does not support the deprecated xlink:href attribute.
...
note that if the target element is not part of the current svg document fragment, then whether the target element will be removed or not is defined by the host language.
opacity - SVG: Scalable Vector Graphics
note: as a presentation attribute, opacity can be used as a css property.
...ient id="gradient" x1="0%" y1="0%" x2="0" y2="100%"> <stop offset="0%" style="stop-color:skyblue;" /> <stop offset="100%" style="stop-color:seagreen;" /> </lineargradient> </defs> <rect x="0" y="0" width="100%" height="100%" fill="url(#gradient)" /> <circle cx="50" cy="50" r="40" fill="black" /> <circle cx="150" cy="50" r="40" fill="black" opacity="0.3" /> </svg> usage
notes default value 1 value <alpha-value> animatable yes <alpha-value> the uniform opacity setting to be applied across an entire object, as a <number>.
... candidate recommendation references the specification in css color 3 and
notes that there are some related attributes.
orient - SVG: Scalable Vector Graphics
th d="m 0 0 l 10 5 l 0 10 z" fill="red" /> </marker> </defs> <polyline points="10,10 10,90 90,90" fill="none" stroke="black" marker-start="url(#arrow)" marker-end="url(#arrow)" /> <polyline points="15,80 29,50 43,60 57,30 71,40 85,15" fill="none" stroke="grey" marker-start="url(#dataarrow)" marker-mid="url(#dataarrow)" marker-end="url(#dataarrow)" /> </svg> usage
notes value auto | auto-start-reverse | <angle> | <number> default value 0 animatable yes (non-additive) auto this value indicates that the marker is oriented such that its positive x-axis is pointing in a direction relative to the path at the position the marker is placed.
...
note: this allows a single arrowhead marker to be defined that can be used for both the start and end of a path, i.e.
...
note: for example, if a value of 45 is given, then the marker's positive x-axis would be pointing down and right in the shape's coordinate system.
patternContentUnits - SVG: Scalable Vector Graphics
note: that this attribute has no effect if attribute viewbox is specified on the <pattern> element.
...
note that the size of the tile is computed against the bounding box of the target element --> <pattern id="p1" width="20%" height="20%" patterncontentunits="userspaceonuse"> <circle cx="10" cy="10" r="10" /> </pattern> <!-- a pattern tile that content coordinates and values are computed against the bounding box of the target element.
...
note that the size of the tile is also computed against the bounding box of the target element --> <pattern id="p2" width="20%" height="20%" patterncontentunits="objectboundingbox"> <circle cx=".1" cy=".1" r=".1" /> </pattern> <!-- left square with user space tiles --> <rect x="10" y="10" width="80" height="80" fill="url(#p1)" /> <!-- right square with bounding box tiles --> <rect x="110" y="10" width="80" height="80" fill="url(#p2)" /> </svg> pattern for <pattern>, patterncontentunits defines the coordinate system in use for the content of the element.
rendering-intent - SVG: Scalable Vector Graphics
only one element is using this attribute: <color-profile> usage
notes value auto | perceptual | relative-colorimetric | saturation | absolute-colorimetric default value auto animatable yes auto this value allows the user agent to determine the best intent based on the content type.
...
note: this method should be used for images.
...
note: this option is generally not recommended.
requiredExtensions - SVG: Scalable Vector Graphics
usage
notes value <list-of-extensions> default value none animatable no <list-of-extensions> the value is a list of references (iri references in svg 1, url references in svg 2) which identify the required extensions, with the individual values separated by white space.
...
note: if a given extension reference contains white space within itself, that white space must be escaped.
...
note: if several extension reference objects are enclosed in a <switch> and none of them matches, this may lead to situations where no content is displayed.
stroke - SVG: Scalable Vector Graphics
the stroke attribute is a presentation attribute defining the color (or any svg paint servers like gradients or patterns) used to paint the outline of the shape;
note: as a presentation attribute stroke can be used as a css property.
...roke --> <circle cx="5" cy="5" r="4" fill="none" stroke="green" /> <!-- stroke a circle with a gradient --> <defs> <lineargradient id="mygradient"> <stop offset="0%" stop-color="green" /> <stop offset="100%" stop-color="white" /> </lineargradient> </defs> <circle cx="15" cy="5" r="4" fill="none" stroke="url(#mygradient)" /> </svg> usage
notes value <paint> default value none animatable yes specifications specification status comment scalable vector graphics (svg) 2the definition of 'stroke' in that specification.
... legend compatibility unknown compatibility unknown
note: for information on using the context-stroke (and context-fill) values from html documents, see the documentation for the non-standard -moz-context-properties property.
systemLanguage - SVG: Scalable Vector Graphics
ements are using this attribute: <a>, <altglyph>, <animate>, <animatecolor>, <animatemotion>, <animatetransform>, <audio>, <canvas>, <circle>, <clippath>, <cursor>, <defs>, <discard>, <ellipse>, <foreignobject>, <g>, <iframe>, <image>, <line>, <mask>, <path>, <pattern>, <polygon>, <polyline>, <rect>, <set>, <svg>, <switch>, <text>, <textpath>, <tref>, <tspan>, <unknown>, <use>, and <video> usage
notes value <language-tags> default value none animatable no <language-tags> the value is a set of comma-separated tokens, each of which must be a language-tag value, as defined in bcp 47.
...
note: if several alternative language objects are enclosed in a <switch> and none of them matches, this may lead to situations where no content is displayed.
...
note: the prefix matching rule does not imply that if a user understands a language with a certain tag, that the user will also understand all languages with the tag as prefix.
visibility - SVG: Scalable Vector Graphics
note: if the visibility attribute is set to hidden on a text element, then the text is invisible but still takes up space in text layout calculations.
...
note: as a presentation attribute, visibility can be used as a css property.
...00%; } <svg viewbox="0 0 220 120" xmlns="http://www.w3.org/2000/svg"> <rect x="10" y="10" width="200" height="100" stroke="black" stroke-width="5" fill="transparent" /> <g stroke="seagreen" stroke-width="5" fill="skyblue"> <rect x="20" y="20" width="80" height="80" visibility="visible" /> <rect x="120" y="20" width="80" height="80" visibility="hidden"/> </g> </svg> usage
notes value visible | hidden | collapse default value visible animatable yes visible this value indicates that the element will be painted.
Content type - SVG: Scalable Vector Graphics
note: for historical reasons, the delimiters are "url(" and ")", for compatibility with the css specifications.
...
note that the non-property <length> definition also allows a percentage unit identifier.
... percentage <percentage> percentages are specified as a number followed by a "%" character: percentage ::= number "%"
note that the definition of <number> depends on whether the percentage is specified in a stylesheet or in an attribute that is not also a presentation attribute.
<animateMotion> - SVG: Scalable Vector Graphics
note: to reuse an existing path, it will be necessary to use an <mpath> element inside the <animatemotion> element instead of the path attribute.
... 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 attributes most notably: id styling attributes class, style event attributes global event attributes, document element event attributes usage
notes this element implements the svganimatemotionelement interface.
<ellipse> - SVG: Scalable Vector Graphics
note: ellipses are unable to specify the exact orientation of the ellipse (if, for example, you wanted to draw an ellipse tilted at a 45 degree angle), but it can be rotated by using the transform attribute.
... value type: <number> ; default value: none; animatable: yes
note: starting with svg2 cx, cy, rx and ry are geometry properties, meaning those attributes can also be used as css properties for that element.
...a-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage
notes categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements specifications specification status comment scalable vector graphics (svg) 2the definition of '<ellipse>' in that specification.
<pattern> - SVG: Scalable Vector Graphics
value type: userspaceonuse|objectboundingbox; default value: userspaceonuse; animatable: yes
note: this attribute has no effect if a viewbox attribute is specified on the <pattern> element.
... value type: <url>; default value: none; animatable: yes
note: for browsers implementing href, if both href and xlink:href are set, xlink:href will be ignored and only href will be used.
...st notably: clip-path, clip-rule, color, color-interpolation, color-rendering, cursor, display, fill, fill-opacity, fill-rule, filter, mask, opacity, pointer-events, shape-rendering, stroke, stroke-dasharray, stroke-dashoffset, stroke-linecap, stroke-linejoin, stroke-miterlimit, stroke-opacity, stroke-width, transform, vector-effect, visibility xlink attributes most notably: xlink:title usage
notes categoriescontainer elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elementsshape elementsstructural elementsgradient elements<a>, <altglyphdef>, <clippath>, <color-profile>, <cursor>, <filter>, <font>, <font-face>, <foreignobject>, <image>, <marker>, <mask>, <pattern>, <script>, <style>, <switch>, <text>, <view> specifications ...
<svg> - SVG: Scalable Vector Graphics
note: the xmlns attribute is only required on the outermost svg element of svg documents.
... value type: <length>|<percentage> ; default value: 0; animatable: yes
note: starting with svg2, x, y, width, and height are geometry properties, meaning these attributes can also be used as css properties.
...a-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage
notes categoriescontainer element, structural elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elementsshape elementsstructural elementsgradient elements<a>, <altglyphdef>, <clippath>, <color-profile>, <cursor>, <filter>, <font>, <font-face>, <foreignobject>, <image>, <marker>, <mask>, <pattern>, <script>, <style>, <switch>, <text>, <view> spec...
<use> - SVG: Scalable Vector Graphics
value type: <length> ; default value: 0; animatable: yes
note: width, and height have no effect on use elements, unless the element referenced has a viewbox - i.e.
...
note: starting with svg2, x, y, width, and height are geometry properties, meaning those attributes can also be used as css properties for that element.
...ive, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role xlink attributes xlink:href, xlink:title usage
notes categoriesgraphics element, graphics referencing element, structural elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements specifications specification status comment scalable vector graphics (svg) 2the definition of '<use>' in that specification.
SVG documentation index - SVG: Scalable Vector Graphics
note that the positive z-axis points towards the viewer of the content.
...(
note that the inline-progression-direction can change within a <text> element due to the unicode bidirectional algorithm and properties direction and unicode-bidi.) 251 x svg, svg attribute the x attribute defines a x-axis coordinate in the user coordinate system.
...
note the existence of all three arguments setting properties.
Basic shapes - SVG: Scalable Vector Graphics
h="5"/> <polyline points="60 110 65 120 70 115 75 130 80 125 85 140 90 135 95 150 100 145" stroke="orange" fill="transparent" stroke-width="5"/> <polygon points="50 160 55 180 70 180 60 190 65 205 50 195 35 205 40 190 30 180 45 180" stroke="green" fill="transparent" stroke-width="5"/> <path d="m20,230 q40,205 50,230 t90,230" fill="none" stroke="blue" stroke-width="5"/> </svg>
note: the stroke, stroke-width, and fill attributes are explained later in the tutorial.
...
note: a rectangle is a type of polygon, so a polygon can be used to create a <rect/> element in cases where you need a little more flexibility.
...but for now,
note that there is a single parameter used to control its shape.
Fills and Strokes - SVG: Scalable Vector Graphics
note: in firefox 3+, rgba values are also allowed, and will give the same effect.
...
note: unlike <path>s, these numbers must be comma-separated (whitespace is ignored).
...
note: the svg specification decides strictly between attributes that are properties and other attributes.
Paths - SVG: Scalable Vector Graphics
note, though, that it wouldn't show up if a path was just drawn normally.
...the thing to
note here is that the curve starts in the direction of the first control point, and then bends so that it arrives along the direction of the second control point.
...
note: the co-ordinate deltas for q are both relative to the previous point (that is, dx and dy are not relative to dx1 and dy1).
PI Parameters - XSLT: Extensible Stylesheet Language Transformations
<?xslt-param name="color" value="blue"?> <?xslt-param name="size" select="2"?> <?xml-stylesheet type="text/xsl" href="style.xsl"?>
note that these pis have no effect when transformation is done using the xsltprocessor object in javascript.
...
note that multiple xml-stylesheet xslt pis are not supported in firefox currently.
...
note that value="..." is not strictly equal to select="'...'" since the value can contain both apostrophe and quote characters.
WebAssembly Concepts - WebAssembly
note: webassembly will also have uses outside web and javascript environments (see non-web embeddings).
...(
note that webassembly has the high-level goal of supporting languages with garbage-collected memory models in the future.) with the advent of webassembly appearing in browsers, the virtual machine that we talked about earlier will now load and run two types of code — javascript and webassembly.
...
note: there are future plans to allow webassembly to call web apis directly.
Compiling an Existing C Module to WebAssembly - WebAssembly
it seemed to work brilliantly: $ emcc -o3 -s wasm=1 -s extra_exported_runtime_methods='["cwrap"]' \ -i libwebp \ webp.c \ libwebp/src/{dec,dsp,demux,enc,mux,utils}/*.c
note: this strategy will not work with every c project.
... now you only need some html and javascript to load your new module: <script src="./a.out.js"></script> <script> module.onruntimeinitialized = async _ => { const api = { version: module.cwrap('version', 'number', []), }; console.log(api.version()); }; </script> and you will see the correct version number in the output:
note: libwebp returns the current version a.b.c as a hexadecimal number 0xabc.
...put it in a javascript buffer of your own, and release all the wasm buffers allocated in the process: api.encode(p, image.width, image.height, 100); const resultpointer = api.get_result_pointer(); const resultsize = api.get_result_size(); const resultview = new uint8array(module.heap8.buffer, resultpointer, resultsize); const result = new uint8array(resultview); api.free_result(resultpointer);
note: new uint8array(somebuffer) will create a new view onto the same memory chunk, while new uint8array(sometypedarray) will copy the data.
Interacting with page scripts - Archive of obsolete content
note that the function's closure will be exported, too: // content-script.js var salutation = "hello, "; function greetme(user) { return salutation + user; } exportfunction(greetme, unsafewindow, {defineas: "greetme"}); finally, the "page.html" file adds a button and a page script that calls the exported function when the user pushes the button: <html> <head> </head> <body> <input id...
... communicating with page scripts there are two different ways a content script can communicate with a page script: using the dom postmessage() api using custom dom events using the dom postmessage api
note that before firefox 31 code in content scripts can't use window to access postmessage() and addeventlistener() and instead must use document.defaultview.
Content Scripts - Archive of obsolete content
note that tab.attach() doesn't accept contentscriptwhen, because it's generally called after the page has loaded.
...so to emit a message from a content script: self.port.emit("mycontentscriptmessage", mycontentscriptmessagepayload); to receive a message from the add-on code: self.port.on("myaddonmessage", function(myaddonmessagepayload) { // handle the message });
note that the global self object is completely different from the self module, which provides an api for an add-on to access its data files and id.
Modules - Archive of obsolete content
passing an xul url will result in a compartment with chrome privileges (
note, however, that if you ever actually do this in any of your code, gabor will be forced to hunt you down and kill you).
...rewriting the loadscript function using sandboxes, we end up with: function loadscript(url, imports) { let global = components.utils.sandbox(url); global.imports = imports; global.exports = {}; loader.loadsubscript(url, global); return global.exports; }
note that the object returned by sandbox is a wrapper to the sandbox, not the sandbox itself.
SDK API Lifecycle - Archive of obsolete content
deprecation process deprecation in the chosen release, the sdk team will communicate the module's deprecation: update the module's stability index to be "deprecated" include a deprecation notice in the release
notes, the add-ons blog, and the jetpack google group.
...the sdk team will remove the corresponding documentation, and communicate the removal in the usual ways: the release
notes, the add-ons blog, and the jetpack google group.
XUL Migration Guide - Archive of obsolete content
note, though, that by using third party packages you're likely to lose the security and compatibility benefits of using the sdk.
...but
note that unlike the supported apis, low-level apis do not come with a compatibility guarantee, so we do not expect code using them will necessarily continue to work as new versions of firefox are released.
l10n - Archive of obsolete content
note that you can't currently use localize strings appearing in content scripts or html files, but you can share the localized strings you want by assigning it's values to a json serializable object.
...
note that if you use this parameter, you can't supply any placeholders.
panel - Archive of obsolete content
getting user input
note: this example uses the action button api, which is only available from firefox 29 onwards.
... scripting trusted panel content
note: this example uses the action button api, which is only available from firefox 29 onwards.
widget - Archive of obsolete content
data = require("sdk/self").data var clockpanel = require("sdk/panel").panel({ width:215, height:160, contenturl: data.url("clock.html") }); require("sdk/widget").widget({ id: "open-clock-btn", label: "clock", contenturl: data.url("history.png"), panel: clockpanel });
note that this is, at the moment, the only way you can attach a panel to a widget.
...
note: if you also register a "click" listener, it will be called instead of the panel being opened.
Creating annotations - Archive of obsolete content
because cfx run doesn't preserve browsing history, if you want to play along it's worth taking a
note of the url.
...you should see a panel with a text area for a
note: enter the
note and press the return key: you should see console output like this: info: http://blog.mozilla.com/addons/2011/02/04/overview-amo-review-process/, post-2249,when you submit a new add-on, you will have to choose between 2 review tracks: full review and preliminary review.
Annotator - Archive of obsolete content
the add-on is an annotator: it enables the user to select elements of web pages and enter
notes (annotations) associated with them.
... the annotator stores the
notes.
Getting Started (jpm) - Archive of obsolete content
open it and add the following code: var buttons = require('sdk/ui/button/action'); var tabs = require("sdk/tabs"); var button = buttons.actionbutton({ id: "mozilla-link", label: "visit mozilla", icon: { "16": "./icon-16.png", "32": "./icon-32.png", "64": "./icon-64.png" }, onclick: handleclick }); function handleclick(state) { tabs.open("http://www.mozilla.org/"); }
note that "entry point" defaults to "index.js" in jpm, meaning that your main file is "index.js", and it is found directly in your add-on's root.
...
note that firefox by default requires add-ons, even locally developed ones, to be signed.
Modifying Web Pages Based on URL - Archive of obsolete content
pi var pagemod = require("sdk/page-mod"); // import the self api var self = require("sdk/self"); // create a page-mod // it will run a script whenever a ".org" url is loaded // the script replaces the page contents with a message pagemod.pagemod({ include: "*.org", contentscriptfile: self.data.url("jquery-1.7.min.js"), contentscript: '$("body").html("<h1>page matches ruleset</h1>");' });
note, though, that you can't load a script from a web site.
... injecting css
note that the feature described in this section is experimental at the moment.
Unit Testing - Archive of obsolete content
assert) { assert.ok(base64.atob("agvsbg8=") == "hello", "atob works"); } exports["test btoa"] = function(assert) { assert.ok(base64.btoa("hello") == "agvsbg8=", "btoa works"); } exports["test empty string"] = function(assert) { assert.throws(function() { base64.atob(); }, "empty string check works"); } require("sdk/test").run(exports);
note that with jpm we must give the exact relative path to the base64.js module.
... what happens here is that jpm test: looks in the test directory of your package loads any modules whose names start with the word test- (
note the hyphen after "test" in the module name.
Localization - Archive of obsolete content
note that because you can't require() modules in content scripts, you can't yet reference localized strings from content scripts.
...so in english we could have two plural localizations (
note that the "other" category does not take the cldr keyword): # en-us translations tomato_id[one]= %d tomato tomato_id= %d tomatoes in russian we could have four plural localizations: # ru-ru translations tomato_id[one]= %d помидор tomato_id[few]= %d помидора tomato_id[many]= %d помидоров tomato_id= %d помидоры the localization module itself understands the cldr...
Bookmarks - Archive of obsolete content
note: all annotations, tags, and so forth are kept when the bookmark's uri is changed.
...
note that this example takes advantage of xpcomutils to generate the nsisupports.queryinterface() method.
Finding window handles - Archive of obsolete content
note: starting in gecko 17.0, nsibasewindow.nativehandle provides the handle (hwnd [widows], gdkwindow* [linux], nswindow* [macosx],...) of a top-level window, for all plateforms, as a string.
...
note: starting in gecko 2.0, only the top level browser window has an hwnd.
Label and description - Archive of obsolete content
note: prior to firefox 3, it was necessary to use -moz-pre-wrap instead of -pre-wrap.
...
note: if running in a xulrunner application add the following preferences to your default preferences file: pref("network.protocol-handler.expose.http", false); pref("network.protocol-handler.warn-external.http", false); change or add additional protocols (https or ftp) as needed.
LookupNamespaceURI - Archive of obsolete content
note that all gecko-based browsers (including firefox) support node.lookupnamespaceuri.
...ml#lookupnamespaceurialgo var i, att, htmlmode = document.contenttype, // mozilla only xmlnspattern = /^xmlns:(.*)$/; switch (node.nodetype) { case 1: // element_node (could also just test for node.element_node, etc., if supported in all browsers) if (node.namespaceuri != null && node.prefix === prefix) { //
note: prefix could be "null" in the case we are looking for default namespace return node.namespaceuri; } if (node.attributes.length) { for (i = 0; i < node.attributes.length; i++) { att = node.attributes[i]; if (xmlnspattern.test(att.name) && xmlnspattern.exec(att.name)[1] === prefi...
Interaction between privileged and non-privileged pages - Archive of obsolete content
note: if you're using html5's postmessage() to send a message from unprivileged code to privileged code, adding 'true' to the end of your event listener in your privileged chrome code will allow the message to be received.
... * @see <https://developer.mozilla.org/docs/code_snippets/ * interaction_between_privileged_and_non-privileged_pages#security_
notes> */ function geteventdata(event) { if (event.target.ownerdocument != targetdoc) throw "event from unexpected source"; return new xml(event.target.getattribute("eventdatafrompage")); } security
notes never invoke the web page's javascript functions from your extension - doing this increases the chance of creating a security hole, where a malicious web page can trick the browser to r...
Jetpack Processes - Archive of obsolete content
note: the jetpack service, provided by nsijetpackservice, is not included by default in firefox 4.
...
note: the above statement is not currently true, as js-ctypes is now provided to jetpack processes as of bug 588563.
Adding Toolbars and Toolbar Buttons - Archive of obsolete content
<window id="main-window"> <toolbox id="navigator-toolbox"> <toolbar id="xulschoolhello-toolbar" toolbarname="&xulschoolhello.toolbarname.label;" accesskey="&xulschoolhello.toolbar.accesskey;" customizable="true" mode="icons" context="toolbar-context-menu" defaultset="xulschoolhello-hello-world-button" insertbefore="personaltoolbar" /> </toolbox> </window> (
note for mac os x: <window id="main-window"> and </window> are not required) our toolbar is added as a child of the toolbox element in the main browser window.
... these are the current icon sets for firefox: windows mac os x (lion and above) mac os x linux (gnome)
note: the images above are probably not distributable under the same cc license, unlike the rest of this material.
The Essentials of an Extension - Archive of obsolete content
note: packaging an extension is really just creating a zip archive of the contents of the main folder, then changing the filename extension to .xpi.
...
note that the tools menu is hidden by default on firefox 4 and above, on windows and some linux distributions.
Session store API - Archive of obsolete content
firefox 3
note in firefox 3 and later, if you need to detect when a tab is about to be closed so that you can update data associated with the tab before it is closed, you can watch for the "sstabclosing" event, which is sent to the tab.
... restoring without restarting firefox 3.6
note this section applies to firefox 3.6 and later.
Signing an extension - Archive of obsolete content
note: these instructions are outdated.
... signing a firefox extension with a windows authenticode ssl certificate / key -
note that some cas do not allow (or support) to divert an authenticode certificate to object signing.
Supporting search suggestions in search plugins - Archive of obsolete content
for example, if the search term is "fir", and you don't need to return descriptions or alternate query urls, you might return the following json: ["fir", ["firefox", "first choice", "mozilla firefox"]]
note that in this example, only the query string and completion array are specified, leaving out the optional elements.
...
note: firefox requires that suggest requests complete within 500ms for suggestions to be displayed.
Creating reusable content with CSS and XBL - Archive of obsolete content
note: xbl cannot be loaded over http, so this technique is only useful for local content accessed using the file:/// scheme, or from add-on code.
...it looks something like this, before and after you press the button:
notes about this demonstration: the html document links the document stylesheet as usual, but it does not link any javascript code.
MozOrientation - Archive of obsolete content
note: this below describes how these values worked for the now obsolete mozorientation.
...
notes this event is only dispatched if an accelerometer is available on the current device.
MMgc - Archive of obsolete content
}; class mygcroot : public mmgc::gcroot { mygcobject* mygcobject; };
note that a gcroot is not a garbage-collected object.
...
note that gcroot can be used either by subclassing, or by creating a gcroot and passing it the memory locations to treat as a root: /** subclassing constructor */ gcroot(gc *gc); /** general constructor */ gcroot(gc *gc, const void *object, size_t size); allocating objects allocating unmanaged objects is as simple as using global operator new/delete, the same way you always have.
MCD, Mission Control Desktop, AKA AutoConfig - Archive of obsolete content
//
note: for accessing the active directory of windows server later than 2000 //it is necessary to allow anonymous read access.
... debugging - bugzilla run time messages
note: the presence of var env_mozdebug=getenv("mozilla_debug")allows user to print debugging messages if mozilla_debug is defined in either the shell for unix (export mozilla_debug=1) or in the command.com environment in windows (set mozilla_debug=1).
Compiling The npruntime Sample Plugin in Visual Studio - Archive of obsolete content
again
note that the resulting dll filename must start with "np", so either call your project like this or rename the file later delete the .cpp and .h and readme files from the project and disk (if you did not create an empty project) copy the npruntime sample plugin source code into the dir of the new vs project and add the files to the project using the vs gui (.cpp files to "source files", .h files to ...
...
note: if your project is still empty, the c++ tree might not be visible.
Creating regular expressions for a microsummary generator - Archive of obsolete content
handling https urls
note: although ebay doesn't do this, occasionally a site will make pages available at both insecure and secure urls.
...
note that since generators are xml, we have to escape the special characters less-than-sign (<), greater-than-sign (>), and ampersand (&) by replacing them with their equivalent entity references (<, >, and &, respectively) in the regular expressions when we put them in generators.
Download Manager preferences - Archive of obsolete content
preference description browser.download.antivirus.dontclean
note: in gecko 1.9.1.
... browser.download.manager.usewindow
note: in gecko 1.9.1 in bug 439495 a boolean value indicating whether or not to use the downloads window (true) or display download status in the status bar (false) in the browser window.
Creating a Help Content Pack - Archive of obsolete content
note that you can use the nc:datasources attribute to inherit content from other content packs.
... the index file one important
note on the index file is that there is no automatically generated set of top-level letters (e.g., a for accessibility and automation or b for book and border).
Me - Archive of obsolete content
note: this page documents the jetpack prototype, which is no longer under active development.
...
note that this mechanism is independent of the first-run page; in particular, the callback is not a load event listener or jquery ready callback.
Microsummary topics - Archive of obsolete content
note: when web sites install generators via window.sidebar.addmicrosummarygenerator(), firefox sets their uri attribute to urn:source:sourceurl, where sourceurl is the url from which the generator was downloaded.
...for example, you might include the following header in your response to prevent firefox from making another microsummary-related request for one hour: cache-control: max-age=3600
note: because of a technical limitation (bug 346820), firefox uses the same cache for both microsummary-related requests and user-initiated requests, so the cache headers you return apply to both.
Migrate apps from Internet Explorer to Mozilla - Archive of obsolete content
note that due to these quirks, pages will render slower than if they were fully standards-compliant.
... a cross-browser event handling example follows (
note that it means you can't define a global variable named event in your code): <div onclick="handleevent(event);">click me!</div> <script> function handleevent(aevent) { var myevent = window.event ?
Modularization techniques - Archive of obsolete content
pruint32 m0; pruint16 m1, m2; pruint8 m3[8]; }; frequently you see them represented as strings, like this: {221ffe10-ae3c-11d1-b66c-00805f8a2676} to initialize an id struct you declare them like this: id = {0x221ffe10, 0xae3c, 0x11d1, {0xb6, 0x6c, 0x00, 0x80, 0x5f, 0x8a, 0x26, 0x76}}; why the b66c couplet gets broken up and grouped with the last set of bytes is probably a foot
note somewhere.
...
note that one interface can have a number of classes that implement it, so there is not necessarily a one-to-one mapping from iids to cids.
Monitoring downloads - Archive of obsolete content
note: the mozistorageconnection method close() is being added to firefox 3 alpha 8; in prior versions of firefox, there is no way to explicitly close the database.
...
note that the start time is being divided by 1000 before we create a javascript date object from it.
File object - Archive of obsolete content
note: calculating the length of the directory is very expensive.
...(xxx
note -- ascii might imply asciiz) file.mode a string describing the mode used to open the file.
Running Tamarin performance tests - Archive of obsolete content
note that avm needs to point to android_shell.sh which is a proxy for running the tests on the phone.
... $ cd /test/performance $ ./runtests.py
note on using an emulator: the emulator does seem to support hardware floating point but gives a buserror when running avmshell -darm_vfp.
Tamarin mercurial commit hook - Archive of obsolete content
[n]:
note that the prompt gives you the options to abort the commit (no), allow the tab (or other violation) on that particular line, or allow the violation for all lines in that file.
... this allows you to reuse the commit message after fixing the issue by using the -l (--logfile) option: hg commit -l /reporoot/.hg/commit.save
notes at the moment this is a local-only hook and is not enforced on the server.
The life of an HTML HTTP request - Archive of obsolete content
[
note: passes nswebshell.mobserver as nsistreamobserver and the webshell as nsicontentviewercontainer to the docloader.] (2) the document loader calls ns_openuri with the url to begin transfering the requested file.
...when the presshell [
note: not true, who really does the call?] has layouted (reflowed) the frames it calls nsiframe::paint() method of all frames.
URIs and URLs - Archive of obsolete content
these schemes support a hierarchical naming system, where the hierarchy of the name is de
noted by a "/" delimiter separating the components in the path.
...
noteable differences necko does not support certain deprecated forms of relative urls, based on the following part of rfc 2396: if the scheme component is defined, indicating that the reference starts with a scheme name, then the reference is interpreted as an absolute uri and we are done.
Venkman - Archive of obsolete content
note that it is not included in the gecko-based browsers such as k-meleon, galeon and netscape 8.x.
... venkman internals
notes on venkman source code.
Event Handlers - Archive of obsolete content
(
note that there is a possibility that this may change in the future.) handlers are attached to the bound element, and they are registered by default for bubbling events.
... [editor's
note: should we have section on error-handling?
XBL 1.0 Reference - Archive of obsolete content
ertion points <children> handling dom changes event flow and targeting flow and targeting across scopes focus and blur events mouseover and mouseout events anonymous content and css selectors and scopes binding stylesheets binding implementations introduction methods properties inheritance of implementations event handlers example - sticky
notes updated and adjusted for the current firefox implementation.
...
notes.html
notes.xml
notes.css view this example download all files (.zip archive) need to ask to adjust the server - it gives "access denied" for zip files (?) references initial xbl 1.0 proposal submitted as a
note to w3c (does not reflect mozilla implementation, nor future plans) xbl 2.0 project original document information last updated date: april 24, 2006 ...
Mac stub installer - Archive of obsolete content
to do this, in addition to the above steps to set up the mac installer to debug you will need to do the following: create a file named xpcom.xpi with the shared libraries in the structure described under the [xpcom] section in: <http://lxr.mozilla.org/seamonkey/sou...ackages-mac#33>
note that if you are using the debug target of the installer binary all shared libraries are expected to have the name format <libname>debug.shlb now set a break point at xpi_init() in the mac installer code and step into xpistub and eventually the xpinstall engine will load including symbols so you can set a break point in the xpinstall engine itself.
...
note that there are two macro strings in the .jsts: $version$ which is replaced at packages time with the browser version.
Windows Install - Archive of obsolete content
note the disk space verification, the editing of the windows registry, the writing to the installation log, and the error checking before either performinstall or cancelinstall is called.
...do the verification if(spaceavailable < spacerequired) { logcomment("insufficient disk space: " + dirpath); logcomment(" required : " + spacerequired + " k"); logcomment(" available: " + spaceavailable + " k"); return(false); } return(true); } function updatewinreg4ren8dot3() { var fprogram = getfolder("program"); var ftemp = getfolder("temporary"); //
notes: // can't use a double backslash before subkey // - windows already puts it in.
addDirectory - Archive of obsolete content
a relative pathname is appended to the registry name of the package as specified by the package parameter to the initinstall method.this parameter can also be null, in which case the xpisourcepath parameter is used as a relative pathname.
note that the registry pathname is not the location of the software on the computer; it is the location of information about the software inside the client version registry.
...also see the
note about binaries on the macintosh platform in addfile.
addFile - Archive of obsolete content
this parameter can also be null, in which case the xpisourcepath parameter is used as a relative pathname.
note that the registry pathname is not the location of the software on the machine; it is the location of information about the software inside the client version registry.
...
note: if you are installing binary files on a macintosh, be aware that the binary format for those files must be applesingle if the resource information is to be installed properly.
registerChrome - Archive of obsolete content
note that you can combine switches as in the example below.
...
note that you can also look in the installed-chrome.txt file in the chrome directory to see how and where the registerchrome function has registered your package with the chrome registry.
Accessing Files - Archive of obsolete content
file and stream guide: [ nsiscriptableio | accessing files | getting file information | reading from files | writing to files | moving, copying and deleting files | uploading and downloading files | working with directories ] important
note: the pages from the file and stream guide use the io object (nsiscriptableio), which was not available in any released version of the platform (pending some fixes).
...it is important to
note that this file does not have to exist for a file reference to be valid.
Working With Directories - Archive of obsolete content
file and stream guide: [ nsiscriptableio | accessing files | getting file information | reading from files | writing to files | moving, copying and deleting files | uploading and downloading files | working with directories ] important
note: the pages from the file and stream guide use the io object (nsiscriptableio), which was not available in any released version of the platform (pending some fixes).
...
note that nsifile.append() modifies the file object, rather than returning a new one.
How to implement a custom XUL query processor component - Archive of obsolete content
lumns> <rows datasources="dummy" ref="." querytype="simpledata"> <template> <row uri="?"> <label value="?name"/> <label value="?age"/> <label value="?hair"/> <label value="?eye"/> </row> </template> </rows> </grid> </window> a few things to
note.
...a few explanatory
notes: we are using a the getbindingfor rather than getbindingobjectfor to simplify the code.
getElementsByAttribute - Archive of obsolete content
note that like most nodelists (but unlike the nodelist returned by queryselectorall), the nodelist returned by this method is live.
...
note that this method is only available on xul elements; it is not part of the w3c dom.
ContextMenus - Archive of obsolete content
note that the default attribute just affects how the item is displayed, it performs no other function itself.
...
note that this special value must begin with an underscore to distinguish it from an id of 'child'.
Panels - Archive of obsolete content
note that the panel is not placed in a separate file and is instead placed inside another window.
...
note that this will also keep the focus within the panel when it is closed.
Simple Example - Archive of obsolete content
note that this value is a literal rather than a resource.
...you might
note that the image's src attribute uses the member variable ?photo <action> <vbox uri="?photo" align="start"> <image src="?photo"/> <label value="?title"/> </vbox> </action> it shouldn't be too difficult to tell what would appear in the window in this example.
Simple Query Syntax - Archive of obsolete content
note that the namespace aware functions (with the suffix ns) need to be used to set or remove attributes with namespaces.
...
note that the menulist itself must use the extended syntax since it doesn't iterate over the children of a resource.
Static Content - Archive of obsolete content
note that the workaround of loading the datasource beforehand as mentioned for the last example isn't necessary, as the existence of the static content is another effective workaround.
...
note that the static content is always placed before the generated content, so the 'all' item will always be the first item in the menu.
Anonymous Content - Archive of obsolete content
note that the built-in elements such as scroll bars get their xbl from the files in the bindings directory in the toolkit package.
...
note that to dom functions, the content will appear as it was in the xul file, so the menupopup will be a child of the menu.
Commands - Archive of obsolete content
note that an element may have multiple controllers, which will all be checked.
...
note that html also has a commands and controller system although you can't use it on unprivileged web pages, but you may use it from, for example, a browser extension.
Content Panels - Archive of obsolete content
note that xul does have a wizard element which may be used to create wizard interfaces.
...you might
note that a mozilla browser window has xul content for the toolbars and statusbar and so forth with a tabbrowser forming the main area.
Creating Dialogs - Archive of obsolete content
note: opendialog() requires universalbrowserwrite privilege.
... amongst other useful attributes are buttonlabelaccept - label to appear on the accept button egsave buttonaccesskeyaccept - access key to use for the accept button egs defaultbutton - button is activated when the enter key is pressed
note: the label attributes are required by remote sites and are probably missing in the above examples due to bug 224996.
Cross Package Overlays - Archive of obsolete content
applying overlays to other packages
note: this section talks about contents.rdf which has been replaced in gecko 1.8 by manifest files.
...as a side
note, you can use a similar technique to apply extra style sheets.
Element Positioning - Archive of obsolete content
note that the css global skin of the xul application may also specify a min-width for the buttons and other elements, thus if simply setting the width property does not set the button width as you expect, try also to modify the button min-width property.
...if you resize the window vertically however, you will
note that the buttons grow in height.
Features of a Window - Archive of obsolete content
gecko 1.9.2
note starting in gecko 1.9.2 (firefox 3.6), overriding the position of a window using window features will not change the persisted values saved by the session store feature.
...
note that you must specify both the width and the height.
Groupboxes - Archive of obsolete content
note that the groupbox has a vertical orientation by default which is necessary to have the text elements stack in a single column.
...this could be used to add extra elements within the structure, such as in the following example: example 3 : source view <radiogroup> <radio id="no" value="no" label="no number"/> <radio id="random" value="random" label="random number"/> <hbox> <radio id="specify" value="specify" label="specify number:"/> <textbox id="specificnumber"/> </hbox> </radiogroup>
note that the radiogroup element does not draw a border around it.
Input Controls - Archive of obsolete content
note that while in html, several different kinds of fields can be created with the input element, in xul there are separate elements for each type.
...
note that the control attribute has been used so that the textbox is selected when the label is clicked.
Install Scripts - Archive of obsolete content
creating an install script
note: for firefox extensions, install.js are no longer used.
... it is important to
note that during step two, you only indicate which files should be installed and any other operations you wish to have happen.
More Tree Features - Archive of obsolete content
note also that the user cannot hide the primary column using the drop down to the right of the columns.
...(
note the mixed case.) if set to true, the user may drag the column headers around to rearrange the order of the columns.
Styling a Tree - Archive of obsolete content
note that the first rule will apply to any row that is 'readonly' regardless of whether other properties such as 'unread' are set.
...xample style sheet treechildren::-moz-tree-row(selected) { background-color: #ffffaa; } treechildren::-moz-tree-row(odd) { background-color: #eeeeee; } treechildren::-moz-tree-row(odd, selected) { background-color: #ffffaa; } treechildren::-moz-tree-cell-text(selected) { color: #000000; } treechildren::-moz-tree-cell-text(odd, selected) { color: #000000; }
note that you can also style e.g.
Templates - Archive of obsolete content
note that it isn't the template tag that determines whether content is built, it is the datasources attribute.
...
note that a template with no rules in it, as in the first example, is really equivalent functionally to a template with a single rule with no attributes.
Updating Commands - Archive of obsolete content
note that we don't need to figure out which element to use or which controller to use.
...
note that the command updater will receive notifications about all focus events on all elements, even if other event handlers respond to the event.
XBL Attribute Inheritance - Archive of obsolete content
note how the inherits attribute has been placed in the xbl namespace, by prefixing it with 'xbl:'.
...the result is as follows: <box class="okcancel" oktitle="ok" canceltitle="cancel" image="happy.png"> <button label="ok" image="happy.png"/> <button label="cancel"/> </box>
note that the attributes are duplicated on the inner (anonymous) content.
XUL Structure - Archive of obsolete content
it is important to
note that when accessing content through a chrome url, it gains the enhanced privileges described above that other kinds of urls do not.
...again,
note how the file browser.css has the same name as the package.
XUL Event Propagation - Archive of obsolete content
introduction xul events were introduced in a very general way in a previous xul
note.
...
note: the dom provides the addeventlistener method for creating event listeners on nodes that do not otherwise supply them.
browser - Archive of obsolete content
note: this is the xul method on <browser> / <tabbrowser>, not the global function in chrome://browser/content/browser.js.
...
note: both browsers must be either standalone browsers or embedded in a tabbrowser.
menuitem - Archive of obsolete content
note: if the checked attribute is set to true, and you persist its value via the persist attribute, mozilla will fail to persist its value when the menuitem is unchecked because of bug 15232.
...
note: the menuitem must have a class of menuitem-iconic for the image to appear.
panel - Archive of obsolete content
note that a context menu will never respect this attribute, always appearing relative to the mouse cursor.
...
note: the arrow will draw as long as the panel doesn't overlap the anchor.
richlistbox - Archive of obsolete content
note: in versions of firefox prior to firefox 3, rich list boxes support only single selection.
...
note that this is not the same as the first row -- if the displayed items have been scrolled down, this function will retrieve the index of the first row that the user can see.
toolbar - Archive of obsolete content
note: gecko 2.0 adds support for external toolbars.
...
note: starting in gecko 1.9.1, toolbar items are moved from the toolbarpalette and added to the toolbar when a toolbar is first displayed.
Creating XULRunner Apps with the Mozilla Build System - Archive of obsolete content
note that the locale manifest uses a variable to specify the name of the locale which has to be defined in the makefile (and you need to say #filter substitution in the manifest for the variable to be expanded).
...
note that the installer is not build automatically when you build you application, since the installer/ directory is not included in the dirs variable in the top-level makefile.
XULRunner tips - Archive of obsolete content
note: i use this method of installing extensions into all of my mozilla applications.
... on windows: firefox.exe -app path\to\application.ini on linux: firefox -app path/to/application.ini on the mac: /applications/firefox.app/contents/macos/firefox-bin -app /path/to/application.ini
note that at least on the mac, you need to use a full path.
2006-10-27 - Archive of obsolete content
axel responded by stating that cédric should send them a nice
note to correct that.
... on the same day cédric replied to axel's posting stating that he was going to forward a
note to tristan separately.
2006-11-03 - Archive of obsolete content
problem compiling with vs 2003 .net phil is trying to compile firefox for the first time and is getting an error when doing so: building deps for /cygdrive/c/mozilla/toolkit/airbag/airbag/src/common/windows/guid_string.cc make[1]: leaving directory `/cygdrive/c/mozilla/obj-i686-pc-cygwin' make: *** [build] error 2 he also
noted that he is using make 3.80-1.
...he also
noted that he has had different results (error messages when compiling) on different machines.
2006-10-27 - Archive of obsolete content
meeting
notes gecko 1.9 bug triage meeting gecko 1.9 bug triage meeting - 3pm pdt final bon echo status meeting the final bon echo status meeting happened on october 24th, 2006.
... meeting
notes ...
2006-11-10 - Archive of obsolete content
other important
notes are contained in the link above firefox and thunderbird 1.5.0.8 were released firefox and thunderbird 1.5.0.8 were released on november 7, 2006 blocker nomination and code freeze for 1.5.0.9/2.0.0.1 blocker nomination is due on november 10.
... discussion version numbering changes some discussion about paul's announcement of version number changes meetings november 6 project status meeting (
notes) november 7 bon echoe status meeting (
notes) november 8 gecko 1.9/gran paradiso status meeting: (agenda) ...
2006-10-20 - Archive of obsolete content
discussions october 16, 2006, 5:10pm - david marteau
notes that using "persist" on templatized content prevents from restoring values for the persistent attributes.
... neil
notes that the format of localstore has changed from previous versions and that "persist" is not functioning properly using the new format.
Monitoring plugins - Archive of obsolete content
here is an example that shows the runtime in an alert box to the user if the runtime exceeds half a second in length: observe: function(subject, topic, data) { if (topic == "experimental-notify-plugin-call" ) { if (data > 0.500) { alert("runtime is: " + data); } } }
note: this is just a simplified example and the use of alert() is discouraged as the component can send hundreds of notifications each second and could potentially cause your browser to crash if an excessive number of alert boxes are displayed.
... also
note that in the example above an if statement first checks to see that the arriving notification's topic is the correct one.
NPP_SetWindow - Archive of obsolete content
the window structure contains a window handle and values for top left corner, width, height, and clipping rectangle (see
note on unix below).
...
note: npp_setwindow is useful only for embedded (np_embed) or full-screen (np_full) plug-ins, which are drawn into windows.
Adobe Flash - Archive of obsolete content
example 2: javascript to flash communication
note: javascript to flash communication may not work with flash player versions older than version 8 if the user has installed multiple mozilla based browsers onto the same machine (see bug 284057 and bug 233533).
... fscommands: accessing javascript from flash
note: fscommand may not work with flash player versions older than version 8 if the user has installed multiple mozilla based browsers onto the same machine (see bug 32048 and bug 233533).
0.90 - Archive of obsolete content
(see rss - what is in a name for more info on rss's naming history.)
note: rss 0.90 has been deprecated.
...2.0!</title> <link>http://www.mozilla.org/party/1999/</link> </item> <item> <title>unix platform parity</title> <link>http://www.mozilla.org/build/unix.html</link> </item> <item> <title>npl 1.0m published</title> <link>http://www.mozilla.org/npl/npl-1.0m.html</link> </item> </rdf:rdf>
note that here, rss is being used to list sections of the web site.
Theme changes in Firefox 2 - Archive of obsolete content
note: we could use an article called updating themes for firefox 2 that would serve as a how-to guide for updating themes.
...
note: this css may be moved out into a separate file that will be referenced by both files in the future.
Using IO Timeout And Interrupt On NT - Archive of obsolete content
this technical memo is a cautionary
note on using netscape portable runtime's (nspr) io timeout and interrupt on windows nt 3.51 and 4.0.
...(
note that we can't specify timeout on overlapped io requests, so the timeouts are all handled at the nspr level.) in this case, the error is <tt>pr_io_timeout_error</tt>.
E4X for templating - Archive of obsolete content
e) { if (cond && cond != undefined) { // we need undefined condition for e4x return h(cond); } else if (_else) { return _else(cond); } return ''; // empty string allows conditions in attribute as well as element content } for example: {_if(elems.length(), function () <description>{elems[0]}</description>, function _else () <label>no data</label> )}
note that the simple xmllist() constructor (<></>) may be useful to still be able to use an expression closure (i.e., without needing return statements and braces): {_if(elems.length(), function () <> <markup/> <markup/> </>)}
note that, while it is convenient to store such e4x in separate file templates (to be eval()d at a later time, taking into account security considerations, such ...
... /* the first two arguments are optional: (h is a handler with an explicit argument v only, or beginning with k, v) lev is optional argument to
note recursive depth (if part of recursion) */ function foreach (min, max, arr, h, lev) { var k, ret=<></>, it = 1; lev = lev || 0; if (typeof min === 'number') { if (typeof max !== 'number') { lev = h; h = arr; arr = max; max = min; min = 1; } } else { lev = arr; h = max; arr = min;...
Date.prototype.toLocaleFormat() - Archive of obsolete content
also
note that the behavior of the used locale depends on the platform, and the user might customize the locale used, so using the system locale the choose the format string might in some cases not even be adequate.
...
note that the format string in this example is not properly localized, which will result in the problems described above.
LiveConnect - Archive of obsolete content
mailing list newsgroup rss feed related topics javascript, plugins older
notes (please update or remove as needed.) while the bloated liveconnect code in the mozilla source was removed in version 1.9.2 of the platform (see bug 442399), its former api has been restored (see also the specification and this thread) (building on npapi?), and as of java 6 update 12, extensions as well as applets can make use of this restored api.
...
note: liveconnect blocked under some conditions liveconnect calls from javascript to java api are blocked when the java control panel security slider is set to very high level, or when the slider is at the default high level and the jre has either expired or is below the security baseline.
Back to the Server: Server-Side JavaScript On The Rise - Archive of obsolete content
listing 4 - demonstration of server and client context <script runat="server"> function exposed() { return "exposed to the browser"; } function
notexposed() { return "can't see me!"; } </script> <script runat="client"> alert( exposed() ); alert(
notexposed() ); </script> there are two blocks of scripts defined, one with runat set to server and the other set to client.
... listing 5 - demonstration of server-proxy <script runat="server"> function
notexposed() { // runs on the server, hidden from the browser return "can't see me!"; } function exposed() { // runs on the server, callable from the browser return "exposed to the browser"; } exposed.proxy = true; // tell jaxer this function is ok to be called from the browser </script> <script runat="client" type="text/javascript"> alert( exposed() ); //works like a charm alert(
notexposed() )...
Styling the Amazing Netscape Fish Cam Page - Archive of obsolete content
div.card {float: left; width: 45%; margin: 1em 2% 0 2%;} div.card img {float: left; position: relative; z-index: 10; margin: 4px 0 0 0; border: 1px solid #339;} div.card h3 {margin: 0 0 0 4px; padding: 0.2em 0 1px 150px; border: 1px solid #339; border-left: 5px double #339; background: #eec url(body-bg-tan.jpg) bottom left no-repeat fixed; color: #339;}
note how the image is pushed downward four pixels, while the h3 is pushed rightward four pixels.
...
note: this reprinted article was originally part of the devedge site.
Writing JavaScript for XHTML - Archive of obsolete content
(
note that xhtml documents which behave correctly in both application/xhtml+xml and text/html environments are sometimes known as 'polyglot' documents.) to test the following examples locally, use firefox's extension switch.
... if (variable < 10 && variable >= 0) action(); ]]> </script>
note that the cdata section is only necessary because of the < in the code; otherwise you could have ignored it.
Mozilla's DOCTYPE sniffing - Archive of obsolete content
any "doctype html system" as opposed to "doctype html public", except for the ibm doctype
noted below a doctype declaration without a dtd, i.e., <!doctype html>.
...
note that all public identifier comparisons are case-insensitive due to the significant number of pages that use public identifiers with incorrect case.
Using the Right Markup to Invoke Plugins - Archive of obsolete content
it is important to
note, however, that the embed element is not part of the html 4.01 specification, and is therefore not a w3c standard.
...
note that the obtainment mechanism for the embed element -- that is, the way in which a plugin is obtained if it is missing -- comes via the pluginspage attribute.
Common causes of memory leaks in extensions - Extensions
unload(function() window.removeeventlistener("leaky", leakref, true), window); }
note: the unload() function is an external function which can be added in your add-on to easily provide a way to undo changes upon unloading of your add-on or a specific part/object.
... components.utils.unload("chrome://myaddon/content/mymodule.jsm"); }
note: modules not belonging to your add-on — such as services.jsm — should not be unloaded by your add-on, as this might cause errors and/or performance regressions and will actually increase the memory usage.
Using the DOM File API in chrome code - Extensions
in bootstrap scope, this must be imported in like so: cu.importglobalproperties( [ "file" ] ) accessing a file by hard-coded pathname to reference a file by its path, you can simply use a string literal: var file = file.createfromfilename("path/to/some/file"); cross platform
note: however using hard-coded paths raises cross platform issues since it uses a platform-dependent path separator (here "/").
...
notes starting in gecko 8.0 (firefox 8.0 / thunderbird 8.0 / seamonkey 2.5), you can also do this in component code.
2D collision detection - Game development
this.color("green"); } else { // no collision this.color("blue"); } });
note: another example without canvas or external libraries.
...}
note: here is another example without canvas or external libraries.
Bounding volume collision detection with THREE.js - Game development
var knot = new three.mesh( new three.torusknotgeometry(0.5, 0.1), new meshnormalmaterial({})); knot.geometry.computeboundingbox(); var knotbbox = new box3( knot.geometry.boundingbox.min, knot.geometry.boundingbox.max);
note: the boundingbox property takes the geometry itself as reference, and not the mesh.
... knotbbox.intersectsbox(otherbox);
note: this is different from the box3.containsbox method, which checks whether the box3 fully wraps another one.
GLSL Shaders - Game development
note: remember that you don't have to use three.js or any other library to write your shaders — pure webgl (web graphics library) is more than enough.
...
note: you can learn more about model, view, and projection transformations from the vertex processing paragraph, and you can also check out the links at the end of this article to learn more about it.
WebVR — Virtual Reality for the Web - Game development
note: for more information, read our webvr concepts article.
...
note: there are of course other apis useful for creating games, for example the gamepad api for control inputs, and the device orientation api for handling display orientation on mobile.
Desktop mouse and keyboard controls - Game development
note: the captain rogers: battle at andromeda is built with phaser and managing the controls is phaser-based, but it could also be done in pure javascript.
... we could write our own keycode object containing the key codes, for example: var keyboardhelper = { left: 37, up: 38, right: 39, down: 40 }; that way instead of using the codes to compare the input in the handler functions we could do something like this, which is arguably easier to remember: if(event.keycode == keyboardhelper.left) { leftpressed = true; }
note: you can also find a list if the different keycodes and what keys they relate to in the keycode reference page.
Mobile touch controls - Game development
note: the game captain rogers: battle at andromeda is built with phaser and managing the controls is phaser-based, but it could also be done in pure javascript.
...
note: the touch events reference article provides more examples and information.
Efficient animation for web games - Game development
if (progress < animationlength) { requestanimationframe(doanimation); } } // start animation requestanimationframe(doanimation); you will
note that we set starttime to -1 at the beginning, when we could just as easily have set the time using the date() object and avoided the extra code in the animation callback.
...puzzowl isn’t out yet, but here’s a little screencast of it running on a nexus 5:
note: this article was originally written and published by chris lord, on his blog — see efficient animation for games on the (mobile) web.
Tiles and tilemaps overview - Game development
note: for the visual grid, a special value (usually a negative number, 0 or null) is needed to represent empty tiles.
...
note: you can take a look at our demo that shows how to use a logic grid to handle collisions.
2D breakout game using pure JavaScript - Game development
note: if you are interested in learning about 2d web game development using a game library, consult this series' counterpart, 2d breakout game using phaser.
...
note: this series of articles can be used as material for hands-on game development workshops.
Load the assets and print them on screen - Game development
block) and the preload() function: var ball;
note: for the sake of this tutorial, we will use global variables.
...(
note that the file name does not also have to be the same, but we'd recommend it, as it makes everything easier to follow.) of course, to load the image, it must be available in our code directory.
2D breakout game using Phaser - Game development
erent versions of the mdn breakout game we are building together — are available on github: initialize the framework scaling load the assets and print them on screen move the ball physics bounce off the walls player paddle and controls game over build the brickfield collision detection the score win the game extra lives animations and tweens buttons randomizing gameplay as a
note on learning paths — starting with pure javascript is the best way to get a solid knowledge of web game development.
...
note: this series of articles can be used as material for hands-on game development workshops.
Debugging CSS - Learn web development
note: there are other useful features in the rules view too, for example declarations with invalid values are crossed out.
...
note: find out more in examining and inspecting the box model.
Fundamental CSS comprehension - Learn web development
note: if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page.
...
note: bear in mind that the second ruleset sets font-size: 10px; on the <html> element — this means that for any descendants of <html>, an em will be equal to 10px rather than 16px as it is by default.
Attribute selectors - Learn web development
(aside: it may help to
note that ^ and $ have long been used as anchors in so-called regular expressions to mean begins with and ends with.) the next example shows usage of these selectors: li[class^="a"] matches any attribute value which starts with a, so matches the first two list items.
...
note: there is also a newer value s, which will force case-sensitive matching in contexts where matching is normally case-insensitive, however this is less well supported in browsers and isn't very useful in an html context.
Pseudo-classes and pseudo-elements - Learn web development
take a look at some other examples on mdn: :last-child :only-child :invalid
note: it is valid to write pseudo-classes and elements without any element selector preceding them.
... ::pseudo-element-name
note: some early pseudo-elements used the single colon syntax, so you may sometimes see this in code or examples.
Styling tables - Learn web development
o do this, add the following css to your style.css file: /* spacing */ table { table-layout: fixed; width: 100%; border-collapse: collapse; border: 3px solid purple; } thead th:nth-child(1) { width: 30%; } thead th:nth-child(2) { width: 20%; } thead th:nth-child(3) { width: 15%; } thead th:nth-child(4) { width: 35%; } th, td { padding: 20px; } the most important parts to
note are as follows: a table-layout value of fixed is generally a good idea to set on your table, as it makes the table behave a bit more predictably by default.
...llowing css to your style.css file, again at the bottom: /* graphics and colors */ thead, tfoot { background: url(leopardskin.jpg); color: white; text-shadow: 1px 1px 1px black; } thead th, tfoot th, tfoot td { background: linear-gradient(to bottom, rgba(0,0,0,0.1), rgba(0,0,0,0.5)); border: 3px solid purple; } again, there's nothing specific to tables here, but it is worthwhile to
note a few things.
Multiple-column layout - Learn web development
cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</p> </div> something to take
note of is that the rule does not take up any width of its own.
...
note that it isn't possible to cause an element to span some columns.
Supporting older browsers - Learn web development
rder-box;} .wrapper { background-color: rgb(79,185,227); padding: 10px; max-width: 400px; display: grid; grid-template-columns: 1fr 1fr 1fr; } .item { float: left; border-radius: 5px; background-color: rgb(207,232,220); padding: 1em; } <div class="wrapper"> <div class="item">item one</div> <div class="item">item two</div> <div class="item">item three</div> </div>
note: the clear property also has no effect once the cleared item becomes a grid item, so you could have a layout with a cleared footer, which is then turned into a grid layout.
...loat: left; border-radius: 5px; background-color: rgb(207,232,220); padding: 1em; width: 33.333%; } @supports (display: grid) { .item { width: auto; } } <div class="wrapper"> <div class="item">item one</div> <div class="item">item two</div> <div class="item">item three</div> </div> support for feature queries is very good across modern browsers, however, you should
note that it is the browsers that do not support css grid, which also doesn’t support feature queries.
Styling lists - Learn web development
the following example: <ol start="4" reversed> <li>toast pita, leave to cool, then slice down the edge.</li> <li>fry the halloumi in a shallow, non-stick pan, until browned on both sides.</li> <li>wash and chop the salad.</li> <li>fill pita with salad, hummus, and fried halloumi.</li> </ol> gives you this output:
note: if there are more list items in a reversed list than the value of the start attribute, the count will continue to zero and then into negative values.
...the following example: <ol> <li value="2">toast pita, leave to cool, then slice down the edge.</li> <li value="4">fry the halloumi in a shallow, non-stick pan, until browned on both sides.</li> <li value="6">wash and chop the salad.</li> <li value="8">fill pita with salad, hummus, and fried halloumi.</li> </ol> gives you this output:
note: even if you are using a non-number list-style-type, you still need to use the equivalent numerical values in the value attribute.
What text editors are available? - Learn web development
esso closed source $75 mac faq, e-mail no end user doc, but plug-in doc yes gedit gpl free windows, mac, linux mailing list, irc online manual yes kate lgpl, gpl free windows, mac, linux mailing list, irc online manual yes komodo edit mpl free windows, mac, linux forum online manual yes
notepad++ gpl free windows forum wiki yes pspad closed source free windows faq, forum online help yes sublime text closed source $70 windows, mac, linux forum official, unofficial yes textmate closed source $50 mac twitter, irc, mailing list, e-mail online manual, wiki yes textwrangler closed...
...that works great for writing
notes to yourself, but when you're doing web development and writing in html, css, and javascript, you can produce some pretty large, complex files.
How do I use GitHub Pages? - Learn web development
it will look something like this:
note: you could also consider using a git graphical user interface to do the same work, if you feel uncomfortable with the command line.
...
note that windows has its own command conventions differing from linux and os x, so the commands below may vary on your machine.
What software do I need to build a website? - Learn web development
here is a short list of editors: operating system built-in editor third-party editor windows
notepad
notepad++ visual studio code web storm brackets shiftedit sublime text mac os textedit textwrangler visual studio code brackets shiftedit sublime text linux vi (all unix) gedit (gnome) kate (kde) leafpad (xfce) ...
...
note: ftp is inherently insecure.
Test your skills: Advanced styling - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
... another thing that commonly de
notes a search box is a magnifying glass icon.
Test your skills: Form validation - Learn web development
note: you can try out solutions locally, however it may be helpful to put your code in an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
...
note: regular expressions are really challenging if you are new to them, but don't despair — have a go and see where you get to; there is no shame in asking for some help.
Dealing with files - Learn web development
note: on windows computers, you might have trouble seeing the file names, because windows has an option called hide extensions for known file types turned on by default.
...
note: the windows file system tends to use backslashes, not forward slashes, e.g.
Using data attributes - Learn web development
to get a data attribute through the dataset object, get the property by the part of the attribute name after data- (
note that dashes are converted to camelcase).
... css access
note that, as data attributes are plain html attributes, you can even access them from css.
Debugging HTML - Learn web development
note: html is parsed permissively because when the web was first created, it was decided that allowing people to get their content published was more important than making sure the syntax was absolutely correct.
...the line numbers point to the last few lines of the file, and this error message comes with a line of code that points out an example of an open element: example: <a href="https://www.mozilla.org/>link to mozilla homepage</a> ↩ </ul>↩ </body>↩</html>
note: an attribute missing a closing quote can result in an open element because the rest of the document is interpreted as the attribute's content.
Test your skills: Conditionals - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
...
note: in the examples below, if there is an error in your code it will be outputted into the results panel on the page, to help you try to figure out the answer (or into the browser's javascript console, in the case of the downloadable version).
Test your skills: Events - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
...
note: in the examples below, if there is an error in your code it will be outputted into the results panel on the page, to help you try to figure out the answer (or into the browser's javascript console, in the case of the downloadable version).
Test your skills: Functions - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
...
note: in the examples below, if there is an error in your code it will be outputted into the results panel on the page, to help you try to figure out the answer (or into the browser's javascript console, in the case of the downloadable version).
Test your skills: Math - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
...
note: in the examples below, if there is an error in your code it will be outputted into the results panel on the page, to help you try to figure out the answer (or into the browser's javascript console, in the case of the downloadable version).
Test your skills: Strings - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
...
note: in the examples below, if there is an error in your code it will be outputted into the results panel on the page, to help you try to figure out the answer (or into the browser's javascript console, in the case of the downloadable version).
Test your skills: variables - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
...
note: in the examples below, if there is an error in your code it will be outputted into the results panel on the page, to help you try to figure out the answer (or into the browser's javascript console, in the case of the downloadable version).
Object building practice - Learn web development
note that we are chaining multiple assignments together, to get the variables all set quicker — this is perfectly ok.
...
note: if you have trouble getting this example to work, try comparing your javascript code against our finished version (also see it running live).
Test your skills: JSON - Learn web development
note: you can try out the solution in the interactive editor below.
...
note: in the example below, if there is an error in your code it will be outputted into the results panel on the page, to help you try to figure out the answer (or into the browser's javascript console, in the case of the downloadable version).
Test your skills: Object-oriented JavaScript - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
...
note: in the examples below, if there is an error in your code it will be outputted into the results panel on the page, to help you try to figure out the answer (or into the browser's javascript console, in the case of the downloadable version).
Test your skills: Object basics - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
...
note: in the examples below, if there is an error in your code it will be outputted into the results panel on the page, to help you try to figure out the answer (or into the browser's javascript console, in the case of the downloadable version).
Getting started with Ember - Learn web development
a
note on todomvc and accessibility the todomvc project has a few issues in terms of adhering to accessible/default web practices.
... if everything is working correctly, you should see a page like this:
note: on windows systems without windows subsystem for linux (wsl), you will experience slower build-times overall compared to macos, linux, and windows with wsl.
Ember resources and troubleshooting - Learn web development
note that sourcemaps are enabled by default.
... with ember-set-helper: <checkbox @value={{this.somedata}} @ontoggle={{set this "somedata" (not this.somedata)}} /> with ember-box: {{#let (box this.somedata) as |somedata|}} <checkbox @value={{unwrap somedata}} @ontoggle={{update somedata (not this.somedata)}} /> {{/let}}
note that none of these solutions are particularly common among members of the community, and as a whole, people are still trying to figure out an ergonomic and simple api for setting data in a template-only context, without backing js.
Learn web development
we have started keeping learning area release
notes to show what has changed — keep checking back frequently!
...
note: our glossary provides terminology definitions.
Chrome Worker Modules
you only need to do it once for each worker, from within the chrome worker itself: importscripts("resource://gre/modules/workers/require.js");
note: although you only need to do this once for each worker, it doesn't hurt if you do it more than once.
...core.declareffi(...)
note that, for the moment, require() only accepts absolute uris.
Accessibility information for UI designers and developers
here's an example of someone tabbing through a footer, the focus moves around:
note: don't remove the focus indicator, as without it, users that can't or don't use a mouse cannot see where they are.
... motion on pages with transitions and animations,
note that some users could experience distraction, dizziness or nausea.
Gecko info for Windows accessibility vendors
there are currently two techniques for parsing tables: 1) use acclocation() to get the coordinates for each cell and feed that into an algorithm that builds up your own table data structure, or 2) use isimpledomnode and parse the table see below for the complete list of roles and
notes about what we support intentional differences with internet explorer for the most part, where we support an msaa feature, we have tried to duplicate internet explorer's use of it.
...
note that the label and description relations may be used to prevent redundant information from being presented by the screen reader, since the label and description can occur both on their own, and in the name or description fields of an iaccessible.
Multiprocess on Windows
note: you should register your typelibs and proxies in both the chrome and content processes.
...
note: if your new interface does not contain either of these annotations, then you do not need to worry about this step.
Software accessibility: Where are we today?
the most recent
noteable attempt at solving this problem was put forth by microsoft in 1997, and is called microsoft active accessibility (msaa).
...on a positive
note, recent federal purchasing rules such as section 508 have caused many companies to pay attention and implement msaa support.
Accessible Toolkit Checklist
note, you can use the accessible description to expose the current tab position, such as "3 of 5" in order to provide ease of access for the user.
...
note, you can use the accessible description to expose the current tree view level and position, such as "l3, 6 of 9" in order to provide ease of access for the user.
Theme concepts
so, in the single image theme example (weta_fade) could be supported in chrome using the following manifest.json file: { "manifest_version": 2, "version": "1.0", "name": "<your_theme_name>", "theme": { "images": { "theme_frame": "weta.png" }, "colors": { "frame": [ 173 , 176 , 159 ], "tab_background_text": [ 0 , 0 , 0 ] } } } also,
note that chrome tiles the “theme_frame”: image from the left of the header area.
... for more information, see the
notes on chrome compatibility.
Application cache implementation overview
note: whenever a load of an items (including the manifest) fails due to a network or server error or leads to a redirect, the update fails and completely rollbacks any changes made (i.e.
...
note: the processnexturi method early returns when state of the update is different then downloading.
What to do and what not to do in Bugzilla
note that in general it's impossible to verify a duplicate until the original has been resolved.
...
note: because of how duplicate detection works in bugzilla, you should try not to verify bugs immediately after they're marked fixed; instead, let a little time pass first.
Choosing the right memory allocator
ns_alloc() == nsimemory::alloc() ns_realloc() == nsimemory::realloc() ns_free() == nsimemory::free() nsmemory::clone() (
note: not part of nsimemory) see infallible memory allocation for information about how to allocate memory infallibly; that is, how to use memory allocators that will only return valid memory buffers, and never return null.
...
notes memory that is allocated with the c standard library (malloc() and free()) should not be passed between shared libraries.
Creating JavaScript callbacks in components
note, that since the javascript function is a single method, this magic only works for callback interfaces with a single method, like nsidomeventlistener.
...so we could convert the example above to accept javascript functions in place of the stringparserobserver by making the following changes: [scriptable, function, uuid(...)] interface stringparserobserver : nsisupports { void onword(string word); }; [scriptable, uuid(...)] interface stringparser { void parse(string data); void addobserver(stringparserobserver observer); };
note the only change was adding function to the interface attributes of the callback interface.
Debugging JavaScript
(
note that before firefox 28, this was labeled "browser debugger" and only the debugger was available, not the whole toolbox.)
note that you must accept the incoming connection : (you may disable the pop-up above with the devtools.debugger.prompt-connection set to false in about:config.
...(
note that before firefox 28, only the script debugger was available.) the use of these tools are the same as the built-in tools.
Debugging a hang on OS X (Archived)
note that sampling will quickly hog up a lot of memory if you leave it on for too long!
...
note that only 3-4 seconds usually suffice,
note that this will quickly hog up a lot of memory if you leave it on for too long!
Debugging
debugging frame reflow and debugging table reflow
notes on debugging issues in gecko's layout engine.
...
note that these are replaced frequently by our tinderboxes.
Makefile - variables
note: non-functional links can be fixed by inserting en/.
... no_ variable description no_profile_guided_optimize inhibit pgo builds no_dist_install
note: values will be appended to the export variable when present.
How Mozilla's build system works
note: this document is not intended for developers who just want to build mozilla.
...
note the use of lib_prefix and lib_suffix to make this work on all platforms.
The Firefox codebase: CSS Guidelines
note: see css logical properties and values for more information.
...
note that using system colors is only useful for the chrome area, since content area colors are overriden by gecko anyway.
Limitations of frame scripts
for example: nsinavhistoryservice nsinavbookmarksservice observers in the content process as
noted in observers in the chrome process, most observers should be registered in the chrome process and will not work in the content process.
...the target property of the object passed into the message handler in the chrome process is the xul <browser> receiving the message, and you can get the chrome window from that (
note: i'm not really sure how...).
Message manager overview
cific 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 browser window: // chrome script let windowmm = window.messagemanager; browser message manager
note that in this context, "browser" refers to the xul <browser> object, which is a frame that hosts a single web document.
... the content frame message manager provides the global object for frame scripts (but
note that there is trickery to ensure that top-level variables defined by frame scripts are not shared).
Storage access policy: Block cookies from trackers
as described above,
note that nightly may include additional protections that end up getting removed or changed before they reach our release users.
... please
note that in the future we expect to make changes to how long storage access will remain valid for.
Tracking Protection
note that with firefox for android, you can access console output using the remote debugger.
...
note: depending on a third party in this way is not a good practice anyway, because then your site can be broken if the third party is slow or unavailable, or if the tracker has been blocked by an add-on.
Firefox and the "about" protocol
see firefox reader view for clutter-free web pages about:rights displays rights information about:robots special page showing
notes about robots about:serviceworkers displays currently running service workers about:studies lists the shield studies that are installed about:sessionrestore session restoration (displayed after a firefox crash) about:support troubleshooting information (also available through firefox menu > ?
...
note: you must access about: protocol pages by typing them into the address bar.
Firefox UI considerations for web developers
note: only "rich" icons (apple-touch-icon and fluid-icon) support the sizes attribute.
... examples consider again the example top sites box shown at the top of the page, repeated below: let's look at some examples among the icons shown here (
note that this discussion is based on the site designs as of early january, 2019).
HTMLIFrameElement.executeScript()
note: use of the browser api requires a privileged app, and browser and/or embed-apps permissions, depending on what you want to do.
...http://example.com/index.html
note: the options parameter does not currently seem to have much effect.
mozbrowserasyncscroll
note: top + height may be larger than scrollheight.
...
note: for performance reasons, this event is asynchronous.
HTMLIFrameElement.sendTouchEvent()
note: this method is available for touch-enabled devices only.
... modifiers a number representing a key pressed at the same time the mouse button was clicked: 1 : alt 2 : ctrl 4 : shift 8 : meta 16 : alt gr 32 : caps lock 64 : fn 128 : num lock 256 : scroll 512 : symbol lock 1024 : win
note: you can specify multiple key modifiers separated by a pipe symbol, for example 1 | 1014.
overflow-clip-box-block
/* keyword values */ overflow-clip-box-block: padding-box; overflow-clip-box-block: content-box; /* global values */ overflow-clip-box-block: inherited; overflow-clip-box-block: initial; overflow-clip-box-block: unset;
note: on gecko, by default, padding-box is used everywhere, but <input type="text"> and similar use the value content-box.
...
note that this property is activated by default only in the ua stylesheet and chrome contexts.
overflow-clip-box-inline
/* keyword values */ overflow-clip-box-inline: padding-box; overflow-clip-box-inline: content-box; /* global values */ overflow-clip-box-inline: inherited; overflow-clip-box-inline: initial; overflow-clip-box-inline: unset;
note: on gecko, by default, padding-box is used everywhere, but <input type="text"> and similar use the value content-box.
...
note that this property is activated by default only in the ua stylesheet and chrome contexts.
overflow-clip-box
/* keyword values */ overflow-clip-box: padding-box; overflow-clip-box: content-box; /* two values */ overflow-clip-box: padding-box content-box; overflow-clip-box: content-box content-box; /* global values */ overflow-clip-box: inherit; overflow-clip-box: initial; overflow-clip-box: unset;
note: on gecko, by default, padding-box is used everywhere, but <input type="text"> and similar use the value content-box.
...
note that this property is activated by default only in the ua stylesheet and chrome contexts.
Gecko SDK
note that in order to develop such components, you do not need the full sources of e.g.
...
note: you can subscribe to a calendar of the firefox release schedule.
Getting Started with Chat
note that on 2nd march 2020, mozilla moved away from irc to matrix for its public channels, the irc server was shut down.
...
note: for a complete list of irc clients go here.
How to get a stacktrace for a bug report
note: when filing a crash report, it is important to know whether the crash occurs with firefox safe mode.
... linux
note that for most distros, the package you need to get symbols for will be something like "xulrunner", not "firefox".
How to implement a custom autocomplete search component
note: when copying the examples below, change the uuid that uniquely identifies the component, otherwise you might have problems if your component gets installed along another component derived from those same examples.
...
note the format of the json.
How to Report a Hung Firefox
note: this article is intended for developers and technically-knowledgeable users.
... if firefox is truly hung, please
note the approximate amount of time you waited before forcing a crash (below) in the bug report.
PBackground
note: if you want more detailed information on ipdl, start out by reading the ipdl tutorial.
...
note: this article was original published as what is pbackground?, by kyle huey.
Implementing QueryInterface
ns_assertion(ainstanceptr, "queryinterface requires a non-null destination!"); if ( !ainstanceptr ) return ns_error_null_pointer; nsisupports* foundinterface; if ( aiid.equals(nscomtypeinfo<nsix>::getiid()) ) foundinterface = ns_static_cast(nsix*, this); else if ( aiid.equals(nscomtypeinfo<nsiy>::getiid()) ) foundinterface = ns_static_cast(nsiy*, this); //
note: don't check for |nsisupports|; |nsbaseimplementation| will do that for me.
... status = nsbaseimplementation::queryinterface(aiid, &foundinterface); else { ns_addref(foundinterface); status = ns_ok; } *ainstanceptr = foundinterface; return status; }
note that if the base implementation's queryinterface finds an appropriate interface, your queryinterface must not addref it.
AddonManager
note: the extensions.enabledscopes preference lets you configure which of these scopes are enabled; however, you can't turn off the profile scope.
...
note: calling this method more than once for the same add-on will replace the last change that was recorded with the new one; an add-on can only appear once across all change types.
AsyncShutdown.jsm
instances of phase
note that you cannot create an instance of phase yourself.
...
note that a result of false may mean either that the blocker has never been installed or that the phase has completed and the blocker has already been resolved.
DeferredTask.jsm
firefox 28
note interface was changed in firefox 28, and old methods were removed.
... promise finalize(); example firefox 28
note this section describes about deferredtask.jsm in firefox 28.0 or higher.
PopupNotifications.jsm
note: this code module is imported by firefox chrome windows, so you don't have to do it yourself in most extensions.
...
note: you shouldn't need to call this when using the popupnotifications object in firefox windows; firefox code takes care of this automatically.
Promise.jsm
to use it, you first need to import the code module into your javascript scope: components.utils.import("resource://gre/modules/promise.jsm");
note: a preliminary promise module is also available starting from gecko 17, though it didn't conform to the promises/a+ proposal until gecko 25: components.utils.import("resource://gre/modules/commonjs/promise/core.js"); // gecko 17 to 20 components.utils.import("resource://gre/modules/commonjs/sdk/core/promise.js"); // gecko 21 to 24 this implementation also includes helper functions that are...
...
note: this argument should not be a promise.
Task.jsm
; throw new task.result("value"); }
note: if you want to exit early from a generator function, without returning a value for the task, you can just use the return statement without any arguments.
...
note: if you want to return a result from a non-legacy generator function, don't use this.
Index
10 localization
notes guide, internationalization, localization, mozilla localizers usually work on the localizable files without the context of the source files including the localized strings; it is important to add comments to the localizable files themselves, too.
... these comments are generally referred to as localization
notes.
Localization and Plurals
downloads.xul: <stringbundleset> <stringbundle id="strings" src="chrome://downloads.properties"/> </stringbundleset> downloads.properties: # localization
note (downloadstitlefiles): semi-colon list of plural forms.
... # see: https://developer.mozilla.org/docs/mozilla/localization/localization_and_plurals # #1 number of files # example: 111 files - downloads downloadstitlefiles=#1 file - downloads;#1 files - downloads # localization
note (timepair): #1 time number; #2 time unit # example: 1 second; 11 seconds timepair=#1 #2 seconds=second;seconds minutes=minute;minutes hours=hour;hours downloads.js: components.utils.import("resource://gre/modules/pluralform.jsm"); let getstr = function(string) document.getelementbyid("strings").getstring(string); // get the correct plural form for the title let numdownloads = 3; let title = pluralform.get(numdownloads, getstr("downloadstitlefiles")); // put in the correct number of downloads print(title.replace("#1", numdownloads)); // get the correct plural form of s...
Localizing XLIFF files for iOS
<
note> tags contain localizer
notes from developers and should not be translated.
... <trans-unit id="add to bookmarks"> <source>add to bookmarks</source> <target>agregar a marcadores</target> <
note>no comment provided by engineer.</
note> </trans-unit> save your translations along the way.
Localizing with Mercurial
note the dot (".") at the end of the second command, which means the current directory.
... to push to mozilla-hosted repositories, you have to have committer access, and you must edit the file (your-local-hg-root aka the directory you pulled your locale into)/.hg/hgrc (
note, this is not your ~/.hgrc) to add these lines (replacing ab-cd with your locale code): [paths] default = https://hg.mozilla.org/l10n-central/ab-cd/ default-push = ssh://hg.mozilla.org/l10n-central/ab-cd/ you’ll also need to tell ssh which account to use for your pushes, too, by editing ~/.ssh/config and adding these lines, where user@host.domain is your account: host hg.mozilla.org user...
Initial setup
hg (mercurial) as
noted above, we use mercurial for maintaining mozilla source code and localized code.
... a solid, unicode-based, text editor here are some suggestions: windows:
notepad++ or
notepad2 gnu/linux: vim, gedit or kate mac os x: textwrangler gnu make make is a tool which controls the generation of executables.
Translation phase
note: if you are starting a new localization and decide to use an offline tool for localizing mozilla applications, you will need to become familiar with using mercurial (hg).
...please
note the pontoon is not available for all web projects yet.
Localization quick start guide
note: this guide is written for two types of contributors: those starting a new localization and those joining an existing localization.
...to help you filter through to the most applicable information,
note that all information that is unique to those starting a new localization will be in orange font.
MathML Accessibility in Mozilla
note that voiceover is proprietary so we do not have control on improvements to mathml accessibility in voiceover.
...
note that this is still very experimental.
Mozilla Port Blocking
background on 08/15/2001, cert issued a vulnerability
note vu#476267 for a "cross-protocol" scripting attack, known as the html form protocol attack which allowed sending arbitrary data to most tcp ports.
... more information nsioservice.cpp gbadportlist bug 83401 vulnerability
note vu#476267 dougt@netscape.com original document information author(s): doug turner last updated date: august 15, 2007 copyright information: portions of this content are © 1998–2007 by individual mozilla.org contributors; content available under a creative commons license | details.
Mozilla Web Developer FAQ
please
note that mac ie 5 behaves in the same way as mozilla when it comes to the alt and title attributes.
... mathml svg (in svg-enabled builds only) xul (please
note that xul is mozilla-specific and, therefore, using it on the public web causes interoperabilty problems.) xml:base is observed when following links.
Activity Monitor, Battery Status Menu and top
note: the power profiling overview is worth reading at this point if you haven't already.
... top -stats pid,command,cpu,idlew,power -o power -d
note: -a and -e can be used instead of -d to get different counting modes.
BloatView
note that this number does not reflect any memory held onto by the class, such as internal buffers, etc.
...
note that although this isn't necessarily the amount of memory consumed at any given time, it does give an indication of how much memory we're consuming.
GC and CC logs
as
noted in the previous section, with multiprocess firefox, you can't record logs from the content process, due to sandboxing.
...
note that just moz_cc_log_directory=.
Intel Power Gadget
note: the power profiling overview is worth reading at this point if you haven't already.
... (an energia dashboard can be seen here; please
note that the data has not been updated since early 2014.) version 3.0 (available on mac and windows, but not on linux) also exposes an api from which the same measurements can be extracted programmatically.
Measuring performance using the PerfMeasurement.jsm code module
note: the perfmeasurement.jsm javascript code module can only be used from chrome -- that is, from within the application itself or an add-on.
...you give the constructor a bit-mask of events you're interested in; see
note: at present, perfmeasurement.jsm is only functional on linux, but it is planned to add support for windows (bug 583322) and osx (bug 583323) as well, and we welcome patches for other operating systems.
Power profiling overview
note: the acpi standard specifies four states, c0, c1, c2 and c3.
... the other thing to
note about c-states is that they apply both to cores and the entire package — i.e.
Profiling with Xperf
(
note that it's not the first version number in the about window; that's the windows version.) if you have an older version, you will experience bugs, especially around symbol loading for local builds.
...
note that it's possible to capture even more data for the non-heap profile; for example, you might want to be able to correlate heap events with performance data, so you can do "xperf -on base -stackwalk profile".
Refcount tracing and balancing
note: due to an issue with the sandbox on windows (bug 1345568), refcount logging currently requires the moz_disable_content_sandbox environment variable to be set.
...
note that setting xpcom_mem_log_classes will also list the serial number of each object that leaked in the "bloat log" (that is, the file specified by the xpcom_mem_bloat_log variable; see the bloatview documentation for more details).
Reporting a Performance Problem
note that increasing the buffer size uses more memory and can make capturing a profile take longer.
...
note that while it's possible to strip profiles of potentially privacy sensitive information, the less information a profile contains, the harder it is to analyze and turn into actionable data.
about:memory
note that in both cases the generated data contains privacy-sensitive details such as the full list of the web pages you have open in other tabs.
...�─ heap-committed 164.00 mb ── heap-mapped 4.84% ── heap-overhead-ratio 1 ── host-object-urls 0.00 mb ── imagelib-surface-cache 5.27 mb ── js-main-runtime-temporary-peak 0 ── page-faults-hard 203,349 ── page-faults-soft 274.99 mb ── resident 251.47 mb ── resident-unique 1,103.64 mb ── vsize some measurements of
note are as follows.
Profile Manager
downloading binaries you can download profile manager builds from https://ftp.mozilla.org/pub/mozilla.org/utilities/profilemanager/1.0/
note: there is no installer; just extract the files from the archive.
... launch option command line argument run firefox in offline mode -offline run firefox in safe mode -safe-mode start firefox with a console -console start new instance -no-remote
note: it isn't possible to start a second instance of firefox without passing it the -no-remote command line argument.
Debugging out-of-memory problems
out-of-memory exceptions from js setting memory.dump_reports_on_oom in about:config to true will cause the browser to automatically write about:memory dumps to a temp file printed to the browser console (
note: not web console) when an oom crash is encountered.
...
note: replace "/storage/emulated/0/download/" in the reported file path with the device's download path (e.g.
Midas editor module security preferences
this functionality is completely removed since 2013-12-14 18:23 pst, see: bugs 38966 and 913734
note: if you've reached this page from a message box in firefox or another mozilla product, try using keyboard shortcuts for the cut, copy, and paste commands: copy: ctrl+c or ctrl+insert (command+c on mac) paste: ctrl+v or shift+insert (command+v on mac) cut: ctrl+x or shift+delete (command+x on mac) the information on the rest of this page is for web developers and advanced users.
...
note: the preference is site as well as protocol specific.
NSPR Poll Method
this technical
note documents the poll method of prfiledesc.
...(
note: this may change in a future nspr release if we make the semantic change to *out_flags mentioned above.
FIPS Mode - an explanation
(
note: mozilla does not distribute a "fips mode"-ready nss with firefox.) this page attempts to provide an informal explanation of what it is, who would use it, and why.
... (
note, the current version of fips 140 is revision 2, a.k.a.
Introduction to Network Security Services
(
note that nspr is a separate mozilla project; see netscape portable runtime for details.) figure 1 relationships among core nss libraries and nspr naming conventions and special libraries windows and unix use different naming conventions for static and dynamic libraries: windows unix static .lib .a dynamic .dll .so or .sl in addition, wind...
...
note that nss 3.x is also available in the lp64 model for these platforms, but the lp64 model of nss 3.x does not have these two extra shared libraries.
NSS Sample Code sample2
*
note: iv is only needed if cipher blocking chaining (cbc) mode of encryption * is used * * the recommended approach is to store and transport wrapped (encrypted) * des keys (ivs can be in the clear).
... *
note that some mechanisms (*_pad) imply the padding is handled for you * by nss.
PKCS11 module installation
note: the information in this article is specific to firefox 3.5 and newer.
...
note: there is currently a bug in firefox where international characters may cause problems.
Python binding for NSS
.nss.der_universal_secitem_fmt_lines() nss.nss.import_crl() nss.nss.make_line_pairs() nss.nss.oid_dotted_decimal() nss.nss.oid_str() nss.nss.oid_tag() nss.nss.oid_tag_name() nss.nss.read_der_from_file() nss.nss.x509_alt_name() nss.nss.x509_ext_key_usage() nss.nss.x509_key_usage() the following class methods and properties were added:
note: it's a method if the name is suffixed with (), a propety otherwise socket.next() socket.readlines() socket.sendall() sslsocket.next() sslsocket.readlines() sslsocket.sendall() authkeyid.key_id authkeyid.serial_number authkeyid.get_general_names() crldistributionpoint.issuer crldistributionpoint.get_general_names() crldistributionp...
....to_hex() signedcrl.delete_permanently() ava.oid ava.oid_tag ava.value ava.value_str dn.cert_uid dn.common_name dn.country_name dn.dc_name dn.email_address dn.locality_name dn.org_name dn.org_unit_name dn.state_name dn.add_rdn() dn.has_key() rdn.has_key() the following module functions were removed:
note: use nss.nss.oid_tag() instead nss.nss.sec_oid_tag_from_name() nss.nss.sec_oid_tag_name() nss.nss.sec_oid_tag_str() the following files were added: doc/examples/cert_dump.py test/test_cert_components.py release 0.8.0 release date 2009-09-21 scm tag pynss_release_0_8_0 source download cha...
FC_InitToken
note: the so password should be the empty string, i.e., ulpinlen argument should be 0.
...
note: resetting the password clears all permanent secret and private keys.
NSC_InitToken
(user certs are the certificates that have their associated private keys in the key database.)
note: the so password should be the empty string, i.e., ulpinlen argument should be 0.
...
note: resetting the password clears all permanent secret and private keys.
NSS tools : certutil
note that the output of the -l option may include "u" flag, which means that there is a private key associated with the certificate.
...
notes 1.
NSS reference
initial
notes we are migrating the ssl reference into the format described in the mdn style guide.
... nss environment variables nss cryptographic module nss tech
notes nss tech
notes nss memory allocation tools based on nss tools documentation.
NSS Tools pk12util
availability see the release
notes for the platforms this tool is available on.
...12 v2 pbe with sha1 and 3key triple des-cbc" "pkcs12 v2 pbe with sha1 and 2key triple des-cbc" "pkcs12 v2 pbe with sha1 and 128 bit rc2 cbc" "pkcs12 v2 pbe with sha1 and 40 bit rc2 cbc" pkcs #5 pbe ciphers: "pkcs #5 password based encryption with md2 and des cbc" "pkcs #5 password based encryption with md5 and des cbc" "pkcs #5 password based encryption with sha1 and des cbc" it should be
noted that the the crypto provider may be the softtoken module or an external hardware module.
Proxies in Necko
note that the proxy method is only used when the protocol handler supports http proxies, as indicated by its protocol flags.
...
note that socks is implemented as an nsisocketprovider, and the socket transport service will therefore use it as as the downmost socket type.
Renaming With Pork
these
notes are based on tools pork refactoring toolchain [required].
...
note the -k,-w0 options are passed down to the mcpp preprocessor such that it can annotate files with more precise position information.
Download Rhino
binaries release release date change log download link rhino 1.7r4 2012-06-18 new in rhino 1.7r4 rhino1_7r4.zip rhino 1.7r5 2015-01-29 release
notes rhino1_7r5.zip rhino 1.7.6 2015-04-15 release
notes rhino1.7.6.zip rhino 1.7.7 2015-06-17 release
notes rhino1.7.7.zip rhino 1.7.7.1 2016-02-01 release
notes rhino1.7.7.1.zip rhino 1.7.7.2 2017-08-24 release
notes rhino1.7.7.2.zip rhino 1.7.8 2018-01-22 release
notes rhino1.7.8.zip rhino 1.7.9 2018-03-15 release
notes rhino1.7.9.zip rhino 1.7.10 2018-04-09 release
notes rhino1.7.10.zip ...
... rhino 1.7.11 2019-05-30 release
notes rhino1.7.11.zip rhino 1.7.12 2020-01-13 release
notes rhino1.7.12.zip to download older rhino versions, see the rhino downloads archive.
Tutorial: Embedding Rhino
here's an example use of runscript from a shell command line: $ java runscript "math.cos(math.pi)" -1 $ java runscript "function f(x){return x+1} f(7)" 8
note that you'll have to have both the rhino classes and the runscript example class file in the classpath.
...(
note that because the java -jar option preempts the rest of the classpath, we can't use that and access the counter class.) $ java -cp "js.jar;examples" org.mozilla.javascript.tools.shell.main js> defineclass("counter") js> c = new counter(7) [object counter] js> c.count 7 js> c.count 8 js> c.count 9 js> c.resetcount() js> c.count 0 counter's constructors the zero-argument constructor is used by r...
Rhino scopes and contexts
then after a custom initialization is done, one can seal the shared scope by callingscriptableobject.sealobject(): sealedsharedscope.sealobject();
note that currently one needs to explicitly seal any additional properties he adds to the sealed shared scope since although after calling sealedsharedscope.sealobject(); it would no be possible to set the additional properties to different values, one still would be able to alter the objects themselves.
...
note that currently in order to use java classes (liveconnect) from a sealed shared scope you need to pre-load a number of objects needed for liveconnect into the scope before it gets sealed.
Shumway
note: if your applet runs at an abnormal speed, try toggling "turbo" at the bottom of the inspector window.
...please
note that source code will be requested for the shumway developers to use as small test cases.
Creating JavaScript jstest reftests
note that tests which use comparesource should be located in the decompilation sub-suite of a suite.
...a different approach is to use the expectexitcode(exitcode) function which outputs a string: ---
note: in this testcase, we expect exit code <exitcode> --- that tells the post-processing scripts jsdriver.pl or post-process-logs.pl that the test passes if the shell or browser terminates with that exit code.
Invariants
but
note that a stack frame is not necessarily newer than the next stack frame down, thanks to generators!) an object's scope chain (found by chasing jsobject::fslots[jsslot_parent]) never forms a cycle.
...(
note that the locking scheme applies to all objects and talks about properties being locked.
JS::CompileOptions
(
note that one may assign both strings and functions to dom elements' event handler idl attributes.
...
note that this *roots* any js values it refers to - they're live unconditionally.
JS::Value
(
note that both -0 and +0 are allowed, and the latter may sometimes be stored using the int32_t representation.) js::value further provides these methods combining various aspects of the above methods: js::objectornullvalue(jsobject*) returns an object value corresponding to the given non-null pointer, or a null value if the pointer is null.
... in particular,
note that it is an error to call val.toobject() when val.isnull().
JSObjectOps.getRequiredSlot
see
note below.
...
note: the slot parameter is a zero-based index into obj slots, unlike the index parameter to the js_getreservedslot and js_setreservedslot api entry points, which is a zero-based index into the jsclass_reserved_slots(clasp) reserved slots that come after the initial well-known slots: proto, parent, class, and optionally, the private data slot.
JS_ClearContextThread
so the usual code for using a jscontext on a thread other than the one where it was created looks like this: void mythread(jscontext *cx) { js_setcontextthread(cx); /*
note: outside the request */ js_beginrequest(cx); ...
... js_endrequest(cx); js_clearcontextthread(cx); /*
note: outside the request */ } js_setcontextthread ties cx to the current thread for exclusive use.
JS_GetStringBytes
note: js_getstringbytes() and js_getstringbytesz() have both been removed as of javascript 1.8.5 (firefox 4).
...
note that for non-ascii strings, if js_cstringsareutf8 is false, these functions can return a corrupted copy of the contents of the string.
JS_InitClass
note: starting with spidermonkey 1.8, the prototype and constructor are set up with stub getter and setter operations instead of class operations.
...
note: by default js_initclass creates a prototype object but does not invoke the constructor (jsclass.construct) on it.
JS_SetFunctionCallback
note: this method is only available if moz_trace_jscalls was defined at compile time using --enable-trace-jscalls.
...
note that debuggers should probably use js_setcallhook in preference to this function, because it is invoked when the javascript stack is guaranteed to be in a consistent state (and therefore it is valid to inspect and modify local variables, generate stack traces, and set breakpoints.) callback syntax typedef void (* jsfunctioncallback)(const jsfunction *fun,const jsscript *scr, ...
JS_SetInterruptCallback
important
note: additional callbacks can occur inside the callback handler if it re-enters the js engine.
...some common uses for an interrupt callback are: to run garbage collection periodically, by calling js_maybegc; to periodically take a break from script execution to update the ui (though
note that mozilla does not do this, by design); to enforce application limits on the amount of time a script may run.
JS_SetOperationCallback
important
note: additional callbacks can occur inside the callback handler if it re-enters the js engine.
...some common uses for an operation callback are: to run garbage collection periodically, by calling js_maybegc; to periodically take a break from script execution to update the ui (though
note that mozilla does not do this, by design); to enforce application limits on the amount of time a script may run.
JS_THREADSAFE
note: js_threadsafe is now permanently on.
... further info
note: spidermonkey internals: thread safety is mostly obsolete.
JS_ValueToObject
(implementation
note: the object's jsobjectops.defaultvalue method is called with hint=jstype_object.) the resulting object is subject to garbage collection unless the variable *objp is protected by a local root scope, an object property, or the js_addroot function.
...
note that a local root scope is not sufficient to protect the resulting object in some cases involving the valueof method!
SpiderMonkey releases
this page lists spidermonkey release
notes.
...
note: standalone spidermonkey is not an official product.
Split object
(
note: with does add an object to the scope chain, but it's a special with wrapper object that is skipped, or something, during the search described here.
...
note that none of the rules listed here affects ordinary property accesses.
TPS Formdata Lists
{ fieldname: "testing", value: "failure", date: -2 }, { fieldname: "username", value: "joe" } ]; formdata lists and phase actions you can use the following functions in phase actions for formdata lists: formdata.add formdata.delete formdata.verify formdata.verifynot for an example, see the tps formdata unittest: http://hg.mozilla.org/services/tps/f...st_formdata.js
notes
note 1, tps supports the delete action for formdata, but sync currently does not correctly sync deleted form data, see bug 564296.
...
note 2, sync currently does not sync formdata dates, so the date field is ignored when performing verify and verify-not actions.
Using RAII classes in Mozilla
in the common case, using these macros involves these three additions to a class: class moz_raii nsautoscriptblocker { public: explicit nsautoscriptblocker(jscontext *cx moz_guard_object_notifier_param) { //
note: no ',' before macro moz_guard_object_notifier_init; nscontentutils::addscriptblocker(cx); } ~nsautoscriptblocker() { nscontentutils::removescriptblocker(); } private: moz_decl_use_guard_object_notifier }; moz_guard_object_notifier_param is added to the end of the constructor's parameter list.
...class using these macros does not use moz_guard_object_notifier_init or moz_decl_use_guard_object_notifier, but instead uses either moz_guard_object_notifier_param_to_parent or moz_guard_object_notifier_only_param_to_parent: nsspecialautoscriptblocker::nsspecialautoscriptblocker(moz_guard_object_notifier_param_in_impl) : nsautoscriptblocker(moz_guard_object_notifier_only_param_to_parent) { }
note that a few of these macros aren't actually implemented yet, but they can be implemented when needed.
Security and the jar protocol
note: support for the jar: protocol was disabled by default for use from web content beginning in firefox 45, but re-enabled again because it broke the experience of ibm i
notes users.
... i
notes has since been updated so that it no longer needs remote jars, so they have been disabled again in firefox 55.
Signing Mozilla apps for Mac OS X
the main options of
note are: -s your-signing-identity lets you specify the signing certificate you want to sign the application with your-signing-identity is the name of your certificate.
...
note that you cannot specify an identifier requirement if you do this, or otherwise you need to sign the outer application again with the identifier requirement.
XForms Accessibility
note, xforms accessibility is implemented only on trunk.
...
note, we support -moz-user-focus style neither for xhtml or xul.
Frecency algorithm
efault score +140 100 * (140/100.0) - first bucket weight and bookmarked bonus +84 70 * (120/100.0) - second bucket weight and followed-link bonus +14 10 * (140/100.0) - fifth bucket weight and bookmarked bonus +14 10 * (140/100.0) - fifth bucket weight and bookmarked bonus -- 252 (4 * 252 / 4) - final frecency score
notes the number of sampled visits is min(10 most recent visits pref, total visit counts).
... developer
notes there are various development
notes you can read about places that may offer additional insights: initial algorithm ideas implementation
notes history the initial algorithm design was by mike connor and seth spitzer.
Manipulating bookmarks using Places
note: all annotations, tags, and so forth are kept when the bookmark's uri is changed.
...
note that this example takes advantage of xpcomutils to generate the nsisupports.queryinterface() method.
places.sqlite Database Troubleshooting
sqlite> .clone places.sqlite sqlite> pragma user_version;
note the version number returned by the last pragma query.
... nn must be replaced with the number we had
noted previously: sqlite> pragma user_version = nn; let's update the page_size value: sqlite> pragma journal_mode = truncate; sqlite> pragma page_size = 32768; sqlite> vacuum; sqlite> pragma journal_mode = wal; sqlite> .exit copy the new places.sqlite to the profile folder, overwriting the existing one.
Aggregating the In-Memory Datasource
private: nscomptr<nsisupports> minner; }; construct the datasource delegate when your object is constructed (or, at worst, when somebody qi's for it): rv = nscomponentmanager::createinstance( krdfinmemorydatasourcecid, this, /* the "outer" */ nscomtypeinfo<nsisupports>::getiid(), getter_addrefs(minner));
note passing this as the "outer" parameter.
...
notes describing all of the vagaries of xpcom aggregation is beyond the scope of this document.
Creating a Python XPCOM component
(
note that some details may be missing.) preparation if a binary of pyxpcom is not available, you will need to build it - see building pyxpcom.
...
note: there are exceptions; see this discussion for information on the use of string and wstring for unicode transfer.
Creating XPCOM components
note: in general, you should try to avoid having to create xpcom components.
...
note:this article describes a method that uses xpidl but you should use webidl instead.
XPCOM Stream Guide
mponents.interfaces.nsistoragestream) .getoutputstream(); var instream = components.classes["@mozilla.org/io/string-input-stream;1"] .createinstance(components.interfaces.nsistringinputstream); var data = "hello world"; instream.setdata(data, data.length); while (instream.available()) { outstream.writefrom(instream, instream.available()); }
note this is an inefficient example: the only important part is how to feed the output stream.
... a
note about unicode strings versus nsiinputstream nsiinputstream and nsioutputstream work with 8-bit characters.
How to build a binary XPCOM component using Visual Studio
note: wintools.zip seems old and lots of newer mdc documentation refers to moztools.zip archive, but the version of xpidl.exe that comes with the gecko-sdk crashes with the dll’s from moztools.
...s add "..\gecko-sdk\lib" to additional library directories add "nspr4.lib xpcom.lib xpcomglue_s.lib" to additional dependencies add "xp_win;xp_win32″ to preprocessor definitions turn off precompiled headers (just to keep it simple) use a custom build step for the xpcom idl file (spawns xpidl-build.bat to process the idl with mozilla toolset, not midl) vc++ express project: xpcom-test.zip
note: the project uses xpcom_glue.
Interfacing with the XPCOM cycle collector
note that the collector also knows how to walk through the js heap, and can locate ownership cycles that pass in and out of it.
...ns_impl_cycle_collection_traverse_end finally, you need to manually add the js object to the trace method: ns_impl_cycle_collection_trace_begin(nsfoo) //if your class is a wrapper cache: //ns_impl_cycle_collection_trace_preserved_wrapper ns_impl_cycle_collection_trace_js_member_callback(msomeobj) ns_impl_cycle_collection_trace_end
note that if your class is a wrapper cache then you likely have generate code that uses ns_impl_cycle_collection_wrappercache_# macro instead of ns_impl_cycle_collection_#.
Components.classes
note that components.classes reflects only those component classes that have been previously installed and registered with the component manager using contractids.
...
note also that it is possible that a given add-on component with a given contractid will be present on one machine but not have been installed on another machine.
Components.isSuccessCode
note: a non-zero xpcom return code (that is, not ns_ok) does not necessarily indicate failure.
...
note: nsiasyncstreamcopier.init() has changed in gecko 1.9.2, omit last 2 boolean parameters if you're using gecko 1.9.1 and earlier.
Components.utils.forceGC
users should
note that garbage collection is a very expensive operation and should only be forced when it is known to be absolutely necessary.
...
note: nsidomwindowutils.garbagecollect() offers similar functionality but will trigger the cycle collector in addition to the garbage collector in the javascript engine.
XPConnect wrappers
note: wrappers can appear in the console log; for example "[object xraywrapper [object blah]]".
...
note that a previous version of the current page recommended using __exposedprops__ to expose objects from chrome to content.
nsresult
note: on compilers that do not support strongly-typed enums (that is, compilers that don't support this feature of c++11), it falls back to being an unsigned 32-bit integer, as in past versions of gecko.
...
note: prior to gecko 19.0, nsresult was not strongly typed.
IAccessibleText
also,
note that the server may have different life cycle management strategies for controls depending on whether or not a control manages its children.
...also,
note that the server may have different life cycle management strategies for controls depending on whether or not a control manages its children.
mozIAsyncFavicons
note that the callback's adatalen will be 0, adata will be null, and amimetype will be empty -- only auri will be non-zero/null/empty.
...
note: this function is identical to nsifaviconservice.setandloadfaviconforpage() void setandfetchfaviconforpage( in nsiuri apageuri, in nsiuri afaviconuri, in boolean aforcereload, in unsigned long afaviconloadtype, in nsifavicondatacallback acallback optional ); parameters apageuri uri of the page whose favicon is being set.
mozIPlacesAutoComplete
note: pages will not be automatically unregistered when private browsing mode is entered or exited.
...
note: pages will not be automatically unregistered when private browsing mode is entered or exited.
mozIRegistry
see the
note above.
...
note that these additional capabilities will not be utilized by nsrepository.
mozIStorageAggregateFunction
note this callback is executed on the thread that the statement or trigger is executing on.
...
note this callback is executed on the thread that the statement or trigger is executing on.
mozIStorageValueArray
note: c++ callers should be aware that a string value for a null column has isvoid set to distinguish it from an empty string.
...
note: c++ callers should be aware that a string value for a null column has isvoid set to distinguish it from an empty string.
nsIArray
null is a valid entry in the array, and as such any nsisupports parameters may be null, except where
noted.
...
note that since null is a valid input, exceptions are used to indicate that an element is not found.
nsIAuthPrompt2
note: this method may throw any exception when the prompt fails to queue, for example because of out-of-memory error.
...
note: exceptions thrown from this function will be treated like a return value of false.
nsIBidiKeyboard
note: this throws ns_error_not_implemented if the widget layer doesn't provide this information.
...(supported on: win32, mac, gtk2)
note: prior to gecko 1.9 this method used a parameter 'out prbool aisrtl' to return the value.
nsICacheService
note: starting in gecko 2.0, cache i/o is handled asynchronously.
...
note: this function may evict some items but will throw if it fails to evict everything.
nsICategoryManager
note: if the category does not exist, then this method does nothing.
...
note: if the category does not exist, then this method does nothing.
nsIChannelEventSink
note: prior to gecko 2.0, redirect handling was synchronous, using the onchannelredirect() method.
...
note: vetoing the redirect simply means that newchannel will not be opened.
nsIClassInfo
note: this flag is private and is for use by the mozilla codebase only.
...
note that nsisupports is an implicit member of the implemented set of interfaces and need not be included.
nsIClipboardDragDropHookList
inherits from: nsisupports last changed in gecko 1.7
note: this interface is not intended for direct use by embedders; it is an implementation detail.
...
note: if this implementation is not present in the list then removal will be ignored.
nsIContentView
note: currently, only <frame> and <iframe> elements are handled as content views.
...
note: when this view becomes inactive, the new content view will have scroll values that are reset to the default.
nsICookie2
note: that expiry time will also be honored for session cookies; thus, whichever is the more restrictive of the two will take effect.
...
note: this time may be approximate.
nsICryptoHMAC
note: this method may be called any time after init() is called.
...
note: this method must be called before any other method on this interface is called.
nsIDNSService
to access the service, use: var dnsservice = components.classes["@mozilla.org/network/dns-service;1"] .createinstance(components.interfaces.nsidnsservice);
note: starting in gecko 7.0, the "happy eyeballs" strategy is used to reduce lengthy timeouts when attempting backup connections during attempts to connect from clients that have broken ipv6 connectivity.
...
note: the operating system may still have its own cache of dns records, which would be unaffected by this method.
nsIDOMGeoPositionAddress
note: this needs to be moved into the dom reference.
... historical
note, which is likely of no interest to most readers: the types of the attributes below all changed from string to domstring in gecko 1.9.2 beta 5.
nsIDOMParser
note: if you're a web developer, please refer to the domparser documentation instead.
...to create a domparser when the constructor is not available (e.g., from a js xpcom component, a js module, or an xpcshell test), use: var parser = components.classes["@mozilla.org/xmlextras/domparser;1"] .createinstance(components.interfaces.nsidomparser); // optionally, call parser.init(principal, documenturi, baseuri); principals, document and base uri
note: this section covers changes introduced to domparser in gecko 1.9.
nsIDOMStorageItem
1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) gecko 1.9.1
note starting in gecko 1.9.1 (firefox 3.5), this is only used for session storage; previously, it was also used for global storage.
...
note: all items, regardless of whether they were stored for an http page or an https page, are visible from https pages.
nsIDownloadManager
note: adding a download doesn't automatically begin the transfer.
...
note: prior to gecko 12.0, this was a synchronous operation; that is, once this method returned, you knew that the download was in the download manager's list.
nsIDownloadProgressListener
it is important to
note that there is no service for this listener.
...
note: if source and destination are identical, which is possible in case of file urls or chrome urls, this is called even in gecko 1.9.2.
nsIEditorSpellCheck
note: this does not clear any suggestions left over from previous calls to checkcurrentword(), so there may be suggestions, but they will be invalid.
...
note: this method was removed in gecko 9.0 (firefox 9.0 / thunderbird 9.0 / seamonkey 2.6).
nsIExternalProtocolService
note: aprotocolscheme should not include a trailing colon, which is part of the uri syntax, not part of the scheme itself.
...
note: aprotocolscheme should not include a trailing colon, which is part of the uri syntax, not part of the scheme itself (that is pass "mailto" not "mailto:").
nsIFileProtocolHandler
note: under some platforms this is a lossy conversion.
...
note: callers should use geturlspecfromactualfile() if possible, for performance reasons.
nsIFileView
inherits from: nsisupports last changed in gecko 1.7
note: nsifileview is linux-only interface.
...
note: a quirk of the nsifileview is that it requires an appropriate treecols section in the tree tag, by default fileview will return the file size in the column.
nsILocalFile
note: the value of the followlinks attribute is not encoded in the persistent descriptor.
...see the
note in the remarks below.
nsILocaleService
note: this has nothing to do with the locale used for localization of the application (ui text strings and so on.).
...
note: this has nothing to do with any http user-agent.
nsIMemory
note: this method was deprecated in gecko 2.0.
...
note: from gecko 2.0 always returns false.
nsIMemoryMultiReporter
note: this differs from the behavior of nsimemoryreporter, which lets all fields except amount be accessed without triggering computation.
...
note: this is a hack that makes nsimemoryreportermanager.explicit more efficient.
nsIMsgDBView
note: this return value does not appear to be implemented in the base implementation.
...
note: this is not implemented in the base implementation.
nsINavHistoryResultNode
note: prior to gecko 1.9.2, this was an nsiuri.
...
note: when an item is added lastmodified is set to the same value as dateadded.
nsIParserUtils
note: if -moz-binding is absent, properties that might be xss risks in other web engines are preserved!
...
note: if -moz-binding is not present, <style> elements and style attributes, and if sanitizerallowstyle is specified, the sanitized content may still be xss dangerous if loaded into a non-gecko web engine!
nsIProtocolProxyService
note: if pac is configured, and the pac file has not yet been loaded, then this method will return a nsiproxyinfo instance with a type of "unknown" to indicate to the consumer that asyncresolve should be used to wait for the pac file to finish loading.
...
note: it is possible to construct filters that compete with one another in undesirable ways.
nsIRequestObserver
note: an exception thrown from onstartrequest has the side-effect of causing the request to be canceled.
...
note: an exception thrown from onstoprequest is generally ignored.
nsISHistory
note: a listener object must implement nsishistorylistener and nssupportsweakreference.
...
note: a listener object must implement nsishistorylistener and nssupportsweakreference.
nsIScreen
gecko 1.9.2
note starting in gecko 1.9.2, gecko running on microsoft windows reports 24 bits per pixel instead of 32 bits per pixel on 8-bits per color component displays, since this is typically what the caller is actually looking for.
...
note: this returns a rectangle representing the region of the screen that is available for application use.
nsIStreamListener
note: your implementation of this method must read exactly acount bytes of data before returning.
...
note: throwing an exception will cancel the request.
nsIStringBundleOverride
to create an instance, use: var stringbundleservice = components.classes["@mozilla.org/intl/stringbundle/text-override;1"] .getservice(components.interfaces.nsistringbundleoverride);
note: you should never need to use this service directly.
...
note that these keys may not exist in the original string bundle.
nsITaskbarPreview
note: neither nsitaskbartabpreview or nsitaskbarwindowpreview makes full use of the controller; see the documentation for each interface for details on which controller methods are used.
...
note: changing this value is computationally expensive for tab previews, because doing so causes the proxy window to be destroyed and rebuilt, then re-registered with the taskbar.
nsITextInputProcessor
var enterkeyevent = new keyboardevent("", { key: "enter", code: "enter" }); tip.commitcomposition(enterkeyevent);
note that specifying keyboard event may not be dispatched during composition due to conforming to the specification of dom level 3 events.
...especially, please
note that modifier key states such as shiftkey are also ignored because each instance of nsitextinputprocessor manages modifier state which is modified when keydown() or keyup() is called with modifier key event.
nsIThreadObserver
note: it is valid to change the thread's observer during a call to this method.
...
note: it is valid to change the thread's observer during a call to this method.
nsITransactionList
note that a null can be returned here if the item is a batch.
...
note that currently there is no requirement for a transactionmanager implementation to associate a toplevel nsitransaction with a batch so it is possible for itemisbatch to return true and getitem() to return null.
nsITransactionManager
note that the transaction at the top of the redo stack will actually be at the index n-1 in the list, where n is the number of items in the list.
...
note that the transaction at the top of the undo stack will actually be at the index n-1 in the list, where n is the number of items in the list.
nsITransferable
to create an instance, use: var transferable = components.classes["@mozilla.org/widget/transferable;1"] .createinstance(components.interfaces.nsitransferable); it's important to
note that a flavor, which specifies a type of data the transferable supports, is represented by a null-terminated string indicating the mime type of the format supported by the flavor.
...
note: currently, this can only be used on windows (in order to support network principal information in drag operations).
nsITreeSelection
note: this property indicates only the index of the row with tree cursor around it.
...
note: setting this attribute to false will fire a select event.
nsIWebNavigation
inherits from: nsisupports last changed in gecko 1.9 (firefox 3) this interface is implemented by the following components: * @mozilla.org/browser/shistory-internal;1 * @mozilla.org/browser/shistory;1 * @mozilla.org/embedding/browser/nswebbrowser;1 * @mozilla.org/docshell;1 gecko 1.9.2
note in gecko 1.9.2 (firefox 3.6), the @mozilla.org/webshell;1 component no longer exists; you need to use @mozilla.org/docshell;1 instead.
...
note for valid load flag combinations look here nsdocshellloadtypes.h stop flags constant value description stop_network 1 this flag specifies that all network activity should be stopped.
nsIWifiAccessPoint
note: this string consists of the bytes as received from the network and may contain nulls and other unprintable characters; if you need to display the ssid, use the ssid attribute instead.
...
note: this is a conversion of the ssid into a "displayable" string.
XPCOM Thread Synchronization
quick reference: difference between nsautolock api and new api old construction
note: this is deprecated code that is shown only to compare with approved code.
... } old usage
note: this is deprecated code that is shown only to compare with approved code.
Troubleshooting XPCOM components registration
note: you should delete compreg.dat from your profile before doing this.
...
note that even your version of msvc may matter; your test machine may not have the c runtime libraries (msvcr70.dll / msvcp70.dll for msvc 7.0, and similarly named files for 7.1 and 8.0) available.
Frequently Asked Questions
[see initialization and assignment for more details] you should
note, though, that there is a small performance penalty for this.
... nscomptr<nsifoo> foo( do_queryinterface(abar, &rv) ); if ( foo ) foo->dosomefoothing(); // |foo| goes out of scope, and so |release|s its referent, here } // ...tons of stuff here, during which i don't need an |nsifoo| return rv; } editors
note: move this discussion to the efficiency section, and link to it from here.
Getting Started Guide
note the slight difference in declaration.
...// given: |nsifoo* mfooptr;| /*
note: this sequence is not the correct order to do assign raw pointers anyway (see comparison 1) but i need it for this comparison.
Using nsIPasswordManager
i just had to use the password manager for a project i was working on, so i thought i'd braindump my
notes to the wiki while i was at it.
... alert(pass.user); // the username alert(pass.password); // the password break; } } catch (ex) { // do something if decrypting the password failed--probably a continue } }
note that the user will be prompted for their master password if they have chosen to set one to secure their passwords.
Using the clipboard
if (source instanceof ci.nsidomwindow) //
note: in gecko versions >16, you can import the privatebrowsingutils.jsm module // and use privatebrowsingutils.privacycontextfromwindow(sourcewindow) instead source = source.queryinterface(ci.nsiinterfacerequestor) .getinterface(ci.nsiwebnavigation); res.init(source); } return res; } here, the string "text to copy" will be copied b...
...please
note: the sourcewindow variable is a placeholder for whatever window owns the data being copied -- from any dom element you can obtain it via element.ownerdocument.defaultview.
Weak reference
it's key to
note that an nsweakptr has exactly the same interface as an nscomptr.
... you really want this weak reference scheme to give you a pointer that implements the interface you actually care about, e.g., //
note: _not_ the implementation we have...
Working with Multiple Versions of Interfaces
the problem in this short
note we illustrate how one can update an xpcom module in order for it to work in both firefox 2 and firefox 3, even if the interfaces have changed in the interim.
... in the extension that prompted this
note, i needed to obtain the hwnd of the document (yes its on windows) in order to identify each particular extension instance.
XPCOM ABI
note: platforms this is not an exhaustive list of possible cpu architectures and compiler abis.
...
note: target_xpcom_abi in the mozilla build system, the variable storing the xpcom abi is named target_xpcom_abi.
XPCOM
unless otherwise
noted you register for the topics using the nsiobserverservice.setting http request headershttp is one of the core technologies behind the web.
...if the referent object is destroyed before the weak reference, the pointer inside the weak reference is set to nsnull.working with multiple versions of interfacesin this short
note we illustrate how one can update an xpcom module in order for it to work in both firefox 2 and firefox 3, even if the interfaces have changed in the interim.working with out parameterswrappedjsobjectwrappedjsobject is a property sometimes available on xpconnect wrappers.
XUL Overlays
if you are developing a mozilla extension,
note that the id namespace is shared by all the extensions.
...
note: the master skin is not the same as the global skin.
Xray vision
so when chrome code accesses content objects, it sees them with xray vision: // chrome code var transfer = gbrowser.contentwindow.confirm("transfer all my money?"); // calls the native implementation
note that using window.confirm() would be a terrible way to implement a security policy, and is only shown here to illustrate how xray vision works.
...nfigurable: true,' + ' get: function() { return "wait, is this really a getter?"; }' + '});'; var sandbox = components.utils.sandbox("https://example.org/"); components.utils.evalinsandbox(sandboxscript, sandbox); // 1) trying to access properties in the prototype that have been redefined // (non-own properties) will show the original 'native' version //
note that functions are not included in the output console.log("1) property redefined in the prototype:"); console.log(sandbox.me.tosource()); // -> "({firstname:"joe", address:{street:"main street"}, lastname:"smith"})" // 2) trying to access properties on the object that shadow properties // on the prototype will show the original 'native' version console.log("2) property that shadows the prototype...
Filelink Providers
nsimsgcloudfileprovider
note: cloudfiles and bigfiles were the two temporary feature names that were used while filelink was under construction.
...
note: the setup dialog window should resize itself automatically in order to fit the content of the iframe without scrollbars.
Index
notes: 16 cached compose window faq seth spitzer (sspitzer@mozilla.org) what is the "cached" compose window?
...it should be
noted that all of this information applies to both thunderbird and the seamonkey application suite.
Theme Packaging
see the install.rdf reference for more information: em:id em:version em:type em:targetapplication em:name em:internalname optional install.rdf properties em:description em:creator em:contributor em:homepageurl em:updateurl
note that if your theme will be made available on the https://addons.mozilla.org website, it may not include an updateurl.
...
note that this page is included from the pages listed below.
libmime content type handlers
the primary * purpose of these handlers will be to represent the attached data in a * viewable html format that is useful for the user * *
note: these will all register by their content type prefixed by the * following: mimecth:text/vcard * * libmime will then use nscomponentmanager::contractidtoclsid() to * locate the appropriate content type handler */ #ifndef nsimimecontenttypehandler_h_ #define nsimimecontenttypehandler_h_ typedef struct { prbool force_inline_display; } contenttypehandlerinits...
... sample content type handler plugin to see an example of a content type handler plugin, the source for the handler of the content type "text/calendar" can be viewed at the following link: calendar plugin
note: this plugin simply creates a blue table in the output stream to identify the fact that it is operational, but the basic constructs of what is needed to build a functional content type handler can be seen.
Toolkit version format
note, that since missing version parts are treated as if they were 0, the following version strings are equal: 1, 1.0, 1.0., 1.0.0, and even 1.0...
... older version formats firefox and thunderbird 1.0 used a simpler version format, namely major[.minor[.release[.build]]][+] where [..] de
notes an optional component, and major, minor, release, and build are all non-negative integers.
Using tab-modal prompts
note: this part of the documentation is outdated.
...alue: 'pre filled value'}; var ok = prompt.prompt.apply(null, ['title - but not shown in tab modal', 'text goes here', input, 'check text, if no text, checkbox is not shown', check]); //this here is just an alert, showing the values of the prompt prompt.alert.apply(null, ['title not shown in modal', 'user clicked ok: ' + ok + '\n' + 'checked: ' + check.value + '\ninput value: ' + input.value]);
note: because the prompts are shown in a tab, if the tab is closed while the prompt is open it will throw an exception.
Using the Mozilla source server
the nightly debug builds are now also source indexed so that by following a couple of simple steps you can also have the source code served to you for debugging without a local build what you'll need windbg or visual studio (
note: express editions will not work, but windbg is a free download) a nightly build that was created after april 15, 2008; go to the /pub/firefox/nightly/latest-mozilla-central/ folder and grab the installer for builds predating the switch to mercurial, you'll need cvs.exe, added to your path (the cvs.exe from mozillabuild has problems, use this one instead)
note: do not use the cvs from mozillabuild, it will not work!
... using the source server in visual studio
note: source server support does not work correctly out of the box in visual studio 2005.
PointerType
note: ctypes.void_t.size is undefined.
...
note: this is never ctypes.void_t or an array type with an unspecified length.
URLs - Plugins
note that npn_geturl is typically asynchronous: it returns immediately and only later handles the request, such as displaying the url or creating the stream for the instance and writing the data.
...
note: you cannot use npn_posturl to specify headers (even a blank line) in a memory buffer.
DevTools API - Firefox Developer Tools
note: some components use add-on sdk event module instead of the devtools eventemitter.
...gdevtools.once("netmonitor-init").then(toolbox => { //
note that the second argument is not available here.
Network request details - Firefox Developer Tools
note that the keys in the response header are all in lowercase, while the request headers keys are not.
...
note: future versions will also show this information when entries in the network monitor timeline graph are moused over (see bug 1580493).
Work with animations - Firefox Developer Tools
le(1)', filter: 'grayscale(100%)' }, { filter: 'grayscale(100%)', offset: 0.333 }, { transform: 'scale(1.5)', offset: 0.666 }, { transform: 'scale(1.5)', filter: 'grayscale(0%)' } ]; application to the example applying all this to our example, we can see that: the animation involved two elements, span#
note and img#icon.
... the span#
note animation: animated the width and opacity properties, to make the name gradually appear lasted 500ms, and had a delay of 150ms was given an easing value of ease-out: you can see this by the convex shape of the green bar.
Call Tree - Firefox Developer Tools
note that we use the same program - the same profile, in fact - in the documentation page for the flame chart.
...for example, we can expand the entry for bubblesort(): so we can see the call graph is like this: sortall() -> sort() -> bubblesort()
note also that self cost for sort() here is 1.45%, and
note that this is the same as for the separate entry for sort() later in the list.
Responsive Design Mode - Firefox Developer Tools
note: the device you select when in responsive design mode and the orientation (portrait or landscape) is saved between sessions.
...(
note that when touch simulation is enabled, this toolbar icon is blue; when simulation is disabled, it is black.
Taking screenshots - Firefox Developer Tools
note: if you capture an image to a filename like test.png, and then you capture to that same filename, the new image will overwrite the old image.
...
note: thanks to eric meyer for his enthusiasm for our screenshot feature, and help!
Console messages - Firefox Developer Tools
css
note: css warnings and reflow messages are not shown by default, for performance reasons (see bug 1452143).
...
note that the sha-1 certificate may not be your site's own certificate, but may be the certificate belonging to a certification authority that was used to sign your site's certificate.
AddressErrors - Web APIs
usage
notes keep in mind that some violation errors may be outside the ability of the user to fix.
...
note: if you have content blocking features enabled in your browser, the example may not work inline below.
Attr.localName - Web APIs
html content <button id="example">click me</button> javascript content const element = document.queryselector("#example"); element.addeventlistener("click", function() { const attribute = element.attributes[0]; alert(attribute.localname); });
notes the local name of an attribute is the part of the attribute's qualified name that comes after the colon.
...
note: in gecko 1.9.2 and earlier, the property returns the upper-cased version of the local name for html attributes in html doms (as opposed to xhtml attributes in xml doms).
Attr.namespaceURI - Web APIs
if (attribute.localname == "value" && attribute.namespaceuri == "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul") { // this is a xul value }
notes this is not a computed value that is the result of a namespace lookup based on an examination of the namespace declarations in scope.
...
note too that the namespace prefix, once it is associated with a particular node, cannot be changed.
AudioContext.createMediaElementSource() - Web APIs
note: you can also view this example running live, or view the source.
...document.documentelement.scrolltop : document.body.scrolltop); gainnode.gain.value = cury/height; } // connect the audiobuffersourcenode to the gainnode // and the gainnode to the destination, so we can play the // music and adjust the volume using the mouse cursor source.connect(gainnode); gainnode.connect(audioctx.destination);
note: as a consequence of calling createmediaelementsource(), audio playback from the htmlmediaelement will be re-routed into the processing graph of the audiocontext.
AudioContext.createMediaStreamSource() - Web APIs
note: you can see this example running live, or view the source.
... mouse is moved // then set new gain value range.oninput = function() { biquadfilter.gain.value = range.value; } }) .catch(function(err) { console.log('the following gum error occured: ' + err); }); } else { console.log('getusermedia not supported on your browser!'); } // dump script to pre element pre.innerhtml = myscript.innerhtml;
note: as a consequence of calling createmediastreamsource(), audio playback from the media stream will be re-routed into the processing graph of the audiocontext.
AudioListener.dopplerFactor - Web APIs
note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc.
... the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }
note: in terms of working out what position values to apply to the listener and panner, to make the sound appropriate to what the visuals are doing on screen, there is quite a bit of math involved, but you will soon get used to it with a bit of experimentation.
AudioListener.setOrientation() - Web APIs
note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc.
... the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }
note: in terms of working out what position values to apply to the listener and panner, to make the sound appropriate to what the visuals are doing on screen, there is quite a bit of math involved, but you will soon get used to it with a bit of experimentation.
AudioListener.setPosition() - Web APIs
note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc.
... the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }
note: in terms of working out what position values to apply to the listener and panner, to make the sound appropriate to what the visuals are doing on screen, there is quite a bit of math involved, but you will soon get used to it with a bit of experimentation.
AudioParam.exponentialRampToValueAtTime() - Web APIs
note: exponential ramps are considered more useful when changing frequencies or playback rates than linear ramps because of the way the human ear works.
...tion gainnode.gain.setvalueattime(0, audioctx.currenttime); source.connect(gainnode); gainnode.connect(audioctx.destination); // set buttons to do something onclick exprampplus.onclick = function() { gainnode.gain.exponentialramptovalueattime(1.0, audioctx.currenttime + 2); } exprampminus.onclick = function() { gainnode.gain.exponentialramptovalueattime(0.01, audioctx.currenttime + 2); }
note: a value of 0.01 was used for the value to ramp down to in the last function rather than 0, as an invalid or illegal string error is thrown if 0 is used — the value needs to be positive.
AudioParam.setValueCurveAtTime() - Web APIs
usage
notes when the parameter's value finishes following the curve, its value is guaranteed to match the last value in the set of values specified in the values parameter.
...
note: some early implementations of the web audio api did not ensure this to be the case, causing unexpected results.
AudioParamDescriptor - Web APIs
note that this should be done in a separate file.
...parameters['customgain'][i] : parameters['customgain'][0]) //
note: a parameter contains an array of 128 values (one value for each of 128 samples), // however it may contain a single value which is to be used for all 128 samples // if no automation is scheduled for the moment.
AudioTrackList.onaddtrack - Web APIs
note: you can also add a handler for the addtrack event using addeventlistener().
... usage
notes the addtrack event is called whenever a new track is added to the media element whose audio tracks are represented by the audiotracklist object.
AudioWorkletNode.parameters - Web APIs
note that this should be done in a separate file.
...parameters['customgain'][i] : parameters['customgain'][0]) //
note: a parameter contains an array of 128 values (one value for each of 128 samples), // however it may contain a single value which is to be used for all 128 samples // if no automation is scheduled for the moment.
AudioWorkletNode.port - Web APIs
note: the port at the other end of the channel is available under the port property of the processor.
...
note that that this should be done in a separate file.
AudioWorkletProcessor() - Web APIs
note that there are default values for the first two properties, so even if there are no options object passed to the audioworkletnode constructor, the options object passed by the node to the audioworkletprocessor constructor will exist and at minimum have numberofinputs and numberofoutputs.
...
note that this should be done in a separate file.
AudioWorkletProcessor.parameterDescriptors (static getter) - Web APIs
note that this should be done in a separate file.
...parameters['customgain'][i] : parameters['customgain'][0]) //
note: a parameter contains an array of 128 values (one value for each of 128 samples), // however it may contain a single value which is to be used for all 128 samples // if no automation is scheduled for the moment.
AudioWorkletProcessor.port - Web APIs
note: the port at the other end of the channel is available under the port property of the node.
...
note that that this should be done in a separate file.
AudioWorkletProcessor - Web APIs
usage
notes deriving classes to define custom audio processing code you have to derive a class from the audioworkletprocessor interface.
...
note that this should be done in a separate file.
AuthenticatorAssertionResponse.signature - Web APIs
note: an authenticatorassertionresponse instance is available on publickeycredential.response after calling navigator.credentials.get().
...
note: this property may only be used in top-level contexts and will not be available in an <iframe> for example.
AuthenticatorAssertionResponse.userHandle - Web APIs
note: an authenticatorassertionresponse instance is available on publickeycredential.response after calling navigator.credentials.get().
...
note: this property may only be used in top-level contexts and will not be available in an <iframe> for example.
AuthenticatorAttestationResponse.getTransports() - Web APIs
note: an authenticatorattestationresponse instance is available on publickeycredential.response after calling navigator.credentials.create().
...
note: this method may only be used in top-level contexts and will not be available in an <iframe> for example.
BaseAudioContext.createPanner() - Web APIs
note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc.
... the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }
note: in terms of working out what position values to apply to the listener and panner, to make the sound appropriate to what the visuals are doing on screen, there is quite a bit of math involved, but you will soon get used to it with a bit of experimentation.
CSSStyleSheet.addRule() - Web APIs
note that due to somewhat estoteric rules about where you can legally insert rules, it's possible that an exception may be thrown.
... usage
notes this method is implemented by browsers by constructing a string using the template literal `${selector}{${styleblock}}`, then passing it into the standard insertrule() method.
CSSStyleSheet.insertRule() - Web APIs
note: although insertrule() is exclusively a method of cssstylesheet, it actually inserts the rule into cssstylesheet.cssrules — its internal cssrulelist.
... *
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.
CSSStyleSheet - Web APIs
see the
notes section for the various ways a cssstylesheet object can be obtained.
...
notes in some browsers, if a stylesheet is loaded from a different domain, accessing cssrules results in securityerror.
Managing screen orientation - Web APIs
rait) { #toolbar { width: 100%; } } /* for landscape, we want the tool bar stick on the left */ @media screen and (orientation: landscape) { #toolbar { position: fixed; width: 2.65em; height: 100%; } p { margin-left: 2em; } li + li { margin-top: .5em; } } and here's the result portrait landscape
note: the orientation media query actually applies based on the orientation of the browser window (or iframe) not the orientation of the device.
... screen.lockorientation('landscape');
note: a screen lock is web application dependent.
Cache.keys() - Web APIs
note: requests with duplicate urls but different headers can be returned if their responses have the vary header set on them.
...
note that this option is ignored by cache.keys().
CanvasRenderingContext2D.arcTo() - Web APIs
note: be aware that you may get unexpected results when using a relatively large radius: the arc's connecting line will go in whatever direction it must to meet the specified radius.
...
note that the arc's second control point and the point specified by lineto() are the same, which produces a totally smooth corner.
Basic usage of canvas - Web APIs
note: if your renderings seem distorted, try specifying your width and height attributes explicitly in the <canvas> attributes, and not using css.
...
note: it is not good practice to embed a script inside html.
Pixel manipulation with canvas - Web APIs
note: any pixels outside the canvas are returned as transparent black in the resulting imagedata object.
...
note: be aware that if the canvas contains any pixels that were obtained from another origin without using cors, the canvas is tainted and its contents can no longer be read and saved.
Using images - Web APIs
note: images can become blurry when scaling up or grainy if they're scaled down too much.
...probably the only thing to
note, for those not so familiar with the dom, is the use of the node.insertbefore method.
Canvas API - Web APIs
const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.fillstyle = 'green'; ctx.fillrect(10, 10, 150, 100); result reference htmlcanvaselement canvasrenderingcontext2d canvasgradient canvasimagesource canvaspattern imagebitmap imagedata renderingcontext textmetrics offscreencanvas path2d imagebitmaprenderingcontext
note: the interfaces related to the webglrenderingcontext are referenced under webgl.
...
note: see the webgl api for 2d and 3d libaries that use webgl.
Using channel messaging - Web APIs
note: this feature is available in web workers.
...
note: for more information and ideas, the ports as the basis of an object-capability model on the web section of the spec is a useful read.
Clipboard.read() - Web APIs
note: the asynchronous clipboard and permissions apis are still in the process of being integrated into most browsers, so they often deviate from the official rules for permissions and the like.
...unable to access it."); } else { const blob = data.items[i].gettype("image/png"); imgelem.src = url.createobjecturl(blob); } } }); } });
note: at this time, while firefox does implement read(), it does not recognize the "clipboard-read" permission, so attempting to use the permissions api to manage access to the api will not work.
Clipboard.write() - Web APIs
note: browser support for the asynchronous clipboard apis is still in the process of being implemented.
... example of copying canvas contents to the clipboard function copycanvascontentstoclipboard(canvas, ondone, onerror) { canvas.toblob(function (blob) { let data = [new clipboarditem({ [blob.type]: blob })]; navigator.clipboard.write(data).then(function () { ondone(); }, function (err) { onerror(err); }) }); }
note: you can only pass in one clipboard item at a time.
ClipboardItem - Web APIs
note: to work with text see the clipboard.readtext() and clipboard.writetext() methods of the clipboard interface.
...
note: you can only pass in one clipboard item at a time.
console.assert() - Web APIs
note: this feature is available in web workers.
...' + number); console.assert(number % 2 === 0, {number: number, errormsg: errormsg}); // or, using es2015 object property shorthand: // console.assert(number % 2 === 0, {number, errormsg}); } // output: // the # is 2 // the # is 3 // assertion failed: {number: 3, errormsg: "the # is not even"} // the # is 4 // the # is 5 // assertion failed: {number: 5, errormsg: "the # is not even"}
note that, while a string containing a substitution string works as a parameter for console.log in node and many, if not most, browsers...
Console.countReset() - Web APIs
note: this feature is available in web workers.
... examples for example, given code like this: let user = ""; function greet() { console.count(); return "hi " + user; } user = "bob"; greet(); user = "alice"; greet(); greet(); console.count(); console.countreset(); console output will look something like this: "default: 1" "default: 2" "default: 3" "default: 4" "default: 0"
note that the call to console.counterreset() resets the value of the default counter to zero.
Console.error() - Web APIs
note: this feature is available in web workers.
... syntax console.error(obj1 [, obj2, ..., objn]); console.error(msg [, subst1, ..., substn]); console.exception(obj1 [, obj2, ..., objn]); console.exception(msg [, subst1, ..., substn]);
note: console.exception() is an alias for console.error(); they are functionally identical.
Console.group() - Web APIs
note: this feature is available in web workers.
...
note: from gecko 9 until gecko 51, the groupcollapsed() method was the same as group().
Constraint validation API - Web APIs
note: client-side constraint validation doesn't remove the need for validation on the server side.
...
note: firefox supported a proprietary error attribute — x-moz-errormessage — for many versions, which allowed you set custom error messages in a similar way.
ConvolverNode - Web APIs
note: for more information on the theory behind linear convolution, see the convolution article on wikipedia.
...
note: you will need to find an impulse response to complete the example below.
Crypto - Web APIs
note: this feature is available in web workers.
... usage
notes you should avoid using the web crypto api on insecure contexts, even though the crypto interface is present on insecure contexts, as is the window.crypto property.
CustomElementRegistry - Web APIs
note how we use the customelementregistry.define() method to define the custom element after creating its class.
...t.createelement('span'); text.textcontent = count; // append it to the shadow root shadow.appendchild(text); // update count when element content changes setinterval(function() { var count = 'words: ' + countwords(wcparent); text.textcontent = count; }, 200) } } // define the new element customelements.define('word-count', wordcount, { extends: 'p' });
note: the customelementregistry is available through the window.customelements property.
DOMHighResTimeStamp - Web APIs
also
note the section below on reduced time precision controlled by browser preferences to avoid timing attacks and fingerprinting.
... usage
notes you can get the current timestamp value—the time that has elapsed since the context was created—by calling the performance method now().
DOMParser - Web APIs
note: xmlhttprequest can parse xml and html directly from a url-addressable resource, returning a document in its response property.
... application/xml xmldocument application/xhtml+xml xmldocument image/svg+xml xmldocument examples parsing xml once you have created a parser object, you can parse xml from a string using the parsefromstring() method: let parser = new domparser() let doc = parser.parsefromstring(stringcontainingxmlsource, "application/xml") error handling
note that if the parsing process fails, the domparser does not throw an exception, but instead returns an error document: <parsererror xmlns="http://www.mozilla.org/newlayout/xml/parsererror.xml"> (error description) <sourcetext>(a snippet of the source xml)</sourcetext> </parsererror> the parsing errors are also reported to the error console, with the document uri (see below) as the source of ...
DataTransfer.setDragImage() - Web APIs
note the example refers to an image file named example.gif.
...use the event target's id for the data ev.datatransfer.setdata("text/plain", ev.target.id); // create an image and use it for the drag image //
note: change "example.gif" to an existing image or the image will not // be created and the default drag image will be used.
DataTransfer - Web APIs
gecko properties
note: all of the properties in this section are gecko-specific.
... gecko methods
note: all of the methods in this section are gecko-specific.
Document.adoptNode() - Web APIs
note: importednode's node.parentnode is null, since it has not yet been inserted into the document tree!
... example const iframe = document.queryselector('iframe'); const iframeimages = iframe.contentdocument.queryselectorall('img'); const newparent = document.getelementbyid('images'); iframeimages.foreach(function(imgel) { newparent.appendchild(document.adoptnode(imgel)); });
notes before they can be inserted into the current document, nodes from external documents should either be: cloned using document.importnode(); or adopted using document.adoptnode().
Document.createEvent() - Web APIs
see
notes section for details.
...elem.dispatchevent(event);
notes event type strings suitable for passing to createevent() are listed in the dom standard — see the table in step 2.
Document.createNSResolver() - Web APIs
notes adapts any dom node to resolve namespaces so that an xpath expression can be easily evaluated relative to the context of the node where it appeared within the document.
...
note, xpath defines qnames without prefix to match only elements in the null namespace.
Document.evaluate() - Web APIs
*/ var thisheading = headings.iteratenext(); var alerttext = "level 2 headings in this document are:\n"; while (thisheading) { alerttext += thisheading.textcontent + "\n"; thisheading = headings.iteratenext(); } alert(alerttext); // alerts the text of all h2 elements
note, in the above example, a more verbose xpath is preferred over common shortcuts such as //h2.
...
notes xpath expressions can be evaluated on html and xml documents.
Document.getBoxObjectFor() - Web APIs
note: this method is obsolete.
... example var mydiv = document.getelementbyid("mydiv"), boxobj = document.getboxobjectfor (mydiv); alert ( "x:" + boxobj.x + ", y:" + boxobj.y + ", width:" + boxobj.width + ", height:" + boxobj.height );
notes specified in nsixuldocument.idl ...
Document.getElementById() - Web APIs
example html <html> <head> <title>getelementbyid example</title> </head> <body> <p id="para">some text here</p> <button onclick="changecolor('blue');">blue</button> <button onclick="changecolor('red');">red</button> </body> </html> javascript function changecolor(newcolor) { var elem = document.getelementbyid('para'); elem.style.color = newcolor; } result usage
notes the capitalization of "id" in the name of this method must be correct for the code to function; getelementbyid() is not valid and will not work, however natural it may seem.
...
note that the id parameter is case-sensitive, so document.getelementbyid("main") will return null instead of the element <div id="main"> because "m" and "m" are different for the purposes of this method.
Document.getElementsByTagName() - Web APIs
syntax var elements = document.getelementsbytagname(name); elements is a live htmlcollection (but see the
note below) of found elements in the order they appear in the tree.
...ext</p> <p>some div2 text</p> </div> </div> <p>some outer text</p> <p>some outer text</p> <button onclick="getallparaelems();"> show all p elements in document</button><br /> <button onclick="div1paraelems();"> show all p elements in div1 element</button><br /> <button onclick="div2paraelems();"> show all p elements in div2 element</button> </body> </html>
notes when called on an html document, getelementsbytagname() lower-cases its argument before proceeding.
Document.lastModified - Web APIs
let nlastmodif = date.parse(document.lastmodified);
notes
note that as a string, lastmodified cannot easily be used for comparing the modification dates of documents.
...= parsefloat(document.cookie.replace(/(?:(?:^|.*;)\s*last_modif\s*\=\s*([^;]*).*$)|^.*$/, "$1")), nlastmodif = date.parse(document.lastmodified); if (isnan(nlastvisit) || nlastmodif > nlastvisit) { document.cookie = "last_modif=" + date.now() + "; expires=fri, 31 dec 9999 23:59:59 gmt; path=" + location.pathname; if (isfinite(nlastvisit)) { alert("this page has been changed!"); } }
note: webkit returns the time string in utc; gecko and internet explorer return a time in the local timezone.
Document.ononline - Web APIs
it is important to
note that this event and attribute are inherently unreliable.
...(
note: using window.ononline or window.onoffline will not work for compatibility reasons.) by specifying ononline="..." or onoffline="..." attributes on the <body> tag in the html markup.
Document.open() - Web APIs
document.open(); document.write("<p>hello world!</p>"); document.write("<p>i am a fish</p>"); document.write("<p>the number is 42</p>"); document.close();
notes an automatic document.open() call happens when document.write() is called after the page has loaded.
...this is no longer the case.document non-spec'ed parameters to document.open gecko-specific
notes starting with gecko 1.9, this method is subject to the same same-origin policy as other properties, and does not work if doing so would change the document's origin.
Document.requestStorageAccess() - Web APIs
note that this number is also incremented when automatic access grants are given through our compatibility heuristics.
...
note: if the requesting origin is not classified as a tracking origin, the access request is automatically given an ephemeral storage access grant, which will go away when the page is reloaded.
Document: scroll event - Web APIs
bubbles yes cancelable no interface event event handler property onscroll
note: in ios uiwebviews, scroll events are not fired while scrolling is taking place; they are only fired after the scrolling has completed.
...
note, however, that input events and animation frames are fired at about the same rate, and therefore the optimization below is often unnecessary.
Document.title - Web APIs
otherwise, it contains the title specified in the markup (see the
notes below).
... example <!doctype html> <html> <head> <title>hello world!</title> </head> <body> <script> alert(document.title); // displays "hello world!" document.title = "goodbye world!"; alert(document.title); // displays "goodbye world!" </script> </body> </html>
notes this property applies to html, svg, xul, and other documents in gecko.
Document.writeln() - Web APIs
example document.writeln("<p>enter password:</p>");
notes document.writeln is the same as document.write but adds a newline.
...
note: document.writeln (like document.write) does not work in xhtml documents (you'll get a "operation is not supported" (ns_error_dom_not_supported_err) error on the error console).
DocumentFragment.querySelectorAll() - Web APIs
note: the definition of this api was moved to the parentnode interface.
... examples this example returns a list of all div elements within the documentfragment with a class of either "
note" or "alert": var matches = documentfrag.queryselectorall("div.
note, div.alert"); specifications specification status comment selectors api level 1the definition of 'documentfragment.queryselectorall' in that specification.
Examples of web and XML development using the DOM - Web APIs
note that the table itself has an onclick event handler that ought to display a message when the table is clicked.
... cells to an existing table: <table id="table0"> <tr> <td>row 0 cell 0</td> <td>row 0 cell 1</td> </tr> </table> <script> var table = document.getelementbyid('table0'); var row = table.insertrow(-1); var cell, text; for (var i = 0; i < 2; i++) { cell = row.insertcell(-1); text = 'row ' + row.rowindex + ' cell ' + i; cell.appendchild(document.createtextnode(text)); } </script>
notes a table's innerhtml property should never be used to modify a table, although you can use it to write an entire table or the content of a cell.
Introduction to the DOM - Web APIs
note: because the vast majority of code that uses the dom revolves around manipulating html documents, it's common to refer to the nodes in the dom as elements, although strictly speaking not every node is an element.
... const table = document.getelementbyid("table"); const tableattrs = table.attributes; // node/element interface for (let i = 0; i < tableattrs.length; i++) { // htmltableelement interface: border attribute if(tableattrs[i].nodename.tolowercase() == "border") table.border = "1"; } // htmltableelement interface: summary attribute table.summary = "
note: increased border"; core interfaces in the dom this section lists some of the most commonly-used interfaces in the dom.
Locating DOM elements using selectors - Web APIs
note: the nodelist returned by queryselectorall() is not live, which means that changes in the dom are not reflected in the collection.
...for example, to select all paragraph (p) elements in a document whose css class is either warning or
note, you can do the following: var special = document.queryselectorall( "p.warning, p.
note" ); you can also query by id.
EffectTiming.fill - Web APIs
note that authors are discouraged from using fill modes to persist the effect of an animation indefinitely.
...
note that there's no rotation applied.
Element: DOMMouseScroll event - Web APIs
note: trusted events are never sent with a value of 0 for detail.
...
note: if the platform's native mouse wheel events only provide scroll distance by pixels, or if the speed can be customized by the user, the value is computed using the line height of the nearest scrollable ancestor element of the event's target.
Element.clientHeight - Web APIs
note: this property will round the value to an integer.
... working draft
notes clientheight is a property introduced in the internet explorer object model.
Element.clientLeft - Web APIs
note: this property will round the value to an integer.
...
note: when an element has display: inline, clientleft returns 0 regardless of the element's border.
Element.clientTop - Web APIs
note: this property will round the value to an integer.
... padding-bottom left top right bottom margin-top margin-bottom border-top border-bottom
notes clienttop was first introduced in the ms ie dhtml object model.
Element.clientWidth - Web APIs
note: this property will round the value to an integer.
... working draft
notes clientwidth was first introduced in the ms ie dhtml object model.
Element.getBoundingClientRect() - Web APIs
also
note how the values of x/left, y/top, right, and bottom are equal to the absolute distance from the relevant edge of the viewport to that side of the element, in each case.
... working draft initial definition
notes the returned domrect object can be modified in modern browsers.
Element.insertAdjacentHTML() - Web APIs
visualization of position names <!-- beforebegin --> <p> <!-- afterbegin --> foo <!-- beforeend --> </p> <!-- afterend -->
note: the beforebegin and afterend positions work only if the node is in the dom tree and has a parent element.
... example // <div id="one">one</div> var d1 = document.getelementbyid('one'); d1.insertadjacenthtml('afterend', '<div id="two">two</div>'); // at this point, the new structure is: // <div id="one">one</div><div id="two">two</div>
notes security considerations when inserting html into a page by using insertadjacenthtml(), be careful not to use user input that hasn't been escaped.
Element.insertAdjacentText() - Web APIs
visualization of position names <!-- beforebegin --> <p> <!-- afterbegin --> foo <!-- beforeend --> </p> <!-- afterend -->
note: the beforebegin and afterend positions work only if the node is in a tree and has an element parent.
...
note that the existing text node is not added to — further text nodes are created containing the new additions.
Element.localName - Web APIs
"localname = '" + circle.localname + "'\n" + "namespaceuri = '" + circle.namespaceuri + "'"; } ]]></script> </head> <body onload="test()"> <svg:svg version="1.1" width="100px" height="100px" viewbox="0 0 100 100"> <svg:circle cx="50" cy="50" r="30" style="fill:#aaa" id="circle"/> </svg:svg> <textarea id="text" rows="4" cols="55"/> </body> </html>
notes the local name of a node is that part of the node's qualified name that comes after the colon.
...for example, in the qualified name ecomm:partners, partners is the local name and ecomm is the prefix: <ecomm:business id="soda_shop" type="brick_n_mortar" xmlns:ecomm="http://example.com/ecomm"> <ecomm:partners> <ecomm:partner id="1001">tony's syrup warehouse </ecomm:partner> </ecomm:partner> </ecomm:business>
note: in gecko 1.9.2 and earlier, the property returns the upper-cased version of the local name for html elements in html doms (as opposed to xhtml elements in xml doms).
Element.name - Web APIs
note: the name property doesn't exist for other elements; unlike tagname and nodename, it is not a property of the node, element or htmlelement interfaces.
...ents.elementname example <form action="" name="forma"> <input type="text" value="foo"> </form> <script type="text/javascript"> // get a reference to the first element in the form let formelement = document.forms['forma'].elements[0] // give it a name formelement.name = 'inputa' // show the value of the input alert(document.forms['forma'].elements['inputa'].value) </script>
notes in internet explorer (ie), the name property of dom objects created using document.createelement() can't be set or modified.
Element.namespaceURI - Web APIs
if (element.localname == "browser" && element.namespaceuri == "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul") { // this is a xul browser }
notes this is not a computed value that is the result of a namespace lookup based on an examination of the namespace declarations in scope.
...also
note that the namespace prefix, once it is associated with a particular element, cannot be changed.
Element.requestFullscreen() - Web APIs
note: this method must be called while responding to a user interaction or a device orientation change; otherwise it will fail.
... usage
notes compatible elements an element that you wish to place into full-screen mode has to meet a small number of simple requirements: it must be one of the standard html elements or <svg> or <math>.
Element.setAttributeNodeNS() - Web APIs
mozilla.org/ns/specialspace" // myns:special-align="utterleft">one</div> // <div id="two">two</div> var myns = "http://www.mozilla.org/ns/specialspace"; var d1 = document.getelementbyid("one"); var d2 = document.getelementbyid("two"); var a = d1.getattributenodens(myns, "special-align"); d2.setattributenodens(a.clonenode(true)); alert(d2.attributes[1].value) // returns: `utterleft'
notes if the specified attribute already exists on the element, then that attribute is replaced with the new one and the replaced one is returned.
...
note that if you try to set without cloning the node, mozilla gives an ns_error_dom_inuse_attribute_err "attribute already in use" error, as the dom requires cloning for attr to be reused (unlike other nodes which can be moved).
Element - Web APIs
note: in firefox 3.5 and earlier, html elements are in no namespace.
...
note: dom level 3 defined namespaceuri, localname and prefix on the node interface.
ElementCSSInlineStyle.style - Web APIs
note that the property names are in camel-case and not kebab-case while setting the style using elt.style.<property> (i.e., elt.style.fontsize, not elt.style.font-size).
...
note the presence of the value bold for font-weight in the computed style and the absence of it in the element's style property specifications specification status comment css object model (cssom)the definition of 'the elementcssinlinestyle.style property' in that specification.
Event.bubbles - Web APIs
note: see event bubbling and capture for more information on bubbling.
...passes the event along if does not passiton(e); } // already bubbling dooutput(e); }
note: only certain events can bubble.
Event.preventDefault() - Web APIs
as
noted below, calling preventdefault() for a non-cancelable event, such as one dispatched via eventtarget.dispatchevent(), without specifying cancelable: true has no effect.
...rningbox.innerhtml = msg; if (document.body.contains(warningbox)) { window.cleartimeout(warningtimeout); } else { // insert warningbox after mytextbox mytextbox.parentnode.insertbefore(warningbox, mytextbox.nextsibling); } warningtimeout = window.settimeout(function() { warningbox.parentnode.removechild(warningbox); warningtimeout = -1; }, 2000); } result
notes calling preventdefault() during any stage of event flow cancels the event, meaning that any default action normally taken by the implementation as a result of the event will not occur.
Event.returnValue - Web APIs
note: while returnvalue has been adopted into the dom standard, it is present primarily to support existing code.
... usage
notes returnvalue was introduced into the dom by internet explorer 6, and due to that browser's ubiquity became so commonly used that other browsers eventually implemented it as well.
Event - Web APIs
note: one element can have several such handlers, even for the exact same event—particularly if separate, independent code modules attach them, each for its own independent purposes.
...
note that all event interfaces have names which end in "event".
EventSource.close() - Web APIs
note: if the connection is already closed, the method does nothing.
... examples var button = document.queryselector('button'); var evtsource = new eventsource('sse.php'); button.onclick = function() { console.log('connection closed'); evtsource.close(); }
note: you can find a full example on github — see simple sse demo using php.
Using files from web applications - Web APIs
if you want to use the dom file api from extensions or other browser chrome code, you can; however,
note there are some additional features to be aware of.
...
note that in this case the input element must not be hidden using display: none (nor visibility: hidden), otherwise the label would not be keyboard-accessible.
FileError - Web APIs
note: this interface is obsolete per the latest specification.
... error codes
note: do not rely on the numeric values of the constants, which might change as the specifications continue to change.
FileReader.readAsDataURL() - Web APIs
note: the blob's result cannot be directly decoded as base64 without first removing the data-url declaration preceding the base64-encoded data.
...le.name) ) { var reader = new filereader(); reader.addeventlistener("load", function () { var image = new image(); image.height = 100; image.title = file.name; image.src = this.result; preview.appendchild( image ); }, false); reader.readasdataurl(file); } } if (files) { [].foreach.call(files, readandpreview); } }
note: the filereader() constructor was not supported by internet explorer for versions before 10.
FileReader - Web APIs
important
note: filereader is used to read file content from the user's (remote) system in secure ways only.
...
note: this feature is available in web workers.
FileSystem - Web APIs
ariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetfilesystemchrome full support 7alternate name full support 7alternate name alternate name uses the non-standard name: domfilesystemedge full support ≤18prefixed
notes full support ≤18prefixed
notes prefixed implemented with the vendor prefix: webkit
notes edge only supports this api in drag-and-drop scenarios using the the datatransferitem.webkitgetasentry() method.
... 14safari ios full support 11.3samsung internet android full support 1.0legend full support full support no support no supportsee implementation
notes.see implementation
notes.uses a non-standard name.uses a non-standard name.requires a vendor prefix or different name for use.requires a vendor prefix or different name for use.
FormData() - Web APIs
note: this feature is available in web workers.
... <label for="username">enter name:</label> <input type="text" id="username" name="username"> </div> <div> <label for="useracc">enter account number:</label> <input type="text" id="useracc" name="useracc"> </div> <div> <label for="userfile">upload file:</label> <input type="file" id="userfile" name="userfile"> </div> <input type="submit" value="submit!"> </form>
note: only successful form controls are included in a formdata object, i.e.
FormData.append() - Web APIs
note: this method is available in web workers.
...
note: if you specify a blob as the data to append to the formdata object, the filename that will be reported to the server in the "content-disposition" header used to vary from browser to browser.
FormData.set() - Web APIs
note: this method is available in web workers.
...
note: if you specify a blob as the data to append to the formdata object, the filename that will be reported to the server in the "content-disposition" header used to vary from browser to browser.
GamepadButton - Web APIs
note: this is the case in firefox gecko 28 and later; chrome and earlier firefox versions still return an array of double values when this property is accessed.
... example the following code is taken from my gamepad api button demo (you can view the demo live, and find the source code on github.)
note the code fork — in chrome navigator.getgamepads needs a webkit prefix and the button values are stored as an array of double values, whereas in firefox navigator.getgamepads doesn't need a prefix, and the button values are stored as an array of gamepadbutton objects; it is the gamepadbutton.value or gamepadbutton.pressed properties of these we need to access, depending on what type of buttons t...
Using the Geolocation API - Web APIs
note: by default, getcurrentposition() tries to answer as fast as possible with a low accuracy result.
...
note: you can use watchposition() without an initial getcurrentposition() call.
GlobalEventHandlers.onauxclick - Web APIs
note: browser vendors are implementing this property as part of a plan to improve compatibility with regards to button behaviors.
...lector('html'); function random(number) { return math.floor(math.random() * number); } button.onclick = function() { var rndcol = 'rgb(' + random(255) + ',' + random(255) + ',' + random(255) + ')'; button.style.backgroundcolor = rndcol; }; button.onauxclick = function() { var rndcol = 'rgb(' + random(255) + ',' + random(255) + ',' + random(255) + ')'; button.style.color = rndcol; }
note: if you are using a three-button mouse, you'll notice that the onauxclick handler is run when either of the non-left mouse buttons are clicked.
GlobalEventHandlers.oncontextmenu - Web APIs
html <div class="shape">spinning</div> <p class="
note" hidden>click to unpause.</p> css @keyframes spin { from { transform: rotate(0); } to { transform: rotate(1turn); } } .shape { width: 8em; height: 8em; display: flex; align-items: center; justify-content: center; animation: spin 18s linear infinite; background: lightsalmon; border-radius: 42%; margin: 1em; } .paused { background-color: #ddd; } .paused .sha...
...pe { animation-play-state: paused; } javascript function pause(e) { body.classlist.add('paused');
note.removeattribute('hidden'); } function play(e) { body.classlist.remove('paused');
note.setattribute('hidden', ''); } const body = document.queryselector('body'); const
note = document.queryselector('.
note'); window.oncontextmenu = pause; window.onpointerdown = play; result specifications specification status comment html living standardthe definition of 'oncontextmenu' in that specification.
GlobalEventHandlers.ontransitioncancel - Web APIs
note: elapsedtime does not include time prior to the transition effect beginning; that means that the value of transition-delay doesn't affect the value of elapsedtime, which is zero until the delay period ends and the animation begins.
... also
note the log that appears in the javascript console when you click the box, or move the cursor away before the transition has run to completion.
msAudioCategory - Web APIs
note that you must set the msaudiocategory before setting the src property in code.
...*
note that if msaudiocategory is set to communications, msrealtime is automatically set to true.
HTMLCollection.item - Web APIs
note: because the contents of an htmlcollection are live, changes to the underlying dom can and will cause the position of individual nodes in the collection to change, so the index value will not necessarily remain constant for a given node.
... usage
notes the item() method returns a numbered element from an htmlcollection.
HTMLElement.innerText - Web APIs
note: innertext is easily confused with node.textcontent, but there are important differences between the two.
...
note how innertext is aware of things like <br> elements, and ignores hidden elements.
HTMLFormElement: submit event - Web APIs
bubbles yes (although specified as a simple event that doesn't bubble) cancelable yes interface submitevent event handler property globaleventhandlers.onsubmit
note that the submit event fires on the <form> element itself, and not on any <button> or <input type="submit"> inside it.
...
note: trying to submit a form that does not pass validation triggers an invalid event.
HTMLImageElement.alt - Web APIs
usage
notes the fundamental guideline for the alt attribute is that every image's alternate text should be able to replace the image without altering the meaning of the page.
...
note the use of the alt attribute on the <img>, providing a good substitution string to use in case the image doesn't load.
HTMLImageElement.complete - Web APIs
efoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetcompletechrome full support 1edge full support 12firefox full support yesie full support 8
notes full support 8
notes
notes ie reports false for broken images.opera full support yessafari full support yeswebview android full support yeschrome android full support yesfir...
... safari ios full support yessamsung internet android full support yeslegend full support full support compatibility unknown compatibility unknownsee implementation
notes.see implementation
notes.
HTMLImageElement.isMap - Web APIs
note: for accessibility reasons, you should generally avoid using server-side image maps, as they require the use of a mouse.
... usage
notes when an image marked as being part of a server-side image map is clicked, the browser constructs the string "?x,y", where x and y indicate the coordinates at which the mouse was clicked as offsets from the top-left corner of the image, specified in css pixels.
HTMLInputElement - Web APIs
note: if the user enters a value different from the value expected, this may return an empty string.
...
note that this is actually fired on the htmlelement interface and also applies to contenteditable elements, but we've listed it here because it is most commonly used with form input elements.
HTMLLinkElement - Web APIs
note: currently the w3c html 5.2 spec states that rev is no longer obsolete, whereas the whatwg living standard still has it labeled obsolete.
...
note that currently firefox only supports preloading of cacheable resources.
HTMLMediaElement.autoplay - Web APIs
note: sites which automatically play audio (or videos with an audio track) can be an unpleasant experience for users, so it should be avoided when possible.
...
note: some browsers offer users the ability to override autoplay in order to prevent disruptive audio or video from playing without permission or in the background.
HTMLMediaElement.srcObject - Web APIs
note: as of march 2020, only safari supports setting objects other than mediastream.
... usage
notes older versions of the media source specification required using createobjecturl() to create an object url then setting src to that url.
HTMLOrForeignElement.dataset - Web APIs
note that the dataset property itself can be read, but not directly written.
...
note also that an html data-attribute and its corresponding dom dataset.property do not share the same name, but they are always similar: in html, the name of a custom data attribute begins with data-.
HTMLScriptElement - Web APIs
note: the exact processing details for these attributes are complex, involving many different aspects of html, and therefore are scattered throughout the specification.
...
note: when inserted using the document.write() method, <script> elements execute (typically synchronously), but when inserted using innerhtml or outerhtml, they do not execute at all.
In depth: Microtasks and the JavaScript runtime environment - Web APIs
javascript execution contexts
note: the details here are generally not important to most javascript programmers.
... a special
note about recursive functions—that is, functions which call themselves, possibly over multiple levels of depth or recursion: each recursive call to the function creates a new execution context.
Using microtasks in JavaScript with queueMicrotask() - Web APIs
using microtasks before getting farther into this, it's important to
note again that most developers won't use microtasks much, if at all.
...an urgent callback has run!"); log("main program started"); settimeout(callback, 0); queuemicrotask(urgentcallback); log("main program exiting"); result
note that the output logged from the main program body appears first, followed by the output from the microtask, followed by the timeout's callback.
History.pushState() - Web APIs
note that the browser won't attempt to load this url after a call to pushstate(), but it might attempt to load the url later, for instance after the user restarts the browser.
...
note that pushstate() never causes a hashchange event to be fired, even if the new url differs from the old url only in its hash.
History - Web APIs
note that all browsers but safari currently ignore the title parameter.
...
note that all browsers but safari currently ignore the title parameter.
IDBCursor.advance() - Web APIs
note: this feature is available in web workers.
...
note that in each iteration of the loop, you can grab data from the current record under the cursor object using cursor.value.foo.
IDBCursor.continue() - Web APIs
note: this feature is available in web workers.
...also
note that in each iteration of the loop, you can grab data from the current record under the cursor object using cursor.value.foo.
IDBCursor.delete() - Web APIs
note: this feature is available in web workers.
...also
note that in each iteration of the loop, you can grab data from the current record under the cursor object using cursor.value.foo.
IDBCursor.key - Web APIs
note: this feature is available in web workers.
...also
note that in each iteration of the loop, you can grab data from the current record under the cursor object using cursor.value.foo.
IDBCursor.primaryKey - Web APIs
note: this feature is available in web workers.
...also
note that in each iteration of the loop, you can grab data from the current record under the cursor object using cursor.value.foo.
IDBCursor.source - Web APIs
note: this feature is available in web workers.
...also
note that in each iteration of the loop, you can grab data from the current record under the cursor object using cursor.value.foo.
IDBCursorWithValue.value - Web APIs
note: this feature is available in web workers.
...also
note that in each iteration of the loop, you can grab data from the current record under the cursor object using cursor.value.foo.
IDBCursorWithValue - Web APIs
note: this feature is available in web workers.
...also
note that in each iteration of the loop, you can grab data from the current record under the cursor object using cursor.value.foo.
IDBDatabase.close() - Web APIs
note: this feature is available in web workers.
... // create event handlers for both success and failure of dbopenrequest.onerror = function(event) {
note.innerhtml += "<li>error loading database.</li>"; }; dbopenrequest.onsuccess = function(event) {
note.innerhtml += "<li>database initialised.</li>"; // store the result of opening the database in the db variable.
IDBDatabase.name - Web APIs
note: this feature is available in web workers.
... // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); // these two event handlers act on the database being // opened successfully, or not dbopenrequest.onerror = function(event) {
note.innerhtml += '<li>error loading database.</li>'; }; dbopenrequest.onsuccess = function(event) {
note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable.
IDBDatabase.objectStoreNames - Web APIs
note: this feature is available in web workers.
... example // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); // these two event handlers act on the database being opened successfully, or not dbopenrequest.onerror = function(event) {
note.innerhtml += '<li>error loading database.</li>'; }; dbopenrequest.onsuccess = function(event) {
note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable.
IDBDatabase.version - Web APIs
note: this feature is available in web workers.
... example // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); // these two event handlers act on the database // being opened successfully, or not dbopenrequest.onerror = function(event) {
note.innerhtml += '<li>error loading database.</li>'; }; dbopenrequest.onsuccess = function(event) {
note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable.
IDBFactory.cmp() - Web APIs
note: this feature is available in web workers.
...
note: do not use this method for comparing arbitrary javascript values, because many javascript values are either not valid indexeddb keys (booleans and objects, for example) or are treated as equivalent indexeddb keys (for example, since indexeddb ignores arrays with non-numeric properties and treats them as empty arrays, so any non-numeric arrays are treated as equivalent).
IDBFactory.deleteDatabase() - Web APIs
note: this feature is available in web workers.
...
note that attempting to delete a database that doesn't exist does not throw an exception, in contrast to idbdatabase.deleteobjectstore(), which does throw an exception if the named object store does not exist.
IDBIndex.getKey() - Web APIs
note that this doesn't return the whole record as idbindex.get does.
...
note: this feature is available in web workers.
IDBIndex.openKeyCursor() - Web APIs
note: cursors returned by openkeycursor() do not make the referenced value available as idbindex.opencursor does.
...
note: this feature is available in web workers.
IDBKeyRange.bound() - Web APIs
note: this feature is available in web workers.
...
note: for a more complete example allowing you to experiment with key range, have a look at the idbkeyrange directory in the indexeddb-examples repo (view the example live too.) function displaydata() { var keyrangevalue = idbkeyrange.bound("a", "f"); var transaction = db.transaction(['fthings'], 'readonly'); var objectstore = transaction.objectstore('fthings'); objectstore.opencursor(keyr...
IDBKeyRange.lower - Web APIs
note: this feature is available in web workers.
...
note: for a more complete example allowing you to experiment with key range, have a look at our idbkeyrange-example repo (view the example live too.) function displaydata() { var keyrangevalue = idbkeyrange.bound("f", "w", true, true); console.log(keyrangevalue.lower); var transaction = db.transaction(['fthings'], 'readonly'); var objectstore = transaction.objectstore('fthings'); objects...
IDBKeyRange.lowerBound() - Web APIs
note: this feature is available in web workers.
...
note: for a more complete example allowing you to experiment with key range, have a look at our idbkeyrange-example repo (view the example live too.) function displaydata() { var keyrangevalue = idbkeyrange.lowerbound("f"); var transaction = db.transaction(['fthings'], 'readonly'); var objectstore = transaction.objectstore('fthings'); objectstore.opencursor(keyrangevalue).onsuccess = funct...
IDBKeyRange.lowerOpen - Web APIs
note: this feature is available in web workers.
...
note: for a more complete example allowing you to experiment with key range, have a look at our idbkeyrange-example repo (view the example live too.) function displaydata() { var keyrangevalue = idbkeyrange.bound("f", "w", true, true); console.log(keyrangevalue.loweropen); var transaction = db.transaction(['fthings'], 'readonly'); var objectstore = transaction.objectstore('fthings'); obj...
IDBKeyRange.only() - Web APIs
note: this feature is available in web workers.
...
note: for a more complete example allowing you to experiment with key range, have a look at our idbkeyrange repo (view the example live too.) function displaydata() { var keyrangevalue = idbkeyrange.only("a"); var transaction = db.transaction(['fthings'], 'readonly'); var objectstore = transaction.objectstore('fthings'); objectstore.opencursor(keyrangevalue).onsuccess = function(event) { ...
IDBKeyRange.upper - Web APIs
note: this feature is available in web workers.
...
note: for a more complete example allowing you to experiment with key range, have a look at our idbkeyrange-example repo (view the example live too.) function displaydata() { var keyrangevalue = idbkeyrange.bound("f", "w", true, true); console.log(keyrangevalue.upper); var transaction = db.transaction(['fthings'], 'readonly'); var objectstore = transaction.objectstore('fthings'); objects...
IDBKeyRange.upperBound() - Web APIs
note: this feature is available in web workers.
...
note: for a more complete example allowing you to experiment with key range, have a look at our idbkeyrange-example repo (view the example live too.) function displaydata() { var keyrangevalue = idbkeyrange.upperbound("f"); var transaction = db.transaction(['fthings'], 'readonly'); var objectstore = transaction.objectstore('fthings'); objectstore.opencursor(keyrangevalue).onsuccess = funct...
IDBKeyRange.upperOpen - Web APIs
note: this feature is available in web workers.
...
note: for a more complete example allowing you to experiment with key range, have a look at our idbkeyrange-example repo (view the example live too.) function displaydata() { var keyrangevalue = idbkeyrange.bound("f", "w", true, true); console.log(keyrangevalue.upperopen); var transaction = db.transaction(['fthings'], 'readonly'); var objectstore = transaction.objectstore('fthings'); obj...
IDBKeyRange - Web APIs
note: this feature is available in web workers.
...
note: for a more complete example allowing you to experiment with key range, have a look at our idbkeyrange-example repo (view the example live too.) function displaydata() { var keyrangevalue = idbkeyrange.bound("a", "f"); var transaction = db.transaction(['fthings'], 'readonly'); var objectstore = transaction.objectstore('fthings'); objectstore.opencursor(keyrangevalue).onsuccess = funct...
IDBRequest - Web APIs
note: this feature is available in web workers.
...for a full working example, see our to-do notifications app (view example live.) var db; // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); // these two event handlers act on the database being // opened successfully, or not dbopenrequest.onerror = function(event) {
note.innerhtml += '<li>error loading database.</li>'; }; dbopenrequest.onsuccess = function(event) {
note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database.
Intersection Observer API - Web APIs
also,
note that if you specified the root option, the target must be a descendant of the root element.
...
note that it's possible to have a non-zero intersection rectangle, which can happen if the intersection is exactly along the boundary between the two or the area of boundingclientrect is zero.
KeyboardEvent.getModifierState() - Web APIs
"accel" virtual modifier
note: the "accel" virtual modifier has been effectively deprecated in current drafts of the dom3 events specification.
...
note that which modifier key makes it return true depends on platforms, browsers, and user settings.
KeyboardEvent.key - Web APIs
note that some other implementations may fire keypress event if supported.
...area.addeventlistener('input', (e) => { logmessage(`key "${e.data}" input [event: input]`); }); textarea.addeventlistener('keyup', (e) => { logmessage(`key "${e.key}" released [event: keyup]`); }); btnclearconsole.addeventlistener('click', (e) => { let child = consolelog.firstchild; while (child) { consolelog.removechild(child); child = consolelog.firstchild; } }); result
note: on browsers that don't fully implement the inputevent interface which is used for the beforeinput and input events, you may get incorrect output on those lines of the log output.
KeyframeEffect.setKeyframes() - Web APIs
element.animate([ { opacity: 1 }, { opacity: 0.1, offset: 0.7 }, { opacity: 0 } ], 2000);
note: offset values, if provided, must be between 0.0 and 1.0 (inclusive) and arranged in ascending order.
...
note: if the keyframes cannot be processed or are malformed, the keyframeeffect's keyframes are not modified.
LargestContentfulPaint - Web APIs
note that in this example data is only sent to the server when the user leaves the tab.
...(
note: `rendertime` may not be available on // image elements loaded cross-origin without the `timing-allow-origin` header.) lcp = lastentry.rendertime || lastentry.loadtime; }); po.observe({type: 'largest-contentful-paint', buffered: true}); // send data to the server.
MediaDevices.getDisplayMedia() - Web APIs
note: browser support for audio tracks varies, both in terms of whether or not they're supported at all by the media recorder and in terms of the which audio source or sourcoes are supported.
... usage
notes privacy and security because getdisplaymedia() could be used in nefarious ways, it can be a source of significant privacy and security concerns.
MediaElementAudioSourceNode - Web APIs
note: you can also view this example running live, or view the source.
...document.documentelement.scrolltop : document.body.scrolltop); gainnode.gain.value = cury/height; } // connect the audiobuffersourcenode to the gainnode // and the gainnode to the destination, so we can play the // music and adjust the volume using the mouse cursor source.connect(gainnode); gainnode.connect(audioctx.destination);
note: as a consequence of calling createmediaelementsource(), audio playback from the htmlmediaelement will be re-routed into the processing graph of the audiocontext.
MediaList.mediaText - Web APIs
note that the medialist is a live list; updating the list via mediatext will immediately update the behavior of the document.
... also
note that is you try to set mediatext to null, it will be treated as an empty string, i.e.
MediaPositionState.playbackRate - Web APIs
note: a value of 0.0 is not permitted.
... let positionstate = { duration: mymediaduration; playbackrate: 2.0; position: mymediaposition; }; navigator.mediasession.setpositionstate(positionstate);
note the value 2.0 as the playbackrate.
MediaStreamTrack - Web APIs
note: you can implement standard "mute" functionality by setting enabled to false.
...
note: you can implement standard "mute" functionality by setting enabled to false, and unmute the media by setting it back to true again.
MediaStreamTrackAudioSourceNode - Web APIs
note: you can see this example running live, or view the source.
... mouse is moved // then set new gain value range.oninput = function() { biquadfilter.gain.value = range.value; } }) .catch(function(err) { console.log('the following gum error occured: ' + err); }); } else { console.log('getusermedia not supported on your browser!'); } // dump script to pre element pre.innerhtml = myscript.innerhtml;
note: as a consequence of calling createmediastreamsource(), audio playback from the media stream will be re-routed into the processing graph of the audiocontext.
MouseEvent.button - Web APIs
note: do not confuse this property with the mouseevent.buttons property, which indicates which buttons are pressed for all mouse events types.
...nt.button return value a number representing a given button: 0: main button pressed, usually the left button or the un-initialized state 1: auxiliary button pressed, usually the wheel button or the middle button (if present) 2: secondary button pressed, usually the right button 3: fourth button, typically the browser back button 4: fifth button, typically the browser forward button as
noted above, buttons may be configured differently to the standard "left to right" layout.
MutationObserver.disconnect() - Web APIs
note: all notifications of mutations that have already been detected, but not yet reported to the observer, are discarded.
... usage
notes if the element being observed is removed from the dom, and then subsequently released by the browser's garbage collection mechanism, the mutationobserver is likewise deleted.
MutationObserver.observe() - Web APIs
usage
notes reusing mutationobservers you can call observe() multiple times on the same mutationobserver to watch for changes to different parts of the dom tree and/or different types of changes.
... there are some caveats to
note: if you call observe() on a node that's already being observed by the same mutationobserver, all existing observers are automatically removed from all targets being observed before the new observer is activated.
Navigator.cookieEnabled - Web APIs
note: when the browser is configured to block third-party cookies, and navigator.cookieenabled is invoked inside a third-party iframe, it returns true in safari, edge spartan and ie (while trying to set a cookie in such scenario would fail).
...
note: web browsers may prevent writing certain cookies in certain scenarios.
Navigator.registerContentHandler() - Web APIs
note: web sites may only register content handlers for themselves.
... example navigator.registercontenthandler( "application/vnd.mozilla.maybe.feed", "http://www.example.tld/?foo=%s", "my feed reader" );
notes for firefox 2 and above, only the application/vnd.mozilla.maybe.feed, application/atom+xml, and application/rss+xml mime types are supported.
Web-based protocol handlers - Web APIs
firefox displays a prompt in the notification bar area:
note:the url template supplied when registering must be of the same domain as the webpage attempting to perform the registration or the registration will fail.
...
note:the server side code is passed the entire contents of the href.
NavigatorID.appVersion - Web APIs
note: do not rely on this property to return the correct browser version.
... example alert('your browser version is reported as ' + navigator.appversion);
notes the window.navigator.useragent property may also contain the version number (for example "mozilla/5.0 (windows; u; win98; en-us; rv:0.9.2) gecko/20010725 netscape 6/6.1"), but you should be aware of how easy it is to change the user agent string and "spoof" other browsers, platforms, or user agents, and also how cavalier the browser vendor themselves are with these properties.
Online and offline events - Web APIs
(
note: using window.ononline or window.onoffline will not work for compatibility reasons.) by specifying ononline="..." or onoffline="..." attributes on the <body> tag in the html markup.
...ans-serif; color: #fff; padding: 0.5em; } #log { padding: 2.5em 0.5em 0.5em; font: 1em sans-serif; } .online { background: green; } .offline { background: red; } and the corresponding htmlxxx when mochitests for this are created, point to those instead and update this example -nickolay <div id="status"></div> <div id="log"></div> <p>this is a test</p> here's the live result
notes if the api isn't implemented in the browser, you can use other signals to detect if you are offline including using service workers and responses from xmlhttprequest.
Node.appendChild() - Web APIs
note that the copies made with clonenode will not be automatically kept in sync.
...
notes chaining may not work as expected, due to appendchild() returning the child element: let ablock = document.createelement('block').appendchild( document.createelement('b') ); sets ablock to <b></b> only, which is probably not what you want.
Node.childNodes - Web APIs
syntax let nodelist = elementnodereference.childnodes; examples simple usage // parg is an object reference to a <p> element // first check that the element has child nodes if (parg.haschildnodes()) { let children = parg.childnodes; for (let i = 0; i < children.length; i++) { // do something with each child as children[i] //
note: list is live!
... adding or removing children will change the list's `length` } } remove all children from a node // this is one way to remove all children from a node // box is an object reference to an element while (box.firstchild) { //the list is live so it will re-index each call box.removechild(box.firstchild); }
notes the items in the collection of nodes are objects, not strings.
Node.cloneNode() - Web APIs
*
note: in the dom4 specification (since gecko 13.0 (firefox 13 / thunderbird 13 / seamonkey 2.10)), the optional deep argument defaults to true.
... example let p = document.getelementbyid("para1") let p_prime = p.clonenode(true)
notes cloning a node copies all of its attributes and their values, including intrinsic (inline) listeners.
Node.namespaceURI - Web APIs
if (node.localname == "browser" && node.namespaceuri == "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul") { // this is a xul browser }
notes this is not a computed value that is the result of a namespace lookup based on an examination of the namespace declarations in scope.
...
note too that the namespace prefix, once it is associated with a particular node, cannot be changed.
Node.nextSibling - Web APIs
syntax nextnode = node.nextsibling
notes gecko-based browsers insert text nodes into a document to represent whitespace in the source markup.
...see the resources in the
notes section.
Node.nodePrincipal - Web APIs
note: this property exists on all nodes (html, svg, mathml, xul, etc.), but only if the script trying to use it has chrome privileges.
...
notes this property is read-only; attempting to write to it will throw an exception.
Node.textContent - Web APIs
note: textcontent and htmlelement.innertext are easily confused, but the two properties are different in important ways.
...
note: to get all of the text and cdata data for the whole document, one could use document.documentelement.textcontent.
NonDocumentTypeChildNode.nextElementSibling - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnextelementsiblingchrome full support 4edge full support 12
notes full support 12
notes
notes before edge 79, this property was only implemented for element, not for characterdata.firefox full support 3.5ie partial support 9
notes partial support 9
notes
notes only implemented for element, not for characterdata.
... 10.1safari ios full support yessamsung internet android full support yeslegend full support full support partial support partial supportsee implementation
notes.see implementation
notes.
Notification.actions - Web APIs
note: this feature is available in web workers.
...
note: device and user agent might be able to display only a limited number of actions (due to, e.g., limited screen space).
Notification.close() - Web APIs
note: this feature is available in web workers.
...
note: this api shouldn't be used just to have the notification removed from the screen after a fixed delay since this method will also remove the notification from any notification tray, preventing users from interacting with it after it was initially shown.
Notification.dir - Web APIs
note: this feature is available in web workers.
...
note: most browsers seem to ignore explicit ltr and rtl settings, and just go with the browser-wide setting.
Notification.requireInteraction - Web APIs
note: this feature is available in web workers.
...
note: this can be set when the notification is first created by setting the requireinteraction option to true in the options object of the notification.notification() constructor.
Notification - Web APIs
note: this feature is available in web workers.
...to see a example in action, check out our to-do list example (also see the app running live.)
note: in the above example we spawn notifications in response to a user gesture (clicking a button).
OfflineAudioContext.startRendering() - Web APIs
note: for a working example, see our offline-audio-context-promise github repo (see the source code too.) // define online and offline audio context var audioctx = new audiocontext(); var offlinectx = new offlineaudiocontext(2,44100*40,44100); source = offlinectx.createbuffersource(); // use xhr to load an audio track, and // decodeaudiodata to decode it and offlineaudiocontext to render it func...
...ted successfully'); var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var song = audioctx.createbuffersource(); song.buffer = renderedbuffer; song.connect(audioctx.destination); play.onclick = function() { song.start(); } }).catch(function(err) { console.log('rendering failed: ' + err); //
note: the promise should reject when startrendering is called a second time on an offlineaudiocontext }); }); } request.send(); } // run getdata to start the process off getdata(); specifications specification status comment web audio apithe definition of 'startrendering()' in that specification.
OffscreenCanvas.getContext() - Web APIs
note: this api is currently implemented for webgl1 and webgl2 contexts only.
...
note: the identifiers "experimental-webgl" or "experimental-webgl2" are also used in implementations of webgl.
PannerNode.distanceModel - Web APIs
note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc.
... the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }
note: in terms of working out what position values to apply to the listener and panner, to make the sound appropriate to what the visuals are doing on screen, there is quite a bit of math involved, but you will soon get used to it with a bit of experimentation.
PannerNode.maxDistance - Web APIs
note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc.
... the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }
note: in terms of working out what position values to apply to the listener and panner, to make the sound appropriate to what the visuals are doing on screen, there is quite a bit of math involved, but you will soon get used to it with a bit of experimentation.
PannerNode.panningModel - Web APIs
note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc.
... the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }
note: in terms of working out what position values to apply to the listener and panner, to make the sound appropriate to what the visuals are doing on screen, there is quite a bit of math involved, but you will soon get used to it with a bit of experimentation.
PannerNode.refDistance - Web APIs
const context = new audiocontext(); // all our test tones will last this many seconds const
note_length = 6; // this is how far we'll move the sound const z_distance = 20; // this function creates a graph for the test tone with a given refdistance // and schedules it to move away from the listener along the z (depth-wise) axis // at the given start time, resulting in a decrease in volume (decay) const scheduletesttone = (refdistance, starttime) => { const osc = new oscillatornode(context)...
...; const panner = new pannernode(context); panner.refdistance = refdistance; // set the initial z position, then schedule the ramp panner.positionz.setvalueattime(0, starttime); panner.positionz.linearramptovalueattime(z_distance, starttime +
note_length); osc.connect(panner) .connect(context.destination); osc.start(starttime); osc.stop(starttime +
note_length); }; // this tone should decay immediately and fairly quickly scheduletesttone(1, context.currenttime); // this tone should decay slower and later than the previous one scheduletesttone(4, context.currenttime +
note_length); // this tone should decay only slightly, and only start decaying fairly late scheduletesttone(7, context.currenttime +
note_length * 2); after running this code, the resulting waveforms shou...
PannerNode.rolloffFactor - Web APIs
example this example demonstrates how different rollofffactor values affect how the volume of the test tone decreases with increasing distance from the listener: const context = new audiocontext(); // all our test tones will last this many seconds const
note_length = 4; // this is how far we'll move the sound const z_distance = 20; // this function creates a graph for the test tone with a given rollofffactor // and schedules it to move away from the listener along the z (depth-wise) axis // at the given start time, resulting in a decrease in volume (decay) const scheduletesttone = (rollofffactor, starttime) => { const osc = new oscillatornode(cont...
...ext); const panner = new pannernode(context); panner.rollofffactor = rollofffactor; // set the initial z position, then schedule the ramp panner.positionz.setvalueattime(0, starttime); panner.positionz.linearramptovalueattime(z_distance, starttime +
note_length); osc.connect(panner) .connect(context.destination); osc.start(starttime); osc.stop(starttime +
note_length); }; // this tone should decay fairly quickly scheduletesttone(1, context.currenttime); // this tone should decay slower than the previous one scheduletesttone(0.5, context.currenttime +
note_length); // this tone should decay only slightly scheduletesttone(0.1, context.currenttime +
note_length * 2); after running this code, the resulting waveforms should look something like this: specifications ...
PannerNode.setOrientation() - Web APIs
note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc.
... the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }
note: in terms of working out what position values to apply to the listener and panner, to make the sound appropriate to what the visuals are doing on screen, there is quite a bit of math involved, but you will soon get used to it with a bit of experimentation.
PannerNode.setPosition() - Web APIs
note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc.
... the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }
note: in terms of working out what position values to apply to the listener and panner, to make the sound appropriate to what the visuals are doing on screen, there is quite a bit of math involved, but you will soon get used to it with a bit of experimentation.
PannerNode.setVelocity() - Web APIs
note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc.
... the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }
note: in terms of working out what position values to apply to the listener and panner, to make the sound appropriate to what the visuals are doing on screen, there is quite a bit of math involved, but you will soon get used to it with a bit of experimentation.
PannerNode - Web APIs
note how we have used some feature detection to either give the browser the newer property values (like audiolistener.forwardx) for setting position, etc.
... the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }
note: in terms of working out what position values to apply to the listener and panner, to make the sound appropriate to what the visuals are doing on screen, there is quite a bit of math involved, but you will soon get used to it with a bit of experimentation.
PaymentRequest.show() - Web APIs
note: in reality, despite the fact that the specification says this can't be done, some browsers, including firefox, support multiple active payment requests at a time.
... usage
notes the most common patterns for using show() involve either the async/await syntax or the use of show().then().catch() to handle the response and any possible rejection.
Payment processing concepts - Web APIs
note this function must go through the merchant server, because a client typically does not access the validation url itself.
... thus, it's important to
note that the user agent never sends a merchantvalidation event, unless the user agent itself implements a payment handler.
Performance - Web APIs
note: this interface and its members are available in web workers, except where indicated below.
... also,
note that performance markers and measures are per context.
PerformanceServerTiming - Web APIs
note: this feature is available in web workers.
...
note that this interface is only available in secure contexts (https) in some browsers.
Permissions.query() - Web APIs
note: as of firefox 44, the permissions for notifications and push have been merged.
...
note: the persistent-storage permission allows an origin to use a persistent box (i.e persistent storage) for its storage, as per the storage api.
Permissions.revoke() - Web APIs
note: as of firefox 44, the permissions for notifications and push have been merged.
...
note: the persistent-storage permission allows an origin to use a persistent box (i.e persistent storage) for its storage, as per the storage api.
PublicKeyCredential.response - Web APIs
note: when validating the fetching of existing credentials, the whole publickeycredential object and the client extensions are necessary for the relying party's server.
...
note: this property may only be used in top-level contexts and will not be available in an <iframe> for example.
PublicKeyCredentialCreationOptions.challenge - Web APIs
note: when the credential is retrieved with a navigator.credentials.get() call, the signature of the challenge is contained in authenticatorassertionresponse.signature.
...
note: a challenge will be at least 16 bytes long.
PublicKeyCredentialCreationOptions.extensions - Web APIs
note: an analogous option exists for the fetching operation (navigators.credentials.get()), see publickeycredentialrequestoptions.extensions.
...
note: extensions are optional and different browsers may recognize different extensions.
PublicKeyCredentialRequestOptions.challenge - Web APIs
note: when the credential is created with a navigator.credentials.create() call, the signature of the challenge is contained within authenticatorattestationresponse.attestationobject.
...
note: a challenge will be at least 16 bytes long.
PublicKeyCredentialRequestOptions.extensions - Web APIs
note: an analogous option exists for the creation operation (navigators.credentials.create()), see publickeycredentialcreationoptions.extensions.
...
note: extensions are optional and different browsers may recognize different extensions.
PushMessageData.arrayBuffer() - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetarraybuffer experimentalchrome full support 50edge full support ≤79firefox full support 44
notes full support 44
notes
notes extended support releases (esr) before firefox 78 esr do not support service workers and the push api.ie no support noopera full support 37safari no support nowebview android ...
...expect behavior to change in the future.see implementation
notes.see implementation
notes.
PushMessageData.blob() - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetblob experimentalchrome full support 50edge full support ≤79firefox full support 44
notes full support 44
notes
notes extended support releases (esr) before firefox 78 esr do not support service workers and the push api.ie no support noopera full support 37safari no support nowebview android ...
...expect behavior to change in the future.see implementation
notes.see implementation
notes.
PushMessageData.json() - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetjson experimentalchrome full support 50edge full support ≤79firefox full support 44
notes full support 44
notes
notes extended support releases (esr) before firefox 78 esr do not support service workers and the push api.ie no support noopera full support 37safari no support nowebview android ...
...expect behavior to change in the future.see implementation
notes.see implementation
notes.
PushMessageData.text() - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internettext experimentalchrome full support 50edge full support ≤79firefox full support 44
notes full support 44
notes
notes extended support releases (esr) before firefox 78 esr do not support service workers and the push api.ie no support noopera full support 37safari no support nowebview android ...
...expect behavior to change in the future.see implementation
notes.see implementation
notes.
PushSubscription.options - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetoptionschrome full support 42edge full support 16firefox full support 44
notes full support 44
notes
notes extended support releases (esr) before firefox 78 esr do not support service workers and the push api.ie no support noopera full support 29safari no support nowebview android ...
...rt 29safari ios no support nosamsung internet android full support 4.0legend full support full support no support no supportsee implementation
notes.see implementation
notes.
Push API - Web APIs
note: as of gecko 44, the allowed quota of push messages per application is not incremented when a new notification fires, when another is still visible, for a period of three seconds.
...
note: chrome versions earlier than 52 require you to set up a project on google cloud messaging to send push messages, and use the associated project number and api key when sending push notifications.
RTCIceCandidate.RTCIceCandidate() - Web APIs
note: parsing of the candidate string is performed using the candidate-attribute grammar from the webrtc specification.
... usage
notes this constructor does not do complete validation of the specified candidateinfo object or string.
RTCIceCandidate.foundation - Web APIs
note: if port is null — and port is supported by the user agent — passing the candidate to addicecandidate() will fail, throwing an operationerror exception.
... usage
notes consider this sdp attribute line (a-line) which describes an ice candidate: a=candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host the field "4234997325" is the foundation.
RTCIceCandidate.port - Web APIs
note: if port is null, passing the candidate to addicecandidate() will fail, throwing an operationerror exception.
... usage
notes consider this sdp attribute line (a-line) which describes an ice candidate: a=candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host the port number is found in the sixth field, which is "44323".
RTCIceCandidate.priority - Web APIs
note: if priority is null, passing the candidate to addicecandidate() will fail, throwing an operationerror exception.
... usage
notes consider this sdp attribute line (a-line) which describes an ice candidate: a=candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host the priority is the number after the protocol, so it's the fourth field in the candidate string.
RTCIceCandidate.protocol - Web APIs
note: if protocol is null — and protocol is supported by the user agent — passing the candidate to addicecandidate() will fail, throwing an operationerror exception.
... usage
notes here's an example candidate a-line from an ice transaction: a=candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host the third field, "udp", is the protocol type, indicating that the candidate would use the udp transport protocol.
RTCIceCandidateStats.networkType - Web APIs
note: the networktype property is only included in rtcicecandidatestats objects for local candidates (that is, candidates generated locally and included in an sdp offer or answer that has been sent to the remote peer).
...
note: keep in mind that the specified value only reflects the initial connection between the local peer and the next hop along the network toward reaching the remote peer.
RTCIceTransport.getSelectedCandidatePair() - Web APIs
usage
notes as the ice agent performs negotiation of a rtcpeerconnection, it gathers and analyzes candidate configurations from each the two peers.
...
note: it's possible for one of the configurations in the selected candidate pair to remain unchanged when a new pairing is chosen.
RTCInboundRtpStreamStats.fecPacketsReceived - Web APIs
note: this counter may also be incremented when fec packets arrive in-band along with media content; this can happen with opus, for example.
... usage
notes it's possible that a subset of the fec packets which have been received were discarded instead of being used.
RTCInboundRtpStreamStats.perDscpPacketsReceived - Web APIs
note: not all operating systems make data available on a per-dscp basis, so this property shouldn't be relied upon on those systems.
...
note: due to network bleaching and remapping, the numbers seen on this record are not necessarily going to match the values as they were when the data was sent.
RTCInboundRtpStreamStats.qpSum - Web APIs
note: this value is only available for video media.
... usage
notes quantization is the process of applying lossy compression to a range of values, resulting in a single quantum value.
RTCOfferOptions.iceRestart - Web APIs
note: rather than manually creating and submitting an offer with icerestart set to true, you should consider calling the rtcpeerconnection method restartice() instead.
... usage
notes when the rtcpeerconnection object's ice connection state changes to failed, you should try to trigger an ice restart.
RTCOutboundRtpStreamStats.perDscpPacketsSent - Web APIs
note: not all operating systems make data available on a per-dscp basis, so this property shouldn't be relied upon on those systems.
...
note: due to network bleaching and remapping, the numbers seen on this record are not necessarily going to match the values as they were when the data was sent.
RTCOutboundRtpStreamStats.pliCount - Web APIs
note: this property is only used for video streams.
... usage
notes upon receiving a pli packet, the sender may have responded by sending a full frame to the remote peer to allow it to re-synchronize with the media.
RTCOutboundRtpStreamStats.qpSum - Web APIs
note: this value is only available for video media.
... usage
notes quantization is the process of applying lossy compression to a range of values, resulting in a single quantum value.
RTCPeerConnection - Web APIs
note: in technical terms, a bundle lets all media flow between two peers flow across a single 5-tuple; that is, from a single ip and port on one peer to a single ip and port on the other peer, using the same transport protocol.
...
note: this value moved into the rtcpeerconnectionstate enum in the may 13, 2016 draft of the specification, as it reflects the state of the rtcpeerconnection, not the signaling connection.
RTCRtpStreamStats.qpSum - Web APIs
note: this value is only available for video media.
... usage
notes quantization is the process of applying lossy compression to a range of values, resulting in a single quantum value.
RTCRtpTransceiver.setCodecPreferences() - Web APIs
note: any codecs not included in codecs will not be considered during the process of negotiating a connection.
... usage
notes getting a list of supported codecs you can only include in the codecs list codecs which the transceiver actually supports.
RTCRtpTransceiver.stopped - Web APIs
usage
notes this property is deprecated and will be removed in the future.
...
note: currently only firefox implements stopped, and has not yet been updated to implement this change.
Reporting API - Web APIs
note: there is no absolute guarantee of report delivery — a report could still fail to be collected if a serious error occurs.
...
note: if you look at the complete source code, you'll notice that we actually call the deprecated getusermedia() method twice.
Request - Web APIs
note: the body functions can be run only once; subsequent calls will resolve with empty strings/arraybuffers.
... in the following snippet, we create a new request using the request() constructor with some initial data and body content for an api request which need a body payload: const request = new request('https://example.com', {method: 'post', body: '{"foo": "bar"}'}); const url = request.url; const method = request.method; const credentials = request.credentials; const bodyused = request.bodyused;
note: the body type can only be a blob, buffersource, formdata, urlsearchparams, usvstring or readablestream type, so for adding a json object to the payload you need to stringify that object.
ResizeObserverEntry - Web APIs
note that this is better supported than the above two properties, but it is left over from an earlier implementation of the resize observer api, is still included in the spec for web compat reasons, and may be deprecated in future versions.
...
note: the content box is the box in which content can be placed, meaning the border box minus the padding and border width.
Response.error() - Web APIs
note: this is mainly relevant to serviceworkers; the error method is used to return an error if you so wish it.
...
note: an "error" response never really gets exposed to script: such a response to a fetch() would reject the promise.
Response.type - Web APIs
note: an "error" response never really gets exposed to script: such a response to a fetch() would reject the promise.
...
note that at the top of the fetch() block we log the response type to the console.
SVGAnimationElement: endEvent event - Web APIs
note: this event is not raised at the simple end of each animation repeat.
....addeventlistener('repeatevent', (e) => { let listitem = document.createelement('li'); let msg = 'repeatevent fired'; if(e.detail) { msg += '; repeat number: ' + e.detail; } listitem.textcontent = msg; list.appendchild(listitem); }) btn.addeventlistener('click', () => { btn.disabled = true; animateelem.setattribute('repeatcount', '1'); }) event handler property equivalent
note that you can also create an event listener for the end event using the onend event handler property: animateelem.onend = () => { console.log('endevent fired'); } specifications specification status comment scalable vector graphics (svg) 2the definition of 'endevent' in that specification.
SVGAnimationElement: repeatEvent event - Web APIs
note: associated with the repeatevent event is an integer that indicates which repeat iteration is beginning; this can be found in the detail property of the event object.
....createelement('li'); listitem.textcontent = 'beginevent fired'; list.appendchild(listitem); }) animateelem.addeventlistener('repeatevent', (e) => { let listitem = document.createelement('li'); let msg = 'repeatevent fired'; if(e.detail) { msg += '; repeat number: ' + e.detail; } listitem.textcontent = msg; list.appendchild(listitem); }) event handler property equivalent
note that you can also create an event listener for the repeat event using the onrepeat event handler property: animateelem.onrepeat = () => { console.log('repeatevent fired'); } specifications specification status comment scalable vector graphics (svg) 2the definition of 'repeatevent' in that specification.
SVGPathSegList - Web APIs
if the item is already in this list,
note that the index of the item to insert before is before the removal of the item.
...if the item is already in this list,
note that the index of the item to replace is before the removal of the item.
SVGPointList - Web APIs
if the item is already in this list,
note that the index of the item to insert before is before the removal of the item.
...if the item is already in this list,
note that the index of the item to replace is before the removal of the item.
SVGStringList - Web APIs
if the item is already in this list,
note that the index of the item to insert before is before the removal of the item.
...if the item is already in this list,
note that the index of the item to replace is before the removal of the item.
ScriptProcessorNode.bufferSize - Web APIs
note: as of the august 29 2014 web audio api spec publication, this feature has been marked as deprecated, and is soon to be replaced by audio workers.
...
note: for a full working example, see our script-processor-node github repo (also view the source code.) var myscript = document.queryselector('script'); var mypre = document.queryselector('pre'); var playbutton = document.queryselector('button'); // create audiocontext and buffer source var audioctx = new audiocontext(); source = audioctx.createbuffersource(); // create a scriptprocessornode with...
ScriptProcessorNode.onaudioprocess - Web APIs
note: as of the august 29 2014 web audio api spec publication, this feature has been marked as deprecated, and is soon to be replaced by audio workers.
...
note: for a full working example, see our script-processor-node github repo (also view the source code.) var myscript = document.queryselector('script'); var mypre = document.queryselector('pre'); var playbutton = document.queryselector('button'); // create audiocontext and buffer source var audioctx = new audiocontext(); source = audioctx.createbuffersource(); // create a scriptprocessornod...
ScriptProcessorNode - Web APIs
note: as of the august 29 2014 web audio api spec publication, this feature has been marked as deprecated, and was replaced by audioworklet (see audioworkletnode).
...
note: for a full working example, see our script-processor-node github repo (also view the source code.) var myscript = document.queryselector('script'); var mypre = document.queryselector('pre'); var playbutton = document.queryselector('button'); // create audiocontext and buffer source var audioctx = new audiocontext(); source = audioctx.createbuffersource(); // create a scriptprocessornode with...
Selection.modify() - Web APIs
note: gecko does not implement "sentence", "paragraph", "sentenceboundary", "paragraphboundary", or "documentboundary".
...
note: starting in gecko 5.0, the "word" granularity no longer includes the following space, regardless of the default platform behavior.
Selection.setBaseAndExtent() - Web APIs
note: if the focus position appears before the anchor position in the document, the direction of the selection is reversed — the caret is placed at the beginning of the text rather the end, which matters for any keyboard command that might follow.
...
note: you can find this example on github (see it live also.) specifications specification status comment selection apithe definition of 'selection.setbaseandextent()' in that specification.
ServiceWorkerGlobalScope: pushsubscriptionchange event - Web APIs
bubbles no cancelable no interface pushsubscriptionchangeevent event handler property onpushsubscriptionchange usage
notes although examples demonstrating how to share subscription related information with the application server tend to use fetch(), this is not necessarily the best choice for real-world use, since it will not work if the app is offline, for example.
...
note: in earlier drafts of the specification, this event was defined to be sent when a pushsubscription has expired.
ServiceWorkerRegistration.navigationPreload - Web APIs
full support 59edge full support 17 full support 17 full support 16disabled disabled from version 16: this feature is behind the enable service workers preference.firefox full support 44
notes full support 44
notes
notes extended support releases (esr) before firefox 78 esr do not support service workers and the push api.ie no support noopera full support 46safari full support 11.1webview android ...
...expect behavior to change in the future.see implementation
notes.see implementation
notes.user must explicitly enable this feature.user must explicitly enable this feature.
ShadowRoot - Web APIs
note that this is currently only implemented by chrome; other browsers still implement them on the document interface.
...
note that this is currently only implemented by chrome; other browsers still implement them on the document interface.
Storage API - Web APIs
note: this feature is available in web workers.
...
note: see using the permissions api for further details about obtaining and managing permissions.
Using the Storage Access API - Web APIs
usage
notes the storage access api is designed to allow embedded content to request access to storage that would otherwise be blocked when a user’s browser is set to block all third-party cookies.
...});
note that access requests are automatically denied unless the embedded content is currently processing a user gesture such as a tap or click — so this code needs to be run inside some kind of user gesture-based event handler, for example: btn.addeventlistener('click', () => { // run code here }); ...
Using writable streams - Web APIs
note: this article assumes that you understand the use cases of writable streams, and are aware of the high-level concepts.
...
note: if you are looking for information about readable streams, try using readable streams instead.
SubtleCrypto.deriveKey() - Web APIs
note that the key usages must be allowed by the algorithm set in derivedkeyalgorithm.
... examples
note: you can try the working examples on github.
SubtleCrypto.unwrapKey() - Web APIs
examples
note: you can try the working examples on github.
...
note that when using aes-gcm we have to pass the iv value into unwrapkey(), and this must be the same as the iv that was used in the corresponding wrapkey() operation.
TextEncoder() - Web APIs
syntax encoder = new textencoder(); parameters textencoder() takes no parameters since firefox 48 and chrome 53
note: prior to firefox 48 and chrome 53, an encoding type label was accepted as a paramer to the textencoder object, since then both browers have removed support for any encoder type other than utf-8, to match the spec.
... exceptions textencoder() throws no exceptions since firefox 48 and chrome 53
note: prior to firefox 48 and chrome 53 an exception would be thrown for an unknown encoding type.
TextTrackList.onaddtrack - Web APIs
note: you can also add a handler for the addtrack event using addeventlistener().
... usage
notes the addtrack event is called whenever a new track is added to the media element whose video tracks are represented by the texttracklist object.
TouchEvent - Web APIs
note: the rate at which touchmove events is sent is browser-specific, and may also vary depending on the capability of the user's hardware.
... using with addeventlistener() and preventdefault() it's important to
note that in many cases, both touch and mouse events get sent (in order to let non-touch-specific code still interact with the user).
Multi-touch interaction - Web APIs
note that the threshold for pinch and zoom movement detection is application specific (and device dependent).
... function move_handler(ev) { //
note: if the user makes more than one "simultaneous" touches, most browsers // fire at least one touchmove event and some will fire several touchmoves.
TransformStream - Web APIs
controller.error("cannot send undefined as a chunk part") default: controller.enqueue(this.textencoder.encode(string(chunk))) break }, flush() { /* do any destructor work here */ } } class anytou8stream extends transformstream { constructor() { super({...transformcontent, textencoder: new textencoder()}) } } polyfilling textencoderstream and textdecoderstream
note that this is deprecated by the native constructors.
... let responses = [ /* conjoined response tree */ ] let {readable, writable} = new transformstream responses.reduce( (a, res, i, arr) => a.then(() => res.pipeto(writable, {preventclose: (i+1) !== arr.length})), promise.resolve() )
note that this is not resilient to other influences.
UIEvent.layerX - Web APIs
note the pagex\pagey properties still return the absolute position in the document, including page scrolling.</span> <span>make the page scroll more!
...
note the pagex\pagey properties still return the absolute position in the document, including page scrolling.</span> </div> <div id="d3"> <form name="form_coords" id="form1"> parent element id: <input type="text" name="parentid" size="7" /><br /> pagex:<input type="text" name="pagexcoords" size="7" /> pagey:<input type="text" name="pageycoords" size="7" /><br /> layerx:<input type="text" name="layerxcoords" size="7" /> layery:<input type="text" name="layerycoords" size="7" /> </form> </div> </body> </html> specifications this property is not part of any specification.
UIEvent.layerY - Web APIs
note the pagex\pagey properties still return the absolute position in the document, including page scrolling.</span> <span>make the page scroll more!
...
note the pagex\pagey properties still return the absolute position in the document, including page scrolling.</span> </div> <div id="d3"> <form name="form_coords" id="form1"> parent element id: <input type="text" name="parentid" size="7" /><br /> pagex:<input type="text" name="pagexcoords" size="7" /> pagey:<input type="text" name="pageycoords" size="7" /><br /> layerx:<input type="text" name="layerxcoords" size="7" /> layery:<input type="text" name="layerycoords" size="7" /> </form> </div> </body> </html> specifications this property is not part of any specification.
UIEvent.pageY - Web APIs
note the pagex\pagey properties still return the absolute position in the document, including page scrolling.</span> <span>make the page scroll more!
...
note the pagex\pagey properties still return the absolute position in the document, including page scrolling.</span> </div> <div id="d3"> <form name="form_coords"> parent element id: <input type="text" name="parentid" size="7" /><br /> pagex:<input type="text" name="pagexcoords" size="7" /> pagey:<input type="text" name="pageycoords" size="7" /><br /> layerx:<input type="text" name="layerxcoords" size="7" /> layery:<input type="text" name="layerycoords" size="7" /> </form> </div> </body> </html> specifications this property is not part of any specification.
URL() - Web APIs
note: this feature is available in web workers.
...
note: you can still use an existing url object for the base, which stringifies itself to the object's href property.
URL.revokeObjectURL() - Web APIs
note: this feature is available in web workers.
...
note: this method is not available from service workers, due to issues with the blob interface's life cycle and the potential for leaks.
URL - Web APIs
note: this feature is available in web workers.
... usage
notes the constructor takes a url parameter, and an optional base parameter to use as a base if the url parameter is a relative url: const url = new url('../cats', 'http://www.example.com/dogs'); console.log(url.hostname); // "www.example.com" console.log(url.pathname); // "/cats" url properties can be set to construct the url: url.hash = 'tabby'; console.log(url.href); // "http://www.example.com...
ValidityState.patternMismatch - Web APIs
input:invalid { border: red solid 3px; }
note, in this case, we get a patternmismatch not a validitystate.toolong or validitystate.tooshort if the values are too long or too short because it is the pattern that is dictating the length of the value.
...
note: the email input type requires, at minimum, a match of x@y and the url type requires, at minimum, a match to x:, with no pattern attribute present.
VideoTrackList.onaddtrack - Web APIs
note: you can also add a handler for the addtrack event using addeventlistener().
... usage
notes the addtrack event is called whenever a new track is added to the media element whose video tracks are represented by the videotracklist object.
VisualViewport - Web APIs
note: only the top-level window has a visual viewport that's distinct from the layout viewport.
... bottombar.style.transform = 'translate(' + offsetleft + 'px,' + offsettop + 'px) ' + 'scale(' + 1/viewport.scale + ')' } window.visualviewport.addeventlistener('scroll', viewporthandler); window.visualviewport.addeventlistener('resize', viewporthandler);
note: this technique should be used with care; emulating position: device-fixed in this way can result in the fixed element flickering during scrolling.
WaveShaperNode.curve - Web APIs
note: the array can be a null value: in that case, no distortion is applied to the input signal.
...
note: sigmoid functions are commonly used for distortion curves because of their natural properties.
WebGLRenderingContext.makeXRCompatible() - Web APIs
usage
notes because makexrcompatible() may involve replacing the underlying webgl context with a new one that uses the new rendering hardware, the existing contents of the context may be lost and, therefore, would need to be re-rendered.
...
note the inclusion of a use-webxr class on the vr mode button.
WebGLRenderingContext.vertexAttribPointer() - Web APIs
note the use of true because webgl expects our data to be in little-endian.
...lized to [0, 1] gl.vertexattribpointer(2, 2, gl.unsigned_short, true, 20, 16); gl.enablevertexattribarray(2); //set the attributes in the vertex shader to the same indices gl.bindattriblocation(shaderprogram, 0, 'position'); gl.bindattriblocation(shaderprogram, 1, 'normal'); gl.bindattriblocation(shaderprogram, 2, 'texuv'); //since the attribute indices have changed, we must re-link the shader //
note that this will reset all uniforms that were previously set.
Clearing with colors - Web APIs
note that css sets the background color of the canvas to black, so when the canvas turns green we know that webgl's magic has worked.
... finally, we
note that color in webgl is usually in rgba format, that is four numerical components for red, green, blue and alpha (opacity).
Matrix math for the web - Web APIs
below is the representation of a rotation about the x axis: let sin = math.sin; let cos = math.cos; //
note: there is no perspective in these transformations, so a rotation // at this point will only appear to only shrink the div let a = math.pi * 0.3; //rotation amount in radians // rotate around z axis let rotatezmatrix = [ cos(a), -sin(a), 0, 0, sin(a), cos(a), 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]; view on jsfiddle here are a set of funct...
...one big
note is that there is no perspective applied, so it might not feel very 3d yet.
Adding 2D content to a WebGL context - Web APIs
note also the lack of any work with textures here; that will be added in using textures in webgl.
... const fieldofview = 45 * math.pi / 180; // in radians const aspect = gl.canvas.clientwidth / gl.canvas.clientheight; const znear = 0.1; const zfar = 100.0; const projectionmatrix = mat4.create(); //
note: glmatrix.js always has the first argument // as the destination to receive the result.
Using WebGL extensions - Web APIs
note: in webgl, unlike in other gl apis, extensions are only available if explicitly requested.
...for instance: var ext = ( gl.getextension('oes_vertex_array_object') || gl.getextension('moz_oes_vertex_array_object') || gl.getextension('webkit_oes_vertex_array_object') );
note that, vendor prefix have been discouraged more and more and thus most browser implement experimental extensions behind a feature flag rather than vendor prefix.
Establishing a connection: The WebRTC perfect negotiation pattern - Web APIs
note that this code is identical for both peers involved in the connection.
... let makingoffer = false; pc.onnegotiationneeded = async () => { try { makingoffer = true; await pc.setlocaldescription(); signaler.send({ description: pc.localdescription }); } catch(err) { console.error(err); } finally { makingoffer = false; } };
note that setlocaldescription() without arguments automatically creates and sets the appropriate description based on the current signalingstate.
Using bounded reference spaces - Web APIs
note that if the underlying platform defines a fixed room-scale origin and boundary, it may initialize any uninitialized values to match that predefined information; this is not unexpected behavior for users of these platforms.
...as this suggests, the safe area is not required to be convex, but may have any number of indentations or extrusions, as long as it's a contiguous shape,
note that the coordinates of the origin here, (0, 0), are indicative of the fact that the boundaries are defined at floor level and are essentially a 2d shape on the floor, like an invisible fence used to keep pets from getting away from home.
Controlling multiple parameters with ConstantSourceNode - Web APIs
<div class="controls"> <div class="left"> <div id="playbutton" class="button"> ▶️ </div> </div> <div class="right"> <span>volume: </span> <input type="range" min="0.0" max="1.0" step="0.01" value="0.8" name="volume" id="volumecontrol"> </div> </div> <p>use the button above to start and stop the tones, and the volume control to change the volume of the
notes e and g in the chord.</p> css .controls { width: 400px; position: relative; vertical-align: middle; height: 44px; } .button { font-size: 32px; cursor: pointer; user-select: none; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; -o-user-select: none; } .right { width: 50%; font: 14px "open sans", "lucida grande", "arial", sans-serif; posit...
... set the oscillator's frequency to the desired value; in this case, oscnode1 is set to a middle c, while oscnode2 and oscnode3 round out the chord by playing the e and g
notes.
Background audio processing using AudioWorklet - Web APIs
num]; let channelcount = math.min(input.length, output.length); for (let channelnum = 0; channelnum < channelcount; channelnum++) { let samplecount = input[channelnum].length; for (let i = 0; i < samplecount; i++) { let sample = input[channelnum][i]; /* manipulate the sample */ output[channelnum][i] = sample; } } }; return true; }
note that when determining the number of sources to process and send through to the corresponding outputs, we use math.min() to ensure that we only process as many channels as we have room for in the output list.
...
note: at this time, unfortunately, chrome does not implement this algorithm in a manner that matches the current standard.
Web Storage API - Web APIs
note: from firefox 45 onwards, when the browser crashes/restarts, the amount of data saved per origin is limited to 10mb.
...
note: access to web storage from third-party iframes is denied if the user has disabled third-party cookies (firefox implements this behaviour from version 43 onwards.)
note: web storage is not the same as mozstorage (mozilla's xpcom interfaces to sqlite) or the session store api (an xpcom storage utility for use by extensions).
Window.captureEvents() - Web APIs
--> <script> function reg() { window.captureevents(event.click); window.onclick = page_click; } function page_click() { alert('page click event detected!'); } </script> </head> <body onload="reg();"> <p>click anywhere on this page.</p> </body> </html>
notes events raised in the dom by user activity (such as clicking buttons or shifting focus away from the current document) generally pass through the high-level window and document objects first before arriving at the object that initiated the event.
...
note that you can pass a list of events to this method using the following syntax: window.captureevents(event.keypress | event.keydown | event.keyup).
Window.content - Web APIs
note: since firefox 57 (initially nightly-only), both the content and _content variants are only available to chrome (privileged) code, and not available to the web anymore.
...
note: some examples use _content instead of content.
Window.find() - Web APIs
note: support for window.find() might change in future versions of gecko.
..." + window.find(text)); } html <p>apples, bananas, and oranges.</p> <button type="button" onclick='findstring("apples")'>search for apples</button> <button type="button" onclick='findstring("banana")'>search for banana</button> <button type="button" onclick='findstring("orange")'>search for orange</button> result
notes in some browsers, window.find() selects (highlights) the found content on the site.
Window.getComputedStyle() - Web APIs
note: valid pseudo-element selector refers to syntactic validity, e.g.
... <style> h3::after { content: ' rocks!'; } </style> <h3>generated content</h3> <script> var h3 = document.queryselector('h3'); var result = getcomputedstyle(h3, ':after').content; console.log('the generated content is: ', result); // returns ' rocks!' </script>
notes the returned cssstyledeclaration object contains active values for css property longhand names.
Window.onpaint - Web APIs
not working in gecko-based applications currently, see
notes section!
...
notes onpaint doesn't work currently, and it is questionable whether this event is going to work at all, see bug 239074.
Privileged features - Web APIs
note: as of gecko 1.9, the internet explorer equivalent to this feature is the window.showmodaldialog() method.
...
note also that starting in gecko 2.0, you can use window.showmodaldialog() without universalbrowserwrite privileges.
Window.pkcs11 - Web APIs
note: this property has been returned null since gecko 1.9.0.14 (firefox 3.0.14) and removed in gecko 29.0 (firefox 29 / thunderbird 29 / seamonkey 2.26)) for security reasons.
... syntax objref = window.pkcs11 example window.pkcs11.addmodule(smod, secpath, 0, 0);
notes see nsidompkcs11 for more information about how to manipulate pkcs11 objects.
window.postMessage() - Web APIs
note that this origin is not guaranteed to be the current or future origin of that window, which might have been navigated to a different location since postmessage was called.
... the secret response " + "is: rheeeeet!", event.origin); } window.addeventlistener("message", receivemessage, false);
notes any window may access this method on any other window, at any time, regardless of the location of the document in the window, to send it a message.
Window.requestAnimationFrame() - Web APIs
note: your callback routine must itself call requestanimationframe() if you want to animate another frame at the next repaint.
... element.style.transform = 'translatex(' + math.min(0.1 * elapsed, 200) + 'px)'; if (elapsed < 2000) { // stop the animation after 2 seconds window.requestanimationframe(step); } } window.requestanimationframe(step);
notes edge versions below 17 and internet explorer do not reliably fire requestanimationframe before the paint cycle.
Window.setImmediate() - Web APIs
notes the clearimmediate method can be used to clear the immediate actions, just like cleartimeout for settimeout.
...do
note that internet explorer 8 includes a synchronous version of postmessage, which means it cannot be used as a fallback.
WindowEventHandlers.onbeforeunload - Web APIs
note: to combat unwanted pop-ups, some browsers don't display prompts created in beforeunload event handlers unless the page has been interacted with.
...default behavior in mozilla firefox prompt will always be shown // chrome requires returnvalue to be set e.returnvalue = ''; }); guarantee the browser unload by removing the returnvalue property of the event window.addeventlistener('beforeunload', function (e) { // the absence of a returnvalue property on the event will guarantee the browser unload happens delete e['returnvalue']; });
notes when your page uses javascript to render content, the javascript may stop when leaving and then navigating back to the page.
WindowEventHandlers.onpopstate - Web APIs
note: calling history.pushstate() or history.replacestate() won't trigger a popstate event.
...e 1", "?page=1"); history.pushstate({page: 2}, "title 2", "?page=2"); history.replacestate({page: 3}, "title 3", "?page=3"); history.back(); // alerts "location: http://example.com/example.html?page=1, state: {"page":1}" history.back(); // alerts "location: http://example.com/example.html, state: null history.go(2); // alerts "location: http://example.com/example.html?page=3, state: {"page":3}
note that even though the original history entry (for http://example.com/example.html) has no state object associated with it, a popstate event is still fired, when we activate that entry after the second call to history.back().
XDomainRequest - Web APIs
if(window.xdomainrequest){ var xdr = new xdomainrequest(); xdr.open("get", "http://example.com/api/method"); xdr.onprogress = function () { //progress }; xdr.ontimeout = function () { //timeout }; xdr.onerror = function () { //error occurred }; xdr.onload = function() { //success(xdr.responsetext); } settimeout(function () { xdr.send(); }, 0); }
note: the xdr.send() call is wrapped in a timeout (see window.settimeout() to prevent an issue with the interface where some requests are lost if multiple xdomainrequests are being sent at the same time.
...
note: the xdr.onprogress event should always be defined, even as an empty function, or xdomainrequest may not fire onload for duplicate requests.
How to check the security state of an XMLHTTPRequest over SSL - Web APIs
notes: this code requires elevated privileges to run; you can only call it from a browser extension or from a xulrunner application.
... sha1 fingerprint = f4:99:64:18:6b:7d:c8:fa:c0:0c:2e:a9:61:77:28:67:13:c4:97:7b valid from 7/14/2011 0:00:00 am valid until 8/20/2013 23:59:59 pm and here is the output of making an https request to a server that uses an expired certificate: test("https://www.appliancetherapy.com/");
note that the security state has become "insecure" now and there is an error name reported: connection status: failed: securityexpiredcertificateerror security info: security state: insecure common name (cn) = www.appliancetherapy.com organisation = appliance therapy group (selane products, inc) issuer = verisign, inc.
XMLHttpRequest.getAllResponseHeaders() - Web APIs
note: for multipart requests, this returns the headers from the current part of the request, not from the original channel.
...
note: in modern browsers, the header names are returned in all lower case, as per the latest spec.
XMLHttpRequest.open() - Web APIs
note: calling this method for an already active request (one for which open() has already been called) is the equivalent of calling abort().
...
note: synchronous requests on the main thread can be easily disruptive to the user experience and should be avoided; in fact, many browsers have deprecated synchronous xhr support on the main thread entirely.
XMLHttpRequest.withCredentials - Web APIs
note: this never affects same-site requests.
...
note: xmlhttprequest responses from a different domain cannot set cookie values for their own domain unless withcredentials is set to true before making the request, regardless of access-control- header values.
XMLSerializer.serializeToString() - Web APIs
usage
notes compatible node types the specified root node—and all of its descendants—must be compatible with the xml serialization algorithm.
...
notes on the resulting xml there are some things worth noting about the xml output by serializetostring(): for xml serializations, element and attr nodes are always serialized with their namespaceuri intact.
XPathResult.resultType - Web APIs
note: this feature is available in web workers.
...
note that if the result is a node-set then unordered_node_iterator_type is always the resulting type.
XRInputSource.profiles - Web APIs
note: the profiles list is always empty when the webxr session is in inline mode.
... usage
notes input profile names an input profile name is a string describing a visual representation and behavior the input source may be configured to use.
XRInputSource - Web APIs
note: while xrinputsource uses the gamepad interface from the gamepad api, this input device is strictly associated with the webxr hardware and is not a general-purpose gaming device.
... usage
notes actions and the target ray if the device provides an indication of the direction in which it is pointed, this is done using a target ray.
XRReferenceSpace: reset event - Web APIs
bubbles yes cancelable no interface xrreferencespaceevent event handler property onreset usage
notes the reset event indicates that the coordinate system has been reset or reconfigured by changing the reference space's origin, moving and rotating it as indicated by the event's transform property.
...
note: a reset event will not occur if the reference space is able to regain tracking of its previous origin, since that means the origin has not been forced to be relocated.
XRSession.inputSources - Web APIs
note: traditional gamepad controllers are supported using the gamepad api.
... usage
notes you can add a handler for the xrsession event inputsourceschange to be advised when the contents of the session's connected devices list changes.
XRSession.requestAnimationFrame() - Web APIs
note: despite the obvious similarities between these methods and the global requestanimationframe() function provided by the window interface, you must not treat these as interchangeable.
...
note: a real application should check that the device and the user agent support webxr api at all and then that they both support the desired session type via xr.issessionsupported().
XRSession - Web APIs
environmentblendmode read only returns this session's blend mode which de
notes how much of the real-world environment is visible through the xr device and how the device will blend the device imagery with it.
...
note: environmentblendmode() is part of the webxr augmented reality module, which has not been completed.
XRSystem: devicechange event - Web APIs
note: not to be confused with the mediadevices devicechange event.
... bubbles no cancelable no interface event event handler xrsystem.ondevicechange usage
notes devicechange events are not delivered if the document which owns the xrsystem object has been granted permission to do so through the xr-spatial-tracking feature policy.
XRWebGLLayer.framebuffer - Web APIs
usage
notes how opaque framebuffers are special the framebuffer represented by the framebuffer property is opaque.
...
note: the depth and stencil properties are not required to be supported in order for a browser to be construed as having full webgl support.
XSL Transformations in Mozilla FAQ - Web APIs
note: starting in gecko 7.0, both text/xsl and application/xslt+xml are supported mime types for xslt media stylesheets.
...
note that firefox will override your xslt stylesheet if your xml is detected as an rss or atom feed.
ARIA Technique Template - Accessibility
description possible effects on user agents and assistive technology
note: opinions may differ on how assistive technology should handle this technique.
... examples example 1: code working examples:
notes aria attributes used related aria techniques compatibility tbd: add support information for common ua and at product combinations additional resources ...
Using the aria-activedescendant attribute - Accessibility
note: opinions may differ on how assistive technology should handle this technique.
... examples example 1: code working examples:
notes aria attributes used related aria techniques compatibility tbd: add support information for common ua and at product combinations additional resources ...
Using the aria-describedby attribute - Accessibility
value a space-separated list of element ids possible effects on user agents and assistive technology
note: opinions may differ on how assistive technology should handle this technique.
... <div id="descriptionclose">closing this window will discard any information entered and return you back to the main page</div> working examples: checkbox example uses aria-describedby tooltip example uses aria-describedby
notes the aria-describedby attributed is not designed to reference descriptions on an external resource—since it is an id, it must reference an element in the same dom document.
Using the aria-label attribute - Accessibility
value string possible effects on user agents and assistive technology
note: opinions may differ on how assistive technology should handle this technique.
... <button aria-label="close" onclick="mydialog.close()">x</button>
notes the most common accessibility api mapping for a label is the accessible name property.
Using the aria-labelledby attribute - Accessibility
note that the region being referenced is the region that contains the header.
...</div>
notes the most common accessibility api mapping for a label is the accessible name property used by aria roles all elements of the base markup related aria techniques using the aria-label attribute using the aria-describedby attribute compatibility tbd: add support information for common ua and at product combinations additional resources wai-aria specification for aria-labelledby ...
Using the aria-orientation attribute - Accessibility
possible effects on user agents and assistive technology
note: opinions may differ on how assistive technology should handle this technique.
... <a href="#" id="handle_zoomslider" role="slider" aria-orientation="vertical" aria-valuemin="0" aria-valuemax="17" aria-valuenow="14" > <span>11</span> </a> working examples: slider example
notes used with aria roles scrollbar listbox combobox menu tree separator slider tablist toolbar related aria techniques compatibility tbd: add support information for common ua and at product combinations additional resources wai-aria specification for the aria-orientation attribute ...
Using the aria-valuemax attribute - Accessibility
note: opinions may differ on how assistive technology should handle this technique.
... <div role="slider" aria-valuenow="4" aria-valuemin="1" aria-valuemax="10"> working examples: progressbar example slider example spinbutton example
notes used with aria roles progressbar scrollbar slider spinbutton related aria techniques aria-valuemin aria-valuenow aria-valuetext compatibility tbd: add support information for common ua and at product combinations additional resources wai-aria specification for the aria-valuemax attribute ...
Using the aria-valuemin attribute - Accessibility
note: opinions may differ on how assistive technology should handle this technique.
... <div role="slider" aria-valuenow="4" aria-valuemin="1" aria-valuemax="10"> working examples: progressbar example slider example spinbutton example
notes used with aria roles progressbar scrollbar slider spinbutton related aria techniques aria-valuemax aria-valuenow aria-valuetext compatibility tbd: add support information for common ua and at product combinations additional resources wai-aria specification for the aria-valuemin attribute ...
Using the aria-valuenow attribute - Accessibility
note: opinions may differ on how assistive technology should handle this technique.
... <div role="slider" aria-valuenow="4" aria-valuemin="1" aria-valuemax="10"> working examples: progressbar example slider example spinbutton example
notes used with aria roles progressbar scrollbar slider spinbutton related aria techniques aria-valuemax aria-valuemin aria-valuetext compatibility tbd: add support information for common ua and at product combinations additional resources wai-aria specification for the aria-valuenow attribute ...
Using the aria-valuetext attribute - Accessibility
note: opinions may differ on how assistive technology should handle this technique.
... <div role="slider" aria-valuenow="1" aria-valuemin="1" aria-valuemax="7" aria-valuetext="sunday"> working examples:
notes used with aria roles progressbar scrollbar slider spinbutton related aria techniques aria-valuenow compatibility tbd: add support information for common ua and at product combinations additional resources wai-aria specification for the aria-valuetext attribute ...
Using the article role - Accessibility
note: opinions may differ on how assistive technology should handle this technique.
... examples <article role="article"> <header> <h2>blog post</h2> </header> <section class="content"> <p>a very interesting post</p> </section> <section class="comments"> <div class="comment" role="article"> <p>meaningful comment</p> </div> <div class="comment" role="article"> <p>positive comment</p> </div> </section> </article>
notes aria attributes used related aria techniques aria techniques - list of roles compatibility tbd: add support information for common ua and at product combinations additional resources wai-aria specification for the article role ...
Using the group role - Accessibility
note: opinons may differ on how assistive technology should handle this technique.
...h</li> </ul> <ul role="group"> <li role="menuitem">custom folder 1</li> <li role="menuitem">custom folder 2</li> <li role="menuitem">custom folder 3</li> </ul> <ul role="group"> <li role="menuitem">new folder</li> </ul> </div> working examples: file directory treeview example using computed properties navigation treeview example using declared properties
notes group members that are outside of the dom subtree of the group need to have explicit relationships assigned to them in order to participate in the group.
Using the log role - Accessibility
note: opinons may differ on how assistive technology should handle this technique.
... <div id="chatarea" role="log"> <ul id="chatregion" aria-live="polite" aria-atomic="false"> <li>please choose a user name to begin using ajax chat.</li> </ul> <ul id="userlistregion" aria-live="off" aria-relevant="additions removals text"> </ul> </div> working examples: http://websiteaccessibility.donaldevans.com/2011/07/12/aria-log/
notes using the log role on an element implies that element has aria-live="polite".
Using the presentation role - Accessibility
possible effects on user agents and assistive technology
note: opinions may differ on how assistive technology should handle this technique.
... examples example 1: <ul role="tablist"> <li role="presentation"> <a role="tab" href="#">tab 1</a> </li> <li role="presentation"> <a role="tab" href="#">tab 2</a> </li> <li role="presentation"> <a role="tab" href="#">tab 3</a> </li> </ul> working examples:
notes aria attributes used related aria techniques compatibility tbd: add support information for common ua and at product combinations additional resources using aria - 2.9 use of role=presentation or role=none: https://www.w3.org/tr/using-aria/#presentation ...
Using the radio role - Accessibility
possible effects on user agents and assistive technology
note: opinons may differ on how assistive technology should handle this technique.
...dio" aria-checked="false"> <img role="presentation" src="radio-unchecked.gif" /> thai </li> <li id="r2" tabindex="-1" role="radio" aria-checked="false"> <img role="presentation" src="radio-unchecked.gif" /> subway </li> <li id="r3" tabindex="0" role="radio" aria-checked="true"> <img role="presentation" src="radio-checked.gif" /> radio maria </li> </ul> working examples:
notes aria attributes used related aria techniques compatibility tbd: add support information for common ua and at product combinations additional resources ...
Using the slider role - Accessibility
by 10 on a range from 0 to 100) possible effects on user agents and assistive technology
note: opinions may differ on how assistive technology should handle this technique.
...luenow and aria-valuetext attributes: var daynames = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"]; var updateslider = function (newvalue) { var handle = document.getelementbyid("day-handle"); handle.setattribute("aria-valuenow", newvalue.tostring()); handle.setattribute("aria-valuetext", daynames[newvalue]); }; working examples: slider example
notes aria attributes used aria-valuemin aria-valuemax aria-valuenow aria-valuetext aria-orientation related aria techniques compatibility tbd: add support information for common ua and at product combinations additional resources wai-aria specification for the slider role ...
Using the status role - Accessibility
note: opinons may differ on how assistive technology should handle this technique.
... <p role="status">your changes were automatically saved.</p> working examples:
notes aria attributes used status related aria techniques alert role live region roles live region attributes compatibility the paciello group published some data on compatibility via their 2014 blog post: screen reader support for aria live regions tbd: add updated support information for common ua and at product combinations additional resources previous recommendations from wai-aria 1.0 (2014) for the status role ...
Using the toolbar role - Accessibility
possible effects on user agents and assistive technology
note: opinons may differ on how assistive technology should handle this technique.
... examples example 1: code working examples: w3c toolbar example
notes aria attributes used related aria techniques compatibility tbd: add support information for common ua and at product combinations additional resources ...
ARIA: gridcell role - Accessibility
<td contenteditable="true">
notes</td> <div role="gridcell" contenteditable="true">item cost</div> contenteditable will make the element it is applied to focusable via the tab key.
...
note that if this attribute is provided, it applies only to the individual gridcell.
ARIA: Listitem role - Accessibility
for example, our above example should be rewritten as follows: <ul> <li>list item 1</li> <li>list item 2</li> <li>list item 3</li> </ul> or use an ordered list if the order of the list items matters: <ol> <li>list item 1</li> <li>list item 2</li> <li>list item 3</li> </ol>
note: the aria list/listitem roles don't distinguish between ordered and unordered lists.
...
note: if you are marking up a list of items that will function as a tabbed interface, you should instead use the tab, tabpanel, and tablist roles.
ARIA - Accessibility
function updateprogress(percentcomplete) { progressbar.setattribute("aria-valuenow", percentcomplete); }
note that aria was invented after html4, so does not validate in html4 or its xhtml variants.
...see also, aria landmark implementation
notes and examples on real sites (updated as of july 2011).
Robust - Accessibility
note: to read the w3c definitions for robust and its guidelines and success criteria, see principle 4: robust — content must be robust enough that it can be interpreted reliably by a wide variety of user agents, including assistive technologies.
... understanding status messages
note: also see the wcag description for guideline 4.1: compatible: maximize compatibility with current and future user agents, including assistive technologies.
-moz-outline-radius - CSS: Cascading Style Sheets
and:-moz-outline-radius-topleft: a length, percentage or calc();-moz-outline-radius-topright: a length, percentage or calc();-moz-outline-radius-bottomright: a length, percentage or calc();-moz-outline-radius-bottomleft: a length, percentage or calc(); formal syntax <outline-radius>{1,4} [ / <outline-radius>{1,4} ]?where <outline-radius> = <length> | <percentage> examples rounding an outline
note: this example will not display the desired effect if you are viewing this in a browser other than firefox.
... html <p>this element has a rounded outline!</p> css p { margin: 5px; border: 1px solid black; outline: dotted red; -moz-outline-radius: 12% 1em 25px; } result
notes dotted or dashed radiused corners were rendered as solid until firefox 50, bug 382721 future versions of gecko/firefox may drop this property completely.
::after (:after) - CSS: Cascading Style Sheets
/* add an arrow after links */ a::after { content: "→"; }
note: the pseudo-elements generated by ::before and ::after are contained by the element's formatting box, and thus don't apply to replaced elements such as <img>, or to <br> elements.
... syntax /* css3 syntax */ ::after /* css2 syntax */ :after
note: css3 introduced the ::after notation (with two colons) to distinguish pseudo-classes from pseudo-elements.
:dir() - CSS: Cascading Style Sheets
note: be aware that the behavior of the :dir() pseudo-class is not equivalent to the [dir=…] attribute selectors.
...
note: in html, the direction is determined by the dir attribute.
:first-of-type - CSS: Cascading Style Sheets
/* selects any <p> that is the first element of its type among its siblings */ p:first-of-type { color: red; }
note: as originally defined, the selected element had to have a parent.
...
note that the universal selector (*) is implied when no simple selector is written.
:focus-visible - CSS: Cascading Style Sheets
note that firefox supports similar functionality through an older, prefixed pseudo-class — :-moz-focusring.
...
note the difference in behavior from elements styled with :focus.
:hover - CSS: Cascading Style Sheets
note: the :hover pseudo-class is problematic on touchscreens.
...
note: for an analogous effect, but based on the :checked pseudo-class (applied to hidden radioboxes), see this demo, taken from the :checked reference page.
:last-of-type - CSS: Cascading Style Sheets
/* selects any <p> that is the last element of its type among its siblings */ p:last-of-type { color: lime; }
note: as originally defined, the selected element had to have a parent.
...
note that the universal selector (*) is implied when no simple selector is written.
:target - CSS: Cascading Style Sheets
/* selects an element with an id matching the current url's fragment */ :target { border: 2px solid black; } for example, the following url has a fragment (de
noted by the # sign) that points to an element called section2: http://www.example.com/index.html#section2 the following element would be selected by a :target selector when the current url is equal to the above: <section id="section2">example</section> syntax :target examples a table of contents the :target pseudo-class can be used to highlight the portion of a page that has been linked to from a table of contents.
...
note: a more complete pure-css lightbox based on the :target pseudo-class is available on github (demo).
@charset - CSS: Cascading Style Sheets
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internet@charsetchrome full support 2edge full support 12firefox full support 1.5
notes full support 1.5
notes
notes firefox 1 supported an invalid syntax where the character encoding is not between single or double quotes.ie full support 5.5
notes full support 5.5
notes
notes from internet explorer 5.5 to ie 7 (inclusive), internet explorer supporte...
... full support 4opera android full support 10.1safari ios full support 4samsung internet android full support 1.0legend full support full supportsee implementation
notes.see implementation
notes.
@import - CSS: Cascading Style Sheets
note that the url for a mozilla package need not actually specify a file; it can just specify the package name and part, and the appropriate file is chosen automatically (e.g.
... recommendation added support for <string> to de
note the url of a stylesheet, and requirement to insert the @import rule at the beginning of the css document.
-moz-device-pixel-ratio - CSS: Cascading Style Sheets
note: this media feature is also implemented by webkit and by ie 11 for windows phone 8.1 as -webkit-device-pixel-ratio.
... example: @media (-webkit-min-device-pixel-ratio: 2), /* webkit-based browsers */ (min--moz-device-pixel-ratio: 2), /* older firefox browsers (prior to firefox 16) */ (min-resolution: 2dppx), /* the standard way */ (min-resolution: 192dpi) /* dppx fallback */
note: see this csswg article for compatibility good practices regarding resolution and dppx.
any-pointer - CSS: Cascading Style Sheets
note: if you want to test the accuracy of the primary pointing device, use pointer instead.
...
note: more than one value can match if the available devices have different characteristics, although none only matches when none of them are pointing devices.
@media - CSS: Cascading Style Sheets
note: in javascript, the rules created using @media can be accessed with the cssmediarule css object model interface.
... name summary
notes any-hover does any available input mechanism allow the user to hover over elements?
@namespace - CSS: Cascading Style Sheets
when a default namespace is defined, all universal and type selectors (but not attribute selectors, see
note below) apply only to elements in that namespace.
...
note: in xml, unless a prefix is defined directly on an attribute (e.g., xlink:href), that attribute has no namespace.
@viewport - CSS: Cascading Style Sheets
note: see https://github.com/w3c/csswg-drafts/issues/4766 for discussion around @viewport's removal from the standards track.
... @viewport { width: 100vw; /*sets the width of the actual viewport to the device width*/ }
note: the use of <meta name="viewport"> tag overrides @viewport syntax the at-rule contains a set of nested descriptors in a css block that is delimited by curly braces.
CSS Box Alignment - CSS: Cascading Style Sheets
note: the documentation for each layout method will detail how box alignment is applied there.
...however the specification
notes that the box alignment specification should be referred to as it may add additional capabilities over what is currently in flexbox.
Spanning and Balancing Columns - CSS: Cascading Style Sheets
note the spanning and balancing functionality covered in this guide is not as well supported across browsers as the functionality covered in the previous two sections in this guide.
...
note that column balancing is not supported by all browsers.
Ordering Flex Items - CSS: Cascading Style Sheets
the specification says the following on this matter: “
note: the reordering capabilities of flex layout intentionally affect only the visual rendering, leaving speech order and navigation based on the source order.
...the specification continues with a warning not to use reordering to fix issues in your source: “authors must not use order or the *-reverse values of flex-flow/flex-direction as a substitute for correct source ordering, as that can ruin the accessibility of the document.”
note: for some years firefox had a bug whereby it would attempt to follow the visual order and not the source order, making it behave differently to other browsers.
Block and inline layout in normal flow - CSS: Cascading Style Sheets
the rectangular area that contains the boxes that form a line is called a line box.” - 9.4.2
note that the css 2.1 specification describes documents as being in a horizontal, top to bottom writing mode.
...
note: if you are not sure whether margins are collapsing, check the box model values in your browser devtools.
Grid template areas - CSS: Cascading Style Sheets
the specification does
note that a future level might provide this functionality.
...
note that for the wide layout i keep my nine column track grid, i redefine where items are placed using grid-template-areas.
Layout using named grid lines - CSS: Cascading Style Sheets
giving lines multiple names you may want to give a line more than one name, perhaps it de
notes the sidebar-end and the main-start for example.
...the area names are: hd ft main sd this gives us column and row lines: hd-start hd-end sd-start sd-end main-start main-end ft-start ft-end you can see the named lines in the image,
note that some lines have two names - for example sd-end and main-start refer to the same column line.
CSS Scrollbars - CSS: Cascading Style Sheets
scrollbar-color desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetscrollbar-colorchrome no support noedge no support nofirefox full support 64
notes full support 64
notes
notes on macos, you need to set the general > show scroll bars setting in system preferences to "always" for this property to have any effect.
...pport nosafari ios no support nosamsung internet android no support nolegend full support full support no support no supportsee implementation
notes.see implementation
notes.user must explicitly enable this feature.user must explicitly enable this feature.
Introducing the CSS Cascade - CSS: Cascading Style Sheets
finally,
note that @import and @charset obey specific algorithms and aren't affected by the cascade algorithm.
...therefore, it is the last one that is then selected: margin-left: 3px
note that the declaration defined in the user css, though having a greater specificity, is not chosen as the cascade algorithm is applied before the specificity algorithm.
Comments - CSS: Cascading Style Sheets
a css comment is used to add explanatory
notes to the code or to prevent the browser from interpreting specific parts of the style sheet.
... /* comment */ examples /* a one-line comment */ /* a comment which stretches over several lines */ /* the comment below is used to disable specific styling */ /* span { color: blue; font-size: 1.5em; } */
notes the /* */ comment syntax is used for both single and multiline comments.
Mozilla CSS extensions - CSS: Cascading Style Sheets
mozilla-only properties and pseudo-classes (avoid using on websites)
note: these properties and pseudo-classes will only work in mozilla applications such as firefox, and are not on a standards track.
...d-forward) :-moz-system-metric(scrollbar-start-backward) :-moz-system-metric(scrollbar-start-forward) :-moz-system-metric(scrollbar-thumb-proportional) :-moz-system-metric(touch-enabled) :-moz-system-metric(windows-default-theme) -moz-user-focus -moz-user-input -moz-user-modify -moz-window-dragging -moz-window-shadow formerly proprietary properties that are now standard
note: to maximize the compatibility of your css, you should use the unprefixed standard properties instead of the prefixed ones listed below.
Pseudo-elements - CSS: Cascading Style Sheets
*/ p::first-line { color: blue; text-transform: uppercase; }
note: in contrast to pseudo-elements, pseudo-classes can be used to style an element based on its state.
...
note: as a rule, double colons (::) should be used instead of a single colon (:).
CSS reference - CSS: Cascading Style Sheets
note that css rule definitions are entirely (ascii) text-based, whereas dom-css / cssom (the rule management system) is object-based.
... keyword index
note: the property names in this index do not include the javascript names where they differ from the css standard names.
Scaling of SVG backgrounds - CSS: Cascading Style Sheets
note: the screenshots below show the expected rendering.
... background: url(100px-wide-no-height-or-ratio.svg); background-size: auto auto; the rendered output looks like this:
note here that the width, which is specified in the source svg at 100 pixels, is obeyed, while the height fills the background area since it's not specified (either explicitly or by an intrinsic ratio).
Syntax - CSS: Cascading Style Sheets
note: the content of a css declaration block, that is a list of semi-colon-separated declarations, without the initial and closing braces, can be put inside an html style attribute.
... it is important to
note that even if a ruleset characterized by a group of selectors is a kind of shorthand replacing rulesets with a single selector each, this doesn't apply to the validity of the ruleset itself.
Visual formatting model - CSS: Cascading Style Sheets
note: boxes are often referred to by their display type — e.g.
...
note however that block boxes, block-level boxes and box containers are all subtly different; see the block boxes section below for more details.
animation-duration - CSS: Cascading Style Sheets
note: negative values are invalid, causing the declaration to be ignored.
...
note: when you specify multiple comma-separated values on an animation-* property, they will be assigned to the animations specified in the animation-name property in different ways depending on how many there are.
animation-timing-function - CSS: Cascading Style Sheets
whether the animation holds temporarily at 0%, 20%, 40%, 60% and 80%, on the 20%, 40%, 60%, 80% and 100%, or makes 5 stops between the 0% and 100% along the animation, or makes 5 stops including the 0% and 100% marks (on the 0%, 25%, 50%, 75%, and 100%) depends on which of the following jump terms is used: jump-start de
notes a left-continuous function, so that the first jump happens when the animation begins; jump-end de
notes a right-continuous function, so that the last jump happens when the animation ends; jump-none there is no jump on either end.
... step-start equal to steps(1, jump-start) step-end equal to steps(1, jump-end)
note: when you specify multiple comma-separated values on an animation-* property, they will be assigned to the animations specified in the animation-name property in different ways depending on how many there are.
animation - CSS: Cascading Style Sheets
/* @keyframes duration | timing-function | delay | iteration-count | direction | fill-mode | play-state | name */ animation: 3s ease-in 1s 2 reverse both paused slidein; /* @keyframes name | duration | timing-function | delay */ animation: 3s linear 1s slidein; /* @keyframes name | duration */ animation: slidein 3s; <div class="grid"> <div class="col"> <div class="
note"> given the following animation: <pre>@keyframes slidein { from { transform: scalex(0); } to { transform: scalex(1); } }</pre> </div> <div class="row"> <div class="cell"> <button class="play" title="play"></button> </div> <div class="cell flx"> <div class="overlay">animation: 3s ease-in 1s 2 reverse both paused slidein;</div> <di...
...y: flex; background: #eee; font: 1em monospace; } .row { display: flex; flex: 1 auto; flex-direction: row; flex-wrap: wrap; justify-content: space-between; } .col { display: flex; flex: 1 auto; flex-direction: column; } .cell { box-sizing: border-box; margin: .5em; padding: 0; background-color: #fff; overflow: hidden; text-align: left; } .flx { flex: 1 0; } .
note { background: #fff3d4; padding: 1em; margin: .5em; font: .8em sans-serif; text-align: left; flex: none; } .overlay { padding: .5em; } @keyframes slidein { from { transform: scalex(0); } to { transform: scalex(1); } } .a1 { animation: 3s ease-in 1s 2 reverse both paused slidein; } .a2 { animation: 3s linear 1s slidein; } .a3 { animation: 3s slidein; } .animation { background:...
background-clip - CSS: Cascading Style Sheets
note: because the root element has a different background painting area, the background-clip property has no effect when specified on it.
... see "the backgrounds of special elements."
note: for documents whose root element is an html element: if the computed value of background-image on the root element is none and its background-color is transparent, user agents must instead propagate the computed values of the background properties from that element’s first html <body> child element.
background-position - CSS: Cascading Style Sheets
note that: if one value is top or bottom, then the other value may not be top or bottom.
... full support 14opera android full support 14safari ios full support 7samsung internet android full support 1.5legend full support full support quantum css
notes gecko has a bug meaning that background-position can't be transitioned between two values containing different numbers of <position> values, for example background-position: 10px 10px; and background-position: 20px 20px, 30px 30px; (see bug 1390446).
border-bottom-left-radius - CSS: Cascading Style Sheets
note: if the value of this property is not set in a border-radius shorthand property that is applied to the element after the border-bottom-left-radius css property, the value of this property is then reset to its initial value by the shorthand property.
... values <length-percentage> de
notes the size of the circle radius or the semi-major and semi-minor axes of the ellipse.
border-bottom-right-radius - CSS: Cascading Style Sheets
note: if the value of this property is not set in a border-radius shorthand property that is applied to the element after the border-bottom-right-radius css property, the value of this property is then reset to its initial value by the shorthand property.
... values <length-percentage> de
notes the size of the circle radius or the semi-major and semi-minor axes of the ellipse.
border-image - CSS: Cascading Style Sheets
note: you should specify a separate border-style in case the border image fails to load.
...
note: if the computed value of border-image-source is none, or if the image cannot be displayed, the border-style will be displayed instead.
border-spacing - CSS: Cascading Style Sheets
note: the border-spacing property is equivalent to the deprecated cellspacing <table> attribute, except that it has an optional second value that can be used to set different horizontal and vertical spacing.
...
note how, along its outside edges, the table's padding values are added to its border-spacing values.
border-top-left-radius - CSS: Cascading Style Sheets
note: if the value of this property is not set in a border-radius shorthand property that is applied to the element after the border-top-left-radius css property, the value of this property is then reset to its initial value by the shorthand property.
... values <length-percentage> de
notes the size of the circle radius or the semi-major and semi-minor axes of the ellipse.
border-top-right-radius - CSS: Cascading Style Sheets
note: if the value of this property is not set in a border-radius shorthand property that is applied to the element after the border-top-right-radius css property, the value of this property is then reset to its initial value by the shorthand property.
... values <length-percentage> de
notes the size of the circle radius or the semi-major and semi-minor axes of the ellipse.
calc() - CSS: Cascading Style Sheets
notes the + and - operators must be surrounded by whitespace.
...
note: the chrome browser currently won’t accept some values returned by calc() when an integer is expected.
caption-side - CSS: Cascading Style Sheets
the css 2.1 specification
notes that the css 2 specification described a different behavior for the top value, which will be reintroduced by this value in a future specification.
... the css 2.1 specification
notes that the css 2 specification described a different behavior for the bottom value, which will be reintroduced by this value in a future specification.
caret-color - CSS: Cascading Style Sheets
note that the insertion caret is only one type of caret.
...
note: while user agents may use currentcolor (which is usually animatable) for the auto value, auto is not interpolated in transitions and animations.
clamp() - CSS: Cascading Style Sheets
note that using clamp() for font sizes, as in these examples, allows you to set a font-size that grows with the size of the viewport, but doesn't go below a minimum font-size or above a maximum font-size.
...
notes math expressions involving percentages for widths and heights on table columns, table column groups, table rows, table row groups, and table cells in both auto and fixed layout tables may be treated as if auto had been specified.
column-rule - CSS: Cascading Style Sheets
note: as with all shorthand properties, any individual value that is not specified is set to its corresponding initial value (possibly overriding values previously set using non-shorthand properties).
... take
note of how the `column-rule` property is used to adjust the style, width, and color of the rule that appears between the columns.
contain - CSS: Cascading Style Sheets
note: if applied (with value: paint, strict or content), this property creates: a new containing block (for the descendants whose position property is absolute or fixed).
...
note that this value is marked "at-risk" in the spec and may not be supported everywhere.
cursor - CSS: Cascading Style Sheets
zoom-out usage
notes although the specification does not define any size limitations for cursor, individual user agents may choose to do so.
... check the browser compatibility table for any
notes on cursor size limits.
<custom-ident> - CSS: Cascading Style Sheets
the <custom-ident> css data type de
notes an arbitrary user-defined string used as an identifier.
...it consists of one or more characters, where characters can be any of the following: any alphabetical character (a to z, or a to z), any decimal digit (0 to 9), a hyphen (-), an underscore (_), an escaped character (preceded by a backslash, \), a unicode character (in the format of a backslash, \, followed by one to six hexadecimal digits, representing its unicode code point)
note that id1, id1, id1 and id1 are all different identifiers as they are case-sensitive.
<easing-function> - CSS: Cascading Style Sheets
the <easing-function> css data type de
notes a mathematical function that describes how fast one-dimensional values change during animations.
... direction is a keyword indicating if it the function is left- or right-continuous: jump-start de
notes a left-continuous function, so that the first step or jump happens when the animation begins; jump-end de
notes a right-continuous function, so that the last step or jump happens when the animation ends; jump-both de
notes a right and left continuous function, includes pauses at both the 0% and 100% marks, effectively adding a step during the animation iteration; jump-none there is no jump o...
env() - CSS: Cascading Style Sheets
note: unlike other css properties, user agent-defined property names are case-sensitive.
...
note: user agent properties are not reset by the all property.
filter - CSS: Cascading Style Sheets
except where
noted, the functions that take a value expressed with a percent sign (as in 34%) also accept the value expressed as decimal (as in 0.34).
...if not specified, the color used depends on the browser - it is usually the value of the <color> property, but
note that safari currently paints a transparent shadow in this case.
flex-basis - CSS: Cascading Style Sheets
note: in case both flex-basis (other than auto) and width (or height in case of flex-direction: column) are set for an element, flex-basis has priority.
...
note: this value was not present in the initial release of flexible box layout, and thus some older implementations will not support it.
float - CSS: Cascading Style Sheets
k block inline-table table table-row block table-row-group block table-column block table-column-group block table-cell block table-caption block table-header-group block table-footer-group block inline-flex flex inline-grid grid other unchanged
note: if you're referring to this property from javascript as a member of the htmlelement.style object, modern browsers support float, but in older browsers you have to spell it as cssfloat, with internet explorer versions 8 and older using stylefloat.
...
note that the second "left" square is placed to the right of the first.
font-variant-alternates - CSS: Cascading Style Sheets
note: in order to preserve text semantics, font designers should include ornaments that don't match unicode dingbat characters as ornamental variants of the bullet character (u+2022).
...s( <feature-value-name> ) | annotation( <feature-value-name> ) ]where <feature-value-name> = <custom-ident> examples html <p>firefox rocks!</p> <p class="variant">firefox rocks!</p> css @font-feature-values "leitura display swashes" { @swash { fancy: 1 } } p { font-size: 1.5rem; } .variant { font-family: leitura display swashes; font-variant-alternates: swash(fancy); } result
note: you need to install the opentype font leitura display swashes for this example to work.
<frequency> - CSS: Cascading Style Sheets
note: although the number 0 is always the same regardless of unit, the unit may not be omitted.
...
note: this data type was initially introduced in css level 2 for the now-obsolete aural media type, where it was used to define the pitch of the voice.
grid-template - CSS: Cascading Style Sheets
note: the repeat() function isn’t allowed in these track listings, as the tracks are intended to visually line up one-to-one with the rows/columns in the “ascii art”.
...
note: the grid shorthand accepts the same syntax, but also resets the implicit grid properties to their initial values.
hyphens - CSS: Cascading Style Sheets
note: the rules defining how hyphenation is performed are not explicitly defined by the specification, so the exact hyphenation may vary from browser to browser.
...
note: the auto setting's behavior depends on the language being properly tagged to select the appropriate hyphenation rules.
ident - CSS: Cascading Style Sheets
the <ident> css data type de
notes an arbitrary string used as an identifier.
...it consists of one or more characters, where characters can be any of the following: any alphabetical character (a to z, or a to z), any decimal digit (0 to 9), a hyphen (-), an underscore (_), an escaped character (preceded by a backslash, \), a unicode character (in the format of a backslash, \, followed by one to six hexadecimal digits, representing its unicode code point)
note that id1, id1, id1 and id1 are all different identifiers as they are case-sensitive.
<image> - CSS: Cascading Style Sheets
syntax the <image> data type can be represented with any of the following: an image de
noted by the <url> data type a <gradient> data type a part of the webpage, defined by the element() function an image, image fragment or solid patch of color, defined by the image() function a blending of two or more images defined by the cross-fade() function.
...
note: not all browsers support every type of image on every property.
ime-mode - CSS: Cascading Style Sheets
note: in general, it's not appropriate for a public web site to change the ime mode.
... <input type="text" name="name" value="initial value" style="ime-mode: disabled">
note: you shouldn't rely on disabling ime to prevent extended characters from passing through your form.
linear-gradient() - CSS: Cascading Style Sheets
note: rendering of color stops in css gradients follows the same rules as color stops in svg gradients.
...
note also that the first example above does not exactly render as depicted in mozilla firefox (particularly version 80.0b3).
list-style-position - CSS: Cascading Style Sheets
note: this property is applied to list items, i.e., elements with display: list-item;.
...
note that there is variance among browsers regarding behavior when a block element is placed first within a list element declared as list-style-position: inside.
margin - CSS: Cascading Style Sheets
note: margins create extra space around an element.
... /* right: 3px margin */ /* bottom: 30px margin */ /* left: 5px margin */ margin: 2em auto; /* top and bottom: 2em margin */ /* box is horizontally centered */ margin: auto; /* top and bottom: 0 margin */ /* box is horizontally centered */
notes horizontal centering to center something horizontally in modern browsers, you can use display: flex; justify-content: center; .
mask-border-slice - CSS: Cascading Style Sheets
mask-border-slice: 30 fill; chromium-based browsers support an outdated version of this property — mask-box-image-slice — with a prefix: -webkit-mask-box-image-slice: 30 fill;
note: the mask-border page features a working example (using the out-of-date prefixed border mask properties supported in chromium), so you can get an idea of the effect.
...
note: the fill keyword needs to be included if you want the element's content to be visible.
object-fit - CSS: Cascading Style Sheets
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetobject-fitchrome full support 31edge full support 16
notes full support 16
notes
notes edge supports object-fit on img elements only.
...nted with the vendor prefix: -o-safari ios full support 10samsung internet android full support 2.0legend full support full support no support no supportsee implementation
notes.see implementation
notes.requires a vendor prefix or different name for use.requires a vendor prefix or different name for use.
<resolution> - CSS: Cascading Style Sheets
the <resolution> css data type, used for describing resolutions in media queries, de
notes the pixel density of an output device, i.e., its resolution.
...
note: although the number 0 is always the same regardless of unit, the unit may not be omitted.
text-decoration - CSS: Cascading Style Sheets
be careful when removing the text decoration on anchors since users often depend on the underline to de
note hyperlinks.</p> <p class="underover">this text has lines above <em>and</em> below it.</p> <p class="thick">this text has a really thick purple underline in supporting browsers.</p> <p class="blink">this text might blink for you, depending on the browser you use.</p> specifications specification status comment css text decoration module level 4 working draft...
... adds text-decoration-thickness;
note that this isn't yet officially part of the shorthand — this is as yet unspecified.
text-rendering - CSS: Cascading Style Sheets
/* keyword values */ text-rendering: auto; text-rendering: optimizespeed; text-rendering: optimizelegibility; text-rendering: geometricprecision; /* global values */ text-rendering: inherit; text-rendering: initial; text-rendering: unset;
note: the text-rendering property is an svg property that is not defined in any css standard.
...
note: webkit precisely applies the specified value, but gecko treats the value the same as optimizelegibility.
<time> - CSS: Cascading Style Sheets
note: although the number 0 is always the same regardless of unit, the unit may not be omitted.
...
note: conversion between s and ms follows the logical 1s = 1000ms.
matrix() - CSS: Cascading Style Sheets
note: matrix(a, b, c, d, tx, ty) is a shorthand for matrix3d(a, b, 0, 0, c, d, 0, 0, 0, 0, 1, 0, tx, ty, 0, 1).
...
note: until firefox 16, gecko accepted a <length> value for tx and ty.
rotate3d() - CSS: Cascading Style Sheets
note: unlike rotations in the 2d plane, the composition of 3d rotations is usually not commutative.
...a positive angle de
notes a clockwise rotation, a negative angle a counter-clockwise one.
translateZ() - CSS: Cascading Style Sheets
note: translatez(tz) is equivalent to translate3d(0, 0, tz).
...
note if the perspective() value is less than the translatez() value, such as transform: perspective(200px) translatez(300px); the transformed element will not be visible as it is further than the user's viewport.
Event reference
note that this is deprecated, and newer implementations use mozbrowsercaretstatechanged instead.
... ussdreceived firefox os specific a new ussd message is received mscontentzoom microsoft specific msmanipulationstatechanged microsoft specific mspointerhover microsoft specific mozilla-specific events
note: these events are never exposed to web content and can only be used in a xul chrome content context.
Video player styling basics - Developer guides
note: in some cases some basic css is omitted from the code examples here as its use is either obvious or not specifically relevant to styling the video player.
... a new function called checkvolume(): var checkvolume = function(dir) { if (dir) { var currentvolume = math.floor(video.volume * 10) / 10; if (dir === '+') { if (currentvolume < 1) video.volume += 0.1; } else if (dir === '-') { if (currentvolume > 0) video.volume -= 0.1; } // if the volume has been turned off, also set it as muted //
note: can only do this with the custom control set as when the 'volumechange' event is raised, there is no way to know if it was via a volume or a mute change if (currentvolume <= 0) video.muted = true; else video.muted = false; } changebuttonstate('mute'); } var altervolume = function(dir) { checkvolume(dir); } this new checkvolume() function does the same thing as the altervolu...
Web Audio playbackRate explained - Developer guides
note: try out this example live, and try adjusting the playback rate control to see the effect.
... browser support chrome 20+ ✔ firefox 20+ ✔ ie 9+ ✔ safari 6+ ✔ opera 15+ ✔ mobile chrome (android) ✖ mobile firefox 24+ ✔ ie mobile ✖ mobile safari 6+ (ios) ✔ opera mobile ✖
notes most browsers stop playing audio outside playbackrate bounds of 0.5 and 4, leaving the video playing silently.
Writing Web Audio API code that works in every browser - Developer guides
thus, start is mapped to
noteon, stop to
noteoff, and so on.
...in the meantime, you can explicitly specify 'equalpower' instead: var panner = new audiocontext.pannernode(); panner.panningmodel = 'equalpower';
note that there's a list of projects built with the web audio api, specifying which ones use the standard audiocontext and which browsers do they work on.
Block formatting context - Developer guides
note: a flex/grid container(display: flex/grid/inline-flex/inline-grid) establishes a new flex/grid formatting context, which is similar to block formatting context except layout.
...
note that flexbox is a more efficient way to implement muti columns layout in morden css.
Content categories - Developer guides
note: a more detailed discussion of these content categories and their comparative functionalities is beyond the scope of this article; for that, you may wish to read the relevant portions of the html specification.
...
note: the <hgroup> element was removed from the w3c html specification prior to html 5 being finalized, but is still part of the whatwg specification and is at least partially supported by most browsers.
Using HTML sections and outlines - Developer guides
also
note that the <time> element has not been included, because the default styling for it in a non-html5 browser is the same as the one in an html5-compatible one.
...createelement("section"); document.createelement("time"); </script> <![endif]--> <noscript> <p><strong>this web page requires javascript to be enabled.</strong></p> <p>javascript is an object-oriented computer programming language commonly used to create interactive effects within web browsers.</p> <p><a href="https://goo.gl/koeeaj">how to enable javascript?</a></p> </noscript>
note: this code will also cause the html validator to return errors.
Localizations and character encodings - Developer guides
note that the fallback encoding as defined by the previous sentence does not necessarily need to be able to represent the characters needed for the language of the localization!
...
note that firefox no longer sends the accept-charset http header, so there is no need to consider what gets advertised in accept-charset when setting the fallback encoding.
Printing - Developer guides
note: you can also use window.onbeforeprint and window.onafterprint to assign handlers for these events, but using eventtarget.addeventlistener() is preferred.
... = "0"; ohiddframe.style.bottom = "0"; ohiddframe.style.width = "0"; ohiddframe.style.height = "0"; ohiddframe.style.border = "0"; ohiddframe.src = surl; document.body.appendchild(ohiddframe); } </script> </head> <body> <p><span onclick="printpage('externalpage.html');" style="cursor:pointer;text-decoration:underline;color:#0000ff;">print external page!</span></p> </body> </html>
note: older versions of internet explorer cannot print the contents of a hidden <iframe>.
HTML attribute: capture - HTML: Hypertext Markup Language
environment the outward-facing camera and/or microphone should be used
note: capture was previously a boolean attribute which, if present, requested that the device's media capture device(s) such as camera or microphone be used instead of requesting a file input.
...ndfile">what does your voice sound like?:</label> <input type="file" id="soundfile" capture="user" accept="audio/*"> </p> <p> <label for="videofile">upload a video:</label> <input type="file" id="videofile" capture="environment" accept="video/*"> </p> <p> <label for="imagefile">upload a photo of yourself:</label> <input type="file" id="imagefile" capture="user" accept="image/*"> </p>
note these work better on mobile devices; if your device is a desktop computer, you'll likely get a typical file picker.
disabled - HTML: Hypertext Markup Language
note: if a <fieldset> is disabled, the descendant form controls are all disabled, with the exception of form controls within the <legend>.
...
note: the required attribute is not permitted on inputs with the disabled attribute specified.
HTML attribute: multiple - HTML: Hypertext Markup Language
data"> <p> <label for="uploads"> choose the images you want to upload: </label> <input type="file" id="uploads" name="uploads" accept=".jpg, .jpeg, .png, .svg, .gif" multiple> </p> <p> <label for="text">pick a text file to upload: </label> <input type="file" id="text" name="text" accept=".txt"> </p> <p> <input type="submit" value="submit"> </p> </form>
note the difference in appearance between the example with multiple set and the other file input without.
... id="favoriteonly"> <option>grumpy@woodworkers.com</option> <option>happy@woodworkers.com</option> <option>sleepy@woodworkers.com</option> <option>bashful@woodworkers.com</option> <option>sneezy@woodworkers.com</option> <option>dopey@woodworkers.com</option> <option>doc@woodworkers.com</option> </select> </p> <p> <input type="submit" value="submit"> </p> </form>
note the difference in appearance between the two form controls.
HTML attribute: readonly - HTML: Hypertext Markup Language
note: only text controls can be made read-only, since for other controls (such as checkboxes and buttons) there is no useful distinction between being read-only and being disabled, so the readonly attribute does not apply.
...
note: the required attribute is not permitted on inputs with the readonly attribute specified.
HTML attribute: required - HTML: Hypertext Markup Language
note color and range don't support required, but type color defaults to #00000, and range defaults to the midpoint between min and max -- with min and max defaulting to 0 and 100 respectively in most browsers if not declared -- so always has a value.
...
note: setting aria-required="true" tells a screen reader that an element (any element) is required, but has no bearing on the optionality of the element.
Date and time formats used in HTML - HTML: Hypertext Markup Language
week and year (date range) 2001-w37 week 37, 2001 (september 10-16, 2001) 1953-w01 week 1, 1953 (december 29, 1952-january 4, 1953) 1948-w53 week 53, 1948 (december 27, 1948-january 2, 1949) 1949-w01 week 1, 1949 (january 3-9, 1949) 0531-w16 week 16, 531 (april 13-19, 531) 0042-w04 week 4, 42 (january 21-27, 42)
note that both the year and week numbers are padded with leading zeroes, with the year padded to four digits and the week to two.
...
note that the normalized form of this date drops the ":00" indicating the number of seconds to be zero, because the seconds are optional when zero, and the normalized string minimizes the length of the string.
<acronym> - HTML: Hypertext Markup Language
usage
note: this element has been removed in html5 and shouldn't be used anymore.
... implementation
note: up to gecko 1.9.2 inclusive, firefox implements the htmlspanelement interface for this element.
<center>: The Centered Text element (obsolete) - HTML: Hypertext Markup Language
implementation
note: up to gecko 1.9.2 inclusive, firefox implements the htmlspanelement interface for this element.
...<p>so will this paragraph.</p></div> example 3 (css alternative) <p style="text-align:center">this line will be centered.<br> and so will this line.</p>
note applying text-align:center to a <div> or <p> element centers the contents of those elements while leaving their overall dimensions unchanged.
<col> - HTML: Hypertext Markup Language
note: to achieve the same effect as the left, center, right or justify values: do not try to set the text-align property on a selector giving a <col> element.
...
note: do not try to set the vertical-align property on a selector giving a <col> element.
<details>: The Details disclosure element - HTML: Hypertext Markup Language
note: the common use of a triangle which rotates or twists around to represent opening or closing the widget is why these are sometimes called "twisties." a <details> widget can be in one of two states.
...
note: unfortunately, at this time there's no built-in way to animate the transition between open and closed.
<embed>: The Embed External Content element - HTML: Hypertext Markup Language
note: this topic documents only the element that is defined as part of html5.
... usage
notes you can use the object-position property to adjust the positioning of the embedded object within the element's frame, and the object-fit property to control how the object's size is adjusted to fit within the frame.
<footer> - HTML: Hypertext Markup Language
note that a <footer> element must not be a descendant of an <address>, <header> or another <footer> element.
... usage
notes enclose information about the author in an <address> element that can be included into the <footer> element.
<header> - HTML: Hypertext Markup Language
note that a <header> element must not be a descendant of an <address>, <footer> or another <header> element.
... implicit aria role banner, or no corresponding role if a descendant of an article, aside, main, nav or section element, or an element with role=article, complementary, main, navigation or region permitted aria roles group, presentation or none dom interface htmlelement usage
notes the <header> element is not sectioning content and therefore does not introduce a new section in the outline.
<iframe>: The Inline Frame element - HTML: Hypertext Markup Language
notes about sandboxing: when the embedded document has the same origin as the embedding page, it is strongly discouraged to use both allow-scripts and allow-same-origin, as that lets the embedded document remove the sandbox attribute — making it no more secure than not using the sandbox attribute at all.
...also
note that programatically removing an <iframe>'s src attribute (e.g.
<input type="color"> - HTML: Hypertext Markup Language
note: setting the value to anything that isn't a valid, fully-opaque, rgb color in hexadecimal notation will result in the value being set to #000000.
...
note: any web browser that doesn't support an input of type color will naturally fall back to the type text.
<keygen> - HTML: Hypertext Markup Language
(
note that only a subset of the curves named there may actually be supported in any particular browser.) if the keyparams parameter string is not a recognized curve name string, then a curve is chosen according to the user's chosen key strength (low, medium, high), using the curve named "secp384r1" for high, and the curve named "secp256r1" for medium keys.
... (
note: choice of the number of key strengths, default values for each strength, and the ui by which the user is offered a choice, are outside of the scope of this specification.) the <keygen> element is only valid within an html form.
<label> - HTML: Hypertext Markup Language
<input type="checkbox" name="peas"> </label> other usage
notes: the form control that the label is labeling is called the labeled control of the label element.
...
note: a <label> element can have both a for attribute and a contained control element, as long as the for attribute points to the contained control element.
<li> - HTML: Hypertext Markup Language
note: this attribute was deprecated in html4, but reintroduced in html5.
...
note: this attribute has been deprecated; use the css list-style-type property instead.
<meta>: The Document-level Metadata element - HTML: Hypertext Markup Language
note: the attribute name has a specific meaning for the <meta> element, and the itemprop attribute must not be set on the same <meta> element that has any existing name, http-equiv or charset attributes.
...
note: can only be used in documents served with a text/html mime type — not in documents served with an xml mime type.
<meter>: The HTML Meter element - HTML: Hypertext Markup Language
note: unless the value attribute is between 0 and 1 (inclusive), the min and max attributes should define the range so that the value attribute's value is within it.
... examples simple example html <p>heat the oven to <meter min="200" max="500" value="350">350 degrees</meter>.</p> result on google chrome, the resulting meter looks like this: high and low range example
note that in this example the min attribute is omitted.
<ol>: The Ordered List element - HTML: Hypertext Markup Language
note: unless the type of the list number matters (like legal or technical documents where items are referenced by their number/letter), use the css list-style-type property instead.
... usage
notes typically, ordered list items display with a preceding marker, such as a number or letter.
<picture>: The Picture element - HTML: Hypertext Markup Language
usage
notes you can use the object-position property to adjust the positioning of the image within the element's frame, and the object-fit property to control how the image is resized to fit within the frame.
...
note: use these properties on the child <img> element, not the <picture> element.
<s> - HTML: Hypertext Markup Language
implementation
note: up to gecko 1.9.2 inclusive, firefox implements the htmlspanelement interface for this element.
... short
note on making your mark (more accessible) | the paciello group tweaking text level styles | adrian roselli specifications specification status comment html living standardthe definition of 's element' in that specification.
<source>: The Media or Image Source element - HTML: Hypertext Markup Language
please
note that sizes will have its effect only if width dimension descriptors are provided with srcset instead of pixel ratio values (200w instead of 2x for example).
... usage
notes the <source> element is an empty element (or void element), which means that it not only has no content but also has no closing tag.
<tr>: The Table Row element - HTML: Hypertext Markup Language
note the use of rowspan on to make the "name", "id", and "balance" headers occupy two rows instead of just one, and the use of colspan to make the "membership dates" header cell span across two columns.
...
note the use of rowspan on to make the "name", "id", and "balance" headers occupy two rows instead of just one, and the use of colspan to make the "membership dates" header cell span across two columns.
<var>: The Variable element - HTML: Hypertext Markup Language
usage
notes related elements other elements that are used in contexts in which <var> is commonly used include: <code>: the html code element <kbd>: the html keyboard input element <samp>: the html sample output element if you encounter code that is mistakenly using <var> for style purposes rather than semantic purposes, you should either use a <span> with appropriate css or, an appropriate semantic...
...this can be overridden in css, like this: var { font: bold 15px "courier", "courier new", monospace; } examples basic example here's a simple example, using <var> to de
note variable names in a mathematical equation.
itemprop - HTML: Hypertext Markup Language
an item with two properties, "favorite-color" and "favorite-fruit", both set to the value "orange" <div itemscope> <span itemprop="favorite-color favorite-fruit">orange</span> </div>
note: there is no relationship between the microdata and the content of the document where the microdata is marked up.
...
note: the rules above disallow ":" characters in non-url values because otherwise they could not be distinguished from urls.
itemscope - HTML: Hypertext Markup Language
note: find more about itemtype attributes at http://schema.org/thing simple example html the following example specifies the itemscope attribute.
...op name carol smith itemscope itemprop[itemtype] aggregaterating [aggregaterating] itemprop ratingvalue 4.0 itemprop reviewcount 35 itemscope itemprop[itemtype] nutrition [nutritioninformation] itemprop servingsize 1 medium slice itemprop calories 250 cal itemprop fatcontent 12 g
note: a handy tool for extracting microdata structures from html is google's structured data testing tool.
itemtype - HTML: Hypertext Markup Language
note: more about itemtype attributes can be found at http://schema.org/thing the itemtype attribute must have a value that is an unordered set of unique tokens which are case-sensitive, each is a valid and absolute url, and all defined to use the same vocabulary.
... 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 structures from html is google's structured data testing tool.
style - HTML: Hypertext Markup Language
note that it is recommended for styles to be defined in a separate file or files.
... usage
note: this attribute must not be used to convey semantic information.
Content Security Policy (CSP) - HTTP
content-security-policy: default-src 'self'; img-src *; media-src media1.com media2.com; script-src userscripts.example.com here, by default, content is only permitted from the document's origin, with the following exceptions: images may load from anywhere (
note the "*" wildcard).
... content-security-policy: default-src 'self' *.mailsite.com; img-src *
note that this example doesn't specify a script-src; with the example csp, this site uses the setting specified by the default-src directive, which means that scripts can be loaded only from the originating server.
Accept-CH - HTTP
note: client hints are accessible only on secure origins (via tls).
... syntax accept-ch: <list of client hints> examples accept-ch: dpr, viewport-width accept-ch: width accept-ch-lifetime: 86400 vary: dpr, viewport-width, width
note: remember to vary the response based on the accepted client hints.
Accept-Encoding - HTTP
notes: an iana registry maintains a complete list of official content encodings.
...
note that the first one was discontinued due to patent licensing problems.
Accept-Patch - HTTP
notes: an iana registry maintains a complete list of official content encodings.
...
note that the first one was discontinued due to patent licensing problems.
CSP: connect-src - HTTP
note: connect-src 'self' does not resolve to websocket schemas in all browsers, more info: https://github.com/w3c/webappsec-csp/issues/7 csp version 1 directive type fetch directive default-src fallback yes.
...when generating the hash, don't include the <script> or <style> tags and
note that capitalization and whitespace matter, including leading or trailing whitespace.
CSP: navigate-to - HTTP
note: if the form-action directive is present, the navigate-to directive will not act on navigations that are form submissions.
...when generating the hash, don't include the <script> or <style> tags and
note that capitalization and whitespace matter, including leading or trailing whitespace.
Feature-Policy: screen-wake-lock - HTTP
note: this api is still actively being developed and available only behind a flag on select browsers and platforms.
...
note: in earlier specification drafts this directive was called wake-lock.
Feature-Policy: wake-lock - HTTP
note: this api is still actively being developed and available only behind a flag on select browsers and platforms.
...
note: latest drafts of screen wake lock api defines screen-wake-lock directive.
Set-Cookie - HTTP
(however, confidential information should never be stored in http cookies, as the entire mechanism is inherently insecure and doesn't encrypt any information.)
note: insecure sites (http:) can't set cookies with the secure attribute (since chrome 52 and firefox 52).
...
note that a cookie that has been created with httponly will still be sent with javascript-initiated requests, e.g.
Strict-Transport-Security - HTTP
note: the strict-transport-security header is ignored by the browser when your site is accessed using http; this is because an attacker may intercept http connections and inject the header or remove it.
...
note that 1 year is acceptable for a domain to be included in browsers' hsts preload lists.
Upgrade - HTTP
for example, the client might send a get request as shown, listing the preferred protocols to switch to (in this case "example/1" and "foo/2"): get /index.html http/1.1 host: www.example.com connection: upgrade upgrade: example/1, foo/2
note: connection: upgrade must be set whenever upgrade is sent.
... syntax connection: upgrade upgrade: protocol_name[/protocol_version]
notes: the connection header with type upgrade must always be sent with the upgrade header (as shown above).
HTTP headers - HTTP
note that only hop-by-hop headers may be set using the connection general header.
...(
note: related ms edge bug).
HTTP response status codes - HTTP
also
note that some servers merely shut down the connection without sending this message.
...
note that together with this response, a user-friendly page explaining the problem should be sent.
Control flow and error handling - JavaScript
the following code throws several exceptions of varying types: throw 'error2'; // string type throw 42; // number type throw true; // boolean type throw {tostring: function() { return "i'm an object!"; } };
note: you can specify an object when you throw an exception.
... it is also important to
note that the finally block will execute whether or not an exception is thrown.
Iterators and generators - JavaScript
terationcount, done: true } } }; return rangeiterator; } using the iterator then looks like this: const it = makerangeiterator(1, 10, 2); let result = it.next(); while (!result.done) { console.log(result.value); // 1 3 5 7 9 result = it.next(); } console.log("iterated over sequence of size: ", result.value); // [5 numbers returned, that took interval in between: 0 to 10]
note: it is not possible to know reflectively whether a particular object is an iterator.
...
note: a value passed to the first invocation of next() is always ignored.
Numbers and dates - JavaScript
decimal numbers 1234567890 42 // caution when using leading zeros: 0888 // 888 parsed as decimal 0777 // parsed as octal in non-strict mode (511 in decimal)
note that decimal literals can start with a zero (0) followed by another decimal digit, but if every digit after the leading 0 is smaller than 8, the number gets parsed as an octal number.
...for example, if you want to use the trigonometric function sine, you would write math.sin(1.56)
note that all trigonometric methods of math take arguments in radians.
Assertions - JavaScript
note that a matched word boundary is not included in the match.
... other assertions
note: the ?
Character classes - JavaScript
note that the m multiline flag doesn't change the dot behavior.
... var nonenglishtext = "Приключения Алисы в Стране чудес"; var regexpbmpword = /([\u0000-\u0019\u0021-\uffff])+/gu; // bmp goes through u+0000 to u+ffff but space is u+0020 console.table(nonenglishtext.match(regexpbmpword)); [ 'Приключения', 'Алисы', 'в', 'Стране', 'чудес' ]
note for mdn editors: please do not try to add funny examples with emoji as those characters are not handled by the platform (kuma).
Inheritance and the prototype chain - JavaScript
please
note that the code below is free-standing (it is safe to assume there is no other javascript on the webpage other than the below code).
...
note: it is not enough to check whether a property is undefined.
Classes - JavaScript
// unnamed let rectangle = class { constructor(height, width) { this.height = height; this.width = width; } }; console.log(rectangle.name); // output: "rectangle" // named let rectangle = class rectangle2 { constructor(height, width) { this.height = height; this.width = width; } }; console.log(rectangle.name); // output: "rectangle2"
note: class expressions are subject to the same hoisting restrictions as described in the class declarations section.
... // for similar methods, the child's method takes precedence over parent's method
note that classes cannot extend regular (non-constructible) objects.
Arrow function expressions - JavaScript
however,
note that in // this example we are not assigning `length` value to the made up property.
... correction: start
note: the previous statement seems false.
setter - JavaScript
note the following when working with the set syntax: it can have an identifier which is either a number or a string; it must have exactly one parameter (see incompatible es5 change: literal getter and setter functions must now have exactly zero or one arguments for more information); it must not appear in an object literal with another set or with a data entry for the same property.
...when current is assigned a value, it updates log with that value: const language = { set current(name) { this.log.push(name); }, log: [] } language.current = 'en'; console.log(language.log); // ['en'] language.current = 'fa'; console.log(language.log); // ['en', 'fa']
note that current is not defined, and any attempts to access it will result in undefined.
Array() constructor - JavaScript
note that this special case only applies to javascript arrays created with the array constructor, not array literals created with the bracket syntax.
... arraylength if the only argument passed to the array constructor is an integer between 0 and 232-1 (inclusive), this returns a new javascript array with its length property set to that number (
note: this implies an array of arraylength empty slots, not slots with actual undefined values).
Array.prototype.reduce() - JavaScript
note: if initialvalue is not provided, reduce() will execute the callback function starting at index 1, skipping the first index.
...ill contain all friends' books + // additional list contained in initialvalue let allbooks = friends.reduce(function(accumulator, currentvalue) { return [...accumulator, ...currentvalue.books] }, ['alphabet']) // allbooks = [ // 'alphabet', 'bible', 'harry potter', 'war and peace', // 'romeo and juliet', 'the lord of the rings', // 'the shining' // ] remove duplicate items in an array
note: if you are using an environment compatible with set and array.from(), you could use let orderedarray = array.from(new set(myarray)) to get an array where duplicate items have been removed.
Array.prototype.includes() - JavaScript
note: when comparing strings and characters, includes() is case-sensitive.
...
note: technically speaking, includes() uses the samevaluezero algorithm to determine whether the given element is found.
Array.prototype.indexOf() - JavaScript
note: if the provided index is negative, the array is still searched from front to back.
...
note: for the string method, see string.prototype.indexof().
Array.prototype.push() - JavaScript
note that we don't create an array to store a collection of objects.
...obj.addelem({}) obj.addelem({}) console.log(obj.length) // → 2
note that although obj is not an array, the method push successfully incremented obj's length property just like if we were dealing with an actual array.
AsyncFunction - JavaScript
note that asyncfunction is not a global object.
...
note: async functions created with the asyncfunction constructor do not create closures to their creation contexts; they are always created in the global scope.
Error.prototype.stack - JavaScript
(
note that the error object also possesses the filename, linenumber and columnnumber properties for retrieving these from the error thrown (but only the error, and not its trace).)
note that this is the format used by firefox.
...
note that if string arguments were passed in with values such as "@", "(", ")" (or if in file names), you could not easily rely on these for breaking the line into its component parts.
Function.prototype.bind() - JavaScript
according to ecma-262, name of the returned bound function should be "bound " + name of target function (
note the space character).
...ll below, // works fine with native bind: const yaxispoint = point.bind(null, 0/*x*/); const emptyobj = {}; const yaxispoint = point.bind(emptyobj, 0/*x*/); const axispoint = new yaxispoint(5); axispoint.tostring(); // '0,5' axispoint instanceof point; // true axispoint instanceof yaxispoint; // true new yaxispoint(17, 42) instanceof point; // true
note that you need not do anything special to create a bound function for use with new.
GeneratorFunction - JavaScript
note that generatorfunction is not a global object.
...
note: generator function created with the generatorfunction constructor do not create closures to their creation contexts; they are always created in the global scope.
Intl.DateTimeFormat.prototype.format() - JavaScript
note that the function is bound to the intl.datetimeformat from which it was obtained, so it can be passed directly to array.prototype.map().
...ct to be able to compare the results of format() to a static value: let d = new date("2019-01-01t00:00:00.000000z"); let formatteddate = intl.datetimeformat(undefined, { year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric' }).format(d); "1.1.2019, 01:00:00" === formatteddate; // true in firefox and others // false in ie and edge
note: see also this stackoverflow thread for more details and examples.
Map - JavaScript
note: as of es5, this can be bypassed by using object.create(null), but this is seldom done.
...
note: since ecmascript 2015, objects do preserve creation order for string and symbol keys.
Object.assign() - JavaScript
note: object.assign() does not throw on null or undefined sources.
...//
note, only string wrappers can have own enumerable properties.
Proxy - JavaScript
const target = {}; const p = new proxy(target, {}); p.a = 37; // operation forwarded to the target console.log(target.a); // 37 // (the operation has been properly forwarded!)
note that while this "no-op" works for javascript objects, it does not work for native browser objects like dom elements.
...bj[prop] = newval; // indicate success return true; } }); let i1 = view.selected = document.getelementbyid('item-1'); //giving error here, i1 is null console.log(i1.getattribute('aria-selected')); // 'true' let i2 = view.selected = document.getelementbyid('item-2'); console.log(i1.getattribute('aria-selected')); // 'false' console.log(i2.getattribute('aria-selected')); // 'true'
note: even if selected: !null, then giving oldval.setattribute is not a function value correction and an extra property the products proxy object evaluates the passed value and converts it to an array if needed.
RegExp - JavaScript
for example, the following are equivalent: let re = /\w+/ let re = new regexp('\\w+') perl-like regexp properties
note that several of the regexp properties have both long and short (perl-like) names.
... let text = 'some text\nand some more\r\nand yet\rthis is the end' let lines = text.split(/\r\n|\r|\n/) console.log(lines) // logs [ 'some text', 'and some more', 'and yet', 'this is the end' ]
note that the order of the patterns in the regular expression matters.
Planned changes to shared memory - JavaScript
note that setting the cross-origin-resource-policy header to any other value than same-origin opens up the resource to potential attacks, such as spectre.
...
note that the cross-origin-opener-policy header limits your ability to retain a reference to popups.
String.prototype.indexOf() - JavaScript
note: for the array method, see array.prototype.indexof().
...for example, the following expression returns -1: 'blue whale'.indexof('blue') // returns -1 checking occurrences
note that 0 doesn't evaluate to true and -1 doesn't evaluate to false.
String.prototype.replaceAll() - JavaScript
note that this is 1-indexed.
...(
note: the above-mentioned special replacement patterns do not apply in this case.)
note that the function will be invoked multiple times for each full match to be replaced if the regular expression in the first parameter is global.
WeakRef - JavaScript
note: please see the avoid where possible section below.
...
notes on weakrefs some
notes on weakrefs: if your code has just created a weakref for a target object, or has gotten a target object from a weakref's deref method, that target object will not be reclaimed until the end of the current javascript job (including any promise reaction jobs that run at the end of a script job).
WeakSet - JavaScript
note: this also means that there is no list of current objects stored in the collection.
... examples using the weakset object const ws = new weakset(); const foo = {}; const bar = {}; ws.add(foo); ws.add(bar); ws.has(foo); // true ws.has(bar); // true ws.delete(foo); // removes foo from the set ws.has(foo); // false, foo has been removed ws.has(bar); // true, bar is retained
note that foo !== bar.
encodeURI() - JavaScript
note how certain characters are used to signify special meaning: http://username:password@www.example.com:80/path/to/file.php?foo=316&bar=this+has+spaces#anchor hence encodeuri() does not encode characters that are necessary to formulate a complete uri.
... + space console.log(encodeuri(set1)); // ;,/?:@&=+$# console.log(encodeuri(set2)); // -_.!~*'() console.log(encodeuri(set3)); // abc%20abc%20123 (the space gets encoded as %20) console.log(encodeuricomponent(set1)); // %3b%2c%2f%3f%3a%40%26%3d%2b%24%23 console.log(encodeuricomponent(set2)); // -_.!~*'() console.log(encodeuricomponent(set3)); // abc%20abc%20123 (the space gets encoded as %20)
note that encodeuri() by itself cannot form proper http get and post requests, such as for xmlhttprequest, because "&", "+", and "=" are not encoded, which are treated as special characters in get and post requests.
Iteration protocols - JavaScript
note that when this zero-argument function is called, it is invoked as a method on the iterable object.
...
note: it is not possible to know reflectively whether a particular object implements the iterator protocol.
Comma operator (,) - JavaScript
usage
notes you can use the comma operator when you want to include multiple expressions in a location that requires a single expression.
... the following code prints the values of the diagonal elements in the array: for (var i = 0, j = 9; i <= 9; i++, j--) console.log('a[' + i + '][' + j + '] = ' + a[i][j]);
note that the comma operators in assignments may appear not to have the normal effect of comma operators because they don't exist within an expression.
Logical OR assignment (||=) - JavaScript
in other words, x ||= y is equivalent to: x || (x = y); and not equivalent to the following which would always perform an assignment: x = x || y;
note that this behavior is different to mathematical and bitwise assignment operators.
...
note: pay attention to the value returned by the api you're checking against.
Object initializer - JavaScript
} }; which is equivalent to this es5-like notation (but
note that ecmascript 5 has no generators): let o = { generator: function* () { ...........
... let obj1 = { foo: 'bar', x: 42 } let obj2 = { foo: 'baz', y: 13 } let clonedobj = { ...obj1 } // object { foo: "bar", x: 42 } let mergedobj = { ...obj1, ...obj2 } // object { foo: "baz", x: 42, y: 13 }
note that object.assign() triggers setters, whereas the spread operator doesn't!
Optional chaining (?.) - JavaScript
using optional chaining with function calls causes the expression to automatically return undefined instead of throwing an exception if the method isn't found: let result = someinterface.custommethod?.();
note: if there is a property with such a name and which is not a function, using ?.
...
note: if someinterface itself is null or undefined, a typeerror exception will still be raised (someinterface is null).
instanceof - JavaScript
/ true, because: c.prototype instanceof object // true c.prototype = {} let o2 = new c() o2 instanceof c // true // false, because c.prototype is nowhere in // o's prototype chain anymore o instanceof c d.prototype = new c() // add c to [[prototype]] linkage of d let o3 = new d() o3 instanceof d // true o3 instanceof c // true since c.prototype is now in o3's prototype chain
note that the value of an instanceof test can change based on changes to the prototype property of constructors.
...
note for mozilla developers: in code using xpcom, instanceof has special effect: obj instanceof xpcominterface (e.g.
typeof - JavaScript
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.
...r'; typeof nan === 'number'; // despite being "not-a-number" typeof number('1') === 'number'; // number tries to parse things into numbers typeof number('shoe') === 'number'; // including values that cannot be type coerced to a number typeof 42n === 'bigint'; // strings typeof '' === 'string'; typeof 'bla' === 'string'; typeof `template literal` === 'string'; typeof '1' === 'string'; //
note that a number within a string is still typeof string typeof (typeof 1) === 'string'; // typeof always returns a string typeof string(1) === 'string'; // string converts anything into a string, safer than tostring // booleans typeof true === 'boolean'; typeof false === 'boolean'; typeof boolean(1) === 'boolean'; // boolean() will convert values based on if they're truthy or falsy typeof !!(1) ==...
void operator - JavaScript
it should be
noted that the precedence of the void operator should be taken into account and that parentheses can help clarify the resolution of the expression following the void operator: void 2 == '2'; // (void 2) == '2', returns false void (2 == '2'); // void (2 == '2'), returns undefined examples immediately invoked function expressions when using an immediately-invoked function expression, void can be ...
...for example: <a href="javascript:void(0);"> click here to do nothing </a> <a href="javascript:void(document.body.style.backgroundcolor='green');"> click here for green background </a>
note: javascript: pseudo protocol is discouraged over other alternatives, such as unobtrusive event handlers.
if...else - JavaScript
note that there is no elseif (in one word) keyword in javascript.
...for example: var b = new boolean(false); if (b) // this condition is truthy examples using if...else if (cipher_char === from_char) { result = result + to_char; x++; } else { result = result + clear_char; } using else if
note that there is no elseif syntax in javascript.
import.meta - JavaScript
note that this will include query parameters and/or hash (i.e., following the ?
...html: <script type="module"> import './index.mjs?someurlinfo=5'; </script> ..the following javascript file will log the `someurlinfo parameter: // index.mjs new url(import.meta.url).searchparams.get('someurlinfo'); // 5 the same applies when a file imports another: // index.mjs import './index2.mjs?someurlinfo=5'; // index2.mjs new url(import.meta.url).searchparams.get('someurlinfo'); // 5
note that while node.js will pass on query parameters (or the hash) as in the latter example, as of node 14.1.0, a url with query parameters will err when loading in the form node --experimental-modules index.mjs?someurlinfo=5 (it is treated as a file rather than a url in this context).
label - JavaScript
note: labeled loops or blocks are very uncommon.
...
note that javascript has no goto statement, you can only use labels with break or continue.
categories - Web app manifests
note: categories are used only as hints for catalogs or stores listing web applications.
...
note: categories values are lower-cased by the stores and catalogs before processing, so "news" and "news" are treated as the same value.
display - Web app manifests
note: if the display member is not specified, it defaults to browser.
...
note: you can selectively apply css to your app based on the display mode, using the display-mode media feature.
orientation - Web app manifests
note: orientation and/or its specific values might not be supported by a user agent on various display modes because supporting them does not make sense for the particular context.
...
note: the orientation can be changed at runtime via the screen orientation api.
Web app manifests
ges/touch/homescreen192.png", "sizes": "192x192", "type": "image/png" }], "related_applications": [{ "platform": "play", "url": "https://play.google.com/store/apps/details?id=cheeaun.hackerweb" }] } deploying a manifest web app manifests are deployed in your html pages using a <link> element in the <head> of a document: <link rel="manifest" href="/manifest.webmanifest">
note: the .webmanifest extension is specified in the media type registration section of the specification (the response of the manifest file should return content-type: application/manifest+json).
...
note: if the manifest requires credentials to fetch - the crossorigin attribute must be set to use-credentials, even if the manifest file is in the same origin as the current page.
MathML attribute reference - MathML
notes: the mathml <mstyle> and <math> elements accept all attributes of all mathml presentation elements.
... see values for
notes on values and units in mathml.
MathML documentation index - MathML
note that this error is not thrown when your mathml markup is wrong or not well-formed xml.
...
note that quotation marks should not be specified unless they are part of the string literal.
CSS and JavaScript animation performance - Web Performance
developers can create an animation by simply changing an element's style each time the loop is called (or updating the canvas draw, or whatever.)
note: like css transitions and animations, requestanimationframe() pauses when the current tab is pushed into the background.
...
note: in nightly/developer edition, you should see that omta is enabled by default, so you might have to do the tests the other way around (test with it enabled first, then disable to test without omta.) summary browsers are able to optimize rendering flows.
Media - Progressive web apps (PWAs)
e:hover any e element that has the pointer over it e:focus any e element that has keyboard focus e:active the e element that is involved in the current user action e:link any e element that is a hyperlink to a url that the user has not visited recently e:visited any e element that is a hyperlink to a url that the user has visited recently
note: the information that can be obtained from the :visited selector is restricted in gecko 2.0.
... action: printing a document
note: this snippet only works on firefox since it erroneously increments the css counter for fix-position elemnts.
Applying SVG effects to HTML content - SVG: Scalable Vector Graphics
note: references to svg in external files must be to the same origin as the referencing document.
...gradient-1" y2="1"> <stop stop-color="white" offset="0"/> <stop stop-opacity="0" offset="1"/> </lineargradient> <circle cx="0.25" cy="0.25" r="0.25" id="circle" fill="white"/> <rect x="0.5" y="0.2" width="300" height="100" fill="url(#gradient-1)"/> </mask> </svg> .target { mask: url(#mask-1); } p { width: 300px; border: 1px solid #000; display: inline-block; }
note that in the css, the mask is specified using a url to the id #mask-1, which is the id of the svg mask specified below it.
cap-height - SVG: Scalable Vector Graphics
note: it was specified to share the syntax and semantics of the obsolete cap-height descriptor of the @font-face at-rule defined in an early version of css 2.
... only one element is using this attribute: <font-face> usage
notes value <number> default value none animatable no specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'cap-height' in that specification.
color-profile - SVG: Scalable Vector Graphics
note: as a presentation attribute, color-profile can be used as a css property.
... as a presentation attribute, it can be applied to any element but it only has an effect on the following element: <image> usage
notes value auto | srgb | <name> | <iri> default value auto animatable yes auto all colors are presumed to be defined in the srgb color space unless a more precise embedded profile is specified within content data.
color-rendering - SVG: Scalable Vector Graphics
note: as a presentation attribute, color-rendering can be used as a css property.
...x="100" cy="100" r="100" fill="url(#gradient)" color-rendering="optimizequality" /> <text x="45" y="50%" color-rendering="optimizequality">quality-optimized</text> <circle cx="100" cy="100" r="100" color-rendering="optimizespeed" fill="url(#gradient)" style="transform: translatex(240px);" /> <text x="290" y="50%" color-rendering="optimizespeed">speed-optimized</text> </svg> usage
notes value auto | optimizespeed | optimizequality default value auto animatable yes auto indicates that the user agent shall make appropriate tradeoffs to balance speed and quality, but quality shall be given more importance than speed.
cx - SVG: Scalable Vector Graphics
value <length-percentage> default value 0 animatable yes
note: starting with svg2 cx, is a geometry property, meaning this attribute can also be used as css property for circles.
... value <length-percentage> default value 0 animatable yes
note: starting with svg2 cx, is a geometry property, meaning this attribute can also be used as css property for ellipses.
cy - SVG: Scalable Vector Graphics
value <length> | <percentage> default value 0 animatable yes
note: starting with svg2, cy is a geometry property meaning this attribute can also be used as a css property for circles.
... value <length> | <percentage> default value 0 animatable yes
note: starting with svg2, cy is a geometry property meaning this attribute can also be used as a css property for ellipses.
descent - SVG: Scalable Vector Graphics
note: it was specified to share the syntax and semantics of the obsolete descent descriptor of the @font-face at-rule defined in an early version of css 2.
... only one element is using this attribute: <font-face> usage
notes value <number> default value value of vert-origin-y animatable no specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'descent' in that specification.
direction - SVG: Scalable Vector Graphics
for other cases, such as when using right-to-left languages, it may be sufficient to add the direction attribute to the outermost <svg> element, and allow that direction to inherit to all text elements:
note: as a presentation attribute, direction can be used as a css property.
... html, body, svg { height: 100%; } <svg viewbox="0 0 600 72" xmlns="http://www.w3.org/2000/svg" direction="rtl" lang="fa"> <text x="300" y="50" text-anchor="middle" font-size="36">داستان svg 1.1 se طولا ني است.</text> </svg> usage
notes value ltr | rtl default value ltr animatable yes specifications specification status comment css writing modes module level 3the definition of 'direction' in that specification.
display - SVG: Scalable Vector Graphics
note: as a presentation attribute, display can be used as a css property.
...e the yellow rectangle is displayed --> <rect x="0" y="0" width="100" height="100" fill="skyblue"></rect> <rect x="20" y="20" width="60" height="60" fill="yellow"></rect> <!-- here the yellow rectangle is not displayed --> <rect x="120" y="0" width="100" height="100" fill="skyblue"></rect> <rect x="140" y="20" width="60" height="60" fill="yellow" display="none"></rect> </svg> usage
notes default value inline value [ <display-outside> | <display-inside> ] | <display-listitem> | <display-internal> | <display-box> | <display-legacy>where <display-outside> = block | inline | run-in<display-inside> = flow | flow-root | table | flex | grid | ruby<display-listitem> = <display-outside>?
dominant-baseline - SVG: Scalable Vector Graphics
note: as a presentation attribute, dominant-baseline can be used as a css property.
...erdana, helvetica, arial, sans-serif; } <svg viewbox="0 0 200 120" xmlns="http://www.w3.org/2000/svg"> <path d="m20,20 l180,20 m20,50 l180,50 m20,80 l180,80" stroke="grey" /> <text dominant-baseline="baseline" x="30" y="20">baseline</text> <text dominant-baseline="middle" x="30" y="50">middle</text> <text dominant-baseline="hanging" x="30" y="80">hanging</text> </svg> usage
notes value auto | text-bottom | alphabetic | ideographic | middle | central | mathematical | hanging | text-top default value auto animatable yes auto if this property occurs on a <text> element, then the computed value depends on the value of the writing-mode attribute.
dur - SVG: Scalable Vector Graphics
220 150" xmlns="http://www.w3.org/2000/svg"> <rect x="0" y="0" width="100" height="100"> <animate attributetype="xml" attributename="y" from="0" to="50" dur="1s" repeatcount="indefinite"/> </rect> <rect x="120" y="0" width="100" height="100"> <animate attributetype="xml" attributename="y" from="0" to="50" dur="3s" repeatcount="indefinite"/> </rect> </svg> usage
notes value <clock-value> | media | indefinite default value indefinite animatable no <clock-value> this value specifies the length of the simple duration.
...
note: the interpolation will not work if the simple duration is indefinite (although this may still be useful for <set> elements).
elevation - SVG: Scalable Vector Graphics
note that the positive z-axis points towards the viewer of the content.
... <fedistantlight elevation="0" /> </fediffuselighting> </filter> <filter id="distantlight2"> <fediffuselighting> <fedistantlight elevation="45" /> </fediffuselighting> </filter> <circle cx="100" cy="100" r="80" style="filter: url(#distantlight1);" /> <circle cx="100" cy="100" r="80" style="filter: url(#distantlight2); transform: translatex(240px);" /> </svg> usage
notes value <number> default value 0 animatable yes specifications specification status comment filter effects module level 1the definition of 'elevation' in that specification.
enable-background - SVG: Scalable Vector Graphics
note: as a presentation attribute, enable-background can be used as a css property.
... as a presentation attribute, it can be applied to any element but it has effect only on the following eleven elements: <a>, <defs>, <glyph>, <g>, <marker>, <mask>, <missing-glyph>, <pattern>, <svg>, <switch>, and <symbol> context
notes value accumulate | new [ <x> <y> <width> <height> ]?
fill-opacity - SVG: Scalable Vector Graphics
note: as a presentation attribute fill-opacity can be used as a css property.
...fill opacity: 1 --> <circle cx="50" cy="50" r="40" /> <!-- fill opacity as a number --> <circle cx="150" cy="50" r="40" fill-opacity="0.7" /> <!-- fill opacity as a percentage --> <circle cx="250" cy="50" r="40" fill-opacity="50%" /> <!-- fill opacity as a css property --> <circle cx="350" cy="50" r="40" style="fill-opacity: .25;" /> </svg> usage
notes value [0-1] | <percentage> default value 1 animatable yes
note: svg2 introduces percentage values for fill-opacity, however, it is not widely supported yet (see browser compatibility below) as a consequence, it is best practices to set opacity with a value in the range [0-1].
fill-rule - SVG: Scalable Vector Graphics
note: as a presentation attribute, fill-rule can be used as a css property.
... --> <polygon fill-rule="evenodd" stroke="red" points="150,0 121,90 198,35 102,35 179,90"/> </svg> usage
notes value nonzero | evenodd default value nonzero animatable yes the fill-rule attribute provides two options for how the inside (that is, the area to be filled) of a shape is determined: nonzero the value nonzero determines the "insideness" of a point in the shape by drawing a ray from that point to infinity in any direction, and then examining the plac...
filter - SVG: Scalable Vector Graphics
note: as a presentation attribute, filter can be used as a css property.
... html, body, svg { height: 100%; } <svg viewbox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <filter id="blur"> <fegaussianblur stddeviation="2" /> </filter> <rect x="10" y="10" width="80" height="80" filter="url(#blur)" /> </svg> usage
notes value none | <filter-function-list> default value none animatable yes for a description of the values see the css filter property.
filterRes - SVG: Scalable Vector Graphics
note that negative values or zero values disable the rendering of the element which referenced the filter.
... only one element is using this attribute: <filter> usage
notes value <number-optional-number> default value none animatable yes <number-optional-number> this value takes one or two values, the first one outlining the resolution in horizontal direction, the second one in vertical direction.
flood-color - SVG: Scalable Vector Graphics
note: as a presentation attribute, flood-color can be used as a css property.
... <feflood flood-color="skyblue" x="0" y="0" width="200" height="200"/> </filter> <filter id="flood2"> <feflood flood-color="seagreen" x="0" y="0" width="200" height="200"/> </filter> <rect x="0" y="0" width="200" height="200" style="filter: url(#flood1);" /> <rect x="0" y="0" width="200" height="200" style="filter: url(#flood2); transform: translatex(220px);" /> </svg> usage
notes value color initial value black animatable yes specifications specification status comment filter effects module level 1the definition of 'flood-color' in that specification.
flood-opacity - SVG: Scalable Vector Graphics
note: as a presentation attribute, flood-opacity can be used as a css property.
...od-opacity="1" x="0" y="0" width="200" height="200"/> </filter> <filter id="flood2"> <feflood flood-color="seagreen" flood-opacity="0.3" x="0" y="0" width="200" height="200"/> </filter> <rect x="0" y="0" width="200" height="200" style="filter: url(#flood1);" /> <rect x="0" y="0" width="200" height="200" style="filter: url(#flood2); transform: translatex(220px);" /> </svg> usage
notes value <alpha-value> initial value 1 animatable yes <alpha-value> a number or percentage indicating the opacity value to use across the current filter primitive subregion.
font-family - SVG: Scalable Vector Graphics
note: as a presentation attribute, font-family can be used as a css property.
...t can be applied to any element but it has effect only on the following eight elements: <altglyph>, <text>, <textpath>, <tref>, and <tspan> html, body, svg { height: 100%; } <svg viewbox="0 0 200 30" xmlns="http://www.w3.org/2000/svg"> <text y="20" font-family="arial, helvetica, sans-serif">sans serif</text> <text x="100" y="20" font-family="monospace">monospace</text> </svg> usage
notes value [ <family-name> | <generic-family> ]#where <family-name> = <string> | <custom-ident>+<generic-family> = serif | sans-serif | cursive | fantasy | monospace default value depends on user agent animatable yes for a description of the values, please refer to the css font-family property.
font-size-adjust - SVG: Scalable Vector Graphics
note: as a presentation attribute, font-size-adjust can be used as a css property.
... </text> </svg> usage
notes default value none value none | <number> animatable yes none choose the size of the font based only on the font-size property.
font-size - SVG: Scalable Vector Graphics
note: as a presentation attribute, font-size can be used as a css property.
... as a presentation attribute, it can be applied to any element but it has effect only on the following eight elements: <altglyph>, <text>, <textpath>, <tref>, and <tspan> html, body, svg { height: 100%; } <svg viewbox="0 0 200 30" xmlns="http://www.w3.org/2000/svg"> <text y="20" font-size="smaller">smaller</text> <text x="100" y="20" font-size="2em">2em</text> </svg> usage
notes value <absolute-size> | <relative-size> | <length-percentage> default value medium animatable yes for a description of the values, please refer to the css font-size property.
font-stretch - SVG: Scalable Vector Graphics
note: as a presentation attribute, font-stretch can be used as a css property.
... as a presentation attribute, it can be applied to any element but it has effect only on the following eight elements: <altglyph>, <text>, <textpath>, <tref>, and <tspan> usage
notes value <font-stretch-absolute>where <font-stretch-absolute> = normal | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded | <percentage> default value normal animatable yes specifications specification status comment css fonts module level 4the definition of 'font-stretch' in that specification.
font-style - SVG: Scalable Vector Graphics
note: as a presentation attribute, font-style can be used as a css property.
... attribute, it can be applied to any element but only has an effect on the following five elements: <altglyph>, <text>, <textpath>, <tref>, and <tspan> html, body, svg { height: 100%; } <svg viewbox="0 0 250 30" xmlns="http://www.w3.org/2000/svg"> <text y="20" font-style="normal">normal font style</text> <text x="150" y="20" font-style="italic">italic font style</text> </svg> usage
notes value normal | italic | oblique default value normal animatable yes for a description of the values, please refer to the css font-style property.
font-variant - SVG: Scalable Vector Graphics
note: as a presentation attribute, font-variant can be used as a css property.
...attribute, it can be applied to any element but it has effect only on the following eight elements: <altglyph>, <text>, <textpath>, <tref>, and <tspan> html, body, svg { height: 100%; } <svg viewbox="0 0 250 30" xmlns="http://www.w3.org/2000/svg"> <text y="20" font-variant="normal">normal text</text> <text x="100" y="20" font-variant="small-caps">small-caps text</text> </svg> usage
notes value normal | none | [ <common-lig-values> || <discretionary-lig-values> || <historical-lig-values> || <contextual-alt-values> || stylistic( <feature-value-name> ) || historical-forms || styleset( <feature-value-name># ) || character-variant( <feature-value-name># ) || swash( <feature-value-name> ) || ornaments( <feature-value-name> ) || annotation( <feature-value-name> ) || [...
font-weight - SVG: Scalable Vector Graphics
note: as a presentation attribute, font-weight can be used as a css property.
... presentation attribute, it can be applied to any element but it has effect only on the following eight elements: <altglyph>, <text>, <textpath>, <tref>, and <tspan> html, body, svg { height: 100%; } <svg viewbox="0 0 200 30" xmlns="http://www.w3.org/2000/svg"> <text y="20" font-weight="normal">normal text</text> <text x="100" y="20" font-weight="bold">bold text</text> </svg> usage
notes value normal | bold | bolder | lighter | <number> default value normal animatable yes for a description of the values, please refer to the css font-weight property.
glyph-orientation-horizontal - SVG: Scalable Vector Graphics
note: as a presentation attribute, glyph-orientation-horizontal can be used as a css property.
... as a presentation attribute, it can be applied to any element but it has effect only on the following five elements: <altglyph>, <textpath>, <text>, <tref>, and <tspan> context
notes value <angle> default value 0deg animatable no <angle> the value of the angle is restricted to 0, 90, 180, and 270 degrees.
horiz-origin-x - SVG: Scalable Vector Graphics
note: the origin applies to all glyphs in the font.
... only one element is using this attribute: <font> usage
notes value <number> default value 0 animatable no <number> this value indicates the x-coordinate of the origin of a glyph for horizontally oriented text.
horiz-origin-y - SVG: Scalable Vector Graphics
note: the origin applies to all glyphs in the font.
... only one element is using this attribute: <font> usage
notes value <number> default value 0 animatable no <number> this value indicates the x-coordinate of the origin of a glyph for horizontally oriented text.
id - SVG: Scalable Vector Graphics
<svg width="120" height="120" viewbox="0 0 120 120" xmlns="http://www.w3.org/2000/svg"> <style type="text/css"> <![cdata[ #smallrect { stroke: #000066; fill: #00cc00; } ]]> </style> <rect id="smallrect" x="10" y="10" width="100" height="100" /> </svg> usage
notes value <id> default value none animatable no <id> specifies the element's id.
...
note: you should avoid the use of id values that would be parsed as an svg view specification (e.g., mydrawing.svg#svgview(viewbox(0,200,1000,1000))) or a basic media fragment when used as a url target fragment.
image-rendering - SVG: Scalable Vector Graphics
note: as a presentation attribute, image-rendering can be used as a css property.
... as a presentation attribute, it can be applied to any element but it has effect only on the following element: <image> usage
notes value auto | optimizespeed | optimizequality default value auto animatable yes auto indicates that the user agent shall make appropriate tradeoffs to balance speed and quality, but quality shall be given more importance than speed.
kerning - SVG: Scalable Vector Graphics
note: as a presentation attribute kerning can be used as a css property.
... following four elements: <altglyph>, <textpath>, <text>, <tref>, and <tspan> html, body, svg { height: 100%; font: 36px verdana, helvetica, arial, sans-serif; } <svg viewbox="0 0 150 125" xmlns="http://www.w3.org/2000/svg"> <text x="10" y="30" kerning="auto">auto</text> <text x="10" y="70" kerning="0">number</text> <text x="10" y="110" kerning="20px">length</text> </svg> usage
notes value auto | <length> default value auto animatable yes auto this value indicates that the spacing between glyphs is adjusted based on kerning tables that are included in the font that will be used.
letter-spacing - SVG: Scalable Vector Graphics
note: as a presentation attribute, letter-spacing can be used as a css property.
... it can be applied to any element but it has effect only on the following eight elements: <altglyph>, <text>, <textpath>, <tref>, and <tspan> html, body, svg { height: 100%; } <svg viewbox="0 0 400 30" xmlns="http://www.w3.org/2000/svg"> <text y="20" letter-spacing="2">bigger letter-spacing</text> <text x="200" y="20" letter-spacing="-0.5">smaller letter-spacing</text> </svg> usage
notes value normal | <length> default value normal animatable yes for a description of the values, please refer to the css letter-spacing property.
marker-end - SVG: Scalable Vector Graphics
note: as a presentation attribute, marker-end can be used as a css property.
.../svg"> <defs> <marker id="triangle" viewbox="0 0 10 10" refx="1" refy="5" markerunits="strokewidth" markerwidth="10" markerheight="10" orient="auto"> <path d="m 0 0 l 10 5 l 0 10 z" fill="#f00"/> </marker> </defs> <polyline fill="none" stroke="black" points="20,100 40,60 70,80 100,20" marker-end="url(#triangle)"/> </svg> usage
notes value none | <marker-ref> default value none animatable yes none indicates that no marker symbol shall be drawn at the final vertex.
marker-mid - SVG: Scalable Vector Graphics
note: as a presentation attribute, marker-mid can be used as a css property.
...html, body, svg { height: 100%; } <svg viewbox="0 0 120 120" xmlns="http://www.w3.org/2000/svg"> <defs> <marker id="circle" markerwidth="8" markerheight="8" refx="4" refy="4"> <circle cx="4" cy="4" r="4" stroke="none" fill="#f00"/> </marker> </defs> <polyline fill="none" stroke="black" points="20,100 40,60 70,80 100,20" marker-mid="url(#circle)"/> </svg> usage
notes value none | <marker-ref> default value none animatable yes none indicates that no marker symbol shall be drawn at the given vertices.
marker-start - SVG: Scalable Vector Graphics
note: as a presentation attribute, marker-start can be used as a css property.
...vg"> <defs> <marker id="triangle" viewbox="0 0 10 10" refx="1" refy="5" markerunits="strokewidth" markerwidth="10" markerheight="10" orient="auto"> <path d="m 0 0 l 10 5 l 0 10 z" fill="#f00"/> </marker> </defs> <polyline fill="none" stroke="black" points="20,100 40,60 70,80 100,20" marker-start="url(#triangle)"/> </svg> usage
notes value none | <marker-ref> default value none animatable yes none indicates that no marker symbol shall be drawn at the first vertex.
mask - SVG: Scalable Vector Graphics
note: as a presentation attribute mask can be used as a css property.
... as a presentation attribute, it can be applied to any element but it has noticeable effects mostly on the following nineteen elements: <a>, <circle>, <clippath>, <ellipse>, <g>, <glyph>, <image>, <line>, <marker>, <mask>, <path>, <pattern>, <polygon>, <polyline>, <rect>, <svg>, <symbol>, <text>, <use> usage
notes value see the css property mask default value none animatable yes specifications specification status comment css masking module level 1the definition of 'mask' in that specification.
overflow - SVG: Scalable Vector Graphics
note: as a presentation attribute, overflow can be used as a css property.
...can be applied to any element but it has effect only on the following eight elements: <foreignobject>, <iframe>, <image>, <marker>, <pattern>, <symbol>, <svg>, and <text> html, body, svg { height: 100%; } <svg viewbox="0 0 200 30" xmlns="http://www.w3.org/2000/svg" overflow="auto"> <text y="20">this text is wider than the svg, so there should be a scrollbar shown.</text> </svg> usage
notes value visible | hidden | scroll | auto default value visible animatable yes for a description of the values, please see the css overflow property.
paint-order - SVG: Scalable Vector Graphics
note: as a presentation attribute, paint-order can be used as a css property.
... as a presentation attribute, it can be applied to any element but it has effect only on the following ten elements: <circle>, <ellipse>, <line>, <path>, <polygon>, <polyline>, <rect>, <text>, <textpath>, and <tspan> usage
notes value normal | [ fill || stroke || markers ] default value normal animatable yes normal this value indicates that the fill will be painted first, then the stroke, and finally the markers.
pointer-events - SVG: Scalable Vector Graphics
note: as a presentation attribute pointer-events can be used as a css property.
...icked on e.target.style.fill = fill }) as a presentation attribute, it can be applied to any element but it is mostly relevant only on the following twenty-three elements: <a>, <circle>, <clippath>, <defs>, <ellipse>, <foreignobject>, <g>, <image>, <line>, <marker>, <mask>, <path>, <pattern>, <polygon>, <polyline>, <rect>, <svg>, <switch>, <symbol>, <text>, <textpath>, <tspan>, <use> usage
notes value bounding-box | visiblepainted | visiblefill | visiblestroke | visible | painted | fill | stroke | all | none default value visiblepainted animatable yes for a detailed explanation of each possible value, have a look at the css pointer-events documentation.
points - SVG: Scalable Vector Graphics
note: a polyline is an open shape, meaning the last point is not connected to the first point.
...
note: a polygon is a closed shape, meaning the last point is connected to the first point.
requiredFeatures - SVG: Scalable Vector Graphics
fill: white; } <svg viewbox="0 0 250 45" xmlns="http://www.w3.org/2000/svg"> <g> <rect fill="forestgreen" x="10" y="10" height="25" width="230" /> <text x="20" y="27">requiredfeatures supported</text> </g> <g requiredfeatures=""> <rect fill="crimson" x="10" y="10" height="25" width="230" /> <text x="20" y="27">requiredfeatures not supported</text> </g> </svg> usage
notes value <list-of-features> default value true if not defined, false if null or empty string as value animatable no <list-of-features> this is a list of feature strings, separated using white space.
...
note that the format and naming for feature strings changed from svg 1.0 to svg 1.1.
rx - SVG: Scalable Vector Graphics
value <length> | <percentage> | auto default value auto animatable yes
note: starting with svg2, rx is a geometry property meaning this attribute can also be used as a css property for ellipses.
... value <length> | <percentage> | auto default value auto animatable yes
note: starting with svg2, rx is a geometry property meaning this attribute can also be used as a css property for rects.
ry - SVG: Scalable Vector Graphics
value <length> | <percentage> | auto default value auto animatable yes
note: starting with svg2, ry is a geometry property meaning this attribute can also be used as a css property for ellipses.
... value <length> | <percentage> | auto default value auto animatable yes
note: starting with svg2, ry is a geometry property meaning this attribute can also be used as a css property for rects.
shape-rendering - SVG: Scalable Vector Graphics
note: as a presentation attribute, shape-rendering can be used as a css property.
...y element but it has effect only on the following seven elements: <circle>, <ellipse>, <line>, <path>, <polygon>, <polyline>, and <rect> html, body, svg { height: 100%; } <svg viewbox="0 0 420 200" xmlns="http://www.w3.org/2000/svg"> <circle cx="100" cy="100" r="100" shape-rendering="geometricprecision"/> <circle cx="320" cy="100" r="100" shape-rendering="crispedges"/> </svg> usage
notes value auto | optimizespeed | crispedges | geometricprecision default value auto animatable yes auto this value indicates that the user agent shall make appropriate tradeoffs to balance speed, crisp edges and geometric precision, but with geometric precision given more importance than speed and crisp edges.
startOffset - SVG: Scalable Vector Graphics
</textpath> </text> </svg> usage
notes value <length-percentage> | <number> default value 0 animatable yes <length-percentage> a length represents a distance along the path measured in the current user coordinate system for the <textpath> element.
...
note: negative values and values larger than the path length (e.g.
stop-opacity - SVG: Scalable Vector Graphics
note: as a presentation attribute, stop-opacity can be used as a css property.
... as a presentation attribute, it can be applied to any element but it has effect only on the following element: <stop> usage
notes value <opacity-value> default value 1 animatable yes <opacity-value> this value is either a <number> between 0 and 1 or a <percentage> value specifying the opacity of the color gradient stop.
stroke-dasharray - SVG: Scalable Vector Graphics
the stroke-dasharray attribute is a presentation attribute defining the pattern of dashes and gaps used to paint the outline of the shape;
note: as a presentation attribute, stroke-dasharray can be used as a css property.
...e="black" stroke-dasharray="4 1" /> <!-- dashes and gaps of various sizes with an odd number of values --> <line x1="0" y1="7" x2="30" y2="7" stroke="black" stroke-dasharray="4 1 2" /> <!-- dashes and gaps of various sizes with an even number of values --> <line x1="0" y1="9" x2="30" y2="9" stroke="black" stroke-dasharray="4 1 2 3" /> </svg> usage
notes value none | <dasharray> default value none animatable yes <dasharray> a list of comma and/or white space separated <length>s and <percentage>s that specify the lengths of alternating dashes and gaps.
stroke-dashoffset - SVG: Scalable Vector Graphics
note: as a presentation attribute stroke-dashoffset can be used as a css property.
...tation is pulled by 1 user units which ends up in the same rendering as the previous example --> <line x1="0" y1="9" x2="30" y2="9" stroke="black" stroke-dasharray="3 1" stroke-dashoffset="1" /> <!-- the following red lines highlight the offset of the dash array for each line --> <path d="m0,5 h-3 m0,7 h3 m0,9 h-1" stroke="rgba(255,0,0,.5)" /> </svg> usage
notes value <percentage> | <length> default value 0 animatable yes the offset is usually expressed in user units resolved against the pathlength but if a <percentage> is used, the value is resolved as a percentage of the current viewport.
stroke-linecap - SVG: Scalable Vector Graphics
note: as a presentation attribute stroke-linecap can be used as a css property.
... <line x1="1" y1="3" x2="5" y2="3" stroke="black" stroke-linecap="round" /> <!-- effect of the "square" value --> <line x1="1" y1="5" x2="5" y2="5" stroke="black" stroke-linecap="square" /> <!-- the following pink lines highlight the position of the path for each stroke --> <path d="m1,1 h4 m1,3 h4 m1,5 h4" stroke="pink" stroke-width="0.025" /> </svg> usage
notes value butt | round | square default value butt animatable yes butt the butt value indicates that the stroke for each subpath does not extend beyond its two endpoints.
stroke-opacity - SVG: Scalable Vector Graphics
note: as a presentation attribute stroke-opacity can be used as a css property.
...reen" /> <!-- stroke opacity as a number --> <circle cx="15" cy="5" r="4" stroke="green" stroke-opacity="0.7" /> <!-- stroke opacity as a percentage --> <circle cx="25" cy="5" r="4" stroke="green" stroke-opacity="50%" /> <!-- stroke opacity as a css property --> <circle cx="35" cy="5" r="4" stroke="green" style="stroke-opacity: .3;" /> </svg> usage
notes value [0-1] | <percentage> default value 1 animatable yes
note: svg2 introduces percentage values for stroke-opacity, however, it is not widely supported yet (see browser compatibility below) as a consequence, it is best practices to set opacity with a value in the range [0-1].
style - SVG: Scalable Vector Graphics
html,body,svg { height:100% } <svg viewbox="0 0 100 60" xmlns="http://www.w3.org/2000/svg"> <rect width="80" height="40" x="10" y="10" style="fill: skyblue; stroke: cadetblue; stroke-width: 2;"/> </svg> usage
notes value <style> default value none animatable no <style> the syntax of style data depends on the style sheet language.
...
note: in theory, the contentstyletype attribute could be used to specify styling languages other than css, like xsl(t).
target - SVG: Scalable Vector Graphics
000/svg"> <a href="https://developer.mozilla.org" target="_self"> <text x="0" y="20">open link within iframe</text> </a> <a href="https://developer.mozilla.org" target="_blank"> <text x="0" y="60">open link in new tab or window</text> </a> <a href="https://developer.mozilla.org" target="_top"> <text x="0" y="100">open link in this tab or window</text> </a> </svg> usage
notes value _self | _parent | _top | _blank | <xml-name> default value _self animatable yes _replace the current svg image is replaced by the linked content in the same rectangular area in the same frame as the current svg image.
...
note: this value was never well implemented, and the distinction between _replace and _self has been made redundant by changes in the html definition of browsing contexts.
text-anchor - SVG: Scalable Vector Graphics
note: as a presentation attribute, text-anchor can be used as a css property.
...text text-anchor="middle" x="60" y="75">a</text> <text text-anchor="end" x="60" y="110">a</text> <!-- materialisation of anchors --> <circle cx="60" cy="40" r="3" fill="red" /> <circle cx="60" cy="75" r="3" fill="red" /> <circle cx="60" cy="110" r="3" fill="red" /> <style><![cdata[ text { font: bold 36px verdana, helvetica, arial, sans-serif; } ]]></style> </svg> usage
notes default value start value start | middle | end animatable yes start the rendered characters are aligned such that the start of the text string is at the initial current text position.
text-decoration - SVG: Scalable Vector Graphics
note: as a presentation attribute, text-decoration can be used as a css property.
...n be applied to any element but it has effect only on the following five elements: <altglyph>, <text>, <textpath>, <tref>, and <tspan> html, body, svg { height: 100%; } <svg viewbox="0 0 250 50" xmlns="http://www.w3.org/2000/svg"> <text y="20" text-decoration="underline">underlined text</text> <text x="0" y="40" text-decoration="line-through">struck-through text</text> </svg> usage
notes value <'text-decoration-line'> || <'text-decoration-style'> || <'text-decoration-color'> default value see individual properties animatable yes for a description of the values, please refer to the css text-decoration property.
text-rendering - SVG: Scalable Vector Graphics
note: as a presentation attribute, text-rendering can be used as a css property.
... as a presentation attribute, it can be applied to any element but it has effect only on the following element: <text> html, body, svg { height: 100%; } <svg viewbox="0 0 140 40" xmlns="http://www.w3.org/2000/svg"> <text y="15" text-rendering="geometricprecision">geometric precision</text> <text y="35" text-rendering="optimizelegibility">optimized legibility</text> </svg> usage
notes value auto | optimizespeed | optimizelegibility | geometricprecision default value auto animatable yes auto this value indicates that the user agent shall make appropriate tradeoffs to balance speed, legibility and geometric precision, but with legibility given more importance than speed and geometric precision.
textLength - SVG: Scalable Vector Graphics
four elements are using this attribute: <text>, <textpath>, <tref>, and <tspan> html, body, svg { height: 100%; } <svg viewbox="0 0 200 60" xmlns="http://www.w3.org/2000/svg"> <text y="20" textlength="6em">small text length</text> <text y="40" textlength="120%">big text length</text> </svg> usage
notes value <length-percentage> | <number> default value none animatable yes <length-percentage> this value specifies the width of the space the text will be adjusted to occupy as absolute length or percentage.
...
note that we have to dive into textlength to get its baseval property; textlength is stored as an svglength object, so we can't treat it like a plain number.
transform-origin - SVG: Scalable Vector Graphics
note: as a presentation attribute in svg, transform-origin corresponds in syntax and behavior to the transform-origin property in css, and can be used as css property to style svg.
... usage
notes values [ <length-percentage> | left | center | right | top | bottom ] | [ [ <length-percentage> | left | center | right ] && [ <length-percentage> | top | center | bottom ] ] <length>?where <length-percentage> = <length> | <percentage> default value 50%, 50% animatable yes the transform-origin property may be specified using one, two, or three values, where each value represents an offset.
unicode-bidi - SVG: Scalable Vector Graphics
note: as a presentation attribute, unicode-bidi can be used as a css property.
... as a presentation attribute, it can be applied to any element but it has effect only on the following eleven elements: <altglyph>, <textpath>, <text>, <tref>, and <tspan> context
notes value normal | embed | isolate | bidi-override | isolate-override | plaintext default value normal animatable no for a description of the values, please refer to the css unicode-bidi property.
units-per-em - SVG: Scalable Vector Graphics
note: this value is almost always necessary as nearly every other attribute requires the definition of a design grid.
... only one element is using this attribute: <font-face> usage
notes value <number> default value 1000 animatable no <number> this value indicates the the number of coordinate units on the em square.
vector-effect - SVG: Scalable Vector Graphics
note: as a presentation attribute, vector-effect can be used as a css property.
... as a presentation attribute, it can be applied to any element but it has effect only on the following ten elements: <circle>, <ellipse>, <foreignobject>, <image>, <line>, <path>, <polygon>, <polyline>, <rect>, <text>, <textpath> <tspan>, and <use> usage
notes value none | non-scaling-stroke | non-scaling-size | non-rotation | fixed-position default value none animatable yes none this value specifies that no vector effect shall be applied, i.e.
word-spacing - SVG: Scalable Vector Graphics
note: as a presentation attribute, word-spacing can be used as a css property.
... be applied to any element but it has effect only on the following five elements: <altglyph>, <text>, <textpath>, <tref>, and <tspan> html, body, svg { height: 100%; } <svg viewbox="0 0 250 50" xmlns="http://www.w3.org/2000/svg"> <text y="20" word-spacing="2">bigger spacing between words</text> <text x="0" y="40" word-spacing="-0.5">smaller spacing between words</text> </svg> usage
notes value normal | <length> animatable yes default values normal for a description of the values, please refer to the css letter-spacing property.
writing-mode - SVG: Scalable Vector Graphics
(
note that the inline-progression-direction can change within a <text> element due to the unicode bidirectional algorithm and properties direction and unicode-bidi.)
note: as a presentation attribute, writing-mode can be used as a css property.
... as a presentation attribute, it can be applied to any element but it has effect only on the following five elements: <altglyph>, <text>, <textpath>, <tref>, and <tspan> usage
notes default value horizontal-tb value horizontal-tb | vertical-rl | vertical-lr animatable yes horizontal-tb this value defines a top-to-bottom block flow direction.
xml:space - SVG: Scalable Vector Graphics
note: instead of using the xml:space attribute, use the white-space css property.
... html, body, svg { height: 100%; } <svg viewbox="0 0 140 50" xmlns="http://www.w3.org/2000/svg"> <text y="20" xml:space="default">default spacing</text> <text y="40" xml:space="preserve">preserved spacing</text> </svg> usage
notes value default | preserve default value default animatable no default with this value set, whitespace characters will be processed in this order: all newline characters are removed.
<circle> - SVG: Scalable Vector Graphics
value type: <number> ; default value: none; animatable: yes
note: starting with svg2, cx, cy, and r are geometry properties, meaning those attributes can also be used as css properties for that element.
...a-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage
notes categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements specifications specification status comment scalable vector graphics (svg) 2the definition of '<circle>' in that specification.
<cursor> - SVG: Scalable Vector Graphics
note: the css cursor property should be used instead of this element.
...
note that cursors usually contain at least two colors so that the cursor can be visible over most backgrounds.
<foreignObject> - SVG: Scalable Vector Graphics
value type: <length>|<percentage> ; default value: 0; animatable: yes
note: starting with svg2, x, y, width, and height are geometry properties, meaning those attributes can also be used as css properties for that element.
...a-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage
notes categoriesnonepermitted contentany elements or character data specifications specification status comment scalable vector graphics (svg) 2the definition of '<foreignobject>' in that specification.
<rect> - SVG: Scalable Vector Graphics
value type: <number> ; default value: none; animatable: yes
note: starting with svg2, x, y, width, height, rx and ry are geometry properties, meaning those attributes can also be used as css properties for that element.
...a-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage
notes categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements specifications specification status comment scalable vector graphics (svg) 2the definition of '<rect>' in that specification.
<set> - SVG: Scalable Vector Graphics
note: the <set> element is non-additive.
... animation timing attributes begin, dur, end, min, max, restart, repeatcount, repeatdur, fill other animation attributes most notably: attributename 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 categoriesanimation elementpermitted contentany number of the following elements, in any order:descriptive elements specifications specification status comment svg animations level 2the definition of '<set>' in that specification.
<text> - SVG: Scalable Vector Graphics
html,body,svg { height:100% } <svg viewbox="0 0 240 80" xmlns="http://www.w3.org/2000/svg"> <style> .small { font: italic 13px sans-serif; } .heavy { font: bold 30px sans-serif; } /*
note that the color of the text is set with the * * fill property, the color property is for html only */ .rrrrr { font: italic 40px serif; fill: red; } </style> <text x="20" y="35" class="small">my</text> <text x="40" y="35" class="heavy">cat</text> <text x="55" y="55" class="small">is</text> <text x="65" y="55" class="rrrrr">grumpy!</text> </svg> attributes x the x coo...
...a-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage
notes categoriesgraphics element, text content elementpermitted contentcharacter data and any number of the following elements, in any order:animation elementsdescriptive elementstext content elements<a> specifications specification status comment scalable vector graphics (svg) 2the definition of '<text>' in that specification.
<title> — the SVG accessible name element - SVG: Scalable Vector Graphics
note: for backward compatibility with svg 1.1, <title> elements should be the first child element of their parent.
...rcle cx="5" cy="5" r="4"> <title>i'm a circle</title> </circle> <rect x="11" y="1" width="8" height="8"> <title>i'm a square</title> </rect> </svg> attributes this element only includes global attributes global attributes core attributes most notably: id styling attributes class, style event attributes global event attributes, document element event attributes usage
notes categoriesdescriptive elementpermitted contentany elements or character data specifications specification status comment scalable vector graphics (svg) 2the definition of '<title>' in that specification.
SVG and CSS - SVG: Scalable Vector Graphics
note: elements referenced by <use> elements inherit the styles from that element.
... result
notes about this demonstration: the svg document links the stylesheet in the usual way.
choose - XPath
note: this method should be used instead of if(), which has been deprecated.
...
note: all parameters are evaluated, even the one that's not returned.
Caching compiled WebAssembly modules - WebAssembly
note: the entire site's wasm cache (not just the given url) is versioned by the specified dbversion passed into the function.
...tantiate(module, importobject); }, if not, we compile it from scratch and then store the compiled module in the database with a key of url, for next time we want to use it: errmsg => { console.log(errmsg); return webassembly.instantiatestreaming(fetch(url)).then(results => { storeindatabase(db, results.module); return results.instance; }); }) },
note: it is for this kind of usage that webassembly.instantiate() returns both a module and an instance: the module represents the compiled code and can be stored/retrieved in idb or shared between workers via postmessage(); the instance is stateful and contains the callable javascript functions, therefore it cannot be stored/shared.
Navigator.mozNotification - Archive of obsolete content
permissions when using notifications in an open web app, be sure to add the desktop-notification permission in your manifest file: "permissions": { "desktop-notification": {} } usage
notes in firefox 22+, the instantiation of a new notification should be done with the notification object by calling new notification(title, options).
Window: userproximity event - Archive of obsolete content
bubbles no cancelable no interface userproximityevent target defaultview (window) default action none event handler property window.onuserroximity specification proximity sensor
note: this event has been disabled by default in firefox 62, behind the device.sensors.proximity.enabled preference (bug 1462308).
Communicating With Other Scripts - Archive of obsolete content
page scripts if a page includes its own scripts using <script> tags, either embedded in the page or linked to it using the src attribute, there are a couple of ways a content script can communicate with it: using the dom postmessage() api using custom dom events using the dom postmessage api
note that before firefox 31 code in content scripts can't use window to access postmessage() and addeventlistener() and instead must use document.defaultview.
self - Archive of obsolete content
note that the self object in content scripts is completely different from the self module, which provides an api for an add-on to access its data files and id.
Content Processes - Archive of obsolete content
a few
notes on security as we stated earlier, the sdk was designed with multiprocess support in mind, despite the fact that work on implementing this in firefox has currently been suspended.
clipboard - Archive of obsolete content
var clipboard = require("sdk/clipboard"); if (clipboard.currentflavors.indexof("image") != -1) require("sdk/tabs").open(clipboard.get()); as
noted before, data type can be easily omitted for images.
indexed-db - Archive of obsolete content
console.log(itemlist); } open("1"); var add = require("sdk/ui/button/action").actionbutton({ id: "add", label: "add", icon: "./add.png", onclick: function() { additem(require("sdk/tabs").activetab.title); } }); var list = require("sdk/ui/button/action").actionbutton({ id: "list", label: "list", icon: "./list.png", onclick: function() { getitems(listitems); } });
note that to run this add-on you'll need to provide icons named "add.png" and "list.png" in the add-on's "data" directory.
passwords - Archive of obsolete content
.cgi"> <div>please log in.</div> <label>username:</label> <input type="text" name="uname"> <label>password:</label> <input type="password" name="pword"> </form> the corresponding values for the credential (excluding username and password) should be: url: "http://www.example.com" formsubmiturl: "http://login.example.com" usernamefield: "uname" passwordfield: "pword"
note that for both url and formsubmiturl, the portion of the url after the hostname is omitted.
self - Archive of obsolete content
note that the self module is completely different from the global self object accessible to content scripts, which is used by a content script to communicate with the add-on code.
simple-storage - Archive of obsolete content
, onclick: function() { console.log(ss.storage.value); } }); require("sdk/ui/button/action").actionbutton({ id: "delete", label: "delete", icon: "./delete.png", onclick: function() { delete ss.storage.value; console.log("deleting value"); } }); if you run it, you'll see that after clicking "read" after clicking "delete" gives you the expected output: info: undefined
note that to run this add-on you'll have to save icon files named "write.png", "read.png", and "delete.png" to the add-on's "data" directory.
windows - Archive of obsolete content
ewfor(browserwindow); // now we can use the chrome window api console.log(chromewindow.document.location.href); // -> "chrome://browser/content/browser.xul" // convert back to the high-level window var highlevelwindow = modelfor(chromewindow); // now we can use the sdk's high-level window api console.log(highlevelwindow.title); } browserwindows.on("open", converttochromeandback);
note that directly accessing low-level chrome objects like this means you're no longer protected by the compatibility guarantees made by the sdk's high-level apis.
core/namespace - Archive of obsolete content
also, multiple namespaces can be used with one object: // ./widget.js let { cu } = require('chrome'); let { ns } = require('sdk/core/namespace'); let { view } = require('./view'); //
note this is completely independent from view's internal namespace object.
event/target - Archive of obsolete content
adding listeners eventtarget interface defines on method, that can be used to register event listeners on them for the given event type: target.on('message', function onmessage(message) { //
note: `this` pseudo variable is an event `target` unless // intentionally overridden via `.bind()`.
remote/parent - Archive of obsolete content
const { remoterequire } = require("sdk/remote/parent"); remoterequire("./my-module.js", module);
note that even single-process applications have a process that contains content frames.
Creating Event Targets - Archive of obsolete content
however: we're now importing from four modules: event/core gives us emit():
note that we don't need on, once, or off, since we will use eventtarget for adding and removing listeners event/target gives us eventtarget, which implements the interface for adding and removing listeners core/heritage gives us class(), which we can use to inherit from eventtarget util/object gives us merge(), which just simplifies setting up the bookmarkmanager's properties we use cla...
Getting started (cfx) - Archive of obsolete content
for example: while true ; do cfx xpi ; wget --post-file=codesy.xpi http://localhost:8888/ ; sleep 5 ; done
note that the logging level defined for the console is different when you use this method, compared to the logging level used when an add-on is run using cfx run.
List Open Tabs - Archive of obsolete content
the following add-on adds an action button that logs the urls of open tabs when the user clicks it: require("sdk/ui/button/action").actionbutton({ id: "list-tabs", label: "list tabs", icon: "./icon-16.png", onclick: listtabs }); function listtabs() { var tabs = require("sdk/tabs"); for (let tab of tabs) console.log(tab.url); }
note: to get this working, you will need to save an icon for the button to your add-on's "data" directory as "icon-16.png".
Logging - Archive of obsolete content
but
note that by default, calls to console.log() will not result in any output in the error console for any installed add-ons: this includes add-ons installed using the add-on builder or using tools like the extension auto-installer.
Customizing the download progress bar - Archive of obsolete content
background-image: url(chrome://myextension/skin/progress_bg_osx.png) !important; %endif %endif } richlistitem .progress-bar { %ifdef xp_win -moz-appearance: none !important; background-image: url(chrome://myextension/skin/progress_fd_win.png) !important; %else %ifdef xp_macosx background-image: url(chrome://myextension/skin/progress_fd_osx.gif) !important; %endif %endif }
note: this file only supports windows and mac, but it would be straightforward to add support for linux.
Dialogs and Prompts - Archive of obsolete content
the header to the right of the sections buttons is made with <dialogheader>: <dialogheader title="general" description="whatever"/>
note, that you should only use this element in a <dialog>, because otherwise it may be not styled properly.
Nanojit - Archive of obsolete content
-i ../nanojit -o jittest ../jittest.cpp libjs_static.a
note: remove the -ddebug if you have not compiled spidermonkey with --enable-debug, and use whatever you called the sample source file in place of jittest.cpp.
Plug-n-Hack Phase1 - Archive of obsolete content
mands manifest an example commands manifest (for owasp zap) is: https://code.google.com/p/zap-extensions/source/browse/branches/beta/src/org/zaproxy/zap/extension/plugnhack/resource/service.json firefox ui in firefox the tool commands will be made available via the developer toolbar (gcli) https://developer.mozilla.org/docs/tools/gcli a example of how the zap commands are currently displayed is:
note that user specified parameters can be specified for commands, which can either be free text, a static pull down list of options or a dynamic list of options obtained from the tool on demand.
BlogPosts - Archive of obsolete content
just browsing: mozilla prism update thanscorner: mozilla prism - webrunner with pazzaz mozilla prism - a revolution in web apps thanscorner: mozilla webrunner 0.7 site specific browsers webrunner using webrunner webrunner + gears = offline desktop reader webrunner 0.5 webrunner 0.5 - mac support webrunner 0.5 - linux install webrunner, google reader, and google
notebook distraction free gtd - 32+ web app files for online todo lists mozilla webrunner: a one-window, tabless browser with no url bar webrunner becomes prism - a mozilla labs project mozilla labs: prism alex faaborg: prism mozilla prism: bringing web apps to the desktop everyone should use site specific browsers mozilla prism portable (spanish) prism, l'avenir des applications web selon mozilla (french) mozilla prism : bundle...
Hacking wiki - Archive of obsolete content
illa.org/projects/deve...lla.org/trunk/ to see the skins properly, you'll need to also check out <tt>mozilla-org/css</tt> to get the css files needed: export cvsroot=:pserver:anonymous@cvs-mirror.mozilla.org:/www cvs login cvs co mozilla-org/css (when prompted to enter a password, type <tt>anonymous</tt>) setting up copy the contents of the <tt>trunk</tt> folder and the <tt>css</tt> folder (
note: the folder itself) into the <tt>www</tt> directory on your server.
Getting File Information - Archive of obsolete content
file and stream guide: [ nsiscriptableio | accessing files | getting file information | reading from files | writing to files | moving, copying and deleting files | uploading and downloading files | working with directories ] important
note: the pages from the file and stream guide use the io object (nsiscriptableio), which was not available in any released version of the platform (pending some fixes).
Uploading and Downloading Files - Archive of obsolete content
file and stream guide: [ nsiscriptableio | accessing files | getting file information | reading from files | writing to files | moving, copying and deleting files | uploading and downloading files | working with directories ] important
note: the pages from the file and stream guide use the io object (nsiscriptableio), which was not available in any released version of the platform (pending some fixes).
Writing to Files - Archive of obsolete content
file and stream guide: [ nsiscriptableio | accessing files | getting file information | reading from files | writing to files | moving, copying and deleting files | uploading and downloading files | working with directories ] important
note: the pages from the file and stream guide use the io object (nsiscriptableio), which was not available in any released version of the platform (pending some fixes).
IO - Archive of obsolete content
file and stream guide: [ nsiscriptableio | accessing files | getting file information | reading from files | writing to files | moving, copying and deleting files | uploading and downloading files | working with directories ] important
note: the pages from the file and stream guide use the io object (nsiscriptableio), which was not available in any released version of the platform (pending some fixes).
Moving, Copying and Deleting Files - Archive of obsolete content
file and stream guide: [ nsiscriptableio | accessing files | getting file information | reading from files | writing to files | moving, copying and deleting files | uploading and downloading files | working with directories ] important
note: the pages from the file and stream guide use the io object (nsiscriptableio), which was not available in any released version of the platform (pending some fixes).
TOC - Archive of obsolete content
file and stream guide: [ nsiscriptableio | accessing files | getting file information | reading from files | writing to files | moving, copying and deleting files | uploading and downloading files | working with directories ] important
note: the pages from the file and stream guide use the io object (nsiscriptableio), which was not available in any released version of the platform (pending some fixes).
insertItemAt - Archive of obsolete content
note: you cannot insert an item to an index that does not exist, eg: trying to insert an item at the end with element.getrowcount() + 1 example <!-- this example inserts at the selected item or appends, then selects the newly created item --> <script language="javascript"> function insertitemtolist(){ var mylistbox = document.getelementbyid('mylistbox'); // create a date to get some labels and values var somedate = new date(); if(mylistbox.selectedindex == -1){ // no item was selected in list so append to the end...
loadOneTab - Archive of obsolete content
firefox 3.6
note the second form of this method was added in firefox 3.6; it adds the relatedtocurrent parameter, and allows the parameters to be specified by name, in any order.
Namespaces - Archive of obsolete content
<foo/> the answer is that it's in no namespace, or alternately, it's in the namespace de
noted by the empty string: <foo xmlns=""/> this second example is semantically equivalent to the first.
MenuButtons - Archive of obsolete content
<button type="menu" label="view"> <menupopup> <menuitem label="icons" type="radio" name="view"/> <menuitem label="list" type="radio" name="view"/> <menuitem label="details" type="radio" name="view"/> </menupopup> </button>
note that when the menu is closed, the button doesn't indicate which view is selected.
Accessibility/XUL Accessibility Reference - Archive of obsolete content
<button id="butwrap1"> <label control="butwrap1"> <!--wrapped label--> </label> </button> <button id='butwrap2'> <label control="butwrap2" value="<!--this-->" /> <label control="butwrap2" value="is" /> <label control="butwrap2" value="a" /> <label control="butwrap2" value="button" /> </button> <button image="images/img.xbm" tooltiptext="<!--button text-->"/>
note that in the third example, only the first label is read browser jaws 7.10 issues to use a browser element with html, the type="content" attribute should be specified.
iframe - Archive of obsolete content
this);"> <menupopup> <menuitem label="mozilla" value="http://mozilla.org" /> <menuitem label="slashdot" value="http://slashdot.org"/> <menuitem label="sourceforge" value="http://sf.net" /> <menuitem label="freshmeat" value="http://freshmeat.net"/> </menupopup> </menulist> <iframe id="myframe" flex="1"/> <script> function donav(obj) { var url = obj.selecteditem.value; //
note the firstchild is the menupopup element document.getelementbyid('myframe').setattribute('src', url); } </script> attributes showcaret type: boolean whether or not to cause a typing caret to be visible in the content area.
image - Archive of obsolete content
note: prior to gecko 8.0, images did not shrink down with the same ratio in both directions when specifying maximum sizes using maxheight or maxwidth.
label - Archive of obsolete content
related elements description attributes label interfaces nsiaccessibleprovider, nsidomxullabelelement
notes labels are not focusable
note: starting in gecko 2.0, labels are properly not focusable.
listbox - Archive of obsolete content
note that this is not the same as the first row -- if the displayed items have been scrolled down, this function will retrieve the index of the first row that the user can see.
prefpane - Archive of obsolete content
using multiple prefpanes
note that when using multiple prefpanes in the same prefwindow, you must not put the <script> elements above the prefpane elements, but instead below them.
resizer - Archive of obsolete content
note: starting in gecko 2.0, you can also specify a target element using the element attribute, to use the resizer to resize the specified element instead of the window.
script - Archive of obsolete content
note: if the javascript file is in chrome://, setting this attribute to application/javascript will always use the latest available javascript version.
tab - Archive of obsolete content
ributes(), haschildnodes(), insertbefore(), isdefaultnamespace(), isequalnode, issamenode, issupported(), lookupnamespaceuri, lookupprefix, normalize(), queryselector(), queryselectorall(), removeattribute(), removeattributenode(), removeattributens(), removechild(), removeeventlistener(), replacechild(), setattribute(), setattributenode(), setattributenodens(), setattributens(), setuserdata
notes
note: prior to gecko 1.9, disabling tabs fails; even while disabled, they still accept events.
titlebar - Archive of obsolete content
ources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width
note: the allowevents attribute did not work for title bars prior to firefox 3.
Creating a Windows Inno Setup installer for XULRunner applications - Archive of obsolete content
; components: main; flags: ignoreversion recursesubdirs createallsubdirs source: c:\develop\xulrunnerinstaller\myapp\defaults\*; excludes: .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] filena...
Deploying XULRunner - Archive of obsolete content
note: to actually install a xulrunner application, a compatible version of xulrunner must be registered on the system and the app must be deployed per the instructions at xul application packaging.
How to enable locale switching in a XULRunner application - Archive of obsolete content
defaults/preferences/prefs.js /* don't inherit os locale */pref("intl.locale.matchos", "false");/* choose own fallback locale; later it can be overridden by the user */pref("general.useragent.locale", "en-gb");
note that some distributions of xulrunner or firefox don't honour the "intl.locale.matchos" setting, so in those cases you won't be able to override the os locale [debian iceweasel bug #417961].
Format - Archive of obsolete content
meetings mozilla project weekly status meeting - 2006/07/24 1:00p pdt (last meeting
notes) firefox 2 (bon echo) status meeting - 2006/07/25 11:00a pdt (last meeting
notes) firefox 3 (gran paradiso) status meeting - 2006/07/26 11:00a pdt ...
2006-11-10 - Archive of obsolete content
important dates: technical submissions: monday 19th feb 2007 technical paper notification: friday 16th march 2007 communication submissions: monday 26th march 2007 communication paper notification: friday 06th april 2007 all camera ready due: monday 16th april 2007 conference dates: monday 07th and tuesday 08th may 2007 notable key
notes representatives from w3c, ibm, university of manchester, uk and oxford brookes university, uk.
2006-11-03 - Archive of obsolete content
meetings calendar project weekly status meeting - 2006/11/01 17:00 utc (meeting
notes) calendar project weekly qa chat - 2006/11/02 16:30 utc (meeting
notes) ...
2006-11-10 - Archive of obsolete content
meetings calendar project weekly status meeting - 2006/11/08 17:00 utc (meeting
notes) calendar project weekly qa chat - 2006/11/09 16:30 utc (meeting
notes) ...
2006-11-17 - Archive of obsolete content
meetings calendar project weekly status meeting - 2006/11/15 17:00 utc (meeting
notes) calendar project weekly qa chat - 2006/11/02 16:30 utc (meeting
notes) ...
2006-07-17 - Archive of obsolete content
meetings mozilla project weekly status meeting - 2006/07/24 1:00p pdt (last meeting
notes) firefox 2 (bon echo) status meeting - 2006/07/25 11:00a pdt (last meeting
notes) firefox 3 (gran paradiso) status meeting - 2006/07/26 11:00a pdt ...
2006-09-22 - Archive of obsolete content
meetings weekly status meeting - 09/25/2006 1pm pdt (last meeting
notes) gran paradiso/gecko 1.9 status meeting - 09/27/2006 11am pdt (last meeting
notes) gecko 1.9 bug triage meeting - 09/28/2006 3pm pdt ...
2006-10-20 - Archive of obsolete content
traffic october 14, 2006, 6:53pm - ed
notes that, on windows, composer 0.1's reccomended install directory needs to be different than those
noted in the release
notes.
2006-11-17 - Archive of obsolete content
summary: mozilla.dev.platform - november 11th - november 17th, 2006 announcements no announcements this week traffic xulrunner: <browser> not allowing javascript popup windows b
notes that when using xul elements <browser/> and <tabbrowser/> the javascript popup windows don't work out of the box and asks what needs to be implement.
2006-18-24 - Archive of obsolete content
summary: mozilla.dev.platform - november 18th - november 24th, 2006 announcements no announcements this week traffic xulrunner: <browser> not allowing javascript popup windows b
notes that when using xul elements <browser/> and <tabbrowser/> the javascript popup windows don't work out of the box and asks what needs to be implement.
Accessibility - Learn web development
note: if you are working on a computer/tablet/other devices where you don't have the ability to create your own files, you can try out most of the code examples in an online coding program such as jsbin or glitch.
Images, media, and form elements - Learn web development
this includes all the items mentioned in the last three sections: button, input, select, textarea { font-family: inherit; font-size: 100%; box-sizing: border-box; padding: 0; margin: 0; } textarea { overflow: auto; }
note: normalizing stylesheets are used by many developers to create a set of baseline styles to use on all projects.
Organizing your CSS - Learn web development
ndation/_lists.scss, foundation/_footer.scss, foundation/_links.scss, etc., then use the sass @use role to load them into other stylesheets: // foundation/_index.sass @use 'code' @use 'lists' @use 'footer' @use 'links' if the partials are all loaded into an index file, as implied above, you can then load that entire directory into another stylesheet in one go: // style.sass @use 'foundation'
note: a simple way to try out sass is to use codepen — you can enable sass for your css in the settings for a pen, and codepen will then run the sass parser for you, in order that you can see the resulting webpage with regular css applied.
Test your skills: sizing - Learn web development
note: you can try out solutions in the interactive editors below, however, it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
Test your skills: tables - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
Embedding the editor
note here that i use the term 'composer' to mean an html-savvy compose widget that does rich text editing, and 'editor' to mean a plain text editor (as well as the underlying technology for composer).
Gecko Keypress Event
note that replacing the original (non-ascii) characters on these keys means that there are some accessibility issues for non-latin keyboard layout users as many non-ascii characters will not be available for shortcuts.
HTML parser threading
note that mtokenizermutex is being held by the parser thread for the entire time that the tokenizer runs.
Geckoview-Junit Tests
mozilla-central$ mach install --app org.mozilla.geckoview.test to run all tests: mozilla-central$ mach geckoview-junit to run just one class of tests: mozilla-central$ mach geckoview-junit <class> please
note that unlike robocop tests, <class> needs to be specified using the fully qualified class name including the package, e.g.
How to add a build-time test
note that the following variables are supplied by the rules.mk file: cppsrcs, simple_programs, run_test_program.
Implementing Download Resuming
note: in versions of firefox prior to 3.0 alpha 7, nsiwebbrowserpersist cannot append to existing files (as opposed to overwriting them), and is therefore not usable for this task (see bug 129921).
JavaScript-DOM Prototypes in Mozilla
a third way through which one can access the prototype of an object is through the constructor property of the object, which itself points (initially) to the constructor: document.images[0].constructor.prototype.foo = bar;
note though, the above may or may not work in mozilla.
JavaScript Tips
(the property could have been implemented as ["class"'] but that just looks silly.) xul also maps the hidden and collapsed attributes to properties, but
note that these are boolean properties whereas the above list are all string properties.
Addon
release
notesuri read only nsiuri a uri for release
notes for this version.
AddonInstall
release
notesuri nsiuri the uri of release
notes for this install.
UpdateInfo
updateinfourl string a url containing simple release
notes for the update.
Add-on Manager
for example, to take a look at the add-ons that were disabled at startup: components.utils.import("resource://gre/modules/addonmanager.jsm"); let addonids = addonmanager.getstartupchanges(addonmanager.startup_change_disabled); if (addonids.length > 0) { // addonids is now an array of the add-on ids that have been disabled alert("
note: " + addonids.length + " add-ons have been disabled."); } open add-on manager tab the add-on manager tab can be opened programatically with the function browseropenaddonsmgr which is available on chrome window of "navigator:browser" type.
Localizing extension metadata on addons.mozilla.org
the localizable data fields of an extension are: name homepage summary description eula privacy policy version
notes developer comments when you submit a new extension to amo, the process is divided into several steps.
Localizing with Pontoon
note that for our purposes here, we'll be using firefox affiliates website to demo pontoon's functionality and workflow.
Localization prerequisites
you can try one of these:
notepad++ or
notepad2 on windows, vim, gedit or kate on gnu/linux, bbedit on mac os x.
Localization formats
(it should be
noted that this is near impossibility since most sites will be set up with gettext support.) .lang files can be easily edited in a text editor with this setup, a localizer is given a "[something].lang" file containing all the strings needing localization.
Writing localizable code
about localizers a few
notes about localizers for developers who rarely deal with them: localizers like tools, and they don't like editors, localization tools are often based on key-value pairs, at least some localizers have their talents focused on language skills and are not savvy in programming, or even building applications.
MathML3Testsuite
note that in general, comparing with the "sample rendering" is not enough to conclude on the success/failure of the test.
MathML Demo: <mtable> - tables and matrices
d+p ( α β γ δ ) ...--- , but
note that setting the baseline relative to a particular row is meaningless if the row doesn't have at least one cell with "rowalign=baseline" where to anchor the baseline (in which case mozilla will behave as if it was align="center#rownumber").
Mozilla Web Services Security Model
allow all services on a site to be accessed from any web page
note that this is only a sensible thing to do if nothing on the site serves content based on cookies, http authentication, ip address / domain origin, or any other method of authentication.
Gecko Profiler FAQ
(see many of the questions above for examples of such limitations.)
note that these tools should all be considered as complementary, it’s typical to capture a profile in gecko profiler and based on some investigations decide to delve into some part of it using a native profiler, etc.
JS::PerfMeasurement
note: at present, js::perfmeasurement is only functional on linux, but it is planned to add support for windows (bug 583322) and osx (bug 583323) as well, and we welcome patches for other operating systems.
NSPR release process
upload a source tar file to https://ftp.mozilla.org/pub/mozilla....nspr/releases/ write the release
notes.
Encrypt Decrypt MAC Keys As Session Objects
ssword file [optional]\n\n", "-f "); fprintf(stderr, "%-20s specify noise file name [optional]\n\n", "-z "); fprintf(stderr, "%-21s specify an input file name\n\n", "-i "); fprintf(stderr, "%-21s specify an output file name\n\n", "-o "); fprintf(stderr, "%-7s for encrypt, it takes as an input file and produces\n", "
note :"); fprintf(stderr, "%-7s .enc and .header as intermediate output files.\n\n", ""); fprintf(stderr, "%-7s for decrypt, it takes .enc and .header\n", ""); fprintf(stderr, "%-7s as input files and produces as a final output file.\n\n", ""); exit(-1); } /* * gather a cka_id */ secstatus gathercka_id(pk11symkey* key, secitem* buf) { secs...
Encrypt and decrypt MAC using token
ssword file [optional]\n\n", "-f "); fprintf(stderr, "%-20s specify noise file name [optional]\n\n", "-z "); fprintf(stderr, "%-21s specify an input file name\n\n", "-i "); fprintf(stderr, "%-21s specify an output file name\n\n", "-o "); fprintf(stderr, "%-7s for encrypt, it takes as an input file and produces\n", "
note :"); fprintf(stderr, "%-7s .enc and .header as intermediate output files.\n\n", ""); fprintf(stderr, "%-7s for decrypt, it takes .enc and .header\n", ""); fprintf(stderr, "%-7s as input files and produces as a final output file.\n\n", ""); exit(-1); } /* * gather a cka_id */ secstatus gathercka_id(pk11symkey* key, secitem* buf) { secs...
NSS FAQ
for the latest nss release
notes and detailed platform information, see project information.
NSS Key Log Format
note: starting with nss 3.24 (used by firefox 48 and 49 only), the sslkeylogfile approach is disabled by default for optimized builds using the makefile (those using gyp via build.sh are not affected).
Enc Dec MAC Output Public Key as CSR
%-21s specify subject\n\n", "-s "); fprintf(stderr, "%-21s specify certficate request file name\n\n", "-r "); fprintf(stderr, "%-21s specify an input file name\n\n", "-i "); fprintf(stderr, "%-21s specify an output file name\n\n", "-o "); fprintf(stderr, "%-7s for encrypt, it takes as an input file and produces\n", "
note :"); fprintf(stderr, "%-7s .enc and .header as intermediate output files.\n\n", ""); fprintf(stderr, "%-7s for decrypt, it takes .enc and .header\n", ""); fprintf(stderr, "%-7s as input files and produces as a final output file.\n\n", ""); exit(-1); } /* map option letter enumerated commad type */ static commandtype option2command(const ch...
Enc Dec MAC Using Key Wrap CertReq PKCS10 CSR
eanup; } } now = pr_now(); pr_explodetime (now, pr_gmtparameters, &printabletime); if ( warpmonths ) { printabletime.tm_month += warpmonths; now = pr_implodetime (&printabletime); pr_explodetime (now, pr_gmtparameters, &printabletime); } printabletime.tm_month += validitymonths; after = pr_implodetime (&printabletime); /*
note that the time is now in micro-second unit */ validity = cert_createvalidity (now, after); if (validity) { cert = cert_createcertificate(serialnumber, (selfsign ?
Encrypt Decrypt_MAC_Using Token
ssword file [optional]\n\n", "-f "); fprintf(stderr, "%-20s specify noise file name [optional]\n\n", "-z "); fprintf(stderr, "%-21s specify an input file name\n\n", "-i "); fprintf(stderr, "%-21s specify an output file name\n\n", "-o "); fprintf(stderr, "%-7s for encrypt, it takes as an input file and produces\n", "
note :"); fprintf(stderr, "%-7s .enc and .header as intermediate output files.\n\n", ""); fprintf(stderr, "%-7s for decrypt, it takes .enc and .header\n", ""); fprintf(stderr, "%-7s as input files and produces as a final output file.\n\n", ""); exit(-1); } /* * gather a cka_id.
NSS Sample Code Sample_3_Basic Encryption and MACing
fprintf(stderr, "%-20s specify noise file name [optional]\n\n", "-z <noisefilename>"); fprintf(stderr, "%-21s specify an input file name\n\n", "-i <ipfilename>"); fprintf(stderr, "%-21s specify an output file name\n\n", "-o <opfilename>"); fprintf(stderr, "%-7s for encrypt, it takes <ipfilename> as an input file and produces\n", "
note :"); fprintf(stderr, "%-7s <ipfilename>.enc and <ipfilename>.header as intermediate output files.\n\n", ""); fprintf(stderr, "%-7s for decrypt, it takes <ipfilename>.enc and <ipfilename>.header\n", ""); fprintf(stderr, "%-7s as input files and produces <opfilename> as a final output file.\n\n", ""); exit(-1); } /* this source code form is su...
NSS Sample Code sample3
- hashing with included secret key */ cout << "part 2 -- hashing with included secret key" << endl; /* initialize data */ memset(data, 0xbc, sizeof data); /* create a key */ key = pk11_keygen(slot, ckm_generic_secret_key_gen, 0, 128, 0); if (!key) { cout << "create key failed" << endl; goto done; } cout << (void *)key << endl; /* create parameters for crypto context */ /*
note: params must be provided, but may be empty */ secitem noparams; noparams.type = sibuffer; noparams.data = 0; noparams.len = 0; /* create context using the same slot as the key */ // context = pk11_createdigestcontext(sec_oid_md5); context = pk11_createcontextbysymkey(ckm_md5, cka_digest, key, &noparams); if (!context) { cout << "createdigestcontext failed" << endl; goto done; } ...
NSS Sample Code sample6
*/ if (slot == null) { fprintf(stderr, "unable to find security device (err %d)\n", pr_geterror()); return; } keyid[0] = id; keyiditem.type = sibuffer; keyiditem.data = (void *)keyid; keyiditem.len = sizeof(keyid[0]); /*
note: keysize must be 0 for fixed key-length algorithms like des.
EncDecMAC using token object - sample 3
s specify db password [optional]\n\n", "-p "); fprintf(stderr, "%-20s specify db password file [optional]\n\n", "-f "); fprintf(stderr, "%-20s specify noise file name [optional]\n\n", "-z "); fprintf(stderr, "%-21s specify an input file name\n\n", "-i "); fprintf(stderr, "%-21s specify an output file name\n\n", "-o "); fprintf(stderr, "%-7s for encrypt, it takes as an input file and produces\n", "
note :"); fprintf(stderr, "%-7s .enc and .header as intermediate output files.\n\n", ""); fprintf(stderr, "%-7s for decrypt, it takes .enc and .header\n", ""); fprintf(stderr, "%-7s as input files and produces as a final output file.\n\n", ""); exit(-1); } /* * gather a cka_id */ secstatus gathercka_id(pk11symkey* key, secitem* buf) { secstatus rv = pk11_readrawattribute(pk11_typesymkey, key, cka_id, ...
sample2
pr_stderr, "could not find certificate named %s\n", issuernickname); goto cleanup; } } now = pr_now(); pr_explodetime (now, pr_gmtparameters, &printabletime); if ( warpmonths ) { printabletime.tm_month += warpmonths; now = pr_implodetime (&printabletime); pr_explodetime (now, pr_gmtparameters, &printabletime); } printabletime.tm_month += validitymonths; after = pr_implodetime (&printabletime); /*
note that the time is now in micro-second unit */ validity = cert_createvalidity (now, after); if (validity) { cert = cert_createcertificate(serialnumber, (selfsign ?
NSS Third-Party Code
note that not all code that can be compiled into the nss libraries necessarily is.
NSS PKCS11 Functions
note: the database must be in the internal token, and must be one created with secmod_openuserdb().
Build instructions
this can be done in sh or bash as follows: export path=/usr/libexec/binutils220:$path the following build instructions should work for all platforms (with some platform-specific changes as
noted).
Installation guide
nspr: libnspr4.so libplds4.so libplc4.so nss: (
note the use of * for libfreebl -- some platforms have multiple ones) libfreebl*3.so libfreebl*3.chk libsoftokn3.so libsoftokn3.chk libnss3.so libsmime3.so libssl3.so libnssckbi.so ...
Migration to HG
however, below is a brief summary that shows how to checkout the source code and build both nspr and nss: mkdir workarea cd workarea hg clone https://hg.mozilla.org/projects/nspr hg clone https://hg.mozilla.org/projects/nss cd nss # set use_64=1 on 64 bit architectures # set build_opt=1 to get an optimized build make nss_build_all
note that the jss project has been given a private copy of the former mozilla/security/coreconf directory, allowing it to remain stable, and only update its build system as necessary.
FC_GetInfo
examples
note the use of the %.32s format string to print the manufacturerid and librarydescription members of the ck_info structure.
FC_GetTokenInfo
examples
note the use of the %.32s format string to print the label and manufacturerid members of the ck_token_info structure.
FC_Initialize
(
note: we probably should return ckr_host_memory instead.) the software integrity test or power-up self-tests failed.
FC_SeedRandom
note that fc_seedrandom() doesn't provide the initial seed material for the random number generator.
gtstd.html
note that this step generates the server's private key, so it must be done in the server's database directory.
sslintro.html
note that this step would not be necessary if the socket weren't already connected.
NSS Tools certutil
availability see the release
notes for the platforms this tool is available on.
JS_SetOptions
note that you may currently (jan 2009) experience bugs with this option enabled.
JS_ShutDown
implementation
note: this method has been used to clean up memory allocated by jsdtoa.cpp, memory allocated to implement date.now() on windows, and when the internationalization api is enabled, memory internally allocated by icu.
JS_TracerInit
this article covers features introduced in spidermonkey 1.8
note: in jsapi 12, the macro js_tracer_init has been replaced by the function js_tracerinit initialize a jstracer for object graph tracing.
JS_ValueToFunction
(implementation
note: the actual conversion is performed by the object itself.
JS_malloc
implementation
note: currently these four functions are implemented using the corresponding standard c functions.
jsdouble
implementation
note: spidermonkey has had several bugs involving details of floating-point arithmetic on various platforms.
jsid
embeddings must not pass jsid_void into jsapi entry points expecting a jsid and do not need to handle jsid_void in hooks receiving a jsid except when explicitly
noted in the api contract.
Running Automated JavaScript Tests
basic usage is: jstests.py path_to_js_shell or using mach: ./mach jstests
note that mach will generally find the js shell itself; the --shell argument can be used to specify the location manually.
Running Parsemark
a typical run can be done like so: cd js/src/tests python parsemark.py /path/to/baseline/js /path/to/parse-tests-dir/ -q > /tmp/baseline.json python parsemark.py /path/to/current/js /path/to/parse-tests-dir/ -q > /tmp/current.json python compare_bench.py /tmp/current.json /tmp/baseline.json
note: unfortunately the comparisons done are very noisy and not reliable!
Setting up CDT to work on SpiderMonkey
the initial build was in clang, so the modified build commands look like this: mkdir _dbg.obj cd _dbg.obj cc='clang -qunused-arguments -fcolor-diagnostics' cxx='clang++ -qunused-arguments -fcolor-diagnostics' \ ../configure --enable-debug --disable-optimize --enable-debug-symbols
note: if you want to use ccache, you can enable it by adding --with-ccache to the arguments list.
SpiderMonkey: The Mozilla JavaScript runtime
spidermonkey internals: gc separate internals article on the gc spidermonkey internals: hacking tips collection of helpful tips & tools for hacking on the engine related topics javascript foss projects using or based on spidermonkey releases spidermonkey release
notes current and past versions: 52, 45, 38, 31, 24, 17 community mailing list spidermonkey questions on stack overflow report a bug ...
TPS Bookmark Lists
all bookmark paths must begin with one of the following: "menu": the normal bookmarks menu "toolbar": the bookmarks toolbar "tags": the tags folder "unfiled": the unfiled bookmarks folder "places": the places root folder ("menu", "toolbar", and "unfiled" are all children of this) sub-folders are preceded with forward slashes, so "menu/folder1" de
notes that "folder1" is a sub-folder of "menu".
Web Replay
note that while this could potentially be a big drag on performance during both replay and recording, many of the hottest atomics (refcounts, gc counters, and so forth) are associated with non-deterministic components and are not recorded.
Zest usecase: Reporting Security Vulnerabilities to Developers
the developer adjusts the script to match their local environment they run the script and see the vulnerability they fix the vulnerability they rerun the script to check that the vulnerability is fixed the fix is applied to the system that the security team is testing the security team rerun the script as an initial check they then perform any manual testing they think is necessary
note that the developers could also include the script in the regression tests to make sure that it doesnt reoccur.
A Web PKI x509 certificate primer
dns:www.example.com extendedkeyusage =serverauth authorityinfoaccess = ocsp;uri:http://ocsp.example.com:80/ intermediate signs the csr (using sha256) and appends the extensions described in the file "openssl x509 -req -sha256 -days 1096 -in example.csr -cakey intkey.pem -ca int.pem -set_serial $some_large_integer -out www.example.com.pem -extfile openssl.int.cnf" security
notes there are several organizations that provide recommendations regarding the security parameters for key/hash sizes given current computational power.
Gecko Roles
role_combobox_option a item of list that is shown by combobox role_image_map an image map -- has child links representing the areas role_option an option in a listbox role_rich_option a rich option in a listbox, it can have other widgets as children role_listbox a list of options editor's
note: use template role_ to get reference on accessible role.
AT APIs Support
please
note that the web docs are sometimes out of date, and the latest at-spi is available on cvs.
Mork
some
notes on further terminology: when referring to cells or aliases, the first component is the key and the second component is the value.
Using the Places annotation service
creating the annotation service the annotation contract id is @mozilla.org/browser/annotation-service;1 var annotationservice = components.classes["@mozilla.org/browser/annotation-service;1"] .getservice(components.interfaces.nsiannotationservice);
note that the annotation service is not thread-safe.
Using the Places livemark service
note: the caller is responsible for reloading the livemark after changing its feed uri (since the contents are likely to be different given a different feed).
Binary compatibility
when you see a @status frozen,
note that this means it should work as long as the component and xpcom are built with the same compiler abi.
Generating GUIDs
note: if you do choose to use an email-style id for your add-on, you probably don't want it to be a real email address, since it might attract spam.
Receiving startup notifications
the important thing to
note is that now instead of registering with the category manager programmatically as was done in the past, you add lines to your chrome.manifest to let the application handle it for you.
How To Pass an XPCOM Object to a New Window
getservice(components.interfaces.nsiwindowwatcher); var win = ww.openwindow(null, "chrome://myextension/content/debug.xul", "debug history", "chrome,centerscreen,resizable", myobject);
note in this example that myobject is passed to the openwindow() method; you can pass any xpcom object (or any other value, for that matter) in this way.
amIWebInstallListener
ze_is(acount)] in nsivariant ainstalls, [optional] in pruint32 acount); void onwebinstalldisabled(in nsidomwindow awindow, in nsiuri auri, [array, size_is(acount)] in nsivariant ainstalls, [optional] in pruint32 acount); boolean onwebinstallrequested(in nsidomwindow awindow, in nsiuri auri, [array, size_is(acount)] in nsivariant ainstalls, [optional] in pruint32 acount);
note: prior to gecko 8.0, all references to nsidomwindow used in this interface were nsidomwindowinternal.
amIWebInstaller
window, in nsiuri areferer, [array, size_is(ainstallcount)] in wstring auris, [array, size_is(ainstallcount)] in wstring ahashes, [array, size_is(ainstallcount)] in wstring anames, [array, size_is(ainstallcount)] in wstring aicons, [optional] in amiinstallcallback acallback, [optional] in pruint32 ainstallcount); boolean isinstallenabled(in astring amimetype, in nsiuri areferer);
note: prior to gecko 8.0, all references to nsidomwindow used in this interface were nsidomwindow.
imgIContainerObserver
notes the arequest parameter was added to this method in gecko 12.0 (firefox 12.0 / thunderbird 12.0 / seamonkey 2.9).
imgIDecoder
implementer's
note: this method is defined by this interface in order to let the output stream efficiently copy the data from the input stream into its internal buffer (if any).
imgIEncoder
1.9 void endimageencode(); void initfromdata([array, size_is(length), const] in pruint8 data, in unsigned long length, in pruint32 width, in pruint32 height, in pruint32 stride, in pruint32 inputformat, in astring outputoptions); void startimageencode(in pruint32 width, in pruint32 height, in pruint32 inputformat, in astring outputoptions); constants possible values for input format (
note that not all image formats support saving alpha channels): constant value description input_format_rgb 0 input is rgb each pixel is represented by three bytes: r, g, and b (in that order, regardless of host endianness) input_format_rgba 1 input is rgb each pixel is represented by four bytes: r, g, and b (in that order, regardless of host endianness).
mozIAsyncHistory
note that this lets you add to history even in private browsing mode; if that's not desired you can first check whether the window is in private browsing mode.
mozISpellCheckingEngine
note: setting this value to a value that doesn't match an existing dictionary throws a ns_error_file_not_found exception.
mozIStorageFunction
note this callback is executed on the thread that the statement or trigger is executing on.
mozIStoragePendingStatement
note: for read statements, such as select, once you cancel the statement, you will receive no further notifications about results.
mozIStorageStatementWrapper
firefox 3.5
note firefox 3.5 adds support for these features directly into the mozistoragestatement interface, so this interface is essentially deprecated.
mozIStorageVacuumParticipant
note: if the database is using the wal journal node and the current page size is not the expected one, the journal node will be changed to truncate because wal doesn't allow page size changes.
mozIVisitInfoCallback
notes this method was replaced by the separate handleresult() and handleerror() methods in gecko 8.0 (firefox 8.0 / thunderbird 8.0 / seamonkey 2.5).
nsIAbCard
astring webpage1 astring used for the contact's work web page webpage2 astring used for the contact's home web page birthyear astring birthmonth astring birthday astring custom1 astring custom2 astring custom3 astring custom4 astring
notes astring lastmodifieddate unsigned long popularityindex unsigned long popularityindex is bumped every time e-mail is sent to this recipient .
nsIAccessibleDocument
note: renamed from document in gecko 2.0 iseditable boolean true if the document is live in an editor.
nsIAccessibleEvent
gecko 1.9.2
note this event is never sent in versions of gecko prior to 1.9.2, even though the constant existed.
nsIDBChangeListener
on this second call, the stored value of astatus is provided, so that any changes may be
noted.
nsIDOMFile
note that in gecko, this interface currently inherits from nsisupports, but in the file api specification, it should be a blob.
nsIDOMFileException
note: gecko's implementation of this interface presently differs from the working draft of the file api specification.
nsIDOMFileList
gecko 1.9.2
note starting in gecko 1.9.2, this is also used by the datatransfer object to support dragging and dropping files into web applications.
nsIDOMFontFace
note: the same physical font may have been found in multiple ways within a range.
nsIDOMGeoGeolocation
starting in gecko 1.9.2, you can access this service using: var geolocation = components.classes["@mozilla.org/geolocation;1"] .getservice(components.interfaces.nsidomgeogeolocation);
note: if nsidgeogeolocation throws an exception when importing, try using this: var geolocation = components.classes["@mozilla.org/geolocation;1"] .getservice(components.interfaces.nsisupports); method overview void clearwatch(in unsigned short watchid); void getcurrentposition(in nsidomgeopositioncallback successcallback, [opt...
nsIDOMHTMLSourceElement
note that dynamically manipulating this value after the page has loaded has no effect on the containing element; instead, change the src attribute of that element (audio or video) instead.
nsIDOMMouseScrollEvent
1.0 66 introduced gecko 1.9.1 inherits from: nsidommouseevent last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) gecko 1.9.2
note prior to gecko 1.9.2, this inherited from nsisupports instead of from nsidommouseevent.
nsIDOMSimpleGestureEvent
note: on mac os x, the units used for magnification gestures by the underlying operating system api are not documented at this time; typical values appear to be in the range 0.0 to 100.0, but currently you can only rely on the value being either positive or negative.
nsIDOMXPathEvaluator
note: prior to gecko 1.9, you could call this method on documents other than the one you planned to run the xpath against; starting with gecko 1.9, however, you must call it on the same document.
nsIDebug
inherits from: nsisupports last changed in gecko 1.7
note: c/c++ consumers who are planning to use the nsidebug interface with the @mozilla.org/xpcom;1 contract should use ns_debugbreak() from xpcom glue instead, or alternatively the ns_abort, ns_assertion, ns_break, and ns_warning macros, which also call ns_debugbreak() if used in a debugging build.
XPI
note: starting in gecko 2.0, xpi files are no longer unpacked when extensions are installed.
Zombie compartments
(please
note that you may need to close the about:addons ui before changes are made).
Using Objective-C from js-ctypes
id nsstring = (id)objc_getclass("nsstring"); sel initwithcstring_encoding = sel_registername("initwithcstring:encoding:"); int nsutf8stringencoding = 4; id tmp = objc_msgsend(nsstring, alloc); id text = objc_msgsend(tmp, initwithcstring_encoding, "hello, firefox!", nsutf8stringencoding);
note that you need to release this allocated nsstring instance.
Declaring and Using Callbacks
this can all be done in a single line of code, like so: var callback = ctypes.functiontype(...).ptr(function(...) {...});
note: the use of .ptr() here isn't a method call; we're accessing a property that dynamically creates a callable object, and then invoking the result.
Declaring types
note: at present, there isn't a way to specify that an array's c equivalent was declared as a packed structure; that is, using #pragma pack.
Memory Management
what won't keep objects alive it's important to
note that getting direct access to the contents of a cdata object using address(), addressofelement(), or contents, will result in a cdata object that does not hold its referent alive.
Type conversion
note that the following table does not contain environment dependent types (ctypes.long, etc.).
ctypes.open
see: http://stackoverflow.com/questions/19382201/how-to-load-dll-from-sdk-addon-data-folder it is important to
note that custom native files cannot be loaded through chrome:// or resource:// uris.
CData
note: this is never ctypes.void_t or an array type with an unspecified length.
CType
note: ctypes.void_t.size is undefined.
Int64
note: it's important to
note that the 64-bit integer objects created by int64 are not int64 objects; rather, they're opaque objects whose values you manipulate through the other methods on the int64 object.
UInt64
note: it's important to
note that the 64-bit integer objects created by uint64 are not uint64 objects; rather, they're opaque objects whose values you manipulate through the other methods on the uint64 object.
js-ctypes
note: js-ctypes is only available from chrome code; that is, ctypes is not available to websites, only application and extension code.
AesGcmParams - Web APIs
note that the iv does not have to be secret, just unique: so it is ok, for example, to transmit it in the clear alongside the encrypted message.
AnalyserNode.fftSize - Web APIs
note: if its value is not a power of 2, or it is outside the specified range, a domexception with the name indexsizeerror is thrown.
AnalyserNode - Web APIs
examples
note: see the guide visualizations with web audio api for more information on creating audio visualizations.
Attr.prefix - Web APIs
<div x:id="example" onclick="console.log(this.attributes[0].prefix)"/>
notes this will only work when a namespace-aware parser is used, i.e.
AudioBufferSourceNode.detune - Web APIs
syntax var source = audioctx.createbuffersource(); source.detune.value = 100; // value in cents
note: though the audioparam returned is read-only, the value it represents is not.
AudioContext() - Web APIs
usage
notes the specification doesn't go into a lot of detail about things like how many audio contexts a user agent should support, or minimum or maximum latency requirements (if any), so these details can vary from browser to browser.
AudioContext.createMediaStreamDestination() - Web APIs
var blob = new blob(chunks, { 'type' : 'audio/ogg; codecs=opus' }); document.queryselector("audio").src = url.createobjecturl(blob); }; </script> </body> </html>
note: you can view this example live, or study the source code, on github.
AudioNode.connect() - Web APIs
will change the value of the gain instead lfo.connect(gain.gain); // connect the oscillator that will produce audio to the gain oscillator.connect(gain); // connect the gain to the destination so we hear sound gain.connect(audioctx.destination); // start the oscillator that will produce audio oscillator.start(); // start the oscillator that will modify the gain value lfo.start(); audioparam
notes it is possible to connect an audionode output to more than one audioparam, and more than one audionode output to a single audioparam, with multiple calls to connect().
AudioNode - Web APIs
<a xlink:href="/docs/web/api/audionode" target="_top"><rect x="151" y="1" width="90" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="196" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">audionode</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;}
note: an audionode can be target of events, therefore it implements the eventtarget interface.
AudioParam.value - Web APIs
usage
notes value precision and variation the data type used internally to store value is a single-precision (32-bit) floating point number, while javascript uses 64-bit double-precision floating point numbers.
Cache.addAll() - Web APIs
note: addall() will overwrite any key/value pairs previously stored in the cache that match the request, but will fail if a resulting put() operation would overwrite a previous cache entry stored by the same addall() method.
Cache.match() - Web APIs
note: cache.match() is basically identical to cache.matchall(), except that rather than resolving with an array of all matching responses, it resolves with the first matching response only (that is, response[0]).
Cache.matchAll() - Web APIs
note: cache.match() is basically identical to cache.matchall(), except that rather than resolving with an array of all matching responses, it resolves with the first matching response only (that is, response[0]).
CacheStorage.open() - Web APIs
note: if the specified cache does not exist, a new cache is created with that cachename and a promise that resolves to this new cache object is returned.
CanvasPattern.setTransform() - Web APIs
as.getcontext('2d'); var svg1 = document.getelementbyid('svg1'); var matrix = svg1.createsvgmatrix(); var img = new image(); img.src = 'https://mdn.mozillademos.org/files/222/canvas_createpattern.png'; img.onload = function() { var pattern = ctx.createpattern(img, 'repeat'); pattern.settransform(matrix.rotate(-45).scale(1.5)); ctx.fillstyle = pattern; ctx.fillrect(0, 0, 400, 400); };
note that newer browser versions started to support dommatrix as an input to settransform(), so for example you could replace the svgmatrix in the above example with the following: const matrix = new dommatrix([1, .2, .8, 1, 0, 0]); edit the code below and see your changes update live in the canvas: playable code <canvas id="canvas" width="400" height="200" class="playable-canvas"></canvas> <svg ...
DelayNode.delayTime - Web APIs
syntax var audioctx = new audiocontext(); var mydelay = audioctx.createdelay(5.0); mydelay.delaytime.value = 3.0;
note: though the audioparam returned is read-only, the value it represents is not.
Detecting device orientation - Web APIs
processing orientation events all you need to do in order to begin receiving orientation change is to listen to the deviceorientation event:
note: gyronorm.js is a polyfill for normalizing the accelerometer and gyroscope data on mobile devices.
Document.alinkColor - Web APIs
syntax var color = document.alinkcolor; document.alinkcolor = color; color is a string containing the name of the color (e.g., blue, darkblue, etc.) or the hexadecimal value of the color (e.g., #0000ff)
notes the default value for this property in mozilla firefox is red (#ee0000 in hexadecimal).
Document.anchors - Web APIs
chor); toc.appendchild(li); } } </script> </head> <body onload="init()"> <h1>title</h1> <h2><a name="contents">contents</a></h2> <ul id="toc"></ul> <h2><a name="plants">plants</a></h2> <ol> <li>apples</li> <li>oranges</li> <li>pears</li> </ol> <h2><a name="veggies">veggies</a></h2> <ol> <li>carrots</li> <li>celery</li> <li>beats</li> </ol> </body> </html> view on jsfiddle
notes for reasons of backwards compatibility, the returned set of anchors only contains those anchors created with the name attribute, not those created with the id attribute.
Document.bgColor - Web APIs
example document.bgcolor = "darkblue";
notes the default value for this property in firefox is white (#ffffff in hexadecimal).
Document.body - Web APIs
syntax const objref = document.body document.body = objref example // given this html: <body id="oldbodyelement"></body> alert(document.body.id); // "oldbodyelement" const anewbodyelement = document.createelement("body"); anewbodyelement.id = "newbodyelement"; document.body = anewbodyelement; alert(document.body.id); // "newbodyelement"
notes document.body is the element that contains the content for the document.
Document.compatMode - Web APIs
note: all these modes are now standardized, so the older "standards" and "almost standards" names are nonsensical and no longer used in standards.
Document.createCDATASection() - Web APIs
example var docu = new domparser().parsefromstring('<xml></xml>', 'application/xml') var cdata = docu.createcdatasection('some <cdata> data & then some'); docu.getelementsbytagname('xml')[0].appendchild(cdata); alert(new xmlserializer().serializetostring(docu)); // displays: <xml><![cdata[some <cdata> data & then some]]></xml>
notes this will only work with xml, not html documents (as html documents do not support cdata sections); attempting it on an html document will throw not_supported_err.
Document.createElement() - Web APIs
note: for backwards compatibility with previous versions of the custom elements specification, some browsers will allow you to pass a string here instead of an object, where the string's value is the custom element's tag name.
Document.createNodeIterator() - Web APIs
note: prior to gecko 12.0 (firefox 12.0 / thunderbird 12.0 / seamonkey 2.9), this method accepted an optional fourth parameter (entityreferenceexpansion) that is not part of the dom4 specification, and has therefore been removed.
Document.createProcessingInstruction() - Web APIs
obsolete added
note that the namespace of the target name is not checked whether it is well-formed, defined what is considered an illegal character for the target name and specified the returned processinginstruction object more precisely.
Document.createRange() - Web APIs
example let range = document.createrange(); range.setstart(startnode, startoffset); range.setend(endnode, endoffset);
notes once a range is created, you need to set its boundary points before you can make use of most of its methods.
Document.currentScript - Web APIs
(for modules use import.meta instead.) it's important to
note that this will not reference the <script> element if the code in the script is being called as a callback or event handler; it will only reference the element while it's initially being processed.
Document.doctype - Web APIs
example var doctypeobj = document.doctype; console.log( "doctypeobj.name: " + doctypeobj.name + "\n" + "doctypeobj.internalsubset: " + doctypeobj.internalsubset + "\n" + "doctypeobj.publicid: " + doctypeobj.publicid + "\n" + "doctypeobj.systemid: " + doctypeobj.systemid );
notes the property returns null if there is no dtd associated with the current document.
Document.documentElement - Web APIs
syntax const element = document.documentelement example const rootelement = document.documentelement; const firsttier = rootelement.childnodes; // firsttier is a nodelist of the direct children of the root element // such as <head> and <body> for (const child of firsttier) { // do something with each direct child of the root element }
notes for any non-empty html document, documentelement will always be an <html> element.
Document.exitFullscreen() - Web APIs
document.onclick = function (event) { if (document.fullscreenelement) { document.exitfullscreen() .then(() => console.log("document exited form full screen mode")) .catch((err) => console.error(err)) } else { document.documentelement.requestfullscreen(); } }
note: for a more complete example, see the example in element.requestfullscreen().
Document.fgColor - Web APIs
example document.fgcolor = "white"; document.bgcolor = "darkblue";
notes the default value for this property in mozilla firefox is black (#000000 in hexadecimal).
Document.forms - Web APIs
note: similarly, you can access a list of a form's component user input elements using the htmlformelement.elements property.
Document.fullscreen - Web APIs
note: since this property is deprecated, you can determine if full-screen mode is active on the document by checking to see if document.fullscreenelement is not null.
Document.getElementsByName() - Web APIs
example <!doctype html> <html lang="en"> <title>example: using document.getelementsbyname</title> <input type="hidden" name="up"> <input type="hidden" name="down"> <script> var up_names = document.getelementsbyname("up"); console.log(up_names[0].tagname); // displays "input" </script> </html>
notes the name attribute can only be applied in (x)html documents.
Document.head - Web APIs
example <!doctype html> <head id="my-document-head"> <title>example: using document.head</title> </head> <script> var thehead = document.head; console.log(thehead.id); // "my-document-head"; console.log( thehead === document.queryselector("head") ); // true </script>
notes document.head is read-only.
Document.images - Web APIs
usage
notes you can use either javascript array notation or the item() method on the returned collection to access the items in the collection.
Document.implementation - Web APIs
notes the w3c's dom level 1 recommendation only specified the hasfeature method, which is one way to determine if a dom module is supported by a browser (see example above and what does your user agent claim to support?).
Document.onfullscreenchange - Web APIs
usage
notes the fullscreenchange event does not directly specify whether the transition is into or out of full-screen mode, so your event handler should look at the value of document.fullscreenelement.
Document.queryCommandSupported() - Web APIs
notes the 'paste' command return false not only if the feature is unavailable, but also if the script calling it has insufficient privileges to perform the action [1] example var flg = document.querycommandsupported("selectall"); if(flg) { // ...do something } specifications specification status comment execcommand ...
Document.rootElement - Web APIs
syntax const element = document.rootelement
notes if the document is a non-empty svg document, then the rootelement will be an svgsvgelement, identical to the documentelement.
Document.styleSheetSets - Web APIs
n an <ul> (list) element with the id "sheetlist", you can populate it with the names of all the available style sheet sets with code like this: let list = document.getelementbyid('sheetlist'); let sheets = document.stylesheetsets; list.innerhtml = ''; for (let i = 0; i < sheets.length; i++) { let item = document.createelement('li'); item.innerhtml = sheets[i]; list.appendchild(item); }
notes the list of available style sheet sets is constructed by enumerating all the style sheets available for the document, in the order in which they're listed in the document.stylesheets attribute, adding the title of each style sheet that has a title to the list.
EXT_float_blend - Web APIs
usage
notes on devices that support the ext_float_blend extension, it is automatically, implicitly, enabled when any one or more of ext_color_buffer_float, oes_texture_float, or webgl_color_buffer_float are enabled.
EffectTiming.endDelay - Web APIs
this is useful for sequencing animations based on the end time of another animation;
note, however, that many of the sequence effectst that will benefit most from this property have not been defined in the specification yet.
Element: auxclick event - Web APIs
html <button><h1>click me!</h1></button> css html { height: 100%; overflow: hidden; } body { height: inherit; display: flex; justify-content: center; align-items: center; margin: 0; } button { border: 0; background-color: white; font-size: 8vw; display: block; width: 100%; height: 100%; } h1 { letter-spacing: 0.5rem; } result
note: if you are using a three-button mouse, you'll notice that the onauxclick handler is run when any of the non-left mouse buttons are clicked (usually including any "special" buttons on gaming mice).
Element.classList - Web APIs
a minor
note is that in ie6-7, this polyfill uses the window[" ucl"] property on the window object for communicating with the css expressions, the x-uclp css property on all elements, and the element[" ucl"] property on all elements to allow garbage collection and boost performance.
Element.className - Web APIs
example let el = document.getelementbyid('item'); if (el.classname === 'active'){ el.classname = 'inactive'; } else { el.classname = 'active'; }
notes the name classname is used for this property instead of class because of conflicts with the "class" keyword in many languages which are used to manipulate the dom.
Element: click event - Web APIs
usage
notes the mouseevent object passed into the event handler for click has its detail property set to the number of times the target was clicked.
Element.getAttributeNode() - Web APIs
example // html: <div id="top" /> let t = document.getelementbyid("top"); let idattr = t.getattributenode("id"); alert(idattr.value == "top")
notes when called on an html element in a dom flagged as an html document, getattributenode lower-cases its argument before proceeding.
Element.getAttributeNodeNS() - Web APIs
== example == tbd the example needs to be fixed pre> // html: <div id="top" /> t = document.getelementbyid("top"); specialnode = t.getattributenodens( "http://www.mozilla.org/ns/specialspace", "id"); // inode.value = "full-top" </pre
notes getattributenodens is more specific than getattributenode in that it allows you to specify attributes that are part of a particular namespace.
Element.getElementsByClassName() - Web APIs
usage
notes as always, the returned collection is live, meaning that it always reflects the current state of the dom tree rooted at the element on which the function was called.
Element.hasAttribute() - Web APIs
example var foo = document.getelementbyid("foo"); if (foo.hasattribute("bar")) { // do something } polyfill ;(function(prototype) { prototype.hasattribute = prototype.hasattribute || function(name) { return !!(this.attributes[name] && this.attributes[name].specified); } })(element.prototype);
notes dom methods dealing with element's attributes: not namespace-aware, most commonly used methods namespace-aware variants (dom level 2) dom level 1 methods for dealing with attr nodes directly (seldom used) dom level 2 namespace-aware methods for dealing with attr nodes directly (seldom used) setattribute (dom 1) setattributens setattributenode setattributenodens getattribute (dom 1) get...
Element.hasAttributeNS() - Web APIs
example // check that the attribute exists before you set a value var d = document.getelementbyid("div1"); if (d.hasattributens( "http://www.mozilla.org/ns/specialspace/", "special-align")) { d.setattribute("align", "center"); }
notes dom methods dealing with element's attributes: not namespace-aware, most commonly used methods namespace-aware variants (dom level 2) dom level 1 methods for dealing with attr nodes directly (seldom used) dom level 2 namespace-aware methods for dealing with attr nodes directly (seldom used) setattribute (dom 1) setattributens setattributenode setattributenodens getattribute (dom 1) get...
Element.id - Web APIs
note: identifiers are case-sensitive, but you should avoid creating ids that differ only in the capitalization.
Element.insertAdjacentElement() - Web APIs
visualization of position names <!-- beforebegin --> <p> <!-- afterbegin --> foo <!-- beforeend --> </p> <!-- afterend -->
note: the beforebegin and afterend positions work only if the node is in a tree and has an element parent.
Element: mousedown event - Web APIs
note: this differs from the click event in that click is fired after a full click action occurs; that is, the mouse button is pressed and released while the pointer remains inside the same element.
Element: mouseenter event - Web APIs
bubbles no cancelable no interface mouseevent event handler property onmouseenter usage
notes though similar to mouseover, mouseenter differs in that it doesn't bubble and it isn't sent to any descendants when the pointer is moved from one of its descendants' physical space to its own physical space.
Element.outerHTML - Web APIs
notes if the element has no parent element, setting its outerhtml property will not change it or its descendants.
Element.prefix - Web APIs
<x:div onclick="console.log(this.prefix)"/>
notes this will only work when a namespace-aware parser is used, i.e.
Element.removeAttributeNS() - Web APIs
example // given: // <div id="div1" xmlns:special="http://www.mozilla.org/ns/specialspace" // special:specialalign="utterleft" width="200px" /> d = document.getelementbyid("div1"); d.removeattributens("http://www.mozilla.org/ns/specialspace", "specialalign"); // now: <div id="div1" width="200px" />
notes dom methods dealing with element's attributes: not namespace-aware, most commonly used methods namespace-aware variants (dom level 2) dom level 1 methods for dealing with attr nodes directly (seldom used) dom level 2 namespace-aware methods for dealing with attr nodes directly (seldom used) setattribute (dom 1) setattributens setattributenode setattributenodens getattribute (dom 1) get...
Element.removeAttributeNode() - Web APIs
example // given: <div id="top" align="center" /> var d = document.getelementbyid("top"); var d_align = d.getattributenode("align"); d.removeattributenode(d_align); // align is now removed: <div id="top" />
notes if the removed attribute has a default value, it is immediately replaced.
Element.scrollIntoView() - Web APIs
example var element = document.getelementbyid("box"); element.scrollintoview(); element.scrollintoview(false); element.scrollintoview({block: "end"}); element.scrollintoview({behavior: "smooth", block: "end", inline: "nearest"});
notes the element may not be scrolled completely to the top or bottom depending on the layout of other elements.
Element.setAttributeNS() - Web APIs
example let d = document.getelementbyid('d1'); d.setattributens('http://www.mozilla.org/ns/specialspace', 'spec:align', 'center');
notes dom methods dealing with element's attributes: not namespace-aware, most commonly used methods namespace-aware variants (dom level 2) dom level 1 methods for dealing with attr nodes directly (seldom used) dom level 2 namespace-aware methods for dealing with attr nodes directly (seldom used) setattribute (dom 1) setattributens setattributenode setattributenodens getattribute (dom 1) get...
Element.setAttributeNode() - Web APIs
html <div id="one" align="left">one</div> <div id="two">two</div> javascript let d1 = document.getelementbyid('one'); let d2 = document.getelementbyid('two'); let a = d1.getattributenode('align'); d2.setattributenode(a.clonenode(true)); // returns: 'left' alert(d2.attributes[1].value);
notes if the attribute named already exists on the element, that attribute is replaced with the new one and the replaced one is returned.
Element.setCapture() - Web APIs
tion mousemoved(e) { var output = document.getelementbyid("output"); output.innerhtml = "position: " + e.clientx + ", " + e.clienty; } </script> </head> <body onload="init()"> <p>this is an example of how to use mouse capture on elements in gecko 2.0.</p> <p><a id="mybutton" href="#">test me</a></p> <div id="output">no events yet</div> </body> </html> view live examples
notes the element may not be scrolled completely to the top or bottom, depending on the layout of other elements.
Element.setPointerCapture() - Web APIs
note: when pointer capture is set, pointerover, pointerout, pointerenter, and pointerleave events are only generated when crossing the boundary of the capture target.
Element: wheel event - Web APIs
bubbles yes cancelable yes interface wheelevent event handler property onwheel
note: don't confuse the wheel event with the scroll event.
ElementCSSInlineStyle - Web APIs
note: elementcssinlinestyle is a mixin and not an interface; you can't actually create an object of type elementcssinlinestyle.
Event.cancelable - Web APIs
console.warn(`the following event couldn't be canceled:`); console.dir(event); } } document.addeventlistener('wheel', preventscrollwheel);
notes whether an event can be canceled or not is something that's determined when that event is initialized.
Event.currentTarget - Web APIs
rrenttarget); // when this function is used as an event handler: this === e.currenttarget } var ps = document.getelementsbytagname('p'); for(var i = 0; i < ps.length; i++){ // console: print the clicked <p> element ps[i].addeventlistener('click', hide, false); } // console: print <body> document.body.addeventlistener('click', hide, false); // click around and make paragraphs disappear
note: the value of event.currenttarget is only available while the event is being handled.
Event.msConvertURL() - Web APIs
example var bloblist = []; document.getelementbyid("pastezone").addeventlistener('paste', handlepaste, false); function handlepaste(evt) { var filelist = window.clipboarddata.files; //
note that window.datatransfer.files is not applicable.
Event.originalTarget - Web APIs
note: originaltarget may also be native anonymous content (see bug 208427), in which case it's useless for non-privileged code.
EventListener - Web APIs
note: due to the need for compatibility with legacy content, eventlistener accepts both a function and an object with a handleevent() property function.
HTMLCollection - Web APIs
note: this interface is called htmlcollection for historical reasons (before the modern dom, collections implementing this interface could only have html elements as their items).
HTMLDialogElement.close() - Web APIs
; } } // update button opens a modal dialog updatebutton.addeventlistener('click', function() { dialog.showmodal(); opencheck(dialog); }); // form cancel button closes the dialog box cancelbutton.addeventlistener('click', function() { dialog.close('animalnotchosen'); opencheck(dialog); }); })(); </script>
note: you can find this example on github as htmldialogelement-basic (see it live also).
HTMLDialogElement.open - Web APIs
; } } // update button opens a modal dialog updatebutton.addeventlistener('click', function() { dialog.showmodal(); opencheck(dialog); }); // form cancel button closes the dialog box cancelbutton.addeventlistener('click', function() { dialog.close('animalnotchosen'); opencheck(dialog); }); })(); </script>
note: you can find this example on github as htmldialogelement-basic (see it live also).
HTMLDialogElement.returnValue - Web APIs
, do nothing } else if (returnvalue === 'confirm') { // user chose a favorite animal, do something with it } } // “update details” button opens the <dialog> modally updatebutton.addeventlistener('click', function() { dialog.showmodal(); opencheck(dialog); handleuserinput(dialog.returnvalue); }); })(); </script>
note: you can find this example on github as htmldialogelement-basic (see it live also).
HTMLDialogElement.showModal() - Web APIs
; } } // update button opens a modal dialog updatebutton.addeventlistener('click', function() { dialog.showmodal(); opencheck(dialog); }); // form cancel button closes the dialog box cancelbutton.addeventlistener('click', function() { dialog.close('animalnotchosen'); opencheck(dialog); }); })(); </script>
note: you can find this example on github as htmldialogelement-basic (see it live also).
HTMLDialogElement - Web APIs
; } } // update button opens a modal dialog updatebutton.addeventlistener('click', function() { dialog.showmodal(); opencheck(dialog); }); // form cancel button closes the dialog box cancelbutton.addeventlistener('click', function() { dialog.close('animalnotchosen'); opencheck(dialog); }); })(); </script>
note: you can find this example on github as htmldialogelement-basic (see it live also).
HTMLElement.lang - Web APIs
note that this attribute, though valid at the individual element level described here, is most often specified for the root element of the document.
HTMLElement.onpaste - Web APIs
note that there is currently no dom-only way to obtain the text being pasted; you'll have to use an nsiclipboard to get that information.
HTMLElement: pointermove event - Web APIs
bubbles yes cancelable yes interface pointerevent event handler property onpointermove usage
notes the event, which is of type pointerevent, provides all the information you need to know about the user's interaction with the pointing device, including the position, movement distance, button states, and much more.
HTMLTableElement.insertRow() - Web APIs
to insert the row into a specific <tbody>: let specific_tbody = document.getelementbyid(tbody_id); let row = specific_tbody.insertrow(index)
note: insertrow() inserts the row directly into the table.
HTMLTrackElement - Web APIs
usage
notes loading of the track's text resource the webvtt or ttml data describing the actual cues for the text track isn't loaded if the track's mode is initially in the disabled state.
HTMLVideoElement.videoHeight - Web APIs
let v = document.getelementbyid("myvideo"); v.addeventlistener("resize", ev => { let w = v.videowidth; let h = v.videoheight; if (w && h) { v.style.width = w; v.style.height = h; } }, false);
note that this only applies the change if both the videowidth and the videoheight are non-zero.
HTMLVideoElement.videoWidth - Web APIs
let v = document.getelementbyid("myvideo"); v.addeventlistener("resize", ev => { let w = v.videowidth; let h = v.videoheight; if (w && h) { v.style.width = w; v.style.height = h; } }, false);
note that this only applies the change if both the videowidth and the videoheight are non-zero.
The HTML DOM API - Web APIs
javascript const namefield = document.getelementbyid("username"); const sendbutton = document.getelementbyid("sendbutton") sendbutton.disabled = true; // [
note: this is disabled since it causes this article to always load with this example focused and scrolled into view] //namefield.focus(); namefield.addeventlistener("input", event => { const elem = event.target; const valid = elem.value.length != 0; if (valid && sendbutton.disabled) { sendbutton.disabled = false; } else if (!valid && !sendbutton.disabled) { sendbutton.disabled = true...
Headers.get() - Web APIs
end('content-type', 'image/jpeg'); myheaders.get('content-type'); // returns "image/jpeg" if the header has multiple values associated with it, the byte string will contain all the values, in the order they were added to the headers object: myheaders.append('accept-encoding', 'deflate'); myheaders.append('accept-encoding', 'gzip'); myheaders.get('accept-encoding'); // returns "deflate,gzip"
note: headers.getall used to have this functionality, with headers.get returning only the first value added to the headers object.
Headers.getAll() - Web APIs
nt-type', 'image/jpeg'); myheaders.getall('content-type'); // returns [ "image/jpeg" ] if the header has multiple values associated with it, the array will contain all the values, in the order they were added to the headers object: myheaders.append('accept-encoding', 'deflate'); myheaders.append('accept-encoding', 'gzip'); myheaders.getall('accept-encoding'); // returns [ "deflate", "gzip" ]
note: use headers.get to return only the first value added to the headers object.
Ajax navigation example - Web APIs
to see how it works, please create the following files (or git clone https://github.com/giabao/mdn-ajax-nav-example.git ):
note: for fully integrating the <form> elements within this mechanism, please take a look at the paragraph submitting forms and uploading files.
LayoutShift - Web APIs
note that in this example data is only sent to the server when the user leaves the tab.
LockedFile.abort() - Web APIs
note: when an ongoing operation is canceled, there is no rollback (it is not a database transaction), therefore the file can be corrupted if the canceled operation was performing some writing.
MIDIMessageEvent - Web APIs
note: even though the web midi api specifies a receivedtime property that returns a domhighrestimestamp, chrome (the only implementation at the time of writing) does not support that property since the basic event.timestamp property already returns a domhighrestimestamp in chrome.
MSCandidateWindowHide - Web APIs
general info synchronous no bubbles no cancelable no
note windows 8.1 and windows 7 imes for certain languages on internet explorer for the desktop might not support this event.
MSCandidateWindowShow - Web APIs
general info synchronous no bubbles no cancelable no
note windows 8.1 and windows 7 imes for certain languages on internet explorer for the desktop might not support this event.
MSCandidateWindowUpdate - Web APIs
general info synchronous no bubbles no cancelable no
note windows 8.1 and windows 7 imes for certain languages on internet explorer for the desktop might not support this event.
MSSiteModeEvent - Web APIs
*
note that as of microsoft edge, the createevent()/initevent() constructor pattern for synthetic events is deprecated.
MediaImage - Web APIs
note that it is just a hint so that user agent may ignore images of types it does not support; user agent still may use mime type sniffing after downloading the image to determine its type.
MediaList - Web APIs
note: medialist is a live list; updating the list using properties or methods listed below will immediately update the behavior of the document.
MediaQueryList - Web APIs
is 600 pixels wide or less */ para.textcontent = 'this is a narrow screen — less than 600px wide.'; document.body.style.backgroundcolor = 'red'; } else { /* the viewport is more than than 600 pixels wide */ para.textcontent = 'this is a wide screen — more than 600px wide.'; document.body.style.backgroundcolor = 'blue'; } } mql.addeventlistener('change', screentest);
note: you can find this example on github (see the source code, and also see it running live).
MediaRecorder.start() - Web APIs
note: if the browser is unable to start recording or continue recording, it will raise a domerror event, followed by a mediarecorder.dataavailable event containing the blob it has gathered, followed by the mediarecorder.stop event.
MediaSessionActionDetails.seekTime - Web APIs
usage
notes to perform a "fast" seek (such as when issuing multiple seekto actions in sequence while handling a scrubbing operation, the details object's fastseek property's value is set to true, indicating that you should minimize or eliminate anything you do while handling the action that is only necessary at the final step.
MediaStreamAudioSourceNode() - Web APIs
note: another way to create a mediastreamaudiosourcenode is to call theaudiocontext.createmediastreamsource() method, specifying the stream from which you want to obtain audio.
MediaStreamTrack: ended event - Web APIs
bubbles no cancelable no interface event event handler property mediastreamtrack.onended usage
notes ended events fire when the media stream track's source permanently stops sending data on the stream.
MediaStreamTrack.getSettings() - Web APIs
note: the returned object identifies the current values of every constrainable property, including those which are platform defaults rather than having been expressly set by the site's code.
MediaStreamTrack: mute event - Web APIs
note: the condition that most people think of as "muted" (that is, a user-toggled state of silencing a track) is actually managed using the mediastreamtrack.enabled property, for which there are no events.
MediaStreamTrack: unmute event - Web APIs
bubbles no cancelable no interface event event handler property onunmute
note: the condition that most people think of as "muted" (that is, a user-controllable way to silence a track) is actually managed using the mediastreamtrack.enabled property, for which there are no events.
Recording a media element - Web APIs
note that the autoplay attribute is used so that as soon as the stream starts to arrive from the camera, it immediately gets displayed, and the muted attribute is specified to ensure that the sound from the user's microphone isn't output to their speakers, causing an ugly feedback loop.
MediaTrackConstraints.cursor - Web APIs
usage
notes you can check the setting selected by the user agent after the display media has been created by getdisplaymedia() by calling getsettings() on the display media's video mediastreamtrack, then checking the value of the returned mediatracksettings object's cursor object.
MediaTrackConstraints.displaySurface - Web APIs
usage
notes you can check the setting selected by the user agent after the display media has been created by getdisplaymedia() by calling getsettings() on the display media's video mediastreamtrack, then checking the value of the returned mediatracksettings object's displaysurface object.
MediaTrackConstraints.logicalSurface - Web APIs
usage
notes you can check the setting selected by the user agent after the display media has been created by getdisplaymedia() by calling getsettings() on the display media's video mediastreamtrack, then checking the value of the returned mediatracksettings object's logicalsurface object.
Navigator.msLaunchUri() - Web APIs
usage
notes if a default protocol handler is available on the system that matches the uri, the successcallback is invoked, otherwise, the nohandlercallback is called.
msSaveBlob - Web APIs
notes when a site calls this method, the behavior is the same as when windows internet explorer downloads a file with the following in the header, where x-download-options removes the file open button from the browser file download dialog: content-length: <blob.size> content-type: <blob.type> content-disposition: attachment;filename=<defaultname> x-download-options: noopen specifications not part...
msSaveOrOpenBlob - Web APIs
notes when a site calls this method, the behavior is the same as when windows internet explorer downloads a file with the following in the header: content-length: <blob.size> content-type: <blob.type> content-disposition: attachment;filename=<defaultname> specifications not part of any specifications.
Navigator.oscpu - Web APIs
pc mac os x version x.y mac os x (i386/x64 build) intel mac os x or macos version x.y linux 64-bit (32-bit build) output of uname -s plus "i686 on x86_64" linux output of uname -sm x.y refers to the version of the operating system example function osinfo() { alert(window.navigator.oscpu); } osinfo(); // alerts "windows nt 6.0" for example usage
notes unless your code is privileged (chrome or at least has the universalbrowserread privilege), it may get the value of the general.oscpu.override preference instead of the true platform.
Navigator.productSub - Web APIs
example <script> function prodsub() { var dt = document.getelementbyid("d").childnodes[0]; dt.data = window.navigator.productsub; } </script> <button onclick="prodsub();">productsub</button> // returns: 20010725
notes on ie, this property returns undefined.
Navigator.xr - Web APIs
usage
notes each window has its own instance of navigator, which can be accessed as window.navigator or simply as navigator.
NavigatorID.platform - Web APIs
for example: "macintel", "win32", "freebsd i386", "webtv os" example console.log(navigator.platform); usage
notes most browsers, including chrome, edge, and firefox 63 and later, return "win32" even if running on a 64-bit version of windows.
NavigatorPlugins.javaEnabled() - Web APIs
syntax result = window.navigator.javaenabled() example if (window.navigator.javaenabled()) { // browser has java }
notes the return value for this method indicates whether the preference that controls java is on or off - not whether the browser offers java support in general.
NavigatorPlugins.plugins - Web APIs
ntbyid('plugintable'); for(var i = 0; i < pluginslength; i++) { let newrow = table.insertrow(); newrow.insertcell().textcontent = navigator.plugins[i].name; newrow.insertcell().textcontent = navigator.plugins[i].filename; newrow.insertcell().textcontent = navigator.plugins[i].description; newrow.insertcell().textcontent = navigator.plugins[i].version?navigator.plugins[i].version:""; }
notes the plugin object exposes a small interface for getting information about the various plugins installed in your browser.
NavigatorStorage - Web APIs
the navigatorstorage mixin adds to the navigator and workernavigator interfaces the navigator.storage property, which provides access to the storagemanager singleton used for controlling the persistence of data stores as well as obtaining information
note: this feature is available in web workers.
NetworkInformation.downlink - Web APIs
note that chrome-based browsers do not conform to the specification, and arbitrarily cap the reported downlink at a maximum of 10 mbps as an anti-fingerprinting measure.
Node.baseURI - Web APIs
note that obtaining the base url for a document may return different urls over time if the <base> tags or the document's location change.
Node.compareDocumentPosition() - Web APIs
example const head = document.head; const body = document.body; if (head.comparedocumentposition(body) & node.document_position_following) { console.log('well-formed document'); } else { console.error('<head> is not before <body>'); }
note: because the result returned by comparedocumentposition() is a bitmask, the bitwise and operator must be used for meaningful results.
Node.nodeName - Web APIs
note that the element.tagname property could have been used instead, since nodename has the same value as tagname for an element.
Node.parentNode - Web APIs
example if (node.parentnode) { // remove a node from the tree, unless // it's not in the tree already node.parentnode.removechild(node); }
notes document and documentfragment nodes can never have a parent, so parentnode will always return null.
Node.prefix - Web APIs
<x:div onclick="console.log(this.prefix)"/>
notes this will only work when a namespace-aware parser is used, i.e.
Node.previousSibling - Web APIs
syntax previousnode = node.previoussibling; example <img id="b0"> <img id="b1"> <img id="b2"> console.log(document.getelementbyid("b1").previoussibling); // <img id="b0"> console.log(document.getelementbyid("b2").previoussibling.id); // "b1"
notes gecko-based browsers insert text nodes into a document to represent whitespace in the source markup.
SVGAnimationElement: beginEvent event - Web APIs
.createelement('li'); listitem.textcontent = 'beginevent fired'; list.appendchild(listitem); }) animateelem.addeventlistener('repeatevent', (e) => { let listitem = document.createelement('li'); let msg = 'repeatevent fired'; if(e.detail) { msg += '; repeat number: ' + e.detail; } listitem.textcontent = msg; list.appendchild(listitem); }) event handler property equivalent
note that you can also create an event listener for the begin event using the onbegin event handler property: animateelem.onbegin = () => { console.log('beginevent fired'); } specifications specification status comment scalable vector graphics (svg) 2the definition of 'beginevent' in that specification.
SVGExternalResourcesRequired - Web APIs
note: the svg dom defines the attribute externalresourcesrequired as being of type svganimatedboolean, whereas the svg language definition says that the attribute is not animated.
SVGGeometryElement - Web APIs
/web/api/svggeometryelement" target="_top"><rect x="81" y="65" width="180" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="171" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svggeometryelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;}
note: the pathlength property and the gettotallength() and getpointatlength() methods were originally part of the svgpathelement interface.
getBBox() - Web APIs
note: getbbox() must return the actual bounding box at the time the method was called—even in case the element has not yet been rendered.
SVGGraphicsElement - Web APIs
web/api/svggraphicselement" target="_top"><rect x="301" y="65" width="180" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="391" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svggraphicselement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;}
note: this interface was introduced in svg 2 and replaces the svglocatable and svgtransformable interfaces from svg 1.1.
SVGNumber - Web APIs
note: if the svgnumber is read-only, a domexception with the code no_modification_allowed_err is raised on an attempt to change the value.
SVGSVGElement - Web APIs
to suspend redraw actions as a collection of svg dom changes occur, precede the changes to the svg dom with a method call similar to: const suspendhandleid = suspendredraw(maxwaitmilliseconds) and follow the changes with a method call similar to: unsuspendredraw(suspendhandleid)
note that multiple suspendredraw() calls can be used at once, and that each such method call is treated independently of the other suspendredraw() method calls.
Storage.clear() - Web APIs
function populatestorage() { localstorage.setitem('bgcolor', 'red'); localstorage.setitem('font', 'helvetica'); localstorage.setitem('image', 'migato.png'); localstorage.clear(); }
note: for a real world example, see our web storage demo.
Storage.getItem() - Web APIs
localstorage.getitem('font'); var currentimage = localstorage.getitem('image'); document.getelementbyid('bgcolor').value = currentcolor; document.getelementbyid('font').value = currentfont; document.getelementbyid('image').value = currentimage; htmlelem.style.backgroundcolor = '#' + currentcolor; pelem.style.fontfamily = currentfont; imgelem.setattribute('src', currentimage); }
note: to see this used within a real world example, see our web storage demo.
Storage.key() - Web APIs
xamples the following function iterates over the local storage keys: function foreachkey(callback) { for (var i = 0; i < localstorage.length; i++) { callback(localstorage.key(i)); } } the following function iterates over the local storage keys and gets the value set for each key: for(var i =0; i < localstorage.length; i++){ console.log(localstorage.getitem(localstorage.key(i))); }
note: for a real world example, see our web storage demo.
Storage.length - Web APIs
example the following function adds three data items to the local storage for the current domain, then returns the number of items in the storage: function populatestorage() { localstorage.setitem('bgcolor', 'yellow'); localstorage.setitem('font', 'helvetica'); localstorage.setitem('image', 'cats.png'); return localstorage.length; // should return 3 }
note: for a real world example, see our web storage demo.
Storage.removeItem() - Web APIs
function populatestorage() { sessionstorage.setitem('bgcolor', 'red'); sessionstorage.setitem('font', 'helvetica'); sessionstorage.setitem('image', 'mycat.png'); sessionstorage.removeitem('image'); }
note: to see this used within a real world example, see our web storage demo.
Storage.setItem() - Web APIs
function populatestorage() { localstorage.setitem('bgcolor', 'red'); localstorage.setitem('font', 'helvetica'); localstorage.setitem('image', 'mycat.png'); }
note: to see this used within a real world example, see our web storage demo.
Storage - Web APIs
localstorage.getitem('font'); var currentimage = localstorage.getitem('image'); document.getelementbyid('bgcolor').value = currentcolor; document.getelementbyid('font').value = currentfont; document.getelementbyid('image').value = currentimage; htmlelem.style.backgroundcolor = '#' + currentcolor; pelem.style.fontfamily = currentfont; imgelem.setattribute('src', currentimage); }
note: to see this running as a complete working example, see our web storage demo.
Storage Access API - Web APIs
note: user interaction propagates to the promise returned by both of these methods, allowing the callers to take actions that require user interaction without requiring a second click from the user.
Streams API - Web APIs
note: you can find a lot more details about the theory and practice of streams in our articles — streams api concepts, using readable streams, and using writable streams.
StyleSheet.disabled - Web APIs
note that disabled == false does not guarantee the style sheet is applied (it could be removed from the document, for instance).
Stylesheet.href - Web APIs
example // on a local machine: <html> <head> <link rel="stylesheet" href="example.css" type="text/css" /> <script> function sref() { alert(document.stylesheets[0].href); } </script> </head> <body> <div class="thunder">thunder</div> <button onclick="sref()">ss</button> </body> </html> // returns "file:////c:/windows/desktop/example.css
notes if the style sheet is a linked style sheet, the value of its attribute is its location.
StyleSheet.ownerNode - Web APIs
syntax noderef = stylesheet.ownernode example <html lang="en"> <head> <link rel="stylesheet" href="example.css"> </head> <body> <button onclick="alert(document.stylesheets[0].ownernode)">show example.css’s ownernode</button> </body> </html> // displays "object htmllinkelement"
notes for style sheets that are included by other style sheets, such as with @import, the value of this property is null.
StyleSheet.parentStyleSheet - Web APIs
syntax objref = stylesheet.parentstylesheet example // find the top level stylesheet if (stylesheet.parentstylesheet) { sheet = stylesheet.parentstylesheet; } else { sheet = stylesheet; }
notes this property returns null if the current stylesheet is a top-level stylesheet or if stylesheet inclusion is not supported.
SubtleCrypto.importKey() - Web APIs
a json web key looks something like this (this is an ec private key): { "crv": "p-384", "d": "wouctu7nw4e8_7n5c1-xbjb4xqsb_lizhymsy8mggxuny6q8ncoh9xsiviwlffk_", "ext": true, "key_ops": ["sign"], "kty": "ec", "x": "szrrxmyi8vwfjg1dpunbfcc9jzvjzefh7ulki1ukxaltd7rgwrcffxqygpcwu6aq", "y": "hhuag3ovdzer0uuqnd4pxhqtxp5idgdyhjhl-wlkjngjqaw0rngy5v29-av-ysew" }; examples
note: you can try the working examples on github.
Text.wholeText - Web APIs
syntax str = textnode.wholetext;
notes and example suppose you have the following simple paragraph within your webpage (with some whitespace added to aid formatting throughout the code samples here), whose dom node is stored in the variable para: <p>thru-hiking is great!
TextDecoder() - Web APIs
"chinese", "csgb2312", "csiso58gb231280", "gb2312", "gb_2312", "gb_2312-80", "gbk", "iso-ir-58", "x-gbk" 'gbk' "gb18030" 'gb18030' "hz-gb-2312" 'hz-gb-2312' "big5", "big5-hkscs", "cn-big5", "csbig5", "x-x-big5" 'big5' "cseucpkdfmtjapanese", "euc-jp", "x-euc-jp" 'euc-jp' "csiso2022jp", "iso-2022-jp"
note: firefox used to accept iso-2022-jp-2 sequences silently when an iso-2022-jp decoder was instantiated, however this was removed in version 56 to simplify the api, as no other browsers support it and no pages seem to use it.
TextTrack.mode - Web APIs
usage
notes the default mode is disabled, unless the default boolean attribute is specified, in which case the default mode is showing.
TextTrackList.length - Web APIs
var mediaelem = document.queryselector("video, audio"); var numtexttracks = 0; if (mediaelem.texttracks) { numtexttracks = mediaelem.texttracks.length; }
note that this sample checks to be sure htmlmediaelement.texttracks is defined, to avoid failing on browsers without support for texttrack.
Spaces and reference spaces: Spatial tracking in WebXR - Web APIs
note: this article presumes that you are familiar with the concepts introduced in geometry and reference spaces in webxr: that is, the basics of 3d coordinate systems, as well as webxr spaces, reference spaces, and how reference spaces are used to create local coordinate systems for individual objects or movable components within a scene.
Keyframe Formats - Web APIs
element.animate([ { opacity: 1 }, { opacity: 0.1, offset: 0.7 }, { opacity: 0 } ], 2000);
note: offset values, if provided, must be between 0.0 and 1.0 (inclusive) and arranged in ascending order.
Using IIR filters - Web APIs
something like this is acceptable: let feedforward = [0.00020298, 0.0004059599, 0.00020298]; our feedback values cannot start with zero, otherwise on the first pass nothing would be sent back: let feedbackward = [1.0126964558, -1.9991880801, 0.9873035442];
note: these values are calculated based on the lowpass filter specified in the filter characteristics of the web audio api specification.
Web Audio API - Web APIs
if you are more familiar with the musical side of things, are familiar with music theory concepts, want to start building instruments, then you can go ahead and start building things with the advance tutorial and others as a guide (the above linked tutorial covers scheduling
notes, creating bespoke oscillators and envelopes, as well as an lfo among other things.) if you aren't familiar with the programming basics, you might want to consult some beginner's javascript tutorials first and then come back here — see our beginner's javascript learning module for a great place to begin.
Attestation and Assertion - Web APIs
it should be
noted that while attestation provides the capability for a root of trust, validating the root of trust is frequently not necessary.
Web Locks API - Web APIs
note that such deadlocks only affect the locks themselves and code depending on them; the browser, other tabs, and other script in the page is not affected.
Web NFC API - Web APIs
note: devices and tags have to be formatted and recorded specifically to support ndef record format to be used with web nfc.
Window.alert() - Web APIs
example window.alert("hello world!"); alert("hello world!"); both produce:
notes the alert dialog should be used for messages which do not require any response on the part of the user, other than the acknowledgement of the message.
Window: beforeunload event - Web APIs
however
note that not all browsers support this method, and some instead require the event handler to implement one of two legacy methods: assigning a string to the event's returnvalue property returning a string from the event handler.
Window.blur() - Web APIs
syntax window.blur() example window.blur();
notes the window.blur() method is the programmatic equivalent of the user shifting focus away from the current window.
Window.close() - Web APIs
note also that close() has no effect when called on window objects returned by htmliframeelement.contentwindow.
Window.closed - Web APIs
before attempting to change the url, it checks that the current window has an opener using the window.opener property and that the opener isn't closed: // check that an opener exists and is not closed if (window.opener && !window.opener.closed) { window.opener.location.href = 'http://www.mozilla.org'; }
note that popups can only access the window that opened them.
Window.confirm() - Web APIs
example if (window.confirm("do you really want to leave?")) { window.open("exit.html", "thanks for visiting!"); } produces:
notes the following text is shared between this article, dom:window.prompt and dom:window.alert dialog boxes are modal windows — they prevent the user from accessing the rest of the program's interface until the dialog box is closed.
Window.defaultStatus - Web APIs
example <html> <body onload="window.defaultstatus='hello!';"/> <button onclick="window.confirm('are you sure you want to quit?');">confirm</button> </body> </html>
notes to set the status once the window has been opened, use window.status.
Window.frameElement - Web APIs
note: despite this property's name, it works for documents embedded within any embedding point, including <object>, <iframe>, or <embed>.
Window.fullScreen - Web APIs
notes switching between regular window and full screen will fire the "resize" event on the corresponding window.
Window.getAttention() - Web APIs
syntax window.getattention();
notes on windows, the taskbar button for the window flashes, if this hasn't been disabled by the user.
Window.getDefaultComputedStyle() - Web APIs
<style> h3:after { content: ' rocks!'; } </style> <h3>generated content</h3> <script> var h3 = document.queryselector('h3'), result = getdefaultcomputedstyle(h3, ':after').content; console.log('the generated content is: ', result); // returns 'none' </script>
notes the returned value is, in certain known cases, expressly incorrect by deliberate intent.
Window.getSelection() - Web APIs
examples function foo() { var selobj = window.getselection(); alert(selobj); var selrange = selobj.getrangeat(0); // do stuff with the range }
notes string representation of the selection object in javascript, when an object is passed to a function expecting a string (like window.alert() or document.write()), the object's tostring() method is called and the returned value is passed to the function.
Window.history - Web APIs
example history.back(); // equivalent to clicking back button history.go(-1); // equivalent to history.back();
notes for top-level pages you can see the list of pages in the session history, accessible via the history object, in the browser's dropdowns next to the back and forward buttons.
Window.pageYOffset - Web APIs
note that the frame's contents have been scrolled to show the section named "overview", and that the value of the pageyoffset property is shown with the corresponding value.
Window.personalbar - Web APIs
<!doctype html> <html> <head> <title>various dom tests</title> <script> // changing bar states on the existing window netscape.security.privilegemanager.enableprivilege("universalbrowserwrite"); window.personalbar.visible = !window.personalbar.visible; </script> </head> <body> <p>various dom tests</p> </body> </html>
notes when you load the example page above, the browser displays the following dialog: to toggle the visibility of these bars, you must either sign your scripts or enable the appropriate privileges, as in the example above.
Window.releaseEvents() - Web APIs
example window.releaseevents(event.keypress)
notes
note that you can pass a list of events to this method using the following syntax: window.releaseevents(event.keypress | event.keydown | event.keyup).
Window.resizeBy() - Web APIs
example // shrink the window window.resizeby(-200, -200);
notes this method resizes the window relative to its current size.
Window.screenX - Web APIs
note: an alias of screenx was implemented across modern browsers in more recent times — window.screenleft.
Window.screenY - Web APIs
note: an alias of screeny was implemented across modern browsers in more recent times — window.screentop.
Window.scroll() - Web APIs
examples <!-- put the 100th vertical pixel at the top of the window --> <button onclick="scroll(0, 100);">click to scroll down 100 pixels</button> using options: window.scroll({ top: 100, left: 100, behavior: 'smooth' });
notes window.scrollto() is effectively the same as this method.
Window.scrollMaxX - Web APIs
example // scroll to right edge of the page let maxx = window.scrollmaxx; window.scrollto(maxx, 0);
notes do not use this property to get the total document width, which is not equivalent to window.innerwidth + window.scrollmaxx, because window.innerwidth includes the width of any visible vertical scrollbar, thus the result would exceed the total document width by the width of any visible vertical scrollbar.
Window.scrollMaxY - Web APIs
example // scroll to the bottom of the page let maxy = window.scrollmaxy; window.scrollto(0, maxy);
notes do not use this property to get the total document height, which is not equivalent to window.innerheight + window.scrollmaxy, because window.innerheight includes the width of any visible horizontal scrollbar, thus the result would exceed the total document height by the width of any visible horizontal scrollbar.
Window.scrollTo() - Web APIs
examples window.scrollto(0, 1000); using options: window.scrollto({ top: 100, left: 100, behavior: 'smooth' });
notes window.scroll() is effectively the same as this method.
Window.scrollX - Web APIs
if (window.scrollx > 400) { window.scroll(0,0); }
notes the pagexoffset property is an alias for the scrollx property: window.pagexoffset == window.scrollx; // always true for cross-browser compatibility, use window.pagexoffset instead of window.scrollx.
Window.scrollY - Web APIs
} window.scrollbypages(1);
notes use this property to check that the document hasn't already been scrolled when using relative scroll functions such as scrollby(), scrollbylines(), or scrollbypages().
Window.sessionStorage - Web APIs
s will only happen if the page is accidentally refreshed) if (sessionstorage.getitem("autosave")) { // restore the contents of the text field field.value = sessionstorage.getitem("autosave"); } // listen for changes in the text field field.addeventlistener("change", function() { // and save the results into the session storage object sessionstorage.setitem("autosave", field.value); });
note: please refer to the using the web storage api article for a full example.
Window.statusbar - Web APIs
<!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <title>various dom tests</title> <script> // changing bar states on the existing window netscape.security.privilegemanager.enableprivilege("universalbrowserwrite"); window.statusbar.visible=!window.statusbar.visible; </script> </head> <body> <p>various dom tests</p> </body> </html>
notes when you load the example page above, the browser displays the following dialog: to toggle the visibility of these bars, you must either sign your scripts or enable the appropriate privileges, as in the example above.
Window.toolbar - Web APIs
<!doctype html> <html> <head> <title>various dom tests</title> <script> // changing bar states on the existing window netscape.security.privilegemanager.enableprivilege("universalbrowserwrite"); window.toolbar.visible=!window.toolbar.visible; </script> </head> <body> <p>various dom tests</p> </body> </html>
notes when you load the example page above, the browser displays the following dialog: to toggle the visibility of these bars, you must either sign your scripts or enable the appropriate privileges, as in the example above.
Window.top - Web APIs
syntax var topwindow = window.top;
notes where the window.parent property returns the immediate parent of the current window, window.top returns the topmost window in the hierarchy of window objects.
Window: unhandledrejection event - Web APIs
bubbles no cancelable yes interface promiserejectionevent event handler property onunhandledrejection usage
notes allowing the unhandledrejection event to bubble will eventually result in an error message being output to the console.
Window: unload event - Web APIs
interface event event handler property onunload it is fired after: beforeunload (cancelable event) pagehide the document is in the following state: all the resources still exist (img, iframe etc.) nothing is visible anymore to the end user ui interactions are ineffective (window.open, alert, confirm, etc.) an error won't stop the unloading workflow please
note that the unload event also follows the document tree: parent frame unload will happen before child frame unload (see example below).
Window.updateCommands() - Web APIs
notes this enables or disables items (setting or clearing the "disabled" attribute on the command node as appropriate), or ensures that the command state reflects the state of the selection by setting current state information in the "state" attribute of the xul command nodes.
WindowEventHandlers - Web APIs
note: windoweventhandlers is a mixin and not an interface; you can't actually create an object of type windoweventhandlers.
WindowOrWorkerGlobalScope.clearTimeout() - Web APIs
{ alert(amessage); this.timeoutid = undefined; }, setup: function() { if (typeof this.timeoutid === 'number') { this.cancel(); } this.timeoutid = window.settimeout(function(msg) { this.remind(msg); }.bind(this), 1000, 'wake up!'); }, cancel: function() { window.cleartimeout(this.timeoutid); } }; window.onclick = function() { alarm.setup(); };
notes passing an invalid id to cleartimeout() silently does nothing; no exception is thrown.
XRWebGLLayerInit.depth - Web APIs
usage
notes this property differs from ignoredepthvalues in that a layer created with ignoredepthvalues set to true may still have a depth buffer, but will not make use of it.
msRegionOverflow - Web APIs
note that the region's overflow property value can be used to control the visibility of the overflowing content.
msWriteProfilerMark - Web APIs
notes mswriteprofilermark enables you to inject dom based performance markers in addition to existing javascript api to learn exactly when parts of the page are being rendered, building a waterfall view for every one of our impressions showing latency per object, which can be useful for more accurately debugging real users perf issues.
mssitemodejumplistitemremoved - Web APIs
syntax event property object.oncandidatewindowhide = handler; addeventlistener method object.addeventlistener("mssitemodejumplistitemremoved", handler, usecapture) general info synchronous no bubbles no cancelable no
note this event is raised once for every item that has been removed since the last time mssitemodeshowjumplist was called.
msthumbnailclick - Web APIs
syntax event property object.onmsthumbnailclick = handler; addeventlistener method object.addeventlistener("msthumbnailclick", handler, usecapture) general info synchronous no bubbles no cancelable no
note the onmsthumbnailclick event is available only to documents that are launched from a pinned site shortcut.
Using ARIA: Roles, states, and properties - Accessibility
combobox grid (including row, gridcell, rowheader, columnheader roles) listbox (including option role) menu menubar radiogroup (see radio role) tablist (including tab and tabpanel roles) tree treegrid document structure roles application article cell columnheader definition directory document feed figure group heading img list listitem math none
note presentation row rowgroup rowheader separator table term textbox toolbar tooltip landmark roles banner complementary contentinfo form main navigation region search live region roles alert log marquee status timer window roles alertdialog dialog states and properties widget attributes aria-autocomplete aria-checked aria-current aria-disabled a...
How to file ARIA-related bugs - Accessibility
tbd: add proper accessibility markup to table genre software where to file
notes screen readers freedom scientific jaws jaws technical support form gw micro window eyes window-eyes comments, questions, and feedback (email) non visual desktop access (nvda) file nvda bugs discuss nvda issues browsers apple safari file webkit.org bugs google chrome file chromium bugs microsoft...
ARIA: tabpanel role - Accessibility
the aria tabpanel role indicates description an element with the tabpanel role associated roles and attributes aria- keyboard interaction key action tab → ← delete required javascript features include
note about semantic alternatives to using this role or attribute.
ARIA: article role - Accessibility
</article> description the article role de
notes a section of a document, page, or site that, if it were standing on its own, could be viewed as a complete document, page or site.
ARIA: figure role - Accessibility
note: if at all possible in your work, you should use the appropriate semantic html elements to mark up a figure and its caption — <figure> and <figcaption>.
:active - CSS: Cascading Style Sheets
note: on systems with multi-button mice, css3 specifies that the :active pseudo-class must only apply to the primary button; on right-handed mice, this is typically the leftmost button.
:first-child - CSS: Cascading Style Sheets
/* selects any <p> that is the first element among its siblings */ p:first-child { color: lime; }
note: as originally defined, the selected element had to have a parent.
:first - CSS: Cascading Style Sheets
(see :first-child for general first element of a node.) /* selects the first page when printing */ @page :first { margin-left: 50%; margin-top: 50%; }
note: you can't change all css properties with this pseudo-class.
:fullscreen - CSS: Cascading Style Sheets
syntax :fullscreen usage
notes the :fullscreen pseudo-class lets you configure your stylesheets to automatically adjust the size, style, or layout of content when elements switch back and forth between full-screen and traditional presentations.
:invalid - CSS: Cascading Style Sheets
mdn understanding wcag, guideline 1.4 explanations understanding success criterion 1.4.1 | w3c understanding wcag 2.0
notes radio buttons if any one of the radio buttons in a group is required, the :invalid pseudo-class is applied to all of them if none of the buttons in the group is selected.
:last-child - CSS: Cascading Style Sheets
/* selects any <p> that is the last element among its siblings */ p:last-child { color: lime; }
note: as originally defined, the selected element had to have a parent.
:not() - CSS: Cascading Style Sheets
h.</div> css .fancy { text-shadow: 2px 2px 3px gold; } /* <p> elements that are not in the class `.fancy` */ p:not(.fancy) { color: green; } /* elements that are not <p> elements */ body :not(p) { text-decoration: underline; } /* elements that are not <div> and not <span> elements */ body :not(div):not(span) { font-weight: bold; } /* elements that are not `.crazy` or `.fancy` */ /*
note that this syntax is not well supported yet.
:nth-last-child() - CSS: Cascading Style Sheets
/* selects every fourth element among any group of siblings, counting backwards from the last one */ :nth-last-child(4n) { color: lime; }
note: this pseudo-class is essentially the same as :nth-child, except it counts items backwards from the end, not forwards from the beginning.
Stacking with floated blocks - CSS: Cascading Style Sheets
this behavior can be shown with an added rule to the above list: the background and borders of the root element descendant non-positioned blocks, in order of appearance in the html floating blocks descendant non-positioned inline elements descendant positioned elements, in order of appearance in the html
note: if an opacity value is applied to the non-positioned block (div #4), then something strange happens: the background and border of that block pops up above the floating blocks and the positioned blocks.
Stacking context example 1 - CSS: Cascading Style Sheets
in terms of stacking contexts, div #1 and div #3 are simply assimilated into the root element, and the resulting hierarchy is the following: root stacking context div #2 (z-index 1) div #4 (z-index 2)
note: div #1 and div #3 are not translucent.
Stacking context example 2 - CSS: Cascading Style Sheets
to better understand the situation, this is the stacking context hierarchy: root stacking context div #2 (z-index 2) div #3 (z-index 1) div #4 (z-index 10)
note: it is worth remembering that in general the html hierarchy is different from the stacking context hierarchy.
Browser compatibility and Scroll Snap - CSS: Cascading Style Sheets
the main things to
note are as follows: the scroll-snap-type-x and scroll-snap-type-y properties have been dropped the scroll-snap-type property has become a longhand, so the old shorthand syntax like scroll-snap-type:mandatory will stop working can i use the old implementation as a fallback?
CSS Text Decoration - CSS: Cascading Style Sheets
be careful when removing the text decoration on anchors since users often depend on the underline to de
note hyperlinks.</p> <p class="underover">this text has lines above <em>and</em> below it.</p> <p class="thick">this text has a really thick purple underline in supporting browsers.</p> <p class="blink">this text might blink for you, depending on the browser you use.</p> specifications specification status comment css text decoration module level 4 working draft...
CSS values and units - CSS: Cascading Style Sheets
(but see
notes regarding whitespace within pages for min(), max() and clamp() functions.) some legacy functional notations such as rgba() use commas, but generally commas are only used to separate items in a list.
animation-direction - CSS: Cascading Style Sheets
note: when you specify multiple comma-separated values on an animation-* property, they will be assigned to the animations specified in the animation-name property in different ways depending on how many there are.
animation-fill-mode - CSS: Cascading Style Sheets
note: when you specify multiple comma-separated values on an animation-* property, they will be assigned to the animations specified in the animation-name property in different ways depending on how many there are.
animation-name - CSS: Cascading Style Sheets
note: when you specify multiple comma-separated values on an animation-* property, they will be assigned to the animations specified in the animation-name property in different ways depending on how many there are.
animation-play-state - CSS: Cascading Style Sheets
note: when you specify multiple comma-separated values on an animation-* property, they will be assigned to the animations specified in the animation-name property in different ways depending on how many there are.
attr() - CSS: Cascading Style Sheets
note: the attr() function can be used with any css property, but support for properties other than content is experimental, and support for the type-or-unit parameter is sparse.
border-bottom-color - CSS: Cascading Style Sheets
note which side of the box is <span class="redtext">red</span>.</p> </div> css .mybox { border: solid 0.3em gold; border-bottom-color: red; width: auto; } .redtext { color: red; } result specifications specification status comment css backgrounds and borders module level 3the definition of 'border-bottom-color' in that specification.
border-bottom-width - CSS: Cascading Style Sheets
if it's a keyword, it must be one of the following values: thin a thin border medium a medium border thick a thick border
note: because the specification doesn't define the exact thickness de
noted by each keyword, the precise result when using one of them is implementation-specific.
border-left-color - CSS: Cascading Style Sheets
note which side of the box is <span class="redtext">red</span>.</p> </div> css .mybox { border: solid 0.3em gold; border-left-color: red; width: auto; } .redtext { color: red; } result specifications specification status comment css backgrounds and borders module level 3the definition of 'border-left-color' in that specification.
border-left-width - CSS: Cascading Style Sheets
if it's a keyword, it must be one of the following values: thin a thin border medium a medium border thick a thick border
note: because the specification doesn't define the exact thickness de
noted by each keyword, the precise result when using one of them is implementation-specific.
border-right-color - CSS: Cascading Style Sheets
note which side of the box is <span class="redtext">red</span>.</p> </div> css .mybox { border: solid 0.3em gold; border-right-color: red; width: auto; } .redtext { color: red; } result specifications specification status comment css backgrounds and borders module level 3the definition of 'border-right-color' in that specification.
border-right-width - CSS: Cascading Style Sheets
if it's a keyword, it must be one of the following values: thin a thin border medium a medium border thick a thick border
note: because the specification doesn't define the exact thickness de
noted by each keyword, the precise result when using one of them is implementation-specific.
border-top-color - CSS: Cascading Style Sheets
note which side of the box is <span class="redtext">red</span>.</p> </div> css .mybox { border: solid 0.3em gold; border-top-color: red; width: auto; } .redtext { color: red; } result specifications specification status comment css backgrounds and borders module level 3the definition of 'border-top-color' in that specification.
border-top-width - CSS: Cascading Style Sheets
if it's a keyword, it must be one of the following values: thin a thin border medium a medium border thick a thick border
note: because the specification doesn't define the exact thickness de
noted by each keyword, the precise result when using one of them is implementation-specific.
border-width - CSS: Cascading Style Sheets
if it's a keyword, it must be one of the following values: thin a thin border medium a medium border thick a thick border
note: because the specification doesn't define the exact thickness de
noted by each keyword, the precise result when using one of them is implementation-specific.
box-align - CSS: Cascading Style Sheets
notes the edge of the box designated the start for alignment purposes depends on the box's orientation: horizontal top vertical left the edge opposite to the start is designated the end.
box-direction - CSS: Cascading Style Sheets
notes the edge of the box designated the start for layout purposes depends on the box's orientation: horizontal left vertical top the edge opposite to the start is designated the end.
box-pack - CSS: Cascading Style Sheets
notes the edge of the box designated the start for packing purposes depends on the box's orientation and direction: normal reverse horizontal left right vertical top bottom the edge opposite to the start is designated the end.
clip - CSS: Cascading Style Sheets
/* keyword value */ clip: auto; /* <shape> values */ clip: rect(1px 10em 3rem 2ch); clip: rect(1px, 10em, 3rem, 2ch); /* global values */ clip: inherit; clip: initial; clip: unset; syntax
note: where possible, authors are encouraged to use the newer clip-path property instead.
color-adjust - CSS: Cascading Style Sheets
usage
notes there are a number of reasons a browser might wish to deviate from the specified appearance, such as: the content uses text and background colors that will be too similar on the output device for legibility purposes.
mask-size - CSS: Cascading Style Sheets
two-value syntax */ /* first value: width of the image, second value: height */ mask-size: 50% auto; mask-size: 3em 25%; mask-size: auto 6px; mask-size: auto auto; /* multiple values */ /* do not confuse this with mask-size: auto auto */ mask-size: auto, auto; mask-size: 50%, 25%, 25%; mask-size: 6px, auto, contain; /* global values */ mask-size: inherit; mask-size: initial; mask-size: unset;
note: if the value of this property is not set in a mask shorthand property that is applied to the element after the mask-size css property, the value of this property is then reset to its initial value by the shorthand property.
max() - CSS: Cascading Style Sheets
notes math expressions involving percentages for widths and heights on table columns, table column groups, table rows, table row groups, and table cells in both auto and fixed layout tables may be treated as if auto had been specified.
min() - CSS: Cascading Style Sheets
notes math expressions involving percentages for widths and heights on table columns, table column groups, table rows, table row groups, and table cells in both auto and fixed layout tables may be treated as if auto had been specified.
Guide to scroll anchoring - CSS: Cascading Style Sheets
to opt out the entire document, you can set it on the <body> element: body { overflow-anchor: none; } to opt out a certain part of the document use overflow-anchor: none on its container element: .container { overflow-anchor: none; }
note: the specification details that once scroll anchoring has been opted out of, you cannot opt back into it from a child element.
text-align - CSS: Cascading Style Sheets
</p> css .example { text-align: justify; border: solid; } result
notes the standard-compatible way to center a block itself without centering its inline content is setting the left and right margin to auto, e.g.: .something { margin: auto; } .something { margin: 0 auto; } .something { margin-left: auto; margin-right: auto; } specifications specification status comment css logical properties and values level 1the definiti...
text-decoration-style - CSS: Cascading Style Sheets
if the specified decoration has a specific semantic meaning, like a line-through line meaning that some text has been deleted, authors are encouraged to de
note this meaning using an html tag, like <del> or <s>.
text-emphasis-position - CSS: Cascading Style Sheets
the informative table below summarizes the preferred emphasis mark positions for chinese, mongolian and japanese: preferred emphasis mark and ruby position language preferred position illustration horizontal vertical japanese over right korean mongolian chinese under right
note: the text-emphasis-position cannot be set, and therefore are not reset either, using the text-emphasis shorthand property.
text-overflow - CSS: Cascading Style Sheets
t-overflow: " [..]"; } html <p class="overflow-visible">lorem ipsum dolor sit amet, consectetur adipisicing elit.</p> <p class="overflow-clip">lorem ipsum dolor sit amet, consectetur adipisicing elit.</p> <p class="overflow-ellipsis">lorem ipsum dolor sit amet, consectetur adipisicing elit.</p> <p class="overflow-string">lorem ipsum dolor sit amet, consectetur adipisicing elit.</p> result
note: live results in the following table may be shown incorrectly due to a limitation of the mdn editor which removes the all contents of style attributes which have text-overflow properties with string value.
touch-action - CSS: Cascading Style Sheets
note that scrolling "up" (pan-up) means that the user is dragging their finger downward on the screen surface, and likewise pan-left means the user is dragging their finger to the right.
transition-delay - CSS: Cascading Style Sheets
syntax /* <time> values */ transition-delay: 3s; transition-delay: 2s, 4ms; /* global values */ transition-delay: inherit; transition-delay: initial; transition-delay: unset; values <time> de
notes the amount of time to wait between a property's value changing and the start of the transition effect.
transition-timing-function - CSS: Cascading Style Sheets
whether the transition holds temporarily at 0%, 20%, 40%, 60% and 80%, on the 20%, 40%, 60%, 80% and 100%, or makes 5 stops between the 0% and 100% along the transition, or makes 5 stops including the 0% and 100% marks (on the 0%, 25%, 50%, 75%, and 100%) depends on which of the following jump terms is used: jump-start de
notes a left-continuous function, so that the first jump happens when the transition begins; jump-end de
notes a right-continuous function, so that the last jump happens when the animation ends; jump-none there is no jump on either end.
vertical-align - CSS: Cascading Style Sheets
is for and why it is here, it will instantly disappear and be replaced by something even more bizarre and inexplicable.</p> <p>there is another theory which states that this has already happened.</p> </td> </tr> </table> table { margin-left: auto; margin-right: auto; width: 80%; } table, th, td { border: 1px solid black; } td { padding: 0.5em; font-family: monospace; }
note that vertical-align only applies to inline, inline-block and table-cell elements: you can't use it to vertically align block-level elements.
HTML attribute: max - HTML: Hypertext Markup Language
week yyyy-w## <input type="week" max="2019-w23" step=""> time hh:mm <input type="time" max="17:00" step="900"> datetime-local yyyy-mm-ddthh:mm <input type="datetime-local" min="2019-12-25t23:59"> number <number> <input type="number" min="0" step="5" max="100"> range <number> <input type="range" min="60" step="5" max="100">
note: when the data entered by the user doesn't adhere to the maximum value set, the value is considered invalid in contraint validation and will match the :invalid and :out-of-range pseudoclasses see client-side validation and rangeoverflow for more information.
HTML attribute: min - HTML: Hypertext Markup Language
week yyyy-w## <input type="week" min="2019-w23" step=""> time hh:mm <input type="time" min="09:00" step="900"> datetime-local yyyy-mm-ddthh:mm <input type="datetime-local" min="2019-12-25t19:30"> number <number> <input type="number" min="0" step="5" max="100"> range <number> <input type="range" min="60" step="5" max="100">
note: when the data entered by the user doesn't adhere to the min value set, the value is considered invalid in contraint validation and will match the :invalid pseudoclass see client-side validation and rangeunderflow for more information.
HTML attribute: step - HTML: Hypertext Markup Language
the number spinner, if present, will only show valid float values of 1.2 and greater
note: when the data entered by the user doesn't adhere to the stepping configuration, the value is considered invalid in contraint validation and will match the :invalid and :out-of-range pseudoclasses see client-side validation and stepmismatch for more information.
<cite>: The Citation element - HTML: Hypertext Markup Language
usage
notes in the context of the <cite> element, a creative work that might be cited could be, for example, one of the following: a book a research paper an essay a poem a musical score a song a play or film script a film a television show a game a sculpture a painting a theatrical production a play an opera a musical an exhibition a legal case report a computer program a web site ...
<code>: The Inline Code element - HTML: Hypertext Markup Language
example a paragraph of text that includes <code>: <p>the function <code>selectall()</code> highlights all the text in the input field so the user can, for example, copy or delete the text.</p> the output generated by this html looks like this:
notes to represent multiple lines of code, wrap the <code> element within a <pre> element.
CSP: manifest-src - HTTP
when generating the hash, don't include the <script> or <style> tags and
note that capitalization and whitespace matter, including leading or trailing whitespace.
CSP: media-src - HTTP
when generating the hash, don't include the <script> or <style> tags and
note that capitalization and whitespace matter, including leading or trailing whitespace.
CSP: object-src - HTTP
when generating the hash, don't include the <script> or <style> tags and
note that capitalization and whitespace matter, including leading or trailing whitespace.
CSP: prefetch-src - HTTP
when generating the hash, don't include the <script> or <style> tags and
note that capitalization and whitespace matter, including leading or trailing whitespace.
CSP: script-src-attr - HTTP
when generating the hash, don't include the <script> or <style> tags and
note that capitalization and whitespace matter, including leading or trailing whitespace.
CSP: script-src-elem - HTTP
when generating the hash, don't include the <script> or <style> tags and
note that capitalization and whitespace matter, including leading or trailing whitespace.
CSP: style-src-attr - HTTP
when generating the hash, don't include the <script> or <style> tags and
note that capitalization and whitespace matter, including leading or trailing whitespace.
CSP: style-src-elem - HTTP
when generating the hash, don't include the <script> or <style> tags and
note that capitalization and whitespace matter, including leading or trailing whitespace.
CSP: worker-src - HTTP
when generating the hash, don't include the <script> or <style> tags and
note that capitalization and whitespace matter, including leading or trailing whitespace.
Cross-Origin-Resource-Policy - HTTP
note: due to a bug in chrome, setting cross-origin-resource-policy can break pdf rendering, preventing visitors from being able to read past the first page of some pdfs.
DPR - HTTP
note: client hints are accessible only on secure origins (via tls).
Date - HTTP
note that date is listed in the forbidden header names in the fetch spec - so this code will not send date header: fetch('https://httpbin.org/get', { 'headers': { 'date': (new date()).toutcstring() } }) header type general header forbidden header name yes syntax date: <day-name>, <day> <month> <year> <hour>:<minute>:<second> gmt directives <day-name> one of "mon", "tue", "wed", "thu", "fri", "sat", or "sun" (case-sensitive).
Expect-CT - HTTP
expect-ct: max-age=86400, enforce, report-uri="https://foo.example/report"
notes root cas manually added to the trust store override and suppress expect-ct reports/enforcement.
Network Error Logging - HTTP
"url": "https://example.com/previous-page", "body": { "elapsed_time": 338, "method": "post", "phase": "application", "protocol": "http/1.1", "referrer": "https://example.com/previous-page", "sampling_fraction": 1, "server_ip": "137.205.28.66", "status_code": 400, "type": "http.error", "url": "https://example.com/bad-request" } } dns name not resolved
note that the phase is set to dns in this report and no server_ip is available to include.
HTTP resources and specifications - HTTP
rfc 6797 http strict transport security (hsts) proposed standard upgrade insecure requests upgrade insecure requests candidate recommendation content security policy 1.0 content security policy 1.0 csp 1.1 and csp 3.0 doesn't extend the http standard obsolete microsoft document specifying legacy document modes* defines x-ua-compatible
note rfc 5689 http extensions for web distributed authoring and versioning (webdav) these extensions of the web, as well as carddav and caldav, are out-of-scope for http on the web.
A typical HTTP session - HTTP
note: the client-server model does not allow the server to send data to the client without an explicit request for it.
205 Reset Content - HTTP
status 205 reset content specifications specification title rfc 7231, section 6.3.6: 205 reset content hypertext transfer protocol (http/1.1): semantics and content compatibility
notes browser behavior differs if this response erroneously includes a body on persistent connections see 204 no content for more detail.
411 Length Required - HTTP
note: by specification, when sending data in a series of chunks, the content-length header is omitted and at the beginning of each chunk you need to add the length of the current chunk in hexadecimal format.
502 Bad Gateway - HTTP
note: a gateway might refer to different things in networking and a 502 error is usually not something you can fix, but requires a fix by the web server or the proxies you are trying to get access through.
504 Gateway Timeout - HTTP
note: a gateway might refer to different things in networking and a 504 error is usually not something you can fix, but requires a fix by the web server or the proxies you are trying to get access through.
CSS Houdini
li { background-image: paint(mycomponent, stroke, 10px); --highlights: blue; --lowlights: green; }
note: with great power comes great responsibility!
Keyed collections - JavaScript
note: remember that set objects store unique values—so any duplicate elements from an array are deleted when converting!
Loops and iteration - JavaScript
(
note that it's possible that number could be zero!) the various loop mechanisms offer different ways to determine the start and end points of the loop.
Groups and ranges - JavaScript
personlist)) !== null); using named groups let personlist = `first_name: john, last_name: doe first_name: jane, last_name: smith`; let regexpnames = /first_name: (?<firstname>\w+), last_name: (?<lastname>\w+)/mg; let match = regexpnames.exec(personlist); do { console.log(`hello ${match.groups.firstname} ${match.groups.lastname}`); } while((match = regexpnames.exec(personlist)) !== null);
note: not all browsers support this feature; refer to the compatibility table.
Quantifiers - JavaScript
note: in the following, item refers not only to singular characters, but also includes character classes, unicode property escapes, groups and ranges.
constructor - JavaScript
class square extends polygon { constructor(length) { // here, it calls the parent class' constructor with lengths // provided for the polygon's width and height super(length, length); //
note: in derived classes, `super()` must be called before you // can use `this`.
extends - JavaScript
class square extends polygon { constructor(length) { // here, it calls the parent class' constructor with lengths // provided for the polygon's width and height super(length, length); //
note: in derived classes, super() must be called before you // can use 'this'.
RangeError: precision is out of range - JavaScript
ses 77.1234.toexponential(-1); // rangeerror 77.1234.toexponential(101); // rangeerror 2.34.tofixed(-100); // rangeerror 2.34.tofixed(1001); // rangeerror 1234.5.toprecision(-1); // rangeerror 1234.5.toprecision(101); // rangeerror valid cases 77.1234.toexponential(4); // 7.7123e+1 77.1234.toexponential(2); // 7.71e+1 2.34.tofixed(1); // 2.3 2.35.tofixed(1); // 2.4 (
note that it rounds up in this case) 5.123456.toprecision(5); // 5.1235 5.123456.toprecision(2); // 5.1 5.123456.toprecision(1); // 5 ...
SyntaxError: Unexpected token - JavaScript
: function round(n, upperbound, lowerbound){ if(n > upperbound) || (n < lowerbound){ throw 'number ' + string(n) + ' is more than ' + string(upperbound) + ' or less than ' + string(lowerbound); }else if(n < ((upperbound + lowerbound)/2)){ return lowerbound; }else{ return upperbound; } } // syntaxerror: expected expression, got '||' the brackets may look correct at first, but
note how the || is outside the brackets.
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.
Array.prototype.flat() - JavaScript
flatdeep(val, d - 1) : val), []) : arr.slice(); }; flatdeep(arr, infinity); // [1, 2, 3, 4, 5, 6] use a stack // non recursive flatten deep using a stack //
note that depth control is hard/inefficient as we will need to tag each value with its own depth // also possible w/o reversing on shift/unshift, but array ops on the end tends to be faster function flatten(input) { const stack = [...input]; const res = []; while(stack.length) { // pop value from stack const next = stack.pop(); if(array.isarray(next)) { // push back array items...
Array.prototype.flatMap() - JavaScript
alternative reduce() and concat() var arr = [1, 2, 3, 4]; arr.flatmap(x => [x, x * 2]); // is equivalent to arr.reduce((acc, x) => acc.concat([x, x * 2]), []); // [1, 2, 2, 4, 3, 6, 4, 8]
note, however, that this is inefficient and should be avoided for large arrays: in each iteration, it creates a new temporary array that must be garbage-collected, and it copies elements from the current accumulator array into a new array instead of just adding the new elements to the existing array.
Array.from() - JavaScript
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()).
Array.of() - JavaScript
the difference between array.of() and the array constructor is in the handling of integer arguments: array.of(7) creates an array with a single element, 7, whereas array(7) creates an empty array with a length property of 7 (
note: this implies an array of 7 empty slots, not slots with actual undefined values).
Array.prototype.unshift() - JavaScript
please
note that, if multiple elements are passed as parameters, they're inserted in chunk at the beginning of the object, in the exact same order they were passed as parameters.
BigInt - JavaScript
1 : 0)) // ↪ [ -12n, 0, 0n, 4n, 4, 6, 10 ]
note that comparisons with object-wrapped bigints act as with other objects, only indicating equality when the same object instance is compared: 0n === object(0n) // false object(0n) === object(0n) // false const o = object(0n) o === o // true conditionals a bigint behaves like a number in cases where: it is converted to a boolean: via the boolean function; when u...
Boolean - JavaScript
note: when the non-standard property document.all is used as an argument for this constructor, the result is a boolean object with the value false.
Date.prototype.getDay() - JavaScript
var xmas95 = new date('december 25, 1995 23:15:30'); var weekday = xmas95.getday(); console.log(weekday); // 1
note: if needed, the full name of a day ("monday" for example) can be obtained by using intl.datetimeformat with an options parameter.
Date.prototype.getMonth() - JavaScript
var xmas95 = new date('december 25, 1995 23:15:30'); var month = xmas95.getmonth(); console.log(month); // 11
note: if needed, the full name of a month ("january" for example) can be obtained by using intl.datetimeformat() with an options parameter.
Date.prototype.toDateString() - JavaScript
examples a basic usage of todatestring() var d = new date(1993, 5, 28, 14, 39, 7); console.log(d.tostring()); // logs mon jun 28 1993 14:39:07 gmt-0600 (pdt) console.log(d.todatestring()); // logs mon jun 28 1993
note: month are 0-indexed when used as an argument of date (thus 0 corresponds to january and 11 to december).
Date.prototype.toLocaleString() - JavaScript
for this reason, you cannot expect to be able to compare the results of tolocalestring() to a static value: "1/1/2019, 01:00:00" === new date("2019-01-01t01:00:00z").tolocalestring("en-us"); // true in firefox and others // false in ie and edge
note: see also this stackoverflow thread for more details and examples.
Error.prototype.toSource() - JavaScript
note: be aware that the properties used by the tosource method in the creation of this string are mutable and may not accurately reflect the function used to create an error instance or the filename or line number where the actual error occurred.
Function.prototype.call() - JavaScript
note: while the syntax of this function is almost identical to that of apply(), the fundamental difference is that call() accepts an argument list, while apply() accepts a single array of arguments.
Function.name - JavaScript
property attributes of function.name writable no enumerable no configurable yes
note that in non-standard, pre-es2015 implementations the configurable attribute was false as well.
Intl.Collator() constructor - JavaScript
examples using collator the following example demonstrates the different potential results for a string occurring before, after, or at the same level as another: console.log(new intl.collator().compare('a', 'c')); // → a negative value console.log(new intl.collator().compare('c', 'a')); // → a positive value console.log(new intl.collator().compare('a', 'a')); // → 0
note that the results shown in the code above can vary between browsers and browser versions.
Intl.Collator.supportedLocalesOf() - JavaScript
note the specification of the "lookup" algorithm here — a "best fit" matcher might decide that indonesian is an adequate match for balinese since most balinese speakers also understand indonesian, and therefore return the balinese language tag as well.
Intl.Collator - JavaScript
examples using collator the following example demonstrates the different potential results for a string occurring before, after, or at the same level as another: console.log(new intl.collator().compare('a', 'c')); // → a negative value console.log(new intl.collator().compare('c', 'a')); // → a positive value console.log(new intl.collator().compare('a', 'a')); // → 0
note that the results shown in the code above can vary between browsers and browser versions.
Intl.DateTimeFormat.supportedLocalesOf() - JavaScript
note the specification of the "lookup" algorithm here — a "best fit" matcher might decide that indonesian is an adequate match for balinese since most balinese speakers also understand indonesian, and therefore return the balinese language tag as well.
Intl.DisplayNames.supportedLocalesOf() - JavaScript
note the specification of the "lookup" algorithm here — a "best fit" matcher might decide that indonesian is an adequate match for balinese since most balinese speakers also understand indonesian, and therefore return the balinese language tag as well.
Intl.ListFormat.supportedLocalesOf() - JavaScript
note the specification of the "lookup" algorithm here — a "best fit" matcher might decide that indonesian is an adequate match for balinese since most balinese speakers also understand indonesian, and therefore return the balinese language tag as well.
Intl.NumberFormat() constructor - JavaScript
on: "compact", compactdisplay: "long" }).format(987654321); // → 988 millions new intl.numberformat('en-gb', { notation: "compact", compactdisplay: "short" }).format(987654321); // → 988m displaying signs display a sign for positive and negative numbers, but not zero: new intl.numberformat("en-us", { 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 co...
Intl.NumberFormat.supportedLocalesOf() - JavaScript
note the specification of the "lookup" algorithm here — a "best fit" matcher might decide that indonesian is an adequate match for balinese since most balinese speakers also understand indonesian, and therefore return the balinese language tag as well.
Intl.PluralRules.supportedLocalesOf() - JavaScript
note the specification of the lookup algorithm here — a best fit matcher might decide that indonesian is an adequate match for balinese since most balinese speakers also understand indonesian, and therefore return the balinese language tag as well.
Intl.RelativeTimeFormat.supportedLocalesOf() - JavaScript
note the specification of the "lookup" algorithm here — a "best fit" matcher might decide that indonesian is an adequate match for balinese since most balinese speakers also understand indonesian, and therefore return the balinese language tag as well.
Math.atan() - JavaScript
examples using math.atan() math.atan(1); // 0.7853981633974483 math.atan(0); // 0 math.atan(-0); // -0 math.atan(infinity); // 1.5707963267948966 math.atan(-infinity); // -1.5707963267948966 // the angle that the line [(0,0);(x,y)] forms with the x-axis in a cartesian coordinate system math.atan(y / x);
note that you may want to avoid using ±infinity for stylistic reasons.
Math.log2() - JavaScript
note that it returns imprecise values on some inputs (like 1 << 29), wrap into math.round() if working with bit masks.
Math.random() - JavaScript
examples
note that as numbers in javascript are ieee 754 floating point numbers with round-to-nearest-even behavior, the ranges claimed for the functions below (excluding the one for math.random() itself) aren't exact.
Math.random() - JavaScript
examples
note that as numbers in javascript are ieee 754 floating point numbers with round-to-nearest-even behavior, the ranges claimed for the functions below (excluding the one for math.random() itself) aren't exact.
Math.round() - JavaScript
note that this differs from many languages' round() functions, which often round this case to the next integer away from zero, instead giving a different result in the case of negative numbers with a fractional part of exactly 0.5.
Math - JavaScript
note: many math functions have a precision that’s implementation-dependent.
NaN - JavaScript
nan === nan; // false number.nan === nan; // false isnan(nan); // true isnan(number.nan); // true number.isnan(nan); // true function valueisnan(v) { return v !== v; } valueisnan(1); // false valueisnan(nan); // true valueisnan(number.nan); // true however, do
note the difference between isnan() and number.isnan(): the former will return true if the value is currently nan, or if it is going to be nan after it is coerced to a number, while the latter will return true only if the value is currently nan: isnan('hello world'); // true number.isnan('hello world'); // false additionally, some array methods cannot find nan, while others can.
Number.prototype.toPrecision() - JavaScript
onsole.log(numobj.toprecision(5)) // logs '5.1235' console.log(numobj.toprecision(2)) // logs '5.1' console.log(numobj.toprecision(1)) // logs '5' numobj = 0.000123 console.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.
Object.defineProperties() - JavaScript
polyfill assuming a pristine execution environment with all names and properties referring to their initial values, object.defineproperties is almost completely equivalent (
note the comment in iscallable) to the following reimplementation in javascript: function defineproperties(obj, properties) { function converttodescriptor(desc) { function hasproperty(obj, prop) { return object.prototype.hasownproperty.call(obj, prop); } function iscallable(v) { // nb: modify as necessary if other values than functions are callable.
Object.defineProperty() - JavaScript
they share the following optional keys (
note: the default value is in the case of defining properties using object.defineproperty()): configurable true if and only if the type of this property descriptor may be changed and if the property may be deleted from the corresponding object.
Object.getOwnPropertyNames() - JavaScript
' -> ' + obj[val]); } ); // logs // 0 -> a // 1 -> b // 2 -> c // non-enumerable property var my_obj = object.create({}, { getfoo: { value: function() { return this.foo; }, enumerable: false } }); my_obj.foo = 1; console.log(object.getownpropertynames(my_obj).sort()); // logs ["foo", "getfoo"] if you want only the enumerable properties, see object.keys() or use a for...in loop (
note that this will also return enumerable properties found along the prototype chain for the object unless the latter is filtered with hasownproperty()).
Object.keys() - JavaScript
var result = [], prop, i; for (prop in obj) { if (hasownproperty.call(obj, prop)) { result.push(prop); } } if (hasdontenumbug) { for (i = 0; i < dontenumslength; i++) { if (hasownproperty.call(obj, dontenums[i])) { result.push(dontenums[i]); } } } return result; }; }()); } please
note that the above code includes non-enumerable keys in ie7 (and maybe ie8), when passing in an object from a different window.
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.
Object.prototype.valueOf() - JavaScript
an object's valueof method is usually invoked by javascript, but you can invoke it yourself as follows: mynumbertype.valueof()
note: objects in string contexts convert via the tostring() method, which is different from string objects converting to string primitives using valueof.
Promise() constructor - JavaScript
note that if you call resolutionfunc or rejectionfunc and pass another promise object as an argument, you can say that it is "resolved", but still cannot be said to be "settled".
Promise.prototype.then() - JavaScript
didn't bother to instantiate and return " + "a promise in the prior then so the sequence may be a bit " + "surprising"); //
note that `string` will not have the 'baz' bit of it at this point.
RegExp.$1-$9 - JavaScript
regexp.$1 : '0'; number; // "24" please
note that any operation involving the usage of other regular expressions between a re.test(str) call and the regexp.$n property, might have side effects, so that accessing these special properties should be done instantly, otherwise the result might be unexpected.
String.prototype.codePointAt() - JavaScript
var first = string.charcodeat(index); var second; if ( // check if it’s the start of a surrogate pair first >= 0xd800 && first <= 0xdbff && // high surrogate size > index + 1 // there is a next code unit ) { second = string.charcodeat(index + 1); if (second >= 0xdc00 && second <= 0xdfff) { // low surrogate // https://mathiasbynens.be/
notes/javascript-encoding#surrogate-formulae return (first - 0xd800) * 0x400 + second - 0xdc00 + 0x10000; } } return first; }; if (defineproperty) { defineproperty(string.prototype, 'codepointat', { 'value': codepointat, 'configurable': true, 'writable': true }); } else { string.prototype.codepointat = codepointat; ...
String.fromCodePoint() - JavaScript
point>>>0) === codepoint clause handles decimals and negatives if (!(codepoint < 0x10ffff && (codepoint>>>0) === codepoint)) throw rangeerror("invalid code point: " + codepoint); if (codepoint <= 0xffff) { // bmp code point codelen = codeunits.push(codepoint); } else { // astral code point; split in surrogate halves // https://mathiasbynens.be/
notes/javascript-encoding#surrogate-formulae codepoint -= 0x10000; codelen = codeunits.push( (codepoint >> 10) + 0xd800, // highsurrogate (codepoint % 0x400) + 0xdc00 // lowsurrogate ); } if (codelen >= 0x3fff) { result += stringfromcharcode.apply(null, codeunits); codeunits.length = 0; } } r...
String.prototype.lastIndexOf() - JavaScript
'canal'.lastindexof('a'); // returns 3 'canal'.lastindexof('a', 2); // returns 1 'canal'.lastindexof('a', 0); // returns -1 'canal'.lastindexof('x'); // returns -1 'canal'.lastindexof('c', -5); // returns 0 'canal'.lastindexof('c', 0); // returns 0 'canal'.lastindexof(''); // returns 5 'canal'.lastindexof('', 2); // returns 2
note: 'abab'.lastindexof('ab', 2) will return 2 and not 0, as fromindex limits only the beginning of the match.
String.prototype.match() - JavaScript
const str = 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz'; const regexp = /[a-e]/gi; const matches_array = str.match(regexp); console.log(matches_array); // ['a', 'b', 'c', 'd', 'e', 'a', 'b', 'c', 'd', 'e']
note: see also string.prototype.matchall() and advanced searching with flags.
String.prototype.normalize() - JavaScript
in the example below we normalize two representations of the character "ñ": let string1 = '\u00f1'; // ñ let string2 = '\u006e\u0303'; // ñ string1 = string1.normalize('nfd'); string2 = string2.normalize('nfd'); console.log(string1 === string2); // true console.log(string1.length); // 2 console.log(string2.length); // 2 composed and decomposed forms
note that the length of the normalized form under "nfd" is 2.
String.prototype.substring() - JavaScript
// replaces olds with news in the string fulls function replacestring(olds, news, fulls) { for (let i = 0; i < fulls.length; ++i) { if (fulls.substring(i, i + olds.length) == olds) { fulls = fulls.substring(0, i) + news + fulls.substring(i + olds.length, fulls.length) } } return fulls } replacestring('world', 'web', 'brave new world')
note that this can result in an infinite loop if olds is itself a substring of news — for example, if you attempted to replace 'world' with 'otherworld' here.
Symbol.isConcatSpreadable - JavaScript
symbol.isconcatspreadable needs to be set to true in order to get a flattened array: let x = [1, 2, 3] let fakearray = { [symbol.isconcatspreadable]: true, length: 2, 0: 'hello', 1: 'world' } x.concat(fakearray) // [1, 2, 3, "hello", "world"]
note: the length property is used to control the number of object properties to be added.
WeakSet() constructor - JavaScript
examples using the weakset object var ws = new weakset(); var foo = {}; var bar = {}; ws.add(foo); ws.add(bar); ws.has(foo); // true ws.has(bar); // true ws.delete(foo); // removes foo from the set ws.has(foo); // false, foo has been removed ws.has(bar); // true, bar is retained
note that foo !== bar.
WebAssembly.Global() constructor - JavaScript
webassembly.instantiatestreaming(fetch('global.wasm'), { js: { global } }) .then(({instance}) => { asserteq("getting initial value from wasm", instance.exports.getglobal(), 0); global.value = 42; asserteq("getting js-updated value from wasm", instance.exports.getglobal(), 42); instance.exports.incglobal(); asserteq("getting wasm-updated value from js", global.value, 43); });
note: you can see the example running live on github; see also the source code.
WebAssembly.Global - JavaScript
webassembly.instantiatestreaming(fetch('global.wasm'), { js: { global } }) .then(({instance}) => { asserteq("getting initial value from wasm", instance.exports.getglobal(), 0); global.value = 42; asserteq("getting js-updated value from wasm", instance.exports.getglobal(), 42); instance.exports.incglobal(); asserteq("getting wasm-updated value from js", global.value, 43); });
note: you can see the example running live on github; see also the source code.
escape() - JavaScript
note: this function was used mostly for url queries (the part of a url following ?)—not for escaping ordinary string literals, which use the format "\xhh".
eval() - JavaScript
note that since json syntax is limited compared to javascript syntax, many valid javascript literals will not parse as json.
isNaN() - JavaScript
note, coercion inside the isnan function has interesting rules; you may alternatively want to use number.isnan(), as defined in ecmascript 2015.
undefined - JavaScript
var x; if (x === undefined) { // these statements execute } else { // these statements do not execute }
note: the strict equality operator (as opposed to the standard equality operator) must be used here, because x == undefined also checks whether x is null, while strict equality doesn't.
Equality (==) - JavaScript
0 == !!undefined; // true, look at logical not operator null == undefined; // true const number1 = new number(3); const number2 = new number(3); number1 == 3; // true number1 == number2; // false comparison of objects const object1 = {"key": "value"} const object2 = {"key": "value"}; object1 == object2 // false object2 == object2 // true comparing strings and string objects
note that strings constructed using new string() are objects.
Exponentiation (**) - JavaScript
note that some programming languages use the caret symbol ^ for exponentiation, but javascript uses that symbol for the bitwise logical xor operator.
Logical OR (||) - JavaScript
o3 = true || false // t || f returns true o4 = false || (3 == 4) // f || f returns false o5 = 'cat' || 'dog' // t || t returns "cat" o6 = false || 'cat' // f || t returns "cat" o7 = 'cat' || false // t || f returns "cat" o8 = '' || false // f || f returns false o9 = false || '' // f || f returns "" o10 = false || varobject // f || object returns varobject
note: if you use this operator to provide a default value to some variable, be aware that any falsy value will not be used.
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).
super - JavaScript
// here, it calls the parent class's constructor with lengths // provided for the rectangle's width and height super(length, length); //
note: in derived classes, super() must be called before you // can use 'this'.
block - JavaScript
note that the block-scoped const c = 2 does not throw a syntaxerror: identifier 'c' has already been declared because it can be declared uniquely within the block.
class - JavaScript
note that super(), used in the constructor, can only be used in constructors, and must be called before the this keyword can be used.
const - JavaScript
my_fav = 20; // my_fav is 7 console.log('my favorite number is: ' + my_fav); // trying to redeclare a constant throws an error // uncaught syntaxerror: identifier 'my_fav' has already been declared const my_fav = 20; // the name my_fav is reserved for constant above, so this will fail too var my_fav = 20; // this throws an error too let my_fav = 20; block scoping it's important to
note the nature of block scoping.
for await...of - JavaScript
function* generator() { yield 0; yield 1; yield promise.resolve(2); yield promise.resolve(3); yield 4; } (async function() { for await (let num of generator()) { console.log(num); } })(); // 0 // 1 // 2 // 3 // 4 // compare with for-of loop: for (let numorpromise of generator()) { console.log(numorpromise); } // 0 // 1 // promise { 2 } // promise { 3 } // 4
note: be aware of yielding rejected promises from sync generator.
for...in - JavaScript
array iteration and for...in
note: for...in should not be used to iterate over an array where the index order is important.
for...of - JavaScript
can iterate over the arguments object to examine all of the parameters passed into a javascript function: (function() { for (const argument of arguments) { console.log(argument); } })(1, 2, 3); // 1 // 2 // 3 iterating over a dom collection iterating over dom collections like nodelist: the following example adds a read class to paragraphs that are direct descendants of an article: //
note: this will only work in platforms that have // implemented nodelist.prototype[symbol.iterator] const articleparagraphs = document.queryselectorall('article > p'); for (const paragraph of articleparagraphs) { paragraph.classlist.add('read'); } closing iterators in for...of loops, abrupt iteration termination can be caused by break, throw or return.
for - JavaScript
/* condition */ nleft += oitnode.offsetleft, ntop += oitnode.offsettop, oitnode = oitnode.offsetparent /* final-expression */ ); /* semicolon */ console.log('offset position of \'' + sid + '\' element:\n left: ' + nleft + 'px;\n top: ' + ntop + 'px;'); } /* example call: */ showoffsetpos('content'); // output: // "offset position of "content" element: // left: 0px; // top: 153px;"
note: this is one of the few cases in javascript where the semicolon is mandatory.
function declaration - JavaScript
you can use the function before you declared it: hoisted(); // logs "foo" function hoisted() { console.log('foo'); }
note that function expressions are not hoisted: nothoisted(); // typeerror: nothoisted is not a function var nothoisted = function() { console.log('bar'); }; examples using function the following code declares a function that returns the total amount of sales, when given the number of units sold of products a, b, and c.
let - JavaScript
note the difference between var, whose scope is inside the function where it is declared.
switch - JavaScript
see example here: var foo = 0; switch (foo) { case -1: console.log('negative 1'); break; case 0: // foo is 0 so criteria met here so this block will run console.log(0); //
note: the forgotten break would have been here case 1: // no break statement in 'case 0:' so this case will run as well console.log(1); break; // it encounters this break so will not continue into 'case 2:' case 2: console.log(2); break; default: console.log('default'); } can i put a default between cases?
throw - JavaScript
each of the following throws an exception: throw 'error2'; // generates an exception with a string value throw 42; // generates an exception with the value 42 throw true; // generates an exception with the value true throw new error('required'); // generates an error object with the message of required also
note that the throw statement is affected by automatic semicolon insertion (asi) as no line terminator between the throw keyword and the expression is allowed.
while - JavaScript
note: use the break statement to stop a loop before condition evaluates to true.
with - JavaScript
note, however, that in many cases this benefit can be achieved by using a temporary variable to store a reference to the desired object.
Template literals (Template strings) - JavaScript
they will show up as undefined element in the “cooked” array: function latex(str) { return { "cooked": str[0], "raw": str.raw[0] } } latex`\unicode` // { cooked: undefined, raw: "\\unicode" }
note that the escape sequence restriction is only dropped from tagged templates—not from untagged template literals: let bad = `bad escape sequence: \unicode`; specifications specification ecmascript (ecma-262)the definition of 'template literals' in that specification.
JavaScript
javascript versions and release
notes browse javascript's feature history and implementation status.
background_color - Web app manifests
note: the background_color member is only meant to improve the user experience while the main stylesheet is loading from the network or the storage media; it is not used by the user agent as the background-color css property when the progressive web app stylesheet is available.
dir - Web app manifests
the dir member can be set to one of the following values: auto — text direction is determined by the user agent ltr — left to right rtl — right to left the directionality-capable members are: name short_name description
note: if the value is omitted or set to auto, the browser will use the unicode bidirectional algorithm to make a best guess about the text's direction.
Using dns-prefetch - Web Performance
you can safely use them together like so: <link rel="preconnect" href="https://fonts.gstatic.com/" crossorigin> <link rel="dns-prefetch" href="https://fonts.gstatic.com/">
note: if a page needs to make connections to many third-party domains, preconnecting them all is counterproductive.
Making PWAs work offline with Service workers - Progressive web apps (PWAs)
registering the service worker we'll start by looking at the code that registers a new service worker, in the app.js file:
note : we're using the es6 arrow functions syntax in the service worker implementation if('serviceworker' in navigator) { navigator.serviceworker.register('./pwa-examples/js13kpwa/sw.js'); }; if the service worker api is supported in the browser, it is registered against the site using the serviceworkercontainer.register() method.
accumulate - SVG: Scalable Vector Graphics
four elements are using this attribute: <animate>, <animatecolor>, <animatemotion>, and <animatetransform> usage
notes value none | sum default value none animatable no sum specifies that each repeat iteration after the first builds upon the last value of the previous iteration.
additive - SVG: Scalable Vector Graphics
four elements are using this attribute: <animate>, <animatecolor>, <animatemotion>, and <animatetransform> usage
notes value replace | sum default value replace animatable no sum specifies that the animation will add to the underlying value of the attribute and other lower priority animations.
alphabetic - SVG: Scalable Vector Graphics
only one element is using this attribute: <font-face> usage
notes value <number> default value 0 animatable no specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'alphabetic' in that specification.
amplitude - SVG: Scalable Vector Graphics
four elements are using this attribute: <fefunca>, <fefuncb>, <fefuncg>, and <fefuncr> usage
notes value <number> default value 1 animatable yes specifications specification status comment filter effects module level 1the definition of 'amplitude' in that specification.
arabic-form - SVG: Scalable Vector Graphics
only one element is using this attribute: <glyph> context
notes value initial | medial | terminal | isolated default value isolated animatable no initial this value indicates that the glyph represents the initial form.
attributeName - SVG: Scalable Vector Graphics
four elements are using this attribute: <animate>, <animatecolor>, <animatetransform>, and <set> html, body, svg { height: 100%; } <svg viewbox="0 0 250 250" xmlns="http://www.w3.org/2000/svg"> <rect x="50" y="50" width="100" height="100"> <animate attributetype="xml" attributename="y" from="0" to="50" dur="5s" repeatcount="indefinite"/> </rect> </svg> usage
notes value <name> default value none animatable no <name> this value indicates the name of the css property or attribute of the target element to be animated.
attributeType - SVG: Scalable Vector Graphics
four elements are using this attribute: <animate>, <animatecolor>, <animatetransform>, and <set> html, body, svg { height: 100%; } <svg viewbox="0 0 250 250" xmlns="http://www.w3.org/2000/svg"> <rect x="50" y="50" width="100" height="100"> <animate attributetype="xml" attributename="y" from="0" to="50" dur="5s" repeatcount="indefinite"/> </rect> </svg> usage
notes value css | xml | auto default value auto animatable no css this value specifies that the value of attributename is the name of a css property defined as animatable.
azimuth - SVG: Scalable Vector Graphics
<fedistantlight azimuth="0" /> </fediffuselighting> </filter> <filter id="distantlight2"> <fediffuselighting> <fedistantlight azimuth="240" /> </fediffuselighting> </filter> <circle cx="100" cy="100" r="80" style="filter: url(#distantlight1);" /> <circle cx="100" cy="100" r="80" style="filter: url(#distantlight2); transform: translatex(240px);" /> </svg> usage
notes value <number> default value 0 animatable yes specifications specification status comment filter effects module level 1the definition of 'azimuth' in that specification.
baseFrequency - SVG: Scalable Vector Graphics
th="100%" height="100%"> <feturbulence basefrequency="0.025" /> </filter> <filter id="noise2" x="0" y="0" width="100%" height="100%"> <feturbulence basefrequency="0.05" /> </filter> <rect x="0" y="0" width="200" height="200" style="filter: url(#noise1);" /> <rect x="0" y="0" width="200" height="200" style="filter: url(#noise2); transform: translatex(220px);" /> </svg> usage
notes value <number-optional-number> default value 0 animatable yes <number-optional-number> if two numbers are provided, the first one represents the base frequency in the horizontal direction and the second one the base frequency in the vertical direction.
baseProfile - SVG: Scalable Vector Graphics
only one element is using this attribute: <svg> context
notes value profile name default value none animatable no example <svg width="120" height="120" version="1.1" xmlns="http://www.w3.org/2000/svg" baseprofile="full"> ...
bbox - SVG: Scalable Vector Graphics
only one element is using this attribute: <font-face> usage
notes value <string> default value none animatable no <string> a comma-separated list of exactly four numbers specifying, in order, the lower left x, lower left y, upper right x, and upper right y of the bounding box for the complete font.
bias - SVG: Scalable Vector Graphics
usage
notes value <number> default value 0 animatable yes one application of bias is when it is desirable to have 0.5 gray value be the zero response of the filter.
by - SVG: Scalable Vector Graphics
four elements are using this attribute: <animate>, <animatecolor>, <animatemotion>, and <animatetransform> html, body, svg { height: 100%; } <svg viewbox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"> <rect x="10" y="10" width="100" height="100"> <animate attributename="width" fill="freeze" by="50" dur="3s"/> </rect> </svg> usage
notes value see below default value none animatable no the exact value type for this attribute depends on the value of the attribute that will be animated.
calcMode - SVG: Scalable Vector Graphics
four elements are using this attribute: <animate>, <animatecolor>, <animatemotion>, and <animatetransform> usage
notes value discrete | linear | paced | spline default value linear animatable no discrete this specifies that the animation function will jump from one value to the next without any interpolation.
clip - SVG: Scalable Vector Graphics
<svg viewbox="0 0 20 10" xmlns="http://www.w3.org/2000/svg"> <!-- auto clipping --> <svg x="0" width="10" height="10" clip="auto"> <circle cx="5" cy="5" r="4" stroke="green" /> </svg> <!-- rect(top, right, bottom, left) clipping --> <svg x="10" width="10" height="10" clip="rect(1, 9, 8, 2)"> <circle cx="5" cy="5" r="4" stroke="green" /> </svg> </svg> usage
notes warning: this property is deprecated.
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.
contentStyleType - SVG: Scalable Vector Graphics
usage
notes value one of the content types specified in the media types default value text/css animatable no since css is the only widely deployed style sheet language for online styling and it's already defined as default value if contentstyletype is ommitted, the attribute is not well supported in user agents.
diffuseConstant - SVG: Scalable Vector Graphics
"0" width="100%" height="100%"> <fediffuselighting in="sourcegraphic" diffuseconstant="2"> <fepointlight x="60" y="60" z="20" /> </fediffuselighting> </filter> <rect x="0" y="0" width="200" height="200" style="filter: url(#diffuselighting1);" /> <rect x="0" y="0" width="200" height="200" style="filter: url(#diffuselighting2); transform: translatex(220px);" /> </svg> usage
notes value <number> default value 1 animatable yes specifications specification status comment filter effects module level 1the definition of 'diffuseconstant' in that specification.
divisor - SVG: Scalable Vector Graphics
x="1 2 0 0 0 0 0 0 -1" divisor="8"/> </filter> <image xlink:href="//developer.mozilla.org/files/6457/mdn_logo_only_color.png" width="200" height="200" style="filter:url(#convolvematrix1);"/> <image xlink:href="//developer.mozilla.org/files/6457/mdn_logo_only_color.png" width="200" height="200" style="filter:url(#convolvematrix2); transform:translatex(220px);"/> </svg> usage
notes value <number> default value sum of all values in kernelmatrix or 1 if sum is 0 animatable yes <number> this value defines the divisor.
end - SVG: Scalable Vector Graphics
five elements are using this attribute: <animate>, <animatecolor>, <animatemotion>, <animatetransform>, and <set> usage
notes default value none value <end-value-list> animatable no the <end-value-list> is a semicolon-separated list of values.
exponent - SVG: Scalable Vector Graphics
funcg type="gamma" exponent="5"/> <fefuncb type="gamma" exponent="5"/> </fecomponenttransfer> </filter> <rect x="0" y="0" width="200" height="200" fill="url(#gradient)" style="filter: url(#componenttransfer1);" /> <rect x="0" y="0" width="200" height="200" fill="url(#gradient)" style="filter: url(#componenttransfer2); transform: translatex(220px);" /> </svg> usage
notes value <number> default value 1 animatable yes <number> if the type attribute of the component element is set to gamma, this value specifies the exponent of the gamma function specifications specification status comment filter effects module level 1the definition of 'exponent' in that specification.
filterUnits - SVG: Scalable Vector Graphics
only one element is using this attribute: <filter> usage
notes value userspaceonuse | objectboundingbox default value objectboundingbox animatable yes userspaceonuse x, y, width and height represent values in the current coordinate system that results from taking the current user coordinate system in place at the time when the <filter> element is referenced (i.e., the user coordinate system for the element referencing the <filter> element via a filter attribute).
format - SVG: Scalable Vector Graphics
two elements are using this attribute: <altglyph> and <glyphref> context
notes value <string> default value none animatable no <string> this value specifies the format of the given font.
fr - SVG: Scalable Vector Graphics
lgradient id="gradient2" cx="0.5" cy="0.5" r="0.5" fx="0.35" fy="0.35" fr="25%"> <stop offset="0%" stop-color="white"/> <stop offset="100%" stop-color="darkseagreen"/> </radialgradient> </defs> <circle cx="100" cy="100" r="100" fill="url(#gradient1)" /> <circle cx="100" cy="100" r="100" fill="url(#gradient2)" style="transform: translatex(240px);" /> </svg> usage
notes value <length> default value 0 animatable none example <svg viewbox="0 0 120 120" width="200" height="200" xmlns="http://www.w3.org/2000/svg"> <defs> <radialgradient id="gradient" cx="0.5" cy="0.5" r="0.5" fx="0.35" fy="0.35" fr="5%"> <stop offset="0%" stop-color="red"/> <stop offset="100%" stop-color="blue"/> </radialgra...
from - SVG: Scalable Vector Graphics
four elements are using this attribute: <animate>, <animatecolor>, <animatemotion>, and <animatetransform> html, body, svg { height: 100%; } <svg viewbox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"> <rect x="10" y="10" height="100"> <animate attributename="width" fill="freeze" from="100" to="150" dur="3s"/> </rect> </svg> usage
notes value see below default value none animatable no the exact value type for this attribute depends on the value of the attribute that will be animated.
fx - SVG: Scalable Vector Graphics
algradient id="gradient2" cx="0.5" cy="0.5" r="0.5" fx="0.75" fy="0.35" fr="5%"> <stop offset="0%" stop-color="white"/> <stop offset="100%" stop-color="darkseagreen"/> </radialgradient> </defs> <circle cx="100" cy="100" r="100" fill="url(#gradient1)" /> <circle cx="100" cy="100" r="100" fill="url(#gradient2)" style="transform: translatex(240px);" /> </svg> usage
notes value <length> default value coincides with the presentational value of cx for the element whether the value for cx was inherited or not.
fy - SVG: Scalable Vector Graphics
algradient id="gradient2" cx="0.5" cy="0.5" r="0.5" fx="0.35" fy="0.75" fr="5%"> <stop offset="0%" stop-color="white"/> <stop offset="100%" stop-color="darkseagreen"/> </radialgradient> </defs> <circle cx="100" cy="100" r="100" fill="url(#gradient1)" /> <circle cx="100" cy="100" r="100" fill="url(#gradient2)" style="transform: translatex(240px);" /> </svg> usage
notes value <length> default value coincides with the presentational value of cy for the element whether the value for cy was inherited or not.
g1 - SVG: Scalable Vector Graphics
two elements are using this attribute: <hkern> and <vkern> context
notes value <name># default value none animatable no <name># this value indicates a comma-separated sequence of glyph names (i.e., values that match glyph-name attributes on <glyph> elements) which identify a set of possible first glyphs in the kerning pair.
g2 - SVG: Scalable Vector Graphics
two elements are using this attribute: <hkern> and <vkern> context
notes value <name># default value none animatable no <name># this value indicates a comma-separated sequence of glyph names (i.e., values that match glyph-name attributes on <glyph> elements) which identify a set of possible second glyphs in the kerning pair.
glyph-name - SVG: Scalable Vector Graphics
only one element is using this attribute: <glyph> context
notes value <name># default value none animatable no <name># this value specifies a comma-separated list of names for the glyph.
glyphRef - SVG: Scalable Vector Graphics
two elements are using this attribute: <altglyph> and <glyphref> usage
notes value <string> default value none animatable yes <string> this value represents the glyph identifier.
gradientTransform - SVG: Scalable Vector Graphics
ansform="skewx(20) translate(-35, 0)"> <stop offset="0%" stop-color="darkblue" /> <stop offset="50%" stop-color="skyblue" /> <stop offset="100%" stop-color="darkblue" /> </radialgradient> <rect x="0" y="0" width="200" height="200" fill="url(#gradient1)" /> <rect x="0" y="0" width="200" height="200" fill="url(#gradient2)" style="transform: translatex(220px);" /> </svg> usage
notes default value identity transform value <transform-list> animatable yes <transform-list> a list of transformation functions specifying some additional transformation from the gradient coordinate system onto the target coordinate system.
hanging - SVG: Scalable Vector Graphics
only one element is using this attribute: <font-face> usage
notes value <number> default value none animatable no <number> this value indicates the alignment coordinate for the glyphs.
ideographic - SVG: Scalable Vector Graphics
only one element is using this attribute: <font-face> usage
notes value <number> default value none animatable no <number> this value indicates the alignment coordinate for the glyphs.
in - SVG: Scalable Vector Graphics
fourteen elements are using this attribute: <feblend>, <fecolormatrix>, <fecomponenttransfer>, <fecomposite>, <feconvolvematrix>, <fediffuselighting>, <fedisplacementmap>, <fedropshadow>, <fegaussianblur>, <femergenode>, <femorphology>, <feoffset>, <fespecularlighting>, <fetile> usage
notes value sourcegraphic | sourcealpha | backgroundimage | backgroundalpha | fillpaint | strokepaint | <filter-primitive-reference> default value sourcegraphic for first filter primitive, otherwise result of previous filter primitive animatable yes sourcegraphic this keyword represents the graphics elements that were the original input into the <filter> ...
intercept - SVG: Scalable Vector Graphics
pe="linear" intercept="0.1"/> <fefuncb type="linear" intercept="0.8"/> </fecomponenttransfer> </filter> <rect x="0" y="0" width="200" height="200" fill="url(#gradient)" style="filter: url(#componenttransfer1);" /> <rect x="0" y="0" width="200" height="200" fill="url(#gradient)" style="filter: url(#componenttransfer2); transform: translatex(220px);" /> </svg> usage
notes value <number> default value 0 animatable yes specifications specification status comment filter effects module level 1the definition of 'intercept' in that specification.
k - SVG: Scalable Vector Graphics
two elements are using this attribute: <hkern> and <vkern> context
notes value <number> default value none animatable no <number> this value indicates the amount for decreasing the spacing between the two glyphs in the kerning pair.
k1 - SVG: Scalable Vector Graphics
ator="arithmetic" k1="10" k2="0" k3="0" k4="0" /> </filter> <image href="https://mdn.mozillademos.org/files/12668/mdn.svg" x="0" y="0" width="200" height="200" style="filter: url(#composite1);" /> <image href="https://mdn.mozillademos.org/files/12668/mdn.svg" x="0" y="0" width="200" height="200" style="filter: url(#composite2); transform: translatex(220px);" /> </svg> usage
notes value <number> default value 0 animatable yes specifications specification status comment filter effects module level 1the definition of 'k1' in that specification.
k2 - SVG: Scalable Vector Graphics
ator="arithmetic" k1="1" k2="10" k3="0" k4="0" /> </filter> <image href="https://mdn.mozillademos.org/files/12668/mdn.svg" x="0" y="0" width="200" height="200" style="filter: url(#composite1);" /> <image href="https://mdn.mozillademos.org/files/12668/mdn.svg" x="0" y="0" width="200" height="200" style="filter: url(#composite2); transform: translatex(220px);" /> </svg> usage
notes value <number> default value 0 animatable yes specifications specification status comment filter effects module level 1the definition of 'k2' in that specification.
k3 - SVG: Scalable Vector Graphics
ator="arithmetic" k1="1" k2="0" k3="10" k4="0" /> </filter> <image href="https://mdn.mozillademos.org/files/12668/mdn.svg" x="0" y="0" width="200" height="200" style="filter: url(#composite1);" /> <image href="https://mdn.mozillademos.org/files/12668/mdn.svg" x="0" y="0" width="200" height="200" style="filter: url(#composite2); transform: translatex(220px);" /> </svg> usage
notes value <number> default value 0 animatable yes specifications specification status comment filter effects module level 1the definition of 'k3' in that specification.
k4 - SVG: Scalable Vector Graphics
or="arithmetic" k1="10" k2="0" k3="0" k4="0.3" /> </filter> <image href="https://mdn.mozillademos.org/files/12668/mdn.svg" x="0" y="0" width="200" height="200" style="filter: url(#composite1);" /> <image href="https://mdn.mozillademos.org/files/12668/mdn.svg" x="0" y="0" width="200" height="200" style="filter: url(#composite2); transform: translatex(220px);" /> </svg> usage
notes value <number> default value 0 animatable yes specifications specification status comment filter effects module level 1the definition of 'k4' in that specification.
kernelMatrix - SVG: Scalable Vector Graphics
kernelmatrix="-1 0 0 0 0 0 0 0 1"/> </filter> <image xlink:href="//developer.mozilla.org/files/6457/mdn_logo_only_color.png" width="200" height="200" style="filter:url(#convolvematrix1);"/> <image xlink:href="//developer.mozilla.org/files/6457/mdn_logo_only_color.png" width="200" height="200" style="filter:url(#convolvematrix2); transform:translatex(220px);"/> </svg> usage
notes value <list of numbers> default value none animatable yes <list of numbers> the list of <number>s that make up the kernel matrix for the convolution.
keyPoints - SVG: Scalable Vector Graphics
ightgrey" 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>]* ;?
keySplines - SVG: Scalable Vector Graphics
0 ; 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 ; 0.5 0 0.5 1 ; 0.5 0 0.5 1"/> </circle> </svg> usage
notes value <control-point> [ ; <control-point> ]* ;?
keyTimes - SVG: Scalable Vector Graphics
120 120" xmlns="http://www.w3.org/2000/svg"> <circle cx="60" cy="10" r="10"> <animate attributename="cx" dur="4s" repeatcount="indefinite" values="60 ; 110 ; 60 ; 10 ; 60" keytimes="0 ; 0.25 ; 0.5 ; 0.75 ; 1"/> <animate attributename="cy" dur="4s" repeatcount="indefinite" values="10 ; 60 ; 110 ; 60 ; 10" keytimes="0 ; 0.25 ; 0.5 ; 0.75 ; 1"/> </circle> </svg> usage
notes value <number> [ ; <number> ]* ;?
lang - SVG: Scalable Vector Graphics
<svg viewbox="0 0 200 100" xmlns="http://www.w3.org/2000/svg"> <text lang="en-us">this is some english text</text> </svg> usage
notes value <language-tag> default value none animatable no <language-tag> this value specifies the language used for the element.
lengthAdjust - SVG: Scalable Vector Graphics
</text> </g> </svg> usage
notes value spacing | spacingandglyphs default value spacing animatable yes specifications specification status comment scalable vector graphics (svg) 2the definition of 'lengthadjust' in that specification.
lighting-color - SVG: Scalable Vector Graphics
" width="100%" height="100%"> <fediffuselighting in="sourcegraphic" lighting-color="blue"> <fepointlight x="60" y="60" z="20" /> </fediffuselighting> </filter> <rect x="0" y="0" width="200" height="200" style="filter: url(#diffuselighting1);" /> <rect x="0" y="0" width="200" height="200" style="filter: url(#diffuselighting2); transform: translatex(220px);" /> </svg> usage
notes value color default value white animatable yes specifications specification status comment filter effects module level 1the definition of 'lighting-color' in that specification.
limitingConeAngle - SVG: Scalable Vector Graphics
="100%"> <fediffuselighting diffuseconstant="2"> <fespotlight x="10" y="10" z="50" pointsatx="100" pointsaty="100" limitingconeangle="40" /> </fediffuselighting> </filter> <rect x="0" y="0" width="200" height="200" style="filter: url(#spotlight1);" /> <rect x="0" y="0" width="200" height="200" style="filter: url(#spotlight2); transform: translatex(220px);" /> </svg> usage
notes value <number> default value 0 animatable yes specifications specification status comment filter effects module level 1the definition of 'limitingconeangle' in that specification.
local - SVG: Scalable Vector Graphics
only one element is using this attribute: <color-profile> usage
notes value <string> default value none animatable no <string> this value specifies the unique id for a locally stored color profile as specified by international color consortium.
markerHeight - SVG: Scalable Vector Graphics
only one element is using this attribute: <marker> usage
notes value <length-percentage> | <number> default value 3 animatable yes <length-percentage> this value defines either an absolute or a relative height of the marker.
markerUnits - SVG: Scalable Vector Graphics
usage
notes value userspaceonuse | strokewidth default value strokewidth animatable yes userspaceonuse this value specifies that the markerwidth and markerunits attributes and the contents of the <marker> element represent values in the current user coordinate system in place for the graphic object referencing the marker (i.e., the user coordinate system for the element referencing the <marker> element via a marker, marker-start, marker-mid, or marker-end property).
markerWidth - SVG: Scalable Vector Graphics
only one element is using this attribute: <marker> usage
notes value <length-percentage> | <number> default value 3 animatable yes <length-percentage> this value defines either an absolute or a relative width of the marker.
mathematical - SVG: Scalable Vector Graphics
only one element is using this attribute: <font-face> usage
notes value <number> default value none animatable no <number> this value indicates the alignment coordinate for the glyphs.
max - SVG: Scalable Vector Graphics
tp://www.w3.org/2000/svg"> <circle cx="60" cy="10" r="10"> <animate attributename="cx" dur="4s" max="6s" repeatcount="indefinite" values="60 ; 110 ; 60 ; 10 ; 60" keytimes="0 ; 0.25 ; 0.5 ; 0.75 ; 1"/> <animate attributename="cy" dur="4s" max="6s" repeatcount="indefinite" values="10 ; 60 ; 110 ; 60 ; 10" keytimes="0 ; 0.25 ; 0.5 ; 0.75 ; 1"/> </circle> </svg> usage
notes value <clock-value> default value none animatable no <clock-value> specifies the length of the maximum value of the active duration, measured in local time.
media - SVG: Scalable Vector Graphics
one element is using this attribute: <style> html, body, svg { height: 100%; } <svg viewbox="0 0 240 220" xmlns="http://www.w3.org/2000/svg"> <style> rect { fill: black; } </style> <style media="all and (min-width: 600px)"> rect { fill: seagreen; } </style> <text y="15">resize the window to see the effect</text> <rect y="20" width="200" height="200" /> </svg> usage
notes value <media-query-list> default value all animatable yes <media-query-list> this value holds a media query that needs to match in order for the style sheet to be applied.
min - SVG: Scalable Vector Graphics
tp://www.w3.org/2000/svg"> <circle cx="60" cy="10" r="10"> <animate attributename="cx" dur="4s" min="2s" repeatcount="indefinite" values="60 ; 110 ; 60 ; 10 ; 60" keytimes="0 ; 0.25 ; 0.5 ; 0.75 ; 1"/> <animate attributename="cy" dur="4s" min="2s" repeatcount="indefinite" values="10 ; 60 ; 110 ; 60 ; 10" keytimes="0 ; 0.25 ; 0.5 ; 0.75 ; 1"/> </circle> </svg> usage
notes value <clock-value> default value 0 animatable no <clock-value> specifies the length of the minimum value of the active duration, measured in local time.
mode - SVG: Scalable Vector Graphics
rcegraphic" in2="floodfill" mode="color-dodge"/> </filter> <image xlink:href="//developer.mozilla.org/files/6457/mdn_logo_only_color.png" width="200" height="200" style="filter:url(#blending1);"/> <image xlink:href="//developer.mozilla.org/files/6457/mdn_logo_only_color.png" width="200" height="200" style="filter:url(#blending2); transform:translatex(220px);"/> </svg> usage
notes value <blend-mode> default value normal animatable yes for a description of the values, see <blend-mode>.
numOctaves - SVG: Scalable Vector Graphics
eturbulence basefrequency="0.025" numoctaves="1" /> </filter> <filter id="noise2" x="0" y="0" width="100%" height="100%"> <feturbulence basefrequency="0.025" numoctaves="3" /> </filter> <rect x="0" y="0" width="200" height="200" style="filter: url(#noise1);" /> <rect x="0" y="0" width="200" height="200" style="filter: url(#noise2); transform: translatex(220px);" /> </svg> usage
notes value <integer> default value 1 animatable yes <integer> defines the number of octaves.
onclick - SVG: Scalable Vector Graphics
ern>, <polygon>, <polyline>, <radialgradient>, <rect>, <script>, <set>, <stop>, <style>, <svg>, <switch>, <symbol>, <text>, <textpath>, <title>, <tref>, <tspan>, <use>, <view> html, body, svg { height: 100%; margin: 0; } <svg viewbox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"> <circle cx="100" cy="100" r="100" onclick="alert('you have clicked the circle.')" /> </svg> usage
notes value <anything> default value none animatable no specifications specification status comment scalable vector graphics (svg) 2the definition of 'onclick' in that specification.
order - SVG: Scalable Vector Graphics
filter id="emboss2" x="0" y="0" width="100%" height="100%"> <feturbulence basefrequency="0.025" seed="0" /> <feconvolvematrix kernelmatrix="3 0 0 0 0 0 0 0 -4" order="1 1 1"/> </filter> <rect x="0" y="0" width="200" height="200" style="filter:url(#emboss1);" /> <rect x="0" y="0" width="200" height="200" style="filter:url(#emboss2); transform: translatex(220px);" /> </svg> usage
notes value <number-optional-number> default value 3 animatable yes <number-optional-number> this value indicates the number of cells in each dimension for the kernel matrix.
orientation - SVG: Scalable Vector Graphics
only one element is using this attribute: <glyph> usage
notes value h | v default value none (meaning glyph can be used for both text directions) animatable yes h this value indicates that the glyph is only used for a horizontal text direction.
origin - SVG: Scalable Vector Graphics
only one element is using this attribute: <animatemotion> context
notes value default default value default animatable no specifications specification status comment svg animations level 2the definition of 'origin' in that specification.
panose-1 - SVG: Scalable Vector Graphics
only one element is using this attribute: <font-face> usage
notes value <integer>{10} default value 0 0 0 0 0 0 0 0 0 0 animatable no <integer>{10} this value specifies a panose-1 number and consists of ten decimal integers, separated by whitespace.
pointsAtX - SVG: Scalable Vector Graphics
lighting2" x="0" y="0" width="100%" height="100%"> <fediffuselighting in="sourcegraphic"> <fespotlight x="60" y="60" z="50" pointsatx="400" /> </fediffuselighting> </filter> <rect x="0" y="0" width="200" height="200" style="filter: url(#lighting1);" /> <rect x="0" y="0" width="200" height="200" style="filter: url(#lighting2); transform: translatex(220px);" /> </svg> usage
notes default value 0 value <number> animatable yes specifications specification status comment filter effects module level 1the definition of 'pointsatx' in that specification.
pointsAtY - SVG: Scalable Vector Graphics
lighting2" x="0" y="0" width="100%" height="100%"> <fediffuselighting in="sourcegraphic"> <fespotlight x="60" y="60" z="50" pointsaty="400" /> </fediffuselighting> </filter> <rect x="0" y="0" width="200" height="200" style="filter: url(#lighting1);" /> <rect x="0" y="0" width="200" height="200" style="filter: url(#lighting2); transform: translatex(220px);" /> </svg> usage
notes default value 0 value <number> animatable yes specifications specification status comment filter effects module level 1the definition of 'pointsaty' in that specification.
pointsAtZ - SVG: Scalable Vector Graphics
ighting2" x="0" y="0" width="100%" height="100%"> <fediffuselighting in="sourcegraphic"> <fespotlight x="100" y="100" z="50" pointsatz="80" /> </fediffuselighting> </filter> <rect x="0" y="0" width="200" height="200" style="filter: url(#lighting1);" /> <rect x="0" y="0" width="200" height="200" style="filter: url(#lighting2); transform: translatex(220px);" /> </svg> usage
notes default value 0 value <number> animatable yes specifications specification status comment filter effects module level 1the definition of 'pointsatz' in that specification.
preserveAlpha - SVG: Scalable Vector Graphics
0 0 0 0 -2" preservealpha="false"/> </filter> <image xlink:href="//developer.mozilla.org/files/6457/mdn_logo_only_color.png" width="200" height="200" style="filter:url(#convolvematrix1);"/> <image xlink:href="//developer.mozilla.org/files/6457/mdn_logo_only_color.png" width="200" height="200" style="filter:url(#convolvematrix2); transform:translatex(220px);"/> </svg> usage
notes default value false value true | false animatable yes true this value indicates that the convolution will only apply to the color channels.
primitiveUnits - SVG: Scalable Vector Graphics
only one element is using this attribute: <filter> usage
notes value userspaceonuse | objectboundingbox default value userspaceonuse animatable yes userspaceonuse this value indicates that any length values within the filter definitions represent values in the current user coordinate system in place at the time when the <filter> element is referenced (i.e., the user coordinate system for the element referencing the <filter> element via a filter attribute).
r - SVG: Scalable Vector Graphics
value <length> | <percentage> default value 0 animatable yes
note: starting with svg2, r is a geometry property meaning this attribute can also be used as a css property for circles.
radius - SVG: Scalable Vector Graphics
usage
notes value <number-optional-number> default value 0 animatable yes specifications specification status comment filter effects module level 1the definition of 'radius' in that specification.
repeatCount - SVG: Scalable Vector Graphics
box="0 0 220 150" xmlns="http://www.w3.org/2000/svg"> <rect x="0" y="0" width="100" height="100"> <animate attributetype="xml" attributename="y" from="0" to="50" dur="1s" repeatcount="5"/> </rect> <rect x="120" y="0" width="100" height="100"> <animate attributetype="xml" attributename="y" from="0" to="50" dur="1s" repeatcount="indefinite"/> </rect> </svg> usage
notes value <number> | indefinite default value none animatable no <number> this value specifies the number of iterations.
repeatDur - SVG: Scalable Vector Graphics
iewbox="0 0 220 150" xmlns="http://www.w3.org/2000/svg"> <rect x="0" y="0" width="100" height="100"> <animate attributetype="xml" attributename="y" from="0" to="50" dur="1s" repeatdur="5s"/> </rect> <rect x="120" y="0" width="100" height="100"> <animate attributetype="xml" attributename="y" from="0" to="50" dur="1s" repeatdur="indefinite"/> </rect> </svg> usage
notes value <clock-value> | indefinite default values none animatable no <clock-value> this value specifies the duration in presentation time to repeat the animation.
restart - SVG: Scalable Vector Graphics
height="100"> <animate attributetype="xml" attributename="y" from="30" to="100" dur="5s" repeatcount="1" restart="whennotactive"/> </rect> <a id="restart"><text y="20">restart animation</text></a> </svg> document.getelementbyid("restart").addeventlistener("click", evt => { document.queryselectorall("animate").foreach(element => { element.beginelement(); }); }); usage
notes value always | whennotactive | never default value always animatable no always this value indicates that the animation can be restarted at any time.
result - SVG: Scalable Vector Graphics
p://www.w3.org/2000/svg"> <filter id="displacementfilter"> <feturbulence type="turbulence" basefrequency="0.05" numoctaves="2" result="turbulence"/> <fedisplacementmap in2="turbulence" in="sourcegraphic" scale="50" xchannelselector="r" ychannelselector="g"/> </filter> <circle cx="100" cy="100" r="100" style="filter: url(#displacementfilter)"/> </svg> usage
notes value <filter-primitive-reference> default value none animatable yes <filter-primitive-reference> this value is a <custom-ident> and defines the name for the filter primitive.
rotate - SVG: Scalable Vector Graphics
usage
notes value auto | auto-reverse | <number> default value 0 animatable no the auto and auto-reverse values allow the animated element's rotation to change dynamically as it travels along the path.
scale - SVG: Scalable Vector Graphics
ight="140%"> <feturbulence type="turbulence" basefrequency="0.05" numoctaves="2" result="turbulence"/> <fedisplacementmap in2="turbulence" in="sourcegraphic" scale="50"/> </filter> <circle cx="100" cy="100" r="80" style="filter: url(#displacementfilter);""/> <circle cx="100" cy="100" r="80" style="filter: url(#displacementfilter2); transform: translatex(240px);""/> </svg> usage
notes value <number> default value none animatable yes <number> this value defines the scale factor for the displacement.
seed - SVG: Scalable Vector Graphics
00%"> <feturbulence basefrequency="0.025" seed="0" /> </filter> <filter id="noise2" x="0" y="0" width="100%" height="100%"> <feturbulence basefrequency="0.025" seed="100" /> </filter> <rect x="0" y="0" width="200" height="200" style="filter:url(#noise1);" /> <rect x="0" y="0" width="200" height="200" style="filter:url(#noise2); transform: translatex(220px);" /> </svg> usage
notes value <number> default value 0 animatable yes example <svg width="200" height="200" viewbox="0 0 220 220" xmlns="http://www.w3.org/2000/svg"> <filter id="displacementfilter"> <feturbulence basefrequency="0.05" seed="1000" result="turbulence"/> <fedisplacementmap in2="turbulence" in="sourcegraphic" scale="50" xchannelsele...
side - SVG: Scalable Vector Graphics
w3.org/2000/svg"> <text> <textpath href="#circle1" side="left">text left from the path</textpath> </text> <text> <textpath href="#circle2" side="right">text right from the path</textpath> </text> <circle id="circle1" cx="100" cy="100" r="70" fill="transparent" stroke="silver"/> <circle id="circle2" cx="320" cy="100" r="70" fill="transparent" stroke="silver"/> </svg> usage
notes value left | right default value left animatable yes left this value places the text on the left side of the path (relative to the path direction).
slope - SVG: Scalable Vector Graphics
only one element is using this attribute: <font-face> usage
notes value <number> default value 0 animatable no <number> this value indicates the vertical stroke angle of the font.
spacing - SVG: Scalable Vector Graphics
only one element is using this attribute: <textpath> usage
notes value auto | exact default value exact animatable yes auto this value indicates that the user agent should use text-on-a-path layout algorithms to adjust the spacing between typographic characters in order to achieve visually appealing results.
specularConstant - SVG: Scalable Vector Graphics
0%" height="100%"> <fespecularlighting in="sourcegraphic" specularconstant="0.8"> <fepointlight x="60" y="60" z="20" /> </fespecularlighting> </filter> <rect x="0" y="0" width="200" height="200" style="filter: url(#specularlighting1);" /> <rect x="0" y="0" width="200" height="200" style="filter: url(#specularlighting2); transform: translatex(220px);" /> </svg> usage
notes value <number> default value 1 animatable yes specifications specification status comment filter effects module level 1the definition of 'specularconstant' in that specification.
spreadMethod - SVG: Scalable Vector Graphics
two elements are using this attribute: <lineargradient> and <radialgradient> context
notes value pad | reflect | repeat initial value pad animatable yes pad this value indicates that the final color of the gradient fills the shape beyond the gradient's edges.
stdDeviation - SVG: Scalable Vector Graphics
"-30%" y="-30%" width="160%" height="160%"> <fegaussianblur stddeviation="10" /> </filter> <circle cx="100" cy="100" r="50" style="filter: url(#gaussianblur1);" /> <circle cx="100" cy="100" r="50" style="filter: url(#gaussianblur2); transform: translatex(140px);" /> <circle cx="100" cy="100" r="50" style="filter: url(#gaussianblur3); transform: translatex(280px);" /> </svg> usage
notes value <number-optional-number> default value 0 animatable yes <number-optional-number> if two numbers are provided, the first number represents a standard deviation value along the x-axis.
stemh - SVG: Scalable Vector Graphics
only one element is using this attribute: <font-face> usage
notes value <number> default value none animatable no <number> this value indicates the horizontal stem width of the font.
stemv - SVG: Scalable Vector Graphics
only one element is using this attribute: <font-face> usage
notes value <number> default value none animatable no <number> this value indicates the vertical stem width of the font.
stitchTiles - SVG: Scalable Vector Graphics
noise2); transform: translate(220px, 0);" /> <rect x="0" y="0" width="100" height="100" style="filter: url(#noise2); transform: translate(320px, 0);" /> <rect x="0" y="0" width="100" height="100" style="filter: url(#noise2); transform: translate(220px, 100px);" /> <rect x="0" y="0" width="100" height="100" style="filter: url(#noise2); transform: translate(320px, 100px);" /> </svg> usage
notes value nostitch | stitch default value nostitch animatable yes nostitch this value indicates that no attempt is made to achieve smooth transitions at the border of tiles which contain a turbulence function.
string - SVG: Scalable Vector Graphics
only one element is using this attribute: <font-face-format> usage
notes value <anything> default value none animatable no <anything> this value specifies a list of formats that are supported by the font referenced by the parent <font-face-uri> element.
stroke-width - SVG: Scalable Vector Graphics
00% } <svg viewbox="0 0 30 10" xmlns="http://www.w3.org/2000/svg"> <!-- default stroke width: 1 --> <circle cx="5" cy="5" r="3" stroke="green" /> <!-- stroke width as a number --> <circle cx="15" cy="5" r="3" stroke="green" stroke-width="3" /> <!-- stroke width as a percentage --> <circle cx="25" cy="5" r="3" stroke="green" stroke-width="2%" /> </svg> usage
notes value <length> | <percentage> default value 1px animatable yes
note: a percentage value is always computed as a percentage of the normalized viewbox diagonal length.
tabindex - SVG: Scalable Vector Graphics
html, body, svg { height: 100%; } <?xml version="1.0"?> <svg viewbox="0 0 260 260" xmlns="http://www.w3.org/2000/svg"> <circle cx="60" cy="60" r="15" tabindex="1" /> <circle cx="60" cy="160" r="30" tabindex="3" /> <circle cx="160" cy="60" r="30" tabindex="2" /> <circle cx="160" cy="160" r="60" tabindex="4" /> </svg> usage
notes value valid integer default value none animatable no valid integer relative order of the element for the purposes of sequential focus navigation.
tableValues - SVG: Scalable Vector Graphics
="table" tablevalues="1 0"/> <fefuncb type="table" tablevalues="1 0"/> </fecomponenttransfer> </filter> <rect x="0" y="0" width="200" height="200" fill="url(#gradient)" style="filter: url(#componenttransfer1);" /> <rect x="0" y="0" width="200" height="200" fill="url(#gradient)" style="filter: url(#componenttransfer2); transform: translatex(220px);" /> </svg> usage
notes value <list-of-numbers> default value empty list resulting in identity transfer animatable yes <list-of-numbers> this value holds a comma- and/or space-separated list of <number>s, which define a lookup table for the color component transfer function.
targetX - SVG: Scalable Vector Graphics
only one element is using this attribute: <feconvolvematrix> usage
notes value <integer> default value floor(orderx / 2) animatable yes <integer> this value indicates the positioning in horizontal direction of the convolution matrix relative to a given target pixel in the input image.
targetY - SVG: Scalable Vector Graphics
only one element is using this attribute: <feconvolvematrix> usage
notes value <integer> default value floor(ordery / 2) animatable yes <integer> this value indicates the positioning in vertical direction of the convolution matrix relative to a given target pixel in the input image.
transform - SVG: Scalable Vector Graphics
s="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <g fill="grey" transform="rotate(-10 50 100) translate(-36 45.5) skewx(40) scale(1 0.5)"> <path id="heart" d="m 10,30 a 20,20 0,0,1 50,30 a 20,20 0,0,1 90,30 q 90,60 50,90 q 10,60 10,30 z" /> </g> <use xlink:href="#heart" fill="none" stroke="red"/> </svg>
note: as of svg2, transform is a presentation attribute, meaning it can be used as a css property.
u1 - SVG: Scalable Vector Graphics
two elements are using this attribute: <hkern> and <vkern> context
notes value [ <character> | <urange> ]# default value none animatable no [ <character> | <urange> ]# this value indicates a comma-separated sequence of unicode characters and/or ranges of unicode characters, which identify a set of possible first glyphs in a kerning pair.
u2 - SVG: Scalable Vector Graphics
two elements are using this attribute: <hkern> and <vkern> context
notes value [ <character> | <urange> ]# default value none animatable no [ <character> | <urange> ]# this value indicates a comma-separated sequence of unicode characters and/or ranges of unicode characters, which identify a set of possible second glyphs in a kerning pair.
unicode-range - SVG: Scalable Vector Graphics
only one element is using this attribute: <font-face> usage
notes value <urange># default value none animatable no <urange># this value is a comma-separated list of iso 10646 characters possibly covered by the glyphs in the font.
unicode - SVG: Scalable Vector Graphics
only one element is using this attribute: <glyph> context
notes value <string> default value none animatable no <string> this value specifies one or more unicode characters corresponding to a glyph.
v-alphabetic - SVG: Scalable Vector Graphics
only one element is using this attribute: <font-face> usage
notes value <number> default value none animatable no specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'v-alphabetic' in that specification.
v-hanging - SVG: Scalable Vector Graphics
only one element is using this attribute: <font-face> usage
notes value <number> default value none animatable no <number> this value indicates the alignment coordinate for the glyphs to achieve hanging baseline alignment.
v-ideographic - SVG: Scalable Vector Graphics
only one element is using this attribute: <font-face> usage
notes value <number> default value none animatable no <number> this value indicates the alignment coordinate for the glyphs.
v-mathematical - SVG: Scalable Vector Graphics
only one element is using this attribute: <font-face> usage
notes value <number> default value none animatable no <number> this value indicates the alignment coordinate for the glyphs.
version - SVG: Scalable Vector Graphics
<svg version="1.1" viewbox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <rect x="10" y="10" width="80" height="80"/> </svg> usage
notes value <number> default value none animatable no specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'version' in that specification.
vert-origin-x - SVG: Scalable Vector Graphics
only one element is using this attribute: <font> usage
notes value <number> default value half of horiz-adv-x value animatable no <number> this value indicates the x-coordinate of the origin of a glyph for vertically oriented text.
vert-origin-y - SVG: Scalable Vector Graphics
only one element is using this attribute: <font> usage
notes value <number> default value ascent value animatable no <number> this value indicates the y-coordinate of the origin of a glyph for vertically oriented text.
viewTarget - SVG: Scalable Vector Graphics
only one element is using this attribute: <view> usage
notes value <xml-name> default value none animatable no <xml-name> this value specifies the name of the object associated with the view.
widths - SVG: Scalable Vector Graphics
only one element is using this attribute: <font-face> usage
notes value <number> default value none animatable no <number> this value is a comma-separated list of ucs range values as defined in iso 10646, each followed by one or more glyph widths.
x-height - SVG: Scalable Vector Graphics
only one element is using this attribute: <font-face> usage
notes value <number> default value none animatable no <number> this value indicates the height of lowercase glyphs.
xChannelSelector - SVG: Scalable Vector Graphics
vg" x="0" y="0" width="100%" height="100%" result="abc"/> <fedisplacementmap in2="abc" in="sourcegraphic" scale="30" xchannelselector="b"/> </filter> <text x="10" y="60" font-size="50" filter="url(#displacementfilter)">some displaced text</text> <text x="10" y="120" font-size="50" filter="url(#displacementfilter2)">some displaced text</text> </svg> usage
notes value r | g | b | a default value a animatable yes r this keyword specifies that the red color channel of the input image defined in in2 will be used to displace the pixels of the input image defined in in along the x-axis.
xlink:arcrole - SVG: Scalable Vector Graphics
her" and in the context of a different arc it might have the role of "daughter." twentytwo elements are using this attribute: <a>, <altglyph>, <animate>, <animatecolor>, <animatemotion>, <animatetransform>, <color-profile>, <cursor>, <feimage>, <filter>, <font-face-uri>, <glyphref>, <image>, <lineargradient>, <mpath>, <pattern>, <radialgradient>, <script>, <set>, <textpath>, <tref>, <use> usage
notes value <iri> default value none animatable no <iri> this value specifies an iri reference that identifies some resource that describes the intended property.
xlink:show - SVG: Scalable Vector Graphics
only one element is using this attribute: <a> usage
notes value new | replace | embed | other | none default value replace animatable no new this value specifies that the referenced resource is opened in a new window or tab.
xlink:type - SVG: Scalable Vector Graphics
twentytwo elements are using this attribute: <a>, <altglyph>, <animate>, <animatecolor>, <animatemotion>, <animatetransform>, <color-profile>, <cursor>, <feimage>, <filter>, <font-face-uri>, <glyphref>, <image>, <lineargradient>, <mpath>, <pattern>, <radialgradient>, <script>, <set>, <textpath>, <tref>, and <use> usage
notes value simple default value simple animatable no simple this value specifies that the referred resource is a simple link.
xml:lang - SVG: Scalable Vector Graphics
<svg viewbox="0 0 200 100" xmlns="http://www.w3.org/2000/svg"> <text xml:lang="en-us">this is some english text</text> </svg> usage
notes value <language-tag> default value none animatable no <language-tag> this value specifies the language used for the element.
yChannelSelector - SVG: Scalable Vector Graphics
vg" x="0" y="0" width="100%" height="100%" result="abc"/> <fedisplacementmap in2="abc" in="sourcegraphic" scale="30" ychannelselector="b"/> </filter> <text x="10" y="60" font-size="50" filter="url(#displacementfilter)">some displaced text</text> <text x="10" y="120" font-size="50" filter="url(#displacementfilter2)">some displaced text</text> </svg> usage
notes value r | g | b | a default value a animatable yes r this keyword specifies that the red color channel of the input image defined in in2 will be used to displace the pixels of the input image defined in in along the y-axis.
zoomAndPan - SVG: Scalable Vector Graphics
<svg viewbox="0 0 200 200" xmlns="http://www.w3.org/2000/svg" zoomandpan="disable"> <filter id="diffuselighting" x="0" y="0" width="100%" height="100%"> <fediffuselighting in="sourcegraphic" zoomandpan="1"> <fepointlight x="60" y="60" z="20" /> </fediffuselighting> </filter> <rect x="0" y="0" width="200" height="200" style="filter: url(#diffuselighting);" /> </svg> usage
notes value disable | magnify default value magnify animatable no specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'zoomandpan' in that specification.
<a> - SVG: Scalable Vector Graphics
a-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage
notes categoriescontainer elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elementsshape elementsstructural elementsgradient elements<a>, <altglyphdef>, <clippath>, <color-profile>, <cursor>, <filter>, <font>, <font-face>, <foreignobject>, <image>, <marker>, <mask>, <pattern>, <script>, <style>, <switch>, <text>, <view> specifications ...
<animate> - SVG: Scalable Vector Graphics
tion 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 implements the svganimateelement interface.
<clipPath> - SVG: Scalable Vector Graphics
tional processing attributes most notably: requiredextensions, systemlanguage presentation attributes most notably: clip-path, clip-rule, color, display, fill, fill-opacity, fill-rule, filter, mask, opacity, shape-rendering, stroke, stroke-dasharray, stroke-dashoffset, stroke-linecap, stroke-linejoin, stroke-miterlimit, stroke-opacity, stroke-width, transform, vector-effect, visibility usage
notes categoriesnonepermitted contentany number of the following elements, in any order:animation elementsdescriptive elementsshape elements<text>, <use> specifications specification status comment css masking module level 1the definition of '<clippath>' in that specification.
<defs> - SVG: Scalable Vector Graphics
event attributes presentation attributes most notably: clip-path, clip-rule, color, color-interpolation, color-rendering, cursor, display, fill, fill-opacity, fill-rule, filter, mask, opacity, pointer-events, shape-rendering, stroke, stroke-dasharray, stroke-dashoffset, stroke-linecap, stroke-linejoin, stroke-miterlimit, stroke-opacity, stroke-width, transform, vector-effect, visibility usage
notes categoriescontainer element, structural elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elementsshape elementsstructural elementsgradient elements<a>, <altglyphdef>, <clippath>, <color-profile>, <cursor>, <filter>, <font>, <font-face>, <foreignobject>, <image>, <marker>, <mask>, <pattern>, <script>, <style>, <switch>, <text>, <view> spec...
<desc> - SVG: Scalable Vector Graphics
</desc> </circle> </svg> attributes this element only includes global attributes global attributes core attributes most notably: id styling attributes class, style event attributes global event attributes, document element event attributes usage
notes categoriesdescriptive elementpermitted contentany elements or character data specifications specification status comment scalable vector graphics (svg) 2the definition of '<desc>' in that specification.
<discard> - SVG: Scalable Vector Graphics
usage context categoriesanimation elementpermitted contentany number of the following elements, in any order:descriptive elements<script> attributes global attributes conditional processing attributes core attributes aria attributes specific attributes begin href (but
note that <discard> has never supported xlink:href) specifications specification status comment svg animations level 2the definition of '<discard>' in that specification.
<feConvolveMatrix> - SVG: Scalable Vector Graphics
note in the above formulas that the values in the kernel matrix are applied such that the kernel matrix is rotated 180 degrees relative to the source and destination images in order to match convolution theory as described in many computer graphics textbooks.
<feDropShadow> - SVG: Scalable Vector Graphics
value type: <number>; default value: 2; animatable: yes global attributes core attributes most notably: id styling attributes class, style filter primitive attributes height, in, result, x, y, width presentation attributes most notably: flood-color, flood-opacity usage
notes categoriesfilter primitive elementpermitted contentany number of the following elements, in any order:<animate>, <script>, <set> specifications specification status comment filter effects module level 1the definition of '<fedropshadow>' in that specification.
<g> - SVG: Scalable Vector Graphics
a-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage
notes categoriescontainer element, structural elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elementsshape elementsstructural elementsgradient elements<a>, <altglyphdef>, <clippath>, <color-profile>, <cursor>, <filter>, <font>, <font-face>, <foreignobject>, <image>, <marker>, <mask>, <pattern>, <script>, <style>, <switch>, <text>, <view> spec...
<line> - SVG: Scalable Vector Graphics
a-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage
notes categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements specifications specification status comment scalable vector graphics (svg) 2the definition of '<line>' in that specification.
<linearGradient> - SVG: Scalable Vector Graphics
most notably: clip-path, clip-rule, color, color-interpolation, color-rendering, cursor, display, fill, fill-opacity, fill-rule, filter, mask, opacity, pointer-events, shape-rendering, stroke, stroke-dasharray, stroke-dashoffset, stroke-linecap, stroke-linejoin, stroke-miterlimit, stroke-opacity, stroke-width, transform, vector-effect, visibility xlink attributes xlink:href, xlink:title usage
notes categoriesgradient elementpermitted contentany number of the following elements, in any order:descriptive elements<animate>, <animatetransform>, <set>, <stop> specifications specification status comment scalable vector graphics (svg) 2the definition of '<lineargradient>' in that specification.
<marker> - SVG: Scalable Vector Graphics
a-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage
notes categoriescontainer elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elementsshape elementsstructural elementsgradient elements<a>, <altglyphdef>, <clippath>, <color-profile>, <cursor>, <filter>, <font>, <font-face>, <foreignobject>, <image>, <marker>, <mask>, <pattern>, <script>, <style>, <switch>, <text>, <view> specifications ...
<mask> - SVG: Scalable Vector Graphics
tional processing attributes most notably: requiredextensions, systemlanguage presentation attributes most notably: clip-path, clip-rule, color, display, fill, fill-opacity, fill-rule, filter, mask, opacity, shape-rendering, stroke, stroke-dasharray, stroke-dashoffset, stroke-linecap, stroke-linejoin, stroke-miterlimit, stroke-opacity, stroke-width, transform, vector-effect, visibility usage
notes categoriescontainer elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elementsshape elementsstructural elementsgradient elements<a>, <altglyphdef>, <clippath>, <color-profile>, <cursor>, <filter>, <font>, <font-face>, <foreignobject>, <image>, <marker>, <mask>, <pattern>, <script>, <style>, <switch>, <text>, <view> specifications ...
<path> - SVG: Scalable Vector Graphics
a-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage
notes categoriesgraphics element, shape elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements specifications specification status comment svg pathsthe definition of '<path>' in that specification.
<polygon> - SVG: Scalable Vector Graphics
a-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage
notes categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements specifications specification status comment scalable vector graphics (svg) 2the definition of '<polygon>' in that specification.
<polyline> - SVG: Scalable Vector Graphics
a-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage
notes categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements specifications specification status comment scalable vector graphics (svg) 2the definition of '<polyline>' in that specification.
<radialGradient> - SVG: Scalable Vector Graphics
most notably: clip-path, clip-rule, color, color-interpolation, color-rendering, cursor, display, fill, fill-opacity, fill-rule, filter, mask, opacity, pointer-events, shape-rendering, stroke, stroke-dasharray, stroke-dashoffset, stroke-linecap, stroke-linejoin, stroke-miterlimit, stroke-opacity, stroke-width, transform, vector-effect, visibility xlink attributes xlink:href, xlink:title usage
notes categoriesgradient elementpermitted contentany number of the following elements, in any order:descriptive elements<animate>, <animatetransform>, <set>, <stop> specifications specification status comment scalable vector graphics (svg) 2the definition of '<radialgradient>' in that specification.
<script> - SVG: Scalable Vector Graphics
value type: <url> ; default value: none; animatable: no global attributes core attributes most notably: id styling attributes class, style event attributes global event attributes, document element event attributes usage
notes categoriesnonepermitted contentany elements or character data specifications specification status comment scalable vector graphics (svg) 2the definition of '<script>' in that specification.
<stop> - SVG: Scalable Vector Graphics
value type: <opacity>; default value: 1; animatable: yes global attributes core attributes most notably: id styling attributes class, style event attributes global event attributes, document element event attributes presentation attributes most notably: color, display, stop-color, stop-opacity, visibility usage
notes categoriesgradient elementpermitted contentany number of the following elements, in any order:<animate>, <animatecolor>, <set> specifications specification status comment scalable vector graphics (svg) 2the definition of '<stop>' in that specification.
<style> - SVG: Scalable Vector Graphics
value type: <string>; default value: none; animatable: no global attributes core attributes most notably: id styling attributes class, style event attributes global event attributes, document element event attributes usage
notes categoriesnonepermitted contentany elements or character data specifications specification status comment scalable vector graphics (svg) 2the definition of '<style>' in that specification.
<symbol> - SVG: Scalable Vector Graphics
a-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage
notes categoriescontainer element, structural elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elementsshape elementsstructural elementsgradient elements<a>, <altglyphdef>, <clippath>, <color-profile>, <cursor>, <filter>, <font>, <font-face>, <foreignobject>, <image>, <marker>, <mask>, <pattern>, <script>, <style>, <switch>, <text>, <view>
note...
<textPath> - SVG: Scalable Vector Graphics
level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role xlink attributes xlink:title usage
notes categoriestext content element, text content child elementpermitted contentcharacter data and any number of the following elements, in any order:descriptive elements<a>, <altglyph>, <animate>, <animatecolor>, <set>, <tref>, <tspan> specifications specification status comment scalable vector graphics (svg) 2the definition of '<textpath>' in that specification.
<tspan> - SVG: Scalable Vector Graphics
a-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage
notes categoriestext content element, text content child elementpermitted contentcharacter data and any number of the following elements, in any order:descriptive elements<a>, <altglyph>, <animate>, <animatecolor>, <set>, <tref>, <tspan> specifications specification status comment scalable vector graphics (svg) 2the definition of '<tspan>' in that specification.
SVG as an Image - SVG: Scalable Vector Graphics
note that the above restrictions are specific to image contexts; they don't apply when svg content is viewed directly, or when it's embedded as a document via the <iframe>, <object>, or <embed> elements.
Patterns - SVG: Scalable Vector Graphics
all three of the preceding examples are shown below on a rectangle that has been slightly elongated to a height of 300px, but i should
note that it's not an exhaustive picture, and there are other options available depending on your application.
SVG image element - SVG: Scalable Vector Graphics
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.