Search completed in 0.90 seconds.
ARIA: switch role - Accessibility
the aria
switch role is functionally identical to the checkbox role, except that instead of representing "checked" and "unchecked" states, which are fairly generic in meaning, the
switch role represents the states "on" and "off." this example creates a widget and assigns the aria
switch role to it.
... <button type="button" role="
switch" aria-checked="true" id="speakerpower" class="
switch"> <span>off</span> <span>on</span> </button> <label for="speakerpower" class="
switch">speaker power</label> description the aria
switch role is identical to the checkbox role, except instead of being "checked" or "unchecked", it is either "on" and "off." like the checkbox role, the aria-checked attribute is required.
...the
switch role does not support the value mixed for the aria-checked attribute; assigning a value of mixed to a
switch instead sets the value to false.
...And 23 more matches
switch - JavaScript
the
switch statement evaluates an expression, matching the expression's value to a case clause, and executes statements associated with that case, as well as statements in cases that follow the matching case.
... syntax
switch (expression) { case value1: //statements executed when the //result of expression matches value1 [break;] case value2: //statements executed when the //result of expression matches value2 [break;] ...
...if the expression matches the specified valuen, the statements inside the case clause are executed until either the end of the
switch statement or a break.
...And 16 more matches
XForms Switch Module - Archive of obsolete content
introduction xforms
switch module define a
switch construct that allows the creation of user interfaces where the user interface can be varied based on user actions and events.
... the module defines for this
switch, case and toggle elements.
...
switch element the element (see the spec) is used in conjunction with case and toggle elements.
...And 12 more matches
How to enable locale switching in a XULRunner application - Archive of obsolete content
this article is for developers who have localised their xul application using dtd entity files and want to provide their users with a mechanism to
switch the locale in the application itself.
... screenshot of sample locale
switching control 3.
...sample chrome/chrome.manifest content locale
switchdemo content/ locale locale
switchdemo de-de locale/de-de/ locale locale
switchdemo en-gb locale/en-gb/ locale locale
switchdemo fr-fr locale/fr-fr/ how are you going to populate the xul listbox?
...And 5 more matches
<switch> - SVG: Scalable Vector Graphics
the <
switch> svg element evaluates any requiredfeatures, requiredextensions and systemlanguage attributes on its direct child elements in order, and then renders the first child where these attributes evaluate to true.
... the display and visibility properties have no effect on <
switch> element processing.
... in particular, setting display:none on a child has no effect on the true/false testing for <
switch> processing.
...And 5 more matches
SVGSwitchElement - Web APIs
the svg
switchelement interface corresponds to the <
switch> element.
...="#fff" 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><polyline points="301,89 291,84 291,94 301,89" stroke="#d4dde4" fill="none"/><line x1="291" y1="89" x2="261" y2="89" stroke="#d4dde4"/><a xlink:href="/docs/web/api/svg
switchelement" target="_top"><rect x="101" y="65" width="160" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="181" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svg
switchelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties this inter...
... specifications specification status comment scalable vector graphics (svg) 2the definition of 'svg
switchelement' in that specification.
... scalable vector graphics (svg) 1.1 (second edition)the definition of 'svg
switchelement' in that specification.
101 Switching Protocols - HTTP
the http 101
switching protocols response code indicates the protocol the server is
switching to as requested by a client which sent the message including the upgrade request header.
... the server includes in this response an upgrade response header to indicate the protocol it
switched to.
... status 101
switching protocols examples
switching protocols might be used with websockets.
... http/1.1 101
switching protocols upgrade: websocket connection: upgrade specifications specification title rfc 7231, section 6.2.2: 101
switching protocol hypertext transfer protocol (http/1.1): semantics and content ...
StringView - Archive of obsolete content
noffset : 0, ntranscrtype = 15; if (sencoding) { this.encoding = sencoding.tostring(); } enc
switch:
switch (this.encoding) { case "utf-8": fputoutptcode = stringview.pututf8charcode; fgetoutptchrsize = stringview.getutf8charlength; ftaview = uint8array; break enc
switch; case "utf-16": fputoutptcode = stringview.pututf16charcode; fgetoutptchrsize = stringview.getutf16charlength; ftaview = uint16array; break enc
switch; case "utf-32": ...
... ftaview = uint32array; ntranscrtype &= 14; break enc
switch; default: /* case "ascii", or case "binarystring" or unknown cases */ ftaview = uint8array; ntranscrtype &= 14; } type
switch:
switch (typeof vinput) { case "string": /* the input argument is a primitive string: a new buffer will be created.
... */ ntranscrtype &= 7; break type
switch; case "object": class
switch:
switch (vinput.constructor) { case stringview: /* the input argument is a stringview: a new buffer will be created.
...And 15 more matches
jspage - Archive of obsolete content
+1)+b);}function $splat(b){var a=$type(b); return(a)?((a!="array"&&a!="arguments")?[b]:b):[];}var $time=date.now||function(){return +new date;};function $try(){for(var b=0,a=arguments.length;b<a; b++){try{return arguments[b]();}catch(c){}}return null;}function $type(a){if(a==undefined){return false;}if(a.$family){return(a.$family.name=="number"&&!isfinite(a))?false:a.$family.name; }if(a.nodename){
switch(a.nodetype){case 1:return"element";case 3:return(/\s/).test(a.nodevalue)?"textnode":"whitespace";}}else{if(typeof a.length=="number"){if(a.callee){return"arguments"; }else{if(a.item){return"collection";}}}}return typeof a;}function $unlink(c){var b;
switch($type(c)){case"object":b={};for(var e in c){b[e]=$unlink(c[e]); }break;case"hash":b=new hash(c);break;case"array":b=[];for(var d=0,a=c.length;d...
...return false; }}return true;},some:function(b,c){for(var a in this){if(this.hasownproperty(a)&&b.call(c,this[a],a)){return true;}}return false;},getkeys:function(){var a=[]; hash.each(this,function(c,b){a.push(b);});return a;},getvalues:function(){var a=[];hash.each(this,function(b){a.push(b);});return a;},toquerystring:function(a){var b=[]; hash.each(this,function(f,e){if(a){e=a+"["+e+"]";}var d;
switch($type(f)){case"object":d=hash.toquerystring(f,e);break;case"array":var c={};f.each(function(h,g){c[g]=h; });d=hash.toquerystring(c,e);break;default:d=e+"="+encodeuricomponent(f);}if(f!=undefined){b.push(d);}});return b.join("&");}});hash.alias({keyof:"indexof",hasvalue:"contains"}); var event=new native({name:"event",initialize:function(a,f){f=f||window;var k=f.document;a=a||f.event;if(a.$extende...
...{k=(!k.compatmode||k.compatmode=="css1compat")?k.html:k.body; var i={x:a.pagex||a.clientx+k.scrollleft,y:a.pagey||a.clienty+k.scrolltop};var c={x:(a.pagex)?a.pagex-f.pagexoffset:a.clientx,y:(a.pagey)?a.pagey-f.pageyoffset:a.clienty}; if(j.match(/dommousescroll|mousewheel/)){var h=(a.wheeldelta)?a.wheeldelta/120:-(a.detail||0)/3;}var e=(a.which==3)||(a.button==2);var l=null;if(j.match(/over|out/)){
switch(j){case"mouseover":l=a.relatedtarget||a.fromelement; break;case"mouseout":l=a.relatedtarget||a.toelement;}if(!(function(){while(l&&l.nodetype==3){l=l.parentnode;}return true;}).create({attempt:browser.engine.gecko})()){l=false; }}}}return $extend(this,{event:a,type:j,page:i,client:c,rightclick:e,wheel:h,relatedtarget:l,target:g,code:b,key:m,shift:a.shiftkey,control:a.ctrlkey,alt:a.altkey,meta:a.m...
...And 12 more matches
Key Values - Web APIs
gdk_key_mode_
switch (0xff7e) gdk_key_iso_level3_shift (0xfe03) gdk_key_iso_level3_latch (0xfe04) gdk_key_iso_level3_lock (0xfe05) gdk_key_iso_level5_shift (0xfe11) gdk_key_iso_level5_latch (0xfe12) gdk_key_iso_level5_lock (0xfe13) qt::key_altgr (0x01001103 qt::key_mode_
switch (0x0100117e) "capslock" the caps lock key.
... vk_final (0x18) "groupfirst"
switches to the first character group on an iso/iec 9995 keyboard.
... gdk_key_iso_first_group (0xfe0c) "grouplast"
switches to the last character group on an iso/iec 9995 keyboard.
...And 12 more matches
Index - Web APIs
908 document.execcommand() api, dom, method, needsexample, reference, editor when an html document has been
switched to designmode, its document object exposes an execcommand method to run commands that manipulate the current editable region, such as form inputs or contenteditable elements.
... 944 document.ononline api, dom, document, property, reference the document.online event is fired on the <body> of each page when the browser
switches between online and offline mode.
... 990 document: fullscreenchange event api, fullscreen api, reference, events, fullscreen, fullscreenchange the fullscreenchange event is fired immediately after the browser
switches into or out of full-screen mode.
...And 10 more matches
Index - Archive of obsolete content
312 adding preferences to an extension add-ons, extensions, preferences system, xul this article takes the creating a dynamic status bar extension sample to the next level, adding a popup menu that lets you quickly
switch between multiple stocks to watch.
... it also adds a preference dialog that lets you
switch to a stock other than one of the ones included in the popup menu.
... 415 dehydra dehydra the development focus
switched to dxr (where the "d" comes from "dehydra"), which is based on clang instead of gcc.
...And 8 more matches
Making decisions in your code — conditionals - Learn web development
to make this work you've got to specify a complete test either side of each or operator: if (x === 5 || x === 7 || x === 10 ||x === 20) { // run my code }
switch statements if...else statements do the job of enabling conditional code well, but they are not without their downsides.
... in such a case,
switch statements are your friend — they take a single expression/value as an input, and then look through a number of choices until they find one that matches that value, executing the corresponding code that goes along with it.
... here's some more pseudocode, to give you an idea:
switch (expression) { case choice1: run this code break; case choice2: run this code instead break; // include as many cases as you like default: actually, just run this code } here we've got: the keyword
switch, followed by a set of parentheses.
...And 7 more matches
Color picker tool - CSS: Cascading Style Sheets
s://mdn.mozillademos.org/files/5705/alpha.png"); float: left; position: relative; } .ui-color-picker .preview:before { height: 100%; width: 50%; left: 50%; top: 0; content: ""; background: #fff; position: absolute; z-index: 1; } .ui-color-picker .preview-color { width: 100%; height: 100%; background-color: rgba(255, 0, 0, 0.5); position: absolute; z-index: 1; } .ui-color-picker .
switch_mode { width: 10px; height: 20px; position: relative; border-radius: 5px 0 0 5px; border: 1px solid #ddd; background-color: #eee; left: -12px; top: -1px; z-index: 1; transition: all 0.5s; } .ui-color-picker .
switch_mode:hover { background-color: #ccc; cursor: pointer; } /* * ui component */ .ui-input-slider { height: 20px; font-family: "segoe ui", arial, helvetica, sans-serif; ...
...a-collapsed='true'] { height: 0 !important; } .block { display: table; } /** * container */ #container { width: 100%; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; display: table; } /** * picker zone */ #picker { padding: 10px; width: 980px; } .ui-color-picker { padding: 3px 5px; float: left; border-color: #fff; } .ui-color-picker .
switch_mode { display: none; } .ui-color-picker .preview-color:hover { cursor: move; } /** * picker container */ #picker-samples { width: 375px; height: 114px; max-height: 218px; margin: 0 10px 0 30px; overflow: hidden; position: relative; float: left; transition: all 0.2s; } #picker-samples .sample { width: 40px; height: 40px; margin: 5px; border: 1px solid #ddd; position: absolut...
...es #add-icon:before { width: 70%; height: 16%; top: 42%; left: 15%; } #picker-samples #add-icon:after { width: 16%; height: 70%; top: 15%; left: 42%; } #picker-samples #add-icon:hover:before, #picker-samples #add-icon:hover:after { background-color: #ddd; box-shadow: 0 0 1px 0 #ddd; } /** * controls */ #controls { width: 110px; padding: 10px; float: right; } #controls #picker-
switch { text-align: center; float: left; } #controls .icon { width: 48px; height: 48px; margin: 10px 0; background-repeat: no-repeat; background-position: center; border: 1px solid #ddd; display: table; float: left; } #controls .icon:hover { cursor: pointer; } #controls .picker-icon { background-image: url('https://mdn.mozillademos.org/files/6081/picker.png'); } #controls #void-sample {...
...And 6 more matches
Responsive images - Learn web development
this is called the resolution
switching problem.
...responsive image technologies were implemented recently to solve the problems indicated above by letting you offer the browser several image files, either all showing the same thing but containing different numbers of pixels (resolution
switching), or different images suitable for different space allocations (art direction).
... resolution
switching: different sizes so, what is the problem that we want to solve with resolution
switching?
...And 5 more matches
Control flow and error handling - JavaScript
javascript supports two conditional statements: if...else and
switch.
...' + `${document.form1.threechar.value} is not valid.`); return false; } }
switch statement a
switch statement allows a program to evaluate an expression and attempt to match the expression's value to a case label.
... a
switch statement looks like this:
switch (expression) { case label_1: statements_1 [break;] case label_2: statements_2 [break;] … default: statements_def [break;] } javascript evaluates the above
switch statement as follows: the program first looks for a case clause with a label matching the value of expression and then transfers control to that clause, executing the associated statements.
...And 5 more matches
XPCOM Examples - Archive of obsolete content
window mediator component this is fine for displaying a list of open windows, but we would like to enhance this so that clicking on the menu item will
switch to that window.
...that means that in order to
switch the window focus, we need to do the following: determine the element that the user clicked on.
...
switch the focus to this window.
...And 4 more matches
CSS grids, logical values, and writing modes - CSS: Cascading Style Sheets
i have added dir="rtl" to the html element, which
switches the writing mode from the default for an english language document of ltr.
...the second however,
switches direction and the text runs from right to left .
...they prevent the browser being able to do the work to
switch writing mode, as they make the assumption that the text is flowing left to right and top to bottom.
...And 4 more matches
Test your skills: Conditionals - Learn web development
conditionals 2 for this task you are given three variables: machineactive — contains an indicator of whether the answer machine is
switched on or not (true/false) score — contains your score in an imaginary game.
... you need to create an if...else structure that checks whether the machine is
switched on and puts a message into the response variable if it isn't, telling the user to
switch the machine on.
... conditionals 3 in this task you need to take the code you wrote for the second task, and rewrite the inner if...else if...else to use a
switch statement instead.
...And 3 more matches
Enc Dec MAC Output Public Key as CSR
intf(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 char* c) {
switch (*c) { case 'g': return gen_csr; case 'e': return encrypt; case 'd': return decrypt; default: return unknown; } } /* * wrap the symkey using public key */ secstatus wrapkey(pk11symkey* key, seckeypublickey *pubkey, secitem **wrappedkey) { secstatus rv; secitem *data = (secitem *)port_zalloc(sizeof(secitem)); if (!data) { pr_fprintf(pr_stderr, "error wh...
...success) return rv; rv = macupdate(ctxmac, ptext, ptextlen); if (rv != secsuccess) return rv; rv = macfinal(ctxmac, mac, maclen, maxlen); return rv; } /* * writetoheaderfile */ secstatus writetoheaderfile(const char *buf, unsigned int len, headertype type, prfiledesc *outfile) { secstatus rv; const char *header; const char *trailer;
switch (type) { case symkey: header = enckey_header; trailer = enckey_trailer; break; case mackey: header = mackey_header; trailer = mackey_trailer; break; case iv: header = iv_header; trailer = iv_trailer; break; case mac: header = mac_header; trailer = mac_trailer; break; case pad: ...
...tus rv; secitem filedata; secitem outbuf; unsigned char *nonbody; unsigned char *body; char *header; char *trailer; prfiledesc *file = null; outbuf.type = sibuffer; file = pr_open(filename, pr_rdonly, 0); if (!file) { pr_fprintf(pr_stderr, "failed to open %s\n", filename); return secfailure; }
switch (type) { case pubkey: header = pubkey_header; trailer = pubkey_trailer; break; case symkey: header = enckey_header; trailer = enckey_trailer; break; case mackey: header = mackey_header; trailer = mackey_trailer; break; case iv: header = iv_header; trailer = iv_trailer; break; case m...
...And 3 more matches
Enc Dec MAC Using Key Wrap CertReq PKCS10 CSR
(infile) { pr_close(infile); } if (vfy) { vfy_destroycontext(vfy, pr_true); } return rv; } /* * write cryptographic parameters to header file */ secstatus writetoheaderfile(const char *buf, unsigned int len, headertype type, prfiledesc *outfile) { secstatus rv; const char *header; const char *trailer;
switch (type) { case symkey: header = enckey_header; trailer = enckey_trailer; break; case mackey: header = mackey_header; trailer = mackey_trailer; break; case iv: header = iv_header; trailer = iv_trailer; break; case mac: header = mac_header; trailer = mac_trailer; break; ...
...ile = null; secitem filedata; secitem outbuf; unsigned char *nonbody; unsigned char *body; char *header; char *trailer; outbuf.type = sibuffer; file = pr_open(filename, pr_rdonly, 0); if (!file) { pr_fprintf(pr_stderr, "failed to open %s\n", filename); rv = secfailure; goto cleanup; }
switch (type) { case pubkey: header = pubkey_header; trailer = pubkey_trailer; break; case symkey: header = enckey_header; trailer = enckey_trailer; break; case mackey: header = mackey_header; trailer = mackey_trailer; break; case iv: header = iv_header; trailer = iv_trailer; b...
...params; seckeyprivatekey *privkey = null; secstatus rv; unsigned char randbuf[blocksize + 1]; rv = generaterandom(randbuf, blocksize); if (rv != secsuccess) { fprintf(stderr, "error while generating the random numbers : %s\n", port_errortostring(rv)); goto cleanup; } pk11_randomupdate(randbuf, blocksize);
switch (keytype) { case rsakey: rsaparams.keysizeinbits = size; rsaparams.pe = publicexponent; mechanism = ckm_rsa_pkcs_key_pair_gen; algtag = sec_oid_pkcs1_md5_with_rsa_encryption; params = &rsaparams; break; default: goto cleanup; ...
...And 3 more matches
sample2
v != secsuccess) { pr_fprintf(pr_stderr, "problem while vfy_end\n"); goto cleanup; } cleanup: if (infile) { pr_close(infile); } if (vfy) { vfy_destroycontext(vfy, pr_true); } return rv; } /* * write cryptographic parameters to header file */ secstatus writetoheaderfile(const char *buf, unsigned int len, headertype type, prfiledesc *outfile) { secstatus rv; const char *header; const char *trailer;
switch (type) { case symkey: header = enckey_header; trailer = enckey_trailer; break; case mackey: header = mackey_header; trailer = mackey_trailer; break; case iv: header = iv_header; trailer = iv_trailer; break; case mac: header = mac_header; trailer = mac_trailer; break; case pad: header = pad_header; trailer = pad_trailer; break; case pubkey: header = pubkey_header; trailer = pubkey_trailer; break; ...
...const char *filename, headertype type, secitem *item, prbool ishexdata) { secstatus rv = secsuccess; prfiledesc* file = null; secitem filedata; secitem outbuf; unsigned char *nonbody; unsigned char *body; char *header; char *trailer; outbuf.type = sibuffer; file = pr_open(filename, pr_rdonly, 0); if (!file) { pr_fprintf(pr_stderr, "failed to open %s\n", filename); rv = secfailure; goto cleanup; }
switch (type) { case pubkey: header = pubkey_header; trailer = pubkey_trailer; break; case symkey: header = enckey_header; trailer = enckey_trailer; break; case mackey: header = mackey_header; trailer = mackey_trailer; break; case iv: header = iv_header; trailer = iv_trailer; break; case mac: header = mac_header; trailer = mac_trailer; break; case pad: header = pad_header; trailer = pad_trailer; break; ...
... *pwdata) { ck_mechanism_type mechanism; secoidtag algtag; pk11rsagenparams rsaparams; void *params; seckeyprivatekey *privkey = null; secstatus rv; unsigned char randbuf[blocksize + 1]; rv = generaterandom(randbuf, blocksize); if (rv != secsuccess) { fprintf(stderr, "error while generating the random numbers : %s\n", port_errortostring(rv)); goto cleanup; } pk11_randomupdate(randbuf, blocksize);
switch (keytype) { case rsakey: rsaparams.keysizeinbits = size; rsaparams.pe = publicexponent; mechanism = ckm_rsa_pkcs_key_pair_gen; algtag = sec_oid_pkcs1_md5_with_rsa_encryption; params = &rsaparams; break; default: goto cleanup; } fprintf(stderr, "\n\n"); fprintf(stderr, "generating key.
...And 3 more matches
Parser API
interface
switchstatement <: statement { type: "
switchstatement"; discriminant: expression; cases: [
switchcase ]; lexical: boolean; } a
switch statement.
... the lexical flag is metadata indicating whether the
switch statement contains any unnested let declarations (and therefore introduces a new lexical scope).
... clauses interface
switchcase <: node { type: "
switchcase"; test: expression | null; consequent: [ statement ]; } a case (if test is an expression) or default (if test === null) clause in the body of a
switch statement.
...And 3 more matches
The JavaScript input interpreter - Firefox Developer Tools
to
switch back to single-line mode, click the x icon at the top of the multi-line editing pane, or press ctrl+b (windows/linux) or cmd+b (macos).
...for example, if you type a function definition in the multi-line editor, and click run, you can
switch to single-line mode and still use your function.
...there are three ways to select an iframe using cd(): you can pass the iframe dom element: var frame = document.getelementbyid("frame1"); cd(frame); you can pass a css selector that matches the iframe: cd("#frame1"); you can pass the iframe's global window object: var frame = document.getelementbyid("frame1"); cd(frame.contentwindow); to
switch the context back to the top-level window, call cd() with no arguments: cd(); for example, suppose we have a document that embeds an iframe: <!doctype html> <html> <head> <meta charset="utf-8"> </head> <body> <iframe id="frame1" src="static/frame/my-frame1.html"></iframe> </body> </html> the iframe defines a new function: <!doctype html> <html> <head> <meta charset="utf-...
...And 3 more matches
Page Visibility API - Web APIs
when the user minimizes the window or
switches to another tab, the api sends a visibilitychange event to let listeners know the state of the page has changed.
... a site has an image carousel that shouldn't advance to the next slide unless the user is viewing the page an application showing a dashboard of information doesn't want to poll the server for updates when the page isn't visible a page wants to detect when it is being prerendered so it can keep accurate count of page views a site wants to
switch off sounds when a device is in standby mode (user pushes power button to turn screen off) developers have historically used imperfect proxies to detect this.
... note: while onblur and onfocus will tell you if the user
switches windows, it doesn't necessarily mean it's hidden.
...And 3 more matches
ui/sidebar - Archive of obsolete content
events attach this event is emitted when a worker is attached to a sidebar, as a result of any of the following: calling the sidebar's show() method, when the sidebar is not shown in the currently active window changing the sidebar's url property the user
switching the sidebar on using the "sidebar" submenu in firefox, when the sidebar is not shown in the currently active window the user opening a new window from a window that has the sidebar showing it is passed a worker as an argument, which defines port.emit() and port.on() methods that you can use to send messages to, and receive messages from, scripts loaded into the sidebar.
... ready this event is emitted after the dom content for a sidebar has been loaded, as a result of any of: calling the sidebar's show() method, when the sidebar is not shown in the currently active window changing the sidebar's url property the user
switching the sidebar on using the "sidebar" submenu in firefox, when the sidebar is not shown in the currently active window the user opening a new window from a window that has the sidebar showing it is passed a worker as an argument, which defines port.emit() and port.on() methods that you can use to send messages to, and receive messages from, scripts loaded into the sidebar.
... detach this event is emitted when a worker is detached from a sidebar, as a result of either of the following: calling the sidebar's hide() method, when the sidebar is being shown in the currently active window the user
switching the sidebar off using the "sidebar" submenu in firefox, when the sidebar is being shown in the currently active window the detach listener receives a worker object as a parameter.
...And 2 more matches
Fundamental text and font styling - Learn web development
once you've become used to using the above, you should also explore the following: font styles: font-variant:
switch between small caps and normal font alternatives.
... font-kerning:
switch font kerning options on and off.
... font-feature-settings:
switch various opentype font features on and off.
...And 2 more matches
Eclipse CDT
to quickly
switch between a source file and its header file, use ctrl-tab.
... to quickly
switch to a recently viewed document use cmd-f6/ctrl-f6.
...note that there are buttons to the right of the "open call hierarchy" tab that open to
switch between "show callers" and "show callees".
...And 2 more matches
Localizing with Koala
switch to "koala file view" in the sidebar (choose it from the list that appears when you click on the arrow pointing down situated next to the sidebar's [x] button).
...it has to be generated every time the user
switches between pages.
... to see the results of the comparison for locale's all files (including searchbar.dtd),
switch to "locale files" view in the "koala file view" sidebar.
...And 2 more matches
Optimizing Applications For NSPR
this means that nspr threads use a shadow stack to preserve context across a thread
switch.
... at thread
switch time, the stack of the current running thread is copied to other storage associated with that thread and the about-to-be-dispatched thread's stack data is copied back onto the windows stack just before the thread is given control.
... consider that the windows stack is swapped in and out with each thread
switch.
...And 2 more matches
Bytecode Descriptions
this is used to implement
switch statements when the jsop::table
switch optimization is not possible.
... the
switch statement
switch (expr) { case a: stmt1; case b: stmt2; } compiles to this bytecode: # dispatch code - evaluate expr, check it against each `case`, # jump to the right place in the body or to the end.
...we could implement
switch statements using jsop::ifne and jsop::pop, but that would also be awkward--putting the jsop::pop inside the
switch body would complicate fallthrough.
...And 2 more matches
Migrating from Firebug - Firefox Developer Tools
that means, that when you open the devtools in a tab, they stay open even when you
switch between different websites.
... when you
switch to another tab, though, they're closed.
...it is currently missing the preview for html, xml and svg, though, which is tracked in bug 1247392 and bug 1262796, but when you click on the url of the request you
switch to the network monitor, which has a preview tab.
...And 2 more matches
Fullscreen API - Web APIs
methods on the document interface document.exitfullscreen() requests that the user agent
switch from full-screen mode back to windowed mode.
... fullscreenerror sent to a document or element if an error occurs while attempting to
switch it into or out of full-screen mode.
... note: navigating to another page, changing tabs, or
switching to another application using any application
switcher (or alt-tab) will likewise exit full-screen mode.
...And 2 more matches
RTCRtpSender.replaceTrack() - Web APIs
the new track must be of the same media kind (audio, video, etc) and
switching the track should not require negotiation.
... among the use cases for replacetrack() is the common need to
switch between the rear- and front-facing cameras on a phone.
... with replacetrack(), you can simply have a track object for each camera and
switch between the two as needed.
...And 2 more matches
Signaling and video calling - Web APIs
if conditions change—for example the network connection deteriorates—one or both peers might suggest
switching to a lower-bandwidth media resolution, or to an alternative codec.
... function handlegetusermediaerror(e) {
switch(e.name) { case "notfounderror": alert("unable to open your call because no camera and/or microphone" + "were found."); break; case "securityerror": case "permissiondeniederror": // do nothing; this is the same as the user canceling the call.
...
switching between the front and rear cameras on a phone.
...And 2 more matches
systemLanguage - SVG: Scalable Vector Graphics
35 elements 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.
... systemlanguage is often used in conjunction with the <
switch> element.
... if the attribute is used in other situations, then it represents a simple
switch on the given element whether to render the element or not.
...And 2 more matches
How to convert an overlay extension to restartless - Archive of obsolete content
here are some functions to handle this: function getgenericpref(branch,prefname) {
switch (branch.getpreftype(prefname)) { default: case 0: return undefined; // pref_invalid case 32: return getucharpref(prefname,branch); // pref_string case 64: return branch.getintpref(prefname); // pref_int case 128: return branch.getboolpref(prefname); // pref_bool } } function setgenericpref(branch,prefname,prefvalue) { ...
...
switch (typeof prefvalue) { case "string": setucharpref(prefname,prefvalue,branch); return; case "number": branch.setintpref(prefname,prefvalue); return; case "boolean": branch.setboolpref(prefname,prefvalue); return; } } function setdefaultpref(prefname,prefvalue) { var defaultbranch = services.prefs.getdefaultbranch(null); setgenericpref(defaultbranch,prefname,prefvalue); } function getucharpref(prefname,branch) // unicode getcharpref { branch = branch ?
...well, you should probably consider
switching to be extractionless when you go restartless.
...so, time to
switch to extractionless, too.
List of Former Mozilla-Based Applications - Archive of obsolete content
applications that
switched to another technology name description additional information angelsoft tools for startups, vcs, and angel investors
switched from xulrunner-based client to a web application autodesk maya 3d modeling tool
switched off of gecko for help browser in version 8.5 blam feed reader
switched to webkit in version 1.8.6 boxee media center software
switched to webkit in version 1.0 epiphany browser
switched from gecko to webkit flock social browsing ...
...flock
switched from being firefox-based to chromium-based when it released a new beta on june 16, 2010 jolicloud web operating system as of march 2010, rw/w reports jolicloud is on chrome/chrome os joost tv over internet
switched from xulrunner-based client to a web application liferea news aggregator
switched to webkit in version 1.6 manyone browser browser originally mozilla-based but now i believe the have a web-based tool (need reference for that) miro (formerly democracy player) video
switched from xulrunner to webkit in version 3.0.2 moblin browser browser when moblin became meego it
switched from a custom gecko-based browser to chrome nautilus file manager hasn't used mozilla code sinc...
...e version 2.0 raptr client gaming client was a xulrunner app initially but now uses adobe air rift technologies software installation over internet no longer using mozilla technology -- need confirmation and details second life virtual world desktop client
switched from embedded mozilla browser to a plugin architecture with a qtwebkit plugin applications that are no longer being developed name description additional information aphrodite browser inactive aol client for mac internet software no longer available beonex communicator internet software last news item on site from 2004 chameleon theme builder inactive civil netizen p2p file delivery (email attachm...
...ent replacement) site not updated since 2006 compuserve client internet software no longer available doczilla sgml/xml/html browser last release on site from july 2005 fabula language learning application inactive galeon browser last news item on site from september 2006 gencatrss rss reader domain
switched over to domain parking service ghostzilla browser archived version of ghostzilla site from 2005 homebase desktop operating environment for internet computers no longer available hp printer assistant printer utility hall of fame page mentions that this used an embedded version of mozilla at some point but i can't find reference to current status (may still be using mozilla...
Complete - Archive of obsolete content
restart the application using the command line
switch: -uilocale fr-fr (of course, if your application is already in french, specify en-us here to
switch the extension to english.) notes: if you use a shortcut or launcher icon to start the application, then you can add the command line
switch by editing the icon's properties.
... the application's user interface only
switches language if you have the appropriate language pack installed.
... but this extension
switches between english and french without needing any language pack.
...to work around the bug, close the application, delete the file xul.mfl in its profile, then restart it with the command line
switch.
button - Archive of obsolete content
autocheck type: boolean if this attribute is true or left out, the checked state of the button will be
switched each time the button is pressed.
...when in state 0 or 1, pressing the button will
switch to the opposite state.
... when in state 2, pressing the button will
switch to state 0.
...the user can click the button to
switch between the states.
toolbarbutton - Archive of obsolete content
autocheck type: boolean if this attribute is true or left out, the checked state of the button will be
switched each time the button is pressed.
...when in state 0 or 1, pressing the button will
switch to the opposite state.
... when in state 2, pressing the button will
switch to state 0.
... checkbox: use this type to create a toggle button which will
switch the checked state each time the button is pressed.
Gecko Compatibility Handbook - Archive of obsolete content
install the user agent
switcher extension.
... after restarting your browser, add the the user-agent strings that you want to test to the list (tools | user agent
switcher | options | options...
... you can now start using the user-agent string you've just created by clicking tools | user agent
switcher |the name you have chosen.
... problem: site certified on netscape 6.x looks incorrect in other browsers if your site is already gecko-compatible, try
switching back to a netscape 6 user-agent string.
Encrypt Decrypt MAC Keys As Session Objects
, ptext, ptextlen); if (rv != secsuccess) return rv; rv = macfinal(ctxmac, mac, maclen, maxlen); return rv; } /* * writetoheaderfile */ secstatus writetoheaderfile(const char *buf, unsigned int len, headertype type, prfiledesc *outfile) { secstatus rv; char header[40]; char trailer[40]; char *outstring = null;
switch (type) { case symkey: strcpy(header, enckey_header); strcpy(trailer, enckey_trailer); break; case mackey: strcpy(header, mackey_header); strcpy(trailer, mackey_trailer); break; case iv: strcpy(header, iv_header); strcpy(trailer, iv_trailer); break; case mac: strcpy(header, mac_header); strcpy(t...
...us rv; prfiledesc* file; secitem filedata; secitem outbuf; unsigned char *nonbody; unsigned char *body; char header[40]; char trailer[40]; outbuf.type = sibuffer; file = pr_open(filename, pr_rdonly, 0); if (!file) { pr_fprintf(pr_stderr, "failed to open %s\n", filename); return secfailure; }
switch (type) { case symkey: strcpy(header, enckey_header); strcpy(trailer, enckey_trailer); break; case mackey: strcpy(header, mackey_header); strcpy(trailer, mackey_trailer); break; case iv: strcpy(header, iv_header); strcpy(trailer, iv_trailer); break; case mac: strcpy(header, mac_header); strcpy(t...
...progname + 1 : argv[0]; /* parse command line arguments */ optstate = pl_createoptstate(argc, argv, "c:d:i:o:f:p:z:a"); while ((status = pl_getnextopt(optstate)) == pl_opt_ok) {
switch (optstate->option) { case 'a': ascii = pr_true; break; case 'c': command = strdup(optstate->value); break; case 'd': dbdir = strdup(optstate->value); break; case 'f': pwdata.source = pw_fromfile; pwdata.data = strdup(optstate->value); break; case 'p':...
...ile, choose filename as inputfile name with extension ".header" */ strcpy(headerfilename, infilename); strcat(headerfilename, ".header"); /* for intermediate encrypted file, choose filename as inputfile name with extension ".enc" */ strcpy(encryptedfilename, infilename); strcat(encryptedfilename, ".enc"); pr_init(pr_user_thread, pr_priority_normal, 0);
switch (cmd) { case encrypt: /* if the intermediate header file already exists, delete it */ if (pr_access(headerfilename, pr_access_exists) == pr_success) { pr_delete(headerfilename); } /* if the intermediate encrypted already exists, delete it */ if (pr_access(encryptedfilename, pr_access_exists) == pr_success) { pr_delete(encryptedf...
Encrypt and decrypt MAC using token
, ptext, ptextlen); if (rv != secsuccess) return rv; rv = macfinal(ctxmac, mac, maclen, maxlen); return rv; } /* * writetoheaderfile */ secstatus writetoheaderfile(const char *buf, unsigned int len, headertype type, prfiledesc *outfile) { secstatus rv; char header[40]; char trailer[40]; char *outstring = null;
switch (type) { case symkey: strcpy(header, enckey_header); strcpy(trailer, enckey_trailer); break; case mackey: strcpy(header, mackey_header); strcpy(trailer, mackey_trailer); break; case iv: strcpy(header, iv_header); strcpy(trailer, iv_trailer); break; case mac: strcpy(header, mac_header); strcpy(t...
...us rv; prfiledesc* file; secitem filedata; secitem outbuf; unsigned char *nonbody; unsigned char *body; char header[40]; char trailer[40]; outbuf.type = sibuffer; file = pr_open(filename, pr_rdonly, 0); if (!file) { pr_fprintf(pr_stderr, "failed to open %s\n", filename); return secfailure; }
switch (type) { case symkey: strcpy(header, enckey_header); strcpy(trailer, enckey_trailer); break; case mackey: strcpy(header, mackey_header); strcpy(trailer, mackey_trailer); break; case iv: strcpy(header, iv_header); strcpy(trailer, iv_trailer); break; case mac: strcpy(header, mac_header); strcpy(t...
...progname + 1 : argv[0]; /* parse command line arguments */ optstate = pl_createoptstate(argc, argv, "c:d:i:o:f:p:z:a"); while ((status = pl_getnextopt(optstate)) == pl_opt_ok) {
switch (optstate->option) { case 'a': ascii = pr_true; break; case 'c': command = strdup(optstate->value); break; case 'd': dbdir = strdup(optstate->value); break; case 'f': pwdata.source = pw_fromfile; pwdata.data = strdup(optstate->value); break; case 'p':...
...ile, choose filename as inputfile name with extension ".header" */ strcpy(headerfilename, infilename); strcat(headerfilename, ".header"); /* for intermediate encrypted file, choose filename as inputfile name with extension ".enc" */ strcpy(encryptedfilename, infilename); strcat(encryptedfilename, ".enc"); pr_init(pr_user_thread, pr_priority_normal, 0);
switch (cmd) { case encrypt: /* if the intermediate header file already exists, delete it */ if (pr_access(headerfilename, pr_access_exists) == pr_success) { pr_delete(headerfilename); } /* if the intermediate encrypted already exists, delete it */ if (pr_access(encryptedfilename, pr_access_exists) == pr_success) { pr_delete(encryptedf...
Encrypt Decrypt_MAC_Using Token
, ptext, ptextlen); if (rv != secsuccess) return rv; rv = macfinal(ctxmac, mac, maclen, maxlen); return rv; } /* * writetoheaderfile */ secstatus writetoheaderfile(const char *buf, unsigned int len, headertype type, prfiledesc *outfile) { secstatus rv; char header[40]; char trailer[40]; char *outstring = null;
switch (type) { case symkey: strcpy(header, enckey_header); strcpy(trailer, enckey_trailer); break; case mackey: strcpy(header, mackey_header); strcpy(trailer, mackey_trailer); break; case iv: strcpy(header, iv_header); strcpy(trailer, iv_trailer); break; case mac: strcpy(header, mac_header); strcpy(t...
...us rv; prfiledesc* file; secitem filedata; secitem outbuf; unsigned char *nonbody; unsigned char *body; char header[40]; char trailer[40]; outbuf.type = sibuffer; file = pr_open(filename, pr_rdonly, 0); if (!file) { pr_fprintf(pr_stderr, "failed to open %s\n", filename); return secfailure; }
switch (type) { case symkey: strcpy(header, enckey_header); strcpy(trailer, enckey_trailer); break; case mackey: strcpy(header, mackey_header); strcpy(trailer, mackey_trailer); break; case iv: strcpy(header, iv_header); strcpy(trailer, iv_trailer); break; case mac: strcpy(header, mac_header); strcpy(t...
...progname + 1 : argv[0]; /* parse command line arguments */ optstate = pl_createoptstate(argc, argv, "c:d:i:o:f:p:z:a"); while ((status = pl_getnextopt(optstate)) == pl_opt_ok) {
switch (optstate->option) { case 'a': ascii = pr_true; break; case 'c': command = strdup(optstate->value); break; case 'd': dbdir = strdup(optstate->value); break; case 'f': pwdata.source = pw_fromfile; pwdata.data = strdup(optstate->value); break; case 'p':...
...ile, choose filename as inputfile name with extension ".header" */ strcpy(headerfilename, infilename); strcat(headerfilename, ".header"); /* for intermediate encrypted file, choose filename as inputfile name with extension ".enc" */ strcpy(encryptedfilename, infilename); strcat(encryptedfilename, ".enc"); pr_init(pr_user_thread, pr_priority_normal, 0);
switch (cmd) { case encrypt: /* if the intermediate header file already exists, delete it.
NSS Sample Code Sample_3_Basic Encryption and MACing
text, ptextlen); if (rv != secsuccess) return rv; rv = macfinal(ctxmac, mac, maclen, maxlen); return rv; } /* * write to header file */ secstatus writetoheaderfile(const char *buf, unsigned int len, headertype type, prfiledesc *outfile) { secstatus rv; char header[40]; char trailer[40]; char *outstring = null;
switch (type) { case symkey: strcpy(header, enckey_header); strcpy(trailer, enckey_trailer); break; case mackey: strcpy(header, mackey_header); strcpy(trailer, mackey_trailer); break; case iv: strcpy(header, iv_header); strcpy(trailer, iv_trailer); break; case mac: strcpy(header, mac_header); strcpy(t...
...us rv; prfiledesc* file; secitem filedata; secitem outbuf; unsigned char *nonbody; unsigned char *body; char header[40]; char trailer[40]; outbuf.type = sibuffer; file = pr_open(filename, pr_rdonly, 0); if (!file) { pr_fprintf(pr_stderr, "failed to open %s\n", filename); return secfailure; }
switch (type) { case symkey: strcpy(header, enckey_header); strcpy(trailer, enckey_trailer); break; case mackey: strcpy(header, mackey_header); strcpy(trailer, mackey_trailer); break; case iv: strcpy(header, iv_header); strcpy(trailer, iv_trailer); break; case mac: strcpy(header, mac_header); strcpy(t...
...progname + 1 : argv[0]; /* parse command line arguments */ optstate = pl_createoptstate(argc, argv, "c:d:i:o:f:p:z:a"); while ((status = pl_getnextopt(optstate)) == pl_opt_ok) {
switch (optstate->option) { case 'a': ascii = pr_true; break; case 'c': command = strdup(optstate->value); break; case 'd': dbdir = strdup(optstate->value); break; case 'f': pwdata.source = pw_fromfile; pwdata.data = strdup(optstate->value); break; case 'p':...
...ile, choose filename as inputfile name with extension ".header" */ strcpy(headerfilename, infilename); strcat(headerfilename, ".header"); /* for intermediate encrypted file, choose filename as inputfile name with extension ".enc" */ strcpy(encryptedfilename, infilename); strcat(encryptedfilename, ".enc"); pr_init(pr_user_thread, pr_priority_normal, 0);
switch (cmd) { case encrypt: /* if the intermediate header file already exists, delete it */ if (pr_access(headerfilename, pr_access_exists) == pr_success) { pr_delete(headerfilename); } /* if the intermediate encrypted already exists, delete it */ if (pr_access(encryptedfilename, pr_access_exists) == pr_success) { pr_delete(encryptedfi...
EncDecMAC using token object - sample 3
{ secstatus rv = macinit(ctxmac); if (rv != secsuccess) return rv; rv = macupdate(ctxmac, ptext, ptextlen); if (rv != secsuccess) return rv; rv = macfinal(ctxmac, mac, maclen, maxlen); return rv; } /* * writetoheaderfile */ secstatus writetoheaderfile(const char *buf, unsigned int len, headertype type, prfiledesc *outfile) { secstatus rv; char header[40]; char trailer[40]; char *outstring = null;
switch (type) { case symkey: strcpy(header, enckey_header); strcpy(trailer, enckey_trailer); break; case mackey: strcpy(header, mackey_header); strcpy(trailer, mackey_trailer); break; case iv: strcpy(header, iv_header); strcpy(trailer, iv_trailer); break; case mac: strcpy(header, mac_header); strcpy(trailer, mac_trailer); break; case pad: strcpy(header, pad_header); strcpy(trailer, pad_trailer); break; ...
...status readfromheaderfile(const char *filename, headertype type, secitem *item, prbool ishexdata) { secstatus rv; prfiledesc* file; secitem filedata; secitem outbuf; unsigned char *nonbody; unsigned char *body; char header[40]; char trailer[40]; outbuf.type = sibuffer; file = pr_open(filename, pr_rdonly, 0); if (!file) { pr_fprintf(pr_stderr, "failed to open %s\n", filename); return secfailure; }
switch (type) { case symkey: strcpy(header, enckey_header); strcpy(trailer, enckey_trailer); break; case mackey: strcpy(header, mackey_header); strcpy(trailer, mackey_trailer); break; case iv: strcpy(header, iv_header); strcpy(trailer, iv_trailer); break; case mac: strcpy(header, mac_header); strcpy(trailer, mac_trailer); break; case pad: strcpy(header, pad_header); strcpy(trailer, pad_trailer); break; ...
...progname + 1 : argv[0]; /* parse command line arguments */ optstate = pl_createoptstate(argc, argv, "c:d:i:o:f:p:z:a"); while ((status = pl_getnextopt(optstate)) == pl_opt_ok) {
switch (optstate->option) { case 'a': ascii = pr_true; break; case 'c': command = strdup(optstate->value); break; case 'd': dbdir = strdup(optstate->value); break; case 'f': pwdata.source = pw_fromfile; pwdata.data = strdup(optstate->value); break; case 'p': pwdata.source = pw_plaintext; pwdata.data = strdup(optstate->value); break; case 'i': infilename = strdup(optstate->value); break; case 'o': outfil...
...r_close(infile); /* for intermediate header file, choose filename as inputfile name with extension ".header" */ strcpy(headerfilename, infilename); strcat(headerfilename, ".header"); /* for intermediate encrypted file, choose filename as inputfile name with extension ".enc" */ strcpy(encryptedfilename, infilename); strcat(encryptedfilename, ".enc"); pr_init(pr_user_thread, pr_priority_normal, 0);
switch (cmd) { case encrypt: /* if the intermediate header file already exists, delete it */ if (pr_access(headerfilename, pr_access_exists) == pr_success) { pr_delete(headerfilename); } /* if the intermediate encrypted already exists, delete it */ if (pr_access(encryptedfilename, pr_access_exists) == pr_success) { pr_delete(encryptedfilename); } /* open db for read/write and authenticate to it.
Guide to the Fullscreen API - Web APIs
when a fullscreen request fails it's not guaranteed that you'll be able to
switch into fullscreen mode.
... in addition, navigating to another page, changing tabs, or
switching to another application (using, for example, alt-tab) while in fullscreen mode exits fullscreen mode as well.
...if it's null, the document is currently in windowed mode, so we need to
switch to fullscreen mode.
...
switching to fullscreen mode is done by calling element.requestfullscreen().
Timing element visibility with the Intersection Observer API - Web APIs
this event is sent when the document becomes hidden or visible, such as when the user
switches tabs in their browser.
...the most important scenario here is when the user
switches tabs.
... since intersection observer only cares about the intersection between the targeted elements and the intersection root, and not the tab's visibility (which is a different issue entirely), we need to use the page visibility api to detect these tab
switches and disable our timers for the duration.
...iouslyvisibleads.foreach(function(adbox) { updateadtimer(adbox); adbox.dataset.lastviewstarted = 0; }); } } else { previouslyvisibleads.foreach(function(adbox) { adbox.dataset.lastviewstarted = performance.now(); }); visibleads = previouslyvisibleads; previouslyvisibleads = null; } } since the event itself doesn't state whether the document has
switched from visible to invisible or vice-versa, the document.hidden property is checked to see if the document is not currently visible.
Logical properties for margins, borders and padding - CSS: Cascading Style Sheets
try changing the direction property to rtl to cause the boxes to display in a right-to-left direction, the margins on the first box will stay in the same place, while the margins on the inline dimension of the second box will
switch.
...again, notice how the margins stay in the same place for the first box, but
switch around to follow the text direction in the second.
...the padding on the first box will stay in the same place, whereas the padding on the inline dimension of the second box will
switch.
...again, notice how the padding stays in the same place for the first box, but
switches around to follow the text direction in the second.
Event reference
fullscreenerror it was impossible to
switch to fullscreen mode for technical reasons or because the permission was denied.
... fullscreenerror event full screen it was impossible to
switch to fullscreen mode for technical reasons or because the permission was denied.
... sswindowstateready addons specific a window state has
switched to "ready".
... sswindowstatebusy addons specific a window state has
switched to "busy".
Rich-Text Editing in Mozilla - Developer guides
executing commands when an html document has been
switched to designmode, the document object exposes the document.execcommand method which allows one to run commands to manipulate the contents of the editable region.
... event handling disabled a further difference for mozilla is that once a document is
switched to designmode, all events on that particular document are disabled.
...t('editorwindow').execcommand(aname,false, aarg); document.getelementbyid('editorwindow').contentwindow.focus() } example: a simple but complete rich text editor <!doctype html> <html> <head> <title>rich text editor</title> <script type="text/javascript"> var odoc, sdeftxt; function initdoc() { odoc = document.getelementbyid("textbox"); sdeftxt = odoc.innerhtml; if (document.compform.
switchmode.checked) { setdocmode(true); } } function formatdoc(scmd, svalue) { if (validatemode()) { document.execcommand(scmd, false, svalue); odoc.focus(); } } function validatemode() { if (!document.compform.
switchmode.checked) { return true ; } alert("uncheck \"show html\"."); odoc.focus(); return false; } function setdocmode(btosource) { var ocontent; if (btosource) { ocontent ...
...+/fvrvv8/f///////////////////////////////////////////////yh5baeaab8alaaaaaawabyaaawn4ceozgmeakqubgsuspvbsyfjjvds6njlb0khr4akbcmfscgbqaocwjf5gwquvyksfbwze+awibv0ghfog2ewidchjwriqo9e2fx4xd5r+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.
Using the application cache - HTML: Hypertext Markup Language
there are three possible section headers: section header description cache:
switches to the explicit section of the cache manifest (this is the default section).
... network:
switches to the online whitelist section of the cache manifest.
... fallback:
switches to the fallback section of the cache manifest.
... cache manifest files can
switch from section to section at will (each section header can be used more than once), and sections are allowed to be empty.
Upgrade - HTTP
header type request header, response header forbidden header name yes overview the upgrade header field may be used by clients to invite a server to
switch to one (or more) of the listed protocols, in descending preference order.
... for example, the client might send a get request as shown, listing the preferred protocols to
switch to (in this case "example/1" and "foo/2"): get /index.html http/1.1 host: www.example.com connection: upgrade upgrade: example/1, foo/2 note: connection: upgrade must be set whenever upgrade is sent.
... if the server decides to upgrade the connection, it must: send back a 101
switching protocols response status with an upgrade header that specifies the protocol(s) being
switched to.
... for example: http/1.1 101
switching protocols upgrade: foo/2 connection: upgrade send a response to the original request using the new protocol (the server may only
switch to a protocol with which it can complete the original request).
requiredExtensions - SVG: Scalable Vector Graphics
requiredextensions is often used in conjunction with the <
switch> element.
... if the attribute is used in other situations, then it represents a simple
switch on the given element whether to render the element or not.
... note: if several extension reference objects are enclosed in a <
switch> and none of them matches, this may lead to situations where no content is displayed.
... it is thus recommended to include a "catch-all" choice at the end of such a <
switch> which is acceptable in all cases.
requiredFeatures - SVG: Scalable Vector Graphics
requiredfeatures is often used in conjunction with the <
switch> element.
... if requiredfeatures is used in other situations, it represents a simple
switch on the given element whether to render the element or not.
... twentynine elements are using this attribute: <a>, <altglyph>, <animate>, <animatecolor>, <animatemotion>, <animatetransform>, <circle>, <clippath>, <cursor>, <defs>, <ellipse>, <foreignobject>, <g>, <image>, <line>, <mask>, <path>, <pattern>, <polygon>, <polyline>, <rect>, <set>, <svg>, <
switch>, <text>, <textpath>, <tref>, <tspan>, <use> html, body, svg { height: 100%; } text { 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="...
... http://www.w3.org/tr/svg11/feature#containerattribute the browser supports the enable-background attribute http://www.w3.org/tr/svg11/feature#conditionalprocessing the browser supports the <
switch> element, and the requiredfeatures, requiredextensions, systemlanguage attributes http://www.w3.org/tr/svg11/feature#image the browser supports the <image> element.
Progress Listeners - Archive of obsolete content
progress listeners progress listeners allow extensions to be notified of events associated with documents loading in the browser and with tab
switching events.
...gers the state change if (aflag & state_start) { // this fires when the load event is initiated } if (aflag & state_stop) { // this fires when the load finishes } }, onlocationchange: function(aprogress, arequest, auri) { // this fires when the location bar changes; that is load event is confirmed // or when the user
switches tabs.
...using the following code, you will get notified when user navigates to another page (by clicking a link, using the back/forward button, by typing an address in the location bar, etc.) and also when user
switches tabs.
Adding preferences to an extension - Archive of obsolete content
« previousnext » this article takes the creating a dynamic status bar extension sample to the next level, adding a popup menu that lets you quickly
switch between multiple stocks to watch.
... it also adds a preference dialog that lets you
switch to a stock other than one of the ones included in the popup menu.
... observe: function(subject, topic, data) { if (topic != "nspref:changed") { return; }
switch(data) { case "symbol": this.tickersymbol = this.prefs.getcharpref("symbol").touppercase(); this.refreshinformation(); break; } }, the topic parameter indicates what type of event occurred.
Porting NSPR to Unix Platforms - Archive of obsolete content
nspr has a user-level threading library where thread context
switches are done by <tt>setjmp/longjmp</tt> or <tt>sigsetjmp/siglongjmp</tt>.
... <tt>mozilla/nsprpub/pr/include/md/_netbsd.h</tt>: for local threads only version, the main challenge is to figure out how to define the three thread context
switch macros.
...for thread management and synchronization: <tt>cvar -d</tt> <tt>cvar2</tt> <tt>./join -d</tt> <tt>perf</tt> <tt>./
switch -d</tt> <tt>intrupt -d</tt> for i/o: <tt>cltsrv -d</tt>, <tt>cltsrv -gd</tt> <tt>socket</tt> <tt>testfile -d</tt> <tt>tmocon -d</tt> '<tt>tmoacc -d</tt>' in conjunction with '<tt>writev -d</tt>' miscellaneous: <tt>dlltest -d</tt> <tt>forktest</tt> original document information author: larryh@netscape.com last updated date: 16 july 1998 ...
Tuning Pageload - Archive of obsolete content
content.
switch.threshold determines how often we
switch content sink modes.
...every content.
switch.threshold microseconds, we decide whether we should be in mode a or mode b.
... the decision is based on whether there were any user events on the relevant widget in the last content.
switch.threshold microseconds.
registerChrome - Archive of obsolete content
method of install object syntax int registerchrome(
switch, srcdir, xpipath); parameters the registerchrome method has the following parameters:
switch switch is the chrome
switch indicating what type of file is being registered.
...one final option for the
switch parameter is delayed_chrome, which registers the
switch only after a relaunch of the browser.
... note that you can combine
switches as in the example below.
Building accessible custom components in XUL - Archive of obsolete content
(we could have laid out the grid by rows instead of columns, but that just shifts the complexity to a different navigation command.) here is the keyboard navigation code: <code> const key_up = 38; const key_down = 40; const key_left = 37; const key_right = 39; function cell_keypress(e) { var current = e.target;
switch (e.keycode) { case key_up: spreadsheet_up(current); break; case key_down: spreadsheet_down(current); break; case key_left: spreadsheet_left(current); break; case key_right: spreadsheet_right(current); break; } } function spreadsheet_up(current) { var next = find_cell_up(current); if (next) { next.
...(we don't need any special code to track the focus change; we just need an onblur handler to accept the edited value before the focus changes.) first, the code to trigger edit mode: <code> const key_up = 38; const key_down = 40; const key_left = 37; const key_right = 39; const key_enter = 13; const key_escape = 27; function cell_keypress(e) { var current = e.target;
switch (e.keycode) { case key_enter: if (current.tagname == 'label') { start_edit(current); } break; case key_up: spreadsheet_up(current); break; case key_down: spreadsheet_down(current); break; case key_left: spreadsheet_left(current); break; case key_right: spreadsheet_right(current); break;...
...); if (keepvalue) { label.value = value; } else { label.value = textbox.origvalue; } label.flex = 1; label.addeventlistener("keypress", cell_keypress, true); return label; } function editable_cell_blur(e) { var textbox = e.target; settimeout(function() { done_edit(textbox, true); }, 0); } function editable_cell_keypress(e) { var textbox = e.target;
switch (e.keycode) { case key_enter: settimeout(function() { var label = done_edit(textbox, true); label.focus(); }, 0); break; case key_escape: settimeout(function() { var label = done_edit(textbox, false); label.focus(); }, 0); break; } } </code> with this new code, we can now navigate to a specific cell within the spreadsheet and press enter to edit the value.
Index - Archive of obsolete content
the user can
switch the state of the check box by selecting it with the mouse.
...the user can
switch which radio button is turned on by selecting it with the mouse or keyboard.
...a row of tabs is displayed at the top of tabbox which may be used to
switch between each page.
prefwindow - Archive of obsolete content
if a window with that type is already open, this method will just
switch that window to the front and focus it instead of opening another window.
... showpane( prefpane ) return type: no return value
switch to a particular pane.
...if you put other elements before the first <prefpane>, you possibly see strange behaviors about
switching panes.
Extentsions FAQ - Archive of obsolete content
i have two states
switching images in the tool bar and would have no problem implementing a third, so yes it's possible.
... could someone write an extension that zaps the google analytics cookie, the urchin cookie,
switches gmail and google calender to https?
... customizegoogle extension already has support for
switching gmail to https (and calendar possibly, too).
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.
... problem: nothing works after
switching the mime type suddenly no inline script works anymore.
...if the content is sent as html, an xml declaration would break ie's doctype
switch, so we don't want it there.
Building Mozilla XForms - Archive of obsolete content
getting started things to know first: the xforms extension has a dependency on the schema-validation extension, so you need to build both (that's done automatically) mozilla
switched from cvs to mercurial starting with firefox 3.5.
...since the
switch to mercurial, the extensions live in separate repositories.
...
switch to the root of your source directory and start the build with make -f client.mk build after the build finishes, you'll have a xforms.xpi in obj-*/dist/xpi-stage/xforms.xpi.
Mozilla XForms User Interface - Archive of obsolete content
switch this element is used in conjunction with case and toggle elements (see the spec).
... the
switch element contains case elements which in turn contain markup.
...the toggle element is used (as an event handler) to make a case visible and thereby hiding all other case elements contained by the same
switch.
Archive of obsolete content
adding preferences to an extension this article takes the creating a dynamic status bar extension sample to the next level, adding a popup menu that lets you quickly
switch between multiple stocks to watch.
... it also adds a preference dialog that lets you
switch to a stock other than one of the ones included in the popup menu.
...the main reason for this is that there is no guarantee of java compatibility on a binary level due to the jri/jni
switch.
Handling different text directions - Learn web development
the writing-mode property lets us
switch from one writing mode to another.
... when we
switch the writing mode, we are changing which direction is block and which is inline.
... if you change the writing mode of the boxes by
switching the writing-mode property on .box to vertical-rl, you will see how the physical properties stay tied to their physical direction, whereas the logical properties
switch with the writing mode.
How to build custom form controls - Learn web development
now we need a javascript
switch to determine if the script is running or not.
... this
switch is a couple of lines: if at page load time our script is running, it will remove the no-widget class and add the widget class, thereby swapping the visibility of the <select> element and the custom control.
... window.addeventlistener("load", function () { document.body.classlist.remove("no-widget"); document.body.classlist.add("widget"); }); without js with js check out the source code note: if you really want to make your code generic and reusable, instead of doing a class
switch it's far better to just add the widget class to hide the <select> elements, and to dynamically add the dom tree representing the custom control after every <select> element in the page.
Accessibility in React - Learn web development
the <todo /> component will
switch templates, as we designed, and you'll see a form that lets us edit the name of the task.
... when we
switch between templates in our <todo /> component, we completely remove the elements that were there before to replace them with something else.
...as a reminder, we want to focus on the editing field when we
switch to the editing template.
Gecko Keypress Event
if the current keyboard layout is dvorak-qwerty layout or a non-latin layout, the command key
switches the keyboard layout to the us qwerty keyboard layout temporary.
... however, users with the same non-latin keyboard layouts would also like to be able to use latin access keys of en-us builds (including nightly builds) without needing to
switch keyboard layout (bug 399939).
... problem 3 users with non-latin keyboard layouts would like to be able to use latin access keys in web pages without
switching to a latin layout (bug 429510).
PerfMeasurement.jsm
context_
switches uint64 the number of context
switches that occurred involving the thread being profiled.
... context_
switches 0x00000200 measure the number of context
switches that occurred.
... cpu_migrations 0x00000400 measure the number of context
switches that occurred.
Localizing with Pontoon
project selector (affiliates)
switches between projects to localize.
... resource selector (homepage)
switches between project resources to localize, like subpages or localization files.
... locale selector (slovenian)
switches between languages to localize.
Extras
ty:.8"/> </radialgradient> </defs> <rect width="300" height="250" fill="url(#grad1)"/> <g transform="translate(150,125)"> <g> <animatetransform attributename="transform" attributetype="xml" type="rotate" from="0" to="360" dur="6s" repeatcount="indefinite"/> <g transform="translate(-50,-35)"> <rect width="100" height="70" fill="url(#grad2)"/> <
switch> <foreignobject width="100" height="70" requiredextensions="http://www.w3.org/1998/math/mathml"> <math display="block"> <mrow> <mo>(</mo> <mtable> <mtr> <mtd><mi>cos</mi><mi>θ</mi></mtd> <mtd><mo>−</mo><mi>sin</mi><mi>θ</mi></mtd> </mtr> <mtr> <mtd><mi>sin</mi><mi>θ</mi></mtd> <mtd><mi>cos</mi><mi>θ</mi></mtd> </mtr> </mtable> <mo>)</mo> </mrow> </math> </foreigno...
...bject> <text>rotation matrix</text> </
switch> </g></g></g> <g> <animatemotion path="m 32,69 c 64,121 100,27 152,42 203,56 239,257 275,161 295,109 144,221 88,214 -2,202 11,35 32,69 z" begin="0s" dur="20s" repeatcount="indefinite"/> <animatetransform attributename="transform" attributetype="xml" type="scale" values="1;2;.5;1" keytimes="0;.25;.75;1" dur="20s" repeatcount="indefinite"/> <circle fill="url(#grad3)" r="30"/> <g transform="translate(-30,-30)"> <
switch> <foreignobject width="60" height="60" requiredextensions="http://www.w3.org/1998/math/mathml"> <math display="block"> <mrow> <munderover> <mo>∑</mo> <mrow> <mi>n</mi> <mo>=</mo> <mn>0</mn> </mrow> <mrow> <mo>+</mo> <mi>∞</mi> </mrow> </munderover> <mfrac> <msup> <mi>...
...α</mi> <mi>n</mi> </msup> <mrow> <mi>n</mi> <mo>!</mo> </mrow> </mfrac> </mrow> </math> </foreignobject> <text>exp(α)</text> </
switch> </g> </g> </svg> </div> inline javascript html content <math display="block"> <mfrac> <mtext id="num">mouse</mtext> <mtext id="denum">over</mtext> </mfrac> </math> javascript content function whoistherealert(evt) { alert("who is there?"); } function attachlistener(id) { document.getelementbyid(id).addeventlistener("mouseover", whoistherealert); } function init() { attachlistener("num"); attachlistener("denum"); } window.addeventlistener("load", init); ...
Web Replay
the advantage of spawning both recording and replaying children is that by
switching between different children the middleman can effectively rewind a live recording, then play forward and allow the user to resume interacting with the tab after they have finished inspecting state in the past.
... recording and replaying executions using these buffers will require new techniques like treating all accesses on the buffers as atomic (probably unacceptable overhead) or performing all accesses on the buffer on a single core and keeping track of context
switches.
...context
switches can occur at different times and data races can lead to different behavior between recording and replay.
Ajax navigation example - Web APIs
() { function closereq () { oloadingbox.parentnode && document.body.removechild(oloadingbox); bisloading = false; } function abortreq () { if (!bisloading) { return; } oreq.abort(); closereq(); } function ajaxerror () { alert("unknown error."); } function ajaxload () { var vmsg, nstatus = this.status;
switch (nstatus) { case 200: vmsg = json.parse(this.responsetext); document.title = opageinfo.title = vmsg.page; document.getelementbyid(stargetid).innerhtml = vmsg.content; if (bupdateurl) { history.pushstate(opageinfo, opageinfo.title, opageinfo.url); bupdateurl = false; ...
...} break; default: vmsg = nstatus + ": " + (ohttpstatus[nstatus] || "unknown");
switch (math.floor(nstatus / 100)) { /* case 1: // informational 1xx console.log("information code " + vmsg); break; case 2: // successful 2xx console.log("successful code " + vmsg); break; case 3: // redirection 3xx console.log("redirection code " + vmsg); break; */ case 4: /* client error 4xx */ ...
...wkey + "\\=[^&]*|&*$", "i"), rendqstmark = /\?$/, oloadingbox = document.createelement("div"), ocover = document.createelement("div"), oloadingimg = new image(), opageinfo = { title: null, url: location.href }, ohttpstatus = /* http://www.iana.org/assignments/http-status-codes/http-status-codes.xml */ { 100: "continue", 101: "
switching protocols", 102: "processing", 200: "ok", 201: "created", 202: "accepted", 203: "non-authoritative information", 204: "no content", 205: "reset content", 206: "partial content", 207: "multi-status", 208: "already reported", 226: "im used", 300: "multip...
Online and offline events - Web APIs
this property is updated whenever the user
switches into "offline mode" by selecting the corresponding menu item (file -> work offline in firefox).
... firefox 2 updates this property when
switching to/from the browser's offline mode.
...these two events are fired on the <body> of each page when the browser
switches between online and offline mode.
WebGLRenderingContext.makeXRCompatible() - Web APIs
exceptions this method doesn't throw traditional exceptions; instead, the promise rejects with one of the following errors as the value passed into the rejection handler: aborterror
switching the context over to the webxr-compatible context failed.
... javascript the code that handles starting up graphics,
switching to vr mode, and so forth looks like this: const outputcanvas = document.queryselector(".output-canvas"); const gl = outputcanvas.getcontext("webgl"); let xrsession = null; let usingxr = false; let currentscene = "scene1"; let glstartbutton; let xrstartbutton; window.addeventlistener("load", (event) => { loadsceneresources(currentscene); glstartbutton.addeventlistener("click", handlestar...
...*/ outputcanvas.addeventlistener("webglcontextrestored", (event) => { loadsceneresources(currentscene); }); async function onstartedxrsession(xrsession) { try { await gl.makexrcompatible(); } catch(err) {
switch(err) { case aborterror: showsimplemessagebox("unable to transfer the game to your xr headset.", "cancel"); break; case invalidstateerror: showsimplemessagebox("you don't appear to have a compatible xr headset available.", "cancel"); break; default: handlefatalerror(err); break; } xrsession.end(); } } async function handl...
Clearing by clicking - Web APIs
<p>a very simple webgl program that still shows some color and user interaction.</p> <p>you can repeatedly click the empty canvas or the button below to change color.</p> <canvas id="canvas-view">your browser does not seem to support html5 canvas.</canvas> <button id="color-
switcher">press here to
switch color</button> body { text-align : center; } canvas { display : block; width : 280px; height : 210px; margin : auto; padding : 0; border : none; background-color : black; } button { display : inline-block; font-size : inherit; margin : auto; padding : 0.6em; } window.addeventlistener("load", function setupwebgl (evt) { "use strict" // clean...
... var canvas = document.queryselector("#canvas-view"); var button = document.queryselector("#color-
switcher"); canvas.addeventlistener("click",
switchcolor, false); button.addeventlistener("click",
switchcolor, false); // a variable to hold the webglrenderingcontext.
... function
switchcolor () { // referring to the externally defined gl variable.
Spaces and reference spaces: Spatial tracking in WebXR - Web APIs
this commonly happens when your user interface provides a way to preview the scene inline within the context of a web page, with a button or other control to
switch to immersive mode.
... since most users would prefer that you maintain the same viewer position and facing direction while performing this transition, you can use the xrframe method getviewerpose() to obtain the current xrviewerpose,
switch the session, then use the saved viewer pose to restore the viewer's position and facing.
...for instance, it may be easier to implement the interactions with the objects in a single room in a house by
switching to a bounded space representing the single room.
Window - Web APIs
connection events offline fired when the browser has lost access to the network and the value of navigator.online has
switched to false.
... online fired when the browser has gained access to the network and the value of navigator.online has
switched to true.
... pagehide sent when the browser hides the current document while in the process of
switching to displaying in its place a different document from the session's history.
How to check the security state of an XMLHTTPRequest over SSL - Web APIs
let nsserr = math.abs(nsinsserrorsservice.nss_sec_error_base) - (status & 0xffff);
switch (nsserr) { case 11: // sec_error_expired_certificate, sec(11) errname = 'securityexpiredcertificateerror'; break; case 12: // sec_error_revoked_certificate, sec(12) errname = 'securityrevokedcertificateerror'; break; // per bsmith, we will be unable to tell these errors apart very soon, // so it makes sense to just...
... break; case 176: // sec_error_cert_signature_algorithm_disabled, sec(176) errname = 'securitycertificatesignaturealgorithmdisablederror'; break; default: errname = 'securityerror'; break; } } else { // calculating the difference let sslerr = math.abs(nsinsserrorsservice.nss_ssl_error_base) - (status & 0xffff);
switch (sslerr) { case 3: // ssl_error_no_certificate, ssl(3) errname = 'securitynocertificateerror'; break; case 4: // ssl_error_bad_certificate, ssl(4) errname = 'securitybadcertificateerror'; break; case 8: // ssl_error_unsupported_certificate_type, ssl(8) errname = 'securityunsupportedcertificatetypeerror'; break; ...
... case 9: // ssl_error_unsupported_version, ssl(9) errname = 'securityunsupportedtlsversionerror'; break; case 12: // ssl_error_bad_cert_domain, ssl(12) errname = 'securitycertificatedomainmismatcherror'; break; default: errname = 'securityerror'; break; } } } else { errtype = 'network';
switch (status) { // connect to host:port failed case 0x804b000c: // ns_error_connection_refused, network(13) errname = 'connectionrefusederror'; break; // network timeout error case 0x804b000e: // ns_error_net_timeout, network(14) errname = 'networktimeouterror'; break; // hostname lookup failed case 0x804b001e: // ns_error_unknown_host, network(...
Basic concepts of flexbox - CSS: Cascading Style Sheets
setting flex-direction: row-reverse will keep the items displaying along the row, however the start and end lines are
switched.
... if we change flex-direction to column the main axis
switches and our items now display in a column.
... set column-reverse and the start and end lines are again
switched.
Setting up adaptive streaming media sources - Developer guides
the stream
switching capabilities are identical between the profiles.
... ondemand profile this profile will allow
switching between streams 'on demand' - that is to say that you only need provide a set of contiguous files and specify the bandwidth for each one and the appropriate file will be chosen automatically.
... <?xml version="1.0"?> <mpd xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="urn:mpeg:dash:schema:mpd:2011" xsi:schemalocation="urn:mpeg:dash:schema:mpd:2011" profiles="urn:mpeg:dash:profile:isoff-main:2011" type="static" mediapresentationduration="pt0h9m56.46s"> <baseurl> http://example.com/segments </baseurl> <period start="pt0s"> <adaptationset bitstream
switching="true"> <representation id="0" codecs="avc1" mimetype="video/mp4" width="320" height="240" startwithsap="1" bandwidth="46986"> <segmentbase> <initialization sourceurl="main/news100/1.m4s" range="0-862"/> </segmentbase> <segmentlist duration="1"> <segmenturl media="main/news100/2.m4s" mediarange="863-7113"/> <segmenturl ...
A re-introduction to JavaScript (JS tutorial) - JavaScript
'yes' : 'no'; the
switch statement can be used for multiple branches based on a number or string:
switch (action) { case 'draw': drawit(); break; case 'eat': eatit(); break; default: donothing(); } if you don't add a break statement, execution will "fall through" to the next level.
... this is very rarely what you want — in fact it's worth specifically labeling deliberate fallthrough with a comment if you really meant it to aid debugging:
switch (a) { case 1: // fallthrough case 2: eatit(); break; default: donothing(); } the default clause is optional.
... you can have expressions in both the
switch part and the cases if you like; comparisons take place between the two using the === operator:
switch (1 + 3) { case 2 + 2: yay(); break; default: neverhappens(); } objects javascript objects can be thought of as simple collections of name-value pairs.
Loops and iteration - JavaScript
markloop: while (themark === true) { dosomething(); } break statement use the break statement to terminate a loop,
switch, or in conjunction with a labeled statement.
... when you use break without a label, it terminates the innermost enclosing while, do-while, for, or
switch immediately and transfers control to the following statement.
... the syntax of the break statement looks like this: break; break [label]; the first form of the syntax terminates the innermost enclosing loop or
switch.
break - JavaScript
the break statement terminates the current loop,
switch, or label statement and transfers program control to the statement following the terminated statement.
...if the statement is not a loop or
switch, this is required.
... a break statement, with or without a following label, cannot be used within the body of a function that is itself nested within the current loop,
switch, or label statement that the break statement is intended to break out of.
let - JavaScript
} you may encounter errors in
switch statements because there is only one block.
... let x = 1;
switch(x) { case 0: let foo; break; case 1: let foo; // syntaxerror for redeclaration.
... let x = 1;
switch(x) { case 0: { let foo; break; } case 1: { let foo; break; } } temporal dead zone unlike variables declared with var, which will start with the value undefined, let variables are not initialized until their definition is evaluated.
SVG element reference - SVG: Scalable Vector Graphics
lighting> <fespotlight> <fetile> <feturbulence> <filter> <foreignobject> g <g> h <hatch> <hatchpath> i <image> l <line> <lineargradient> m <marker> <mask> <mesh> <meshgradient> <meshpatch> <meshrow> <metadata> <mpath> p <path> <pattern> <polygon> <polyline> r <radialgradient> <rect> s <script> <set> <solidcolor> <stop> <style> <svg> <
switch> <symbol> t <text> <textpath> <title> <tspan> u <unknown> <use> v <view> svg elements by category animation elements <animate>, <animatecolor>, <animatemotion>, <animatetransform>, <discard>, <mpath>, <set> basic shapes <circle>, <ellipse>, <line>, <polygon>, <polyline>, <rect> container elements <a>, <defs>, <g>, <marker>, <mask>, <missing-glyph>, <pattern>, <svg>, <...
...
switch>, <symbol>, <unknown> descriptive elements <desc>, <metadata>, <title> filter primitive elements <feblend>, <fecolormatrix>, <fecomponenttransfer>, <fecomposite>, <feconvolvematrix>, <fediffuselighting>, <fedisplacementmap>, <fedropshadow>, <feflood>,<fefunca>, <fefuncb>, <fefuncg>, <fefuncr>,<fegaussianblur>, <feimage>, <femerge>, <femergenode>, <femorphology>, <feoffset>, <fespecularlighting>, <fetile>, <feturbulence> font elements <font>, <font-face>, <font-face-format>, <font-face-name>, <font-face-src>, <font-face-uri>, <hkern>, <vkern> gradient elements <lineargradient>, <meshgradient>, <radialgradient>, <stop> graphics elements <circle>, <ellipse>, <image>, <line>, <mesh>, <path>, <polygon>, <polyline>, <rect>, <text>, <use> graphics referencing elements <mesh>, <use> ...
..., <defs>, <hatch>, <lineargradient>, <marker>, <mask>, <meshgradient>, <metadata>, <pattern>, <radialgradient>, <script>, <style>, <symbol>, <title> paint server elements <hatch>, <lineargradient>, <meshgradient>, <pattern>, <radialgradient>, <solidcolor> renderable elements <a>, <circle>, <ellipse>, <foreignobject>, <g>, <image>, <line>, <mesh>, <path>, <polygon>, <polyline>, <rect>, <svg>, <
switch>, <symbol>, <text>, <textpath>, <tspan>, <unknown>, <use> shape elements <circle>, <ellipse>, <line>, <mesh>, <path>, <polygon>, <polyline>, <rect> structural elements <defs>, <g>, <svg>, <symbol>, <use> text content elements <altglyph>, <altglyphdef>, <altglyphitem>, <glyph>, <glyphref>, <textpath>, <text>, <tref>, <tspan> text content child elements <altglyph>, <textpath>, <tref>, <tspa...
Communicating using "postMessage" - Archive of obsolete content
now we have to embed the event type in the message payload, and implement a
switch function in the receiver to dispatch the message: var pagemodscript = "window.addeventlistener('mouseover', function(event) {" + " self.postmessage({" + " kind: 'mouseover'," + " element: event.target.tostring()" + " });" + "}, false);" + "window.addeventlistener('mouse...
...{" + " self.postmessage({" + " kind: 'mouseout'," + " element: event.target.tostring()" + " });" + " }, false);" var pagemod = require('sdk/page-mod').pagemod({ include: ['*'], contentscript: pagemodscript, onattach: function(worker) { worker.on('message', function(message) {
switch(message.kind) { case 'mouseover': console.log('mouseover: ' + message.element); break; case 'mouseout': console.log('mouseout: ' + message.element); break; } }); } }); implementing the same add-on with user-defined events is shorter and more readable: var pagemodscript = "window.addeventlistener('mouseover', function(event) {" + ...
Porting the Library Detector - Archive of obsolete content
once the list is built, the
switchlibraries() function constructs a xul statusbarpanel element for each library it found, populates it with the icon at the corresponding chrome:// url, and adds it to the box.
...tpostamble; return widgetcontent; } function updatewidgetview(tab) { var widgetview = widget.getview(tab.window); if (!tab.libraries) { tab.libraries = []; } widgetview.content = buildwidgetviewcontent(tab.libraries); widgetview.width = tab.libraries.length * icon_width; } main.js will use the tabs module to update the widget's content when necessary (for example, when the user
switches between tabs): tabs.on('activate', function(tab) { updatewidgetview(tab); }); tabs.on('ready', function(tab) { tab.libraries = []; }); showing the library detail the xul library detector displayed the detailed information about each library on mouseover in a tooltip: we can't do this using a widget, so instead will use a panel.
cfx to jpm - Archive of obsolete content
what you need to do all this means that: if your package.json contains an id field, and its value does not contain "@", then you must append "@jetpack" to it when
switching to jpm.
...so when
switching over to jpm: either rename your "main.js" to "index.js" and move it from "lib" to the top level or add a main field to package.json with the value "lib/main.js".
On page load - Archive of obsolete content
if you need finer control over custom code execution—for example, as documents are loading or when tabs are
switched—see progress listeners.
... progress listeners allow extensions to be notified of events associated with documents loading in the browser and with tab
switching events.
Preferences - Archive of obsolete content
this.branch.addobserver("", this, false); }, unregister: function() { this.branch.removeobserver("", this); }, observe: function(asubject, atopic, adata) { // asubject is the nsiprefbranch we're observing (after appropriate qi) // adata is the name of the pref that's been changed (relative to asubject)
switch (adata) { case "pref1": // extensions.myextension.pref1 was changed break; case "pref2": // extensions.myextension.pref2 was changed break; } } } myprefobserver.register(); and next, here is a more evolved version of the previous code better fit for code reuse both within a project and across projects (for example, using javascript code modules)...
... foreach(function (pref_leaf_name) { that._callback(that._branch, pref_leaf_name); }); } }; preflistener.prototype.unregister = function() { if (this._branch) this._branch.removeobserver('', this); }; var mylistener = new preflistener( "extensions.myextension.", function(branch, name) {
switch (name) { case "pref1": // extensions.myextension.pref1 was changed break; case "pref2": // extensions.myextension.pref2 was changed break; } } ); mylistener.register(true); note: you need to keep a reference to the preference branch you are observing (unless it is the root branch) or it will get garbage collected and will never notify you.
Index of archived content - Archive of obsolete content
components creating xulrunner apps with the mozilla build system creating a windows inno setup installer for xulrunner applications custom app bundles for mac os x debugging a xulrunner application deploying xulrunner dialogs in xulrunner getting started with xulrunner how to enable locale
switching in a xulrunner application macfaq make your xulrunner app match the system locale 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 wi...
...xforms hint element xforms input element xforms label element xforms message element xforms output element xforms range element xforms repeat element xforms secret element xforms select element xforms select1 element xforms submit element xforms
switch module xforms textarea element xforms trigger element xforms upload element other resources requests for enhancement rfe to the custom controls rfe to the custom controls interfaces rfe to the xforms api ...
MMgc - Archive of obsolete content
// before sweeping we check for missing write barriers bool gc::incrementalvalidation = false; // check for missing write barriers at every alloc bool gc::incrementalvalidationpedantic = false; if you suspect you have missing write barriers, turn these
switches on in a debug build.
... (the second
switch will slow your application down a lot more than the first
switch, so you could try the first, then the second.) when a missing write barrier is detected, mmgc will assert and drop you into the debugger, and will print out a message telling you which object contained the missing write barrier, the address of the member variable that needs it, and what object didn't get marked due to the missing write barrier.
Monitoring downloads - Archive of obsolete content
that code looks like this: ondownloadstatechange: function(astate, adownload) { var statement;
switch(adownload.state) { case components.interfaces.nsidownloadmanager.download_downloading: // add a new row for the download being started; each row includes the // source uri, size, and start time.
... speed = statement.getdouble(4) / 1024.0; cell = document.createelement('listcell'); cell.setattribute("label", speed.tofixed(1) + "kb/sec"); cell.setattribute("style", "text-align:right"); row.appendchild(cell); var status = statement.getint32(5); var style = "color:black"; cell = document.createelement('listcell'); var statusstr;
switch(status) { case 0: statusstr = "downloading"; break; case 1: statusstr = "complete"; style = "color:green"; break; case 2: statusstr = "failed"; style = "color:red"; break; case 3: statusstr = "canceled"; style = "color:purple"; break; ...
Plug-n-Hack - Archive of obsolete content
without integration between security tools and browsers, a user must often
switch between the tool and their browser several times to perform a simple task, such as intercepting an http(s) request.
...a browser that supports pnh can then allow the user to invoke such functionality without having to
switch to and from the tool.
Tamarin build documentation - Archive of obsolete content
the work for that fix also included some changes to the configure.py default behavior to decouple the --target
switch from sdk choice: there is a new
switch, --mac-sdk, that selects the 10.4u, 10.5 or 10.6 sdk.
... its options are '104u', '105' or '106' (note: no '.') if you don't pass the --mac-sdk
switch you will get no sdk in your build.
Learn XPI Installer Scripting by Example - Archive of obsolete content
extension, theme, and plug-in developers must
switch away from install.js based packages to the new packaging scheme with an install.rdf manifest.
...in this most common form of the registerchrome function (it can also be used to support the now-deprecatedmanifest.rdf style of installation archive), the three parameters represent, in order, the chrome
switch used to indicate what kind of software is being registered, the target destination of the software (e.g., the "chrome" folder in the example above), and the path within the xpi (or jar theme archive) where the contents.rdf file is located.
XUL Events - Archive of obsolete content
the focus can be changed by clicking on another element, by pressing tab to
switch to the next element in the tab order sequence, or by pressing 'back tab' to
switch focus to the previous element in the tab order.
... sizemodechange sent when a window is minimized or un-minimized,
switched between full screen and windowed mode, or maximized.
Input Controls - Archive of obsolete content
when the user clicks the checkbox, it
switches between checked and unchecked.
... example 3 : source view <radiogroup> <radio id="orange" label="orange"/> <radio id="violet" selected="true" label="violet"/> <radio id="yellow" label="yellow"/> </radiogroup> attributes like buttons, check boxes and radio buttons are made up of a label and an image, where the image
switches between checked and unchecked when it is pressed.
XUL Changes for Firefox 1.5 - Archive of obsolete content
a set of icons will appear across the top of the dialog allowing the user to
switch panels.
...the pageshow and pagehide events are used when
switching from a page in the cache, while the load and unload events are used only when the page is loaded or unloaded.
tabbox - Archive of obsolete content
a row of tabs is displayed at the top of tabbox which may be used to
switch between each page.
... handlectrltab type: boolean if set to true or omitted, the tabbox will
switch to the next tab when the control and tab keys are pressed.
XULRunner tips - Archive of obsolete content
install.dialog.progress.chrome", "chrome://mozapps/content/extensions/extensions.xul?type=extensions"); pref("xpinstall.dialog.progress.type.skin", "extension:manager-themes"); pref("xpinstall.dialog.progress.type.chrome", "extension:manager-extensions"); pref("extensions.update.enabled", true); pref("extensions.update.interval", 86400); pref("extensions.dss.enabled", false); pref("extensions.dss.
switchpending", false); pref("extensions.ignoremtimechanges", false); pref("extensions.logging.enabled", false); pref("general.skins.selectedskin", "classic/1.0"); // nb these point at amo pref("extensions.update.url", "chrome://mozapps/locale/extensions/extensions.properties"); pref("extensions.getmoreextensionsurl", "chrome://mozapps/locale/extensions/extensions.properties"); pref("extensions.getmoret...
...it has an -app command-line
switch to run a specified xul application instead of starting the browser.
Mozprofile - Archive of obsolete content
the profile to be operated on may be specified with the --profile
switch.
...pi: you can pass preferences in to the profile class's constructor: obj = firefoxprofile(preferences=[("accessibility.typeaheadfind.flashbar", 0)]) using a json blob file: mozprofile --preferences myprefs.json using a .ini file: mozprofile --preferences myprefs.ini via the command line: mozprofile --pref key:value --pref key:value [...] when setting preferences from an .ini file or the --pref
switch, the value will be interpolated as an integer or a boolean (true/false) if possible.
Browser Detection and Cross Browser Support - Archive of obsolete content
mozilla-based browsers (such as firefox), internet explorer 6 on windows, and internet explorer 5 for macintosh all support doctype
switching.
... this is a technique where these browsers can be
switched from "quirks" mode (which emulates buggy implementations in earlier generation browsers) to standards mode (which more strictly adhers to the standards).
Mobile accessibility - Learn web development
when you've found the talkback menu, press the slider
switch to turn talkback on.
... if you want to turn talkback off: navigate back to the talkback menu screen (using the different gestures that are currently enabled.) navigate to the slider
switch and activate it to turn it off.
The box model - Learn web development
prerequisites: basic computer literacy, basic software installed, basic knowledge of working with files, html basics (study introduction to html), and an idea of how css works (study css first steps.) objective: to learn about the css box model, what makes up the box model and how to
switch to the alternate model.
... 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.
Introduction to CSS layout - Learn web development
we also have entire layout methods that are
switched on via specific display values, for example css grid and flexbox, which alter how elements inside the element they are set on are laid out.
... once again, you can
switch on grid layout with a specific value of display — display: grid.
Responsive design - Learn web development
media queries enable the type of layout
switch that cameron adams had previously explored using javascript, using only css.
...you can see how the heading
switches sizes as the layout goes to the two column version.
The web and web standards - Learn web development
this can be considered a forerunner of the web, as it worked on packet
switching, and featured the first implementation of the tcp/ip protocol suite.
... javascript is the programming language we use to add interactivity to web sites, from dynamic style
switching, to fetching updates from the server, right through to complex 3d graphics.
Getting started with Ember - Learn web development
developers are then more easily able to
switch between projects and applications without having to completely relearn the architecture, patterns, conventions, etc.
... conventions for minimizing the differences between applications (allowing easier mental context
switching).
React interactivity: Editing, filtering, conditional rendering - Learn web development
to start with, we want to call setediting() with a value of true when a user presses the "edit" button in our viewtemplate, so that we can
switch templates.
... update the "edit" button in the viewtemplate like so: <button type="button" classname="btn" onclick={() => setediting(true)}> edit <span classname="visually-hidden">{props.name}</span> </button> now we'll add the same onclick handler to the "cancel" button in the editingtemplate, but this time we'll set isediting to false so that it
switches us back to the view template.
Accessibility API cross-reference
a checkbox; aria has two kinds: use checkbox if you need to express 'mixed' state (some of the descendents are true, some are false), otherwise use
switch or (preferred in html) <input type=checkbox>, which are true/false only.
... checkbutton check_box check_box checkbox or
switch <input type=checkbox> pretty obvious what this is for clock n/a n/a timer <time> column of cells in a table - how would the user specifically point to this, as opposed to the column header or cells?
CSUN Firefox Materials
why do the most discerning users
switch to firefox?
...custom searches can be added to this quick search bar and the user can
switch between them by choosing from a drop down available via the standard alt+down arrow key combination.
Gecko info for Windows accessibility vendors
queryservice() can be used to
switch between the interfaces (iaccessible, isimpledomdocument, isimpledomnode and isimpledomtext).
...at the root of the window hierarchy mozillacontentwindowclass -- root document window mozillacontentframewindowclass - root of a subdocument created by a <frame> or <iframe> element mozillahiddenwindowclass - ignore these windows, they are used to help manage other windows mozillawindowclass - general filler window, a catch all starting in firefox 2, however, you should begin
switching your code to use navrelation_embeds.
Software accessibility: Where are we today?
single
switch technologies enable persons with severe physical disabilities.
...they might press a
switch down to begin moving a highlight bar through the list, and release the
switch when the desired option is highlighted.
Application cache implementation overview
when the update is about to actually start, the scheduling service calls nsofflinecacheupdate::begin() method, that
switches the update to checking state (+invokes onchecking event) and starts fetch of the manifest file.
...if so, the update
switches to downloading state and fetches in parallel items listed in the manifest by call to nsofflinecacheupdate::processnexturi().
Gmake vs. Pymake
path issues on windows on windows, you must take special care to be able to
switch back and forth between gmake and pymake on the same object dir.
... if you try to
switch from gmake to pymake or pymake to gmake the build will fail unless you did a relative configure.
Displaying Places information using views
switch (acol.id || acol.element.getattribute("anonid")) { // uri for all nodes (like folders), not just uri nodes (like bookmarks) case "fulluri": return this.nodefortreeindex(arowindex).uri; break; // index of node in parent container case "indexinparent": return this.nodefortreeindex(arowindex).bookmarkindex; break; // is the row even or odd?
... return this._getcelltext(arowindex, acol); }; view._cycleheader = view.cycleheader; view.cycleheader = function (acol) {
switch (acol.id || acol.element.getattribute("anonid")) { case "fulluri": case "indexinparent": case "parity": // you might resort by column here.
Storage access policy: Block cookies from trackers
although both of these approaches provide the same level of storage access, we recommend third parties
switch to using the storage access api in order to guarantee their access to storage.
...these providers should consider
switching to explicitly request storage access through the storage access api as soon as possible.
Firefox and the "about" protocol
col: about: page description about:about provides an overview of all about: pages available for your current firefox version about:addons add-ons manager about:buildconfig displays the configuration and platform used to build firefox about:cache displays information about the memory, disk, and appcache about:checkerboard
switches to the checkerboarding measurement page, which allows to detect checkerboarding issues about:config provides a way to inspect and change firefox preferences and settings about:compat lists overriding site compatability fixes, linked to specific bug issues.
... about:crashes lists all crashes, which happened during the runtime of firefox (in case the user enabled the crash reporter) about:credits lists all contributors to the firefox project about:debugging
switches to the developer tools debugging page, which allows you to debug add-ons, tabs and service workers about:devtools summarizes the developer tools and provides links to documentation for each tool about:downloads displays all downloads done within firefox about:home start page of firefox when opening a new window about:license displays licensing information about:logo firefox logo about:memory provides a way to display memory usage, save it as report and run the gc and cc abou...
Power profiling overview
the first is the ability to
switch frequently (thousands of times per second) between active and idle states, and there are actually several different kinds of idle states.
...even just
switching a tab from the foreground to the background can make a difference.
JSAPI User Guide
besides its name, * each property has a "tiny" identifier (my_color, e.g.) that can be used * in
switch statements (in a common my_getproperty function, for example).
... */ static jsbool my_getproperty(jscontext *cx, jsobject *obj, jsval id, jsval *vp) { if (jsval_is_int(id)) {
switch (jsval_to_int(id)) { case my_color: *vp = .
Accessing the Windows Registry Using XPCOM
function readregistryvalue(wrk, value) {
switch (wrk.getvaluetype(value)) { case wrk.type_string: return wrk.readstringvalue(value); case wrk.type_binary: return wrk.readbinaryvalue(value); case wrk.type_int: return wrk.readintvalue(value); case wrk.type_int64: return wrk.readint64value(value); } // unknown type return null; } writing registry values writing registry values is quite similar to r...
...this example demonstrates a trivial registry value cache for one key: var cache = {}; function readregistryvaluenocache(wrk, value) {
switch (wrk.getvaluetype(value)) { case wrk.type_string: return wrk.readstringvalue(value); case wrk.type_binary: return wrk.readbinaryvalue(value); case wrk.type_int: return wrk.readintvalue(value); case wrk.type_int64: return wrk.readint64value(value); } // unknown type return null; } function readregistryvalue(wrk, value) { if (wrk.haschanged()) { ...
nsIFocusManager
flag_no
switchframe 4 if attempting to change focus in a window that is not focused, do not
switch focus to that window.
...this flag will have no effect if a child window is focused and an attempt is made to adjust the focus in an ancestor, as the frame must be
switched in this case.
DOM Inspector internals - Firefox Developer Tools
viewers are dynamically loaded; when the panel is made to
switch from one viewer to another, the old viewer is destroyed, and the new viewer is loaded in its place.
...another convenient consequence of this is that if you use a properly set up development profile, then for the most part, the effects of development changes can be seen by simply
switching away from the current viewer and back.
Highlight and inspect DOM nodes - Firefox Developer Tools
hover over the target to highlight the item on the page, click on the target to
switch to the page inspector with the item highlighted.
...you can click any one of these targets to
switch to the page inspector with this item highlighted.
DevTools API - Firefox Developer Tools
switchhost(hosttype)
switches the location of the toolbox parameters: hosttype {toolbox.hosttype} - the type of the new host.
...default: 99 visibility
switch string, optional.
Aggregate view - Firefox Developer Tools
after firefox 48, the default view is the tree map view, and you can
switch to the aggregate view using the dropdown labeled "view:": the aggregate view looks something like this: it presents a breakdown of the heap's contents, as a table.
... there are three main ways to group the data: type call stack inverted call stack you can
switch between them using the dropdown menu labeled "group by:" located at the top of the panel: there's also a box labeled "filter" at the top-right of the pane.
Dominators view - Firefox Developer Tools
taking a snapshot to see what it looks like in the dominators view: load the page enable the memory tool in the settings, if you haven't already open the memory tool check "record call stacks" press the button labeled "make monsters!" take a snapshot
switch to the "dominators" view analyzing the dominators tree you'll see the three arrays as the top three gc roots, each retaining about 23% of the total memory usage: if you expand an array, you'll see the objects (monsters) it contains.
... using the call stack view finally, you can
switch to the call stack view, see where the objects are being allocated, and jump to that point in the debugger: ...
Examine and edit HTML - Firefox Developer Tools
clicking the marker opens a tooltip listing the event listeners and allows you for each listener to
switch to the line of javascript code in the debugger where the listener is defined.
...clicking the marker
switches to the line of javascript code in the debugger where the custom element got defined.
Intensive JavaScript - Firefox Developer Tools
by
switching to the flame chart view we can find out: this shows us the js call stack at this point in the execution.
...
switch the radio button to "use a worker", and capture a new profile.
UI Tour - Firefox Developer Tools
filter the markers that are displayed in the waterfall view
switch the active tool in the details pane.
...to
switch to a different tool, use the buttons in the toolbar.
Console messages - Firefox Developer Tools
the context menu for network messages includes a few extra items in addition the globally-available ones: copy link location acts as you would expect, copying the url into the clipboard open in network panel
switches context to the network tab, selects the request and shows you the details resend request sends the network request again.
...web sites and certification authorities are encouraged to
switch to stronger hash algorithms in future.
Document: fullscreenerror event - Web APIs
the fullscreenerror event is fired when the browser cannot
switch to full-screen mode.
... for some reasons that
switching into full-screen mode might fail, see the guide to the fullscreen api.
Element: fullscreenerror event - Web APIs
the fullscreenerror event is fired when the browser cannot
switch to full-screen mode.
... for some reasons that
switching into full-screen mode might fail, see the guide to the fullscreen api.
Element.onfullscreenerror - Web APIs
example this example attempts to
switch into full-screen mode from outside a handler for a user-initiated event (such as a click or keypress event).
... since full-screen mode changes are only permitted in response to a user input, this causes an error to occur, which triggers the delivery of the fullscreenerror event to the error handler, let elem = document.queryselector("video")}} elem.onfullscreenerror = function ( event ) { displaywarning("unable to
switch into full-screen mode."); }; //....
Element.requestFullscreen() - Web APIs
detecting full-screen activation you can determine whether or not your attempt to
switch to full-screen mode is successful by using the promise returned by requestfullscreen(), as seen in the example below.
...it's also important to listen for fullscreenchange to be aware when, for example, the user manually toggles full-screen mode, or when the user
switches applications, causing your application to temporarily exit full-screen mode.
EventTarget.addEventListener() - Web APIs
nd(this), false); // trick } const s = new something(document.body); another solution is using a special function called handleevent() to catch any events: const something = function(element) { // |this| is a newly created object this.name = 'something good'; this.handleevent = function(event) { console.log(this.name); // 'something good', as this is bound to newly created object
switch(event.type) { case 'click': // some code here...
... the reference to this is to pass to the eventlistener a function that calls the method of the object that contains the fields that need to be accessed: class someclass { constructor() { this.name = 'something good'; } register() { const that = this; window.addeventlistener('keydown', function(e) { that.somemethod(e); }); } somemethod(e) { console.log(this.name);
switch(e.keycode) { case 5: // some code here...
KeyboardEvent.getModifierState() - Web APIs
if (event.getmodifierstate("control") + event.getmodifierstate("alt") + event.getmodifierstate("meta") > 1) { return; } // handle shortcut key with standard modifier if (event.getmodifierstate("accel")) {
switch (event.key.tolowercase()) { case "c": if (event.getmodifierstate("shift")) { // handle accel + shift + c event.preventdefault(); // consume the key event } break; case "k": if (!event.getmodifierstate("shift")) { // handle accel + k event.preventdefault(); // consume the key event } break; } return; } // do somethig ...
...if ((event.getmodifierstate("scrolllock") || event.getmodifierstate("scroll") /* hack for ie */) && !event.getmodifierstate("control") && !event.getmodifierstate("alt") && !event.getmodifierstate("meta")) {
switch (event.key) { case "arrowdown": case "down": // hack for ie and old gecko event.preventdefault(); // consume the key event break; case "arrowleft": case "left": // hack for ie and old gecko // do something different if scrolllock is locked.
PaymentRequest.onpaymentmethodchange - Web APIs
the paymentmethodchange event is triggered by a user-agent controlled interaction (i.e., the end-user
switches from a debit to a credit card in the payment ui).
... examples an example payment method change handler is shown below; this example handles changes made to the payment method when using apple pay, specifically: request.onpaymentmethodchange = ev => { const { type: cardtype } = ev.methoddetails; const newstuff = {}; if (ev.methodname === "https://apple.com/apple-pay") {
switch (cardtype) { case "store": // do apple pay specific handling for store card...
Multi-touch interaction - Web APIs
function get_cache(ev) { // return the cache for this event's target element
switch(ev.target.id) { case "target1": return evcache1; case "target2": return evcache2; case "target3": return evcache3; default: log("error with cache handling",ev); } } function push_event(ev) { // save this event in the target's cache var cache = get_cache(ev); cache.push(ev); } function remove_event(ev) { // remove this event from the target's cache var cache = get_cache(ev); f...
...no pointers down // yellow - one pointer down // pink - two pointers down // lightblue - three or more pointers down var evcache = get_cache(ev);
switch (evcache.length) { case 0: // target element has no touch points ev.target.style.background = "white"; break; case 1: // single touch point ev.target.style.background = "yellow"; break; case 2: // two simultaneous touch points ev.target.style.background = "pink"; break; default: // three or more simultaneous touches ev.target.styl...
RTCPeerConnection: connectionstatechange event - Web APIs
pc.onconnectionstatechange = ev => {
switch(pc.connectionstate) { case "new": case "checking": setonlinestatus("connecting..."); break; case "connected": setonlinestatus("online"); break; case "disconnected": setonlinestatus("disconnecting..."); break; case "closed": setonlinestatus("offline"); break; case "failed": setonlinestatus("error"); break; defa...
...ult: setonlinestatus("unknown"); break; } } you can also create a handler for connectionstatechange by using addeventlistener(): pc.addeventlistener("connectionstatechange", ev => {
switch(pc.connectionstate) { /* ...
SVGFETurbulenceElement - Web APIs
it is invalid to attempt to define a new value of this type or to attempt to
switch an existing value to this type.
...it is invalid to attempt to define a new value of this type or to attempt to
switch an existing value to this type.
SVGMarkerElement - Web APIs
it is invalid to attempt to define a new value of this type or to attempt to
switch an existing value to this type.
...it is invalid to attempt to define a new value of this type or to attempt to
switch an existing value to this type.
SVGPreserveAspectRatio - Web APIs
it is invalid to attempt to define a new value of this type or to attempt to
switch an existing value to this type.
...it is invalid to attempt to define a new value of this type or to attempt to
switch an existing value to this type.
SVGTextPathElement - Web APIs
it is invalid to attempt to define a new value of this type or to attempt to
switch an existing value to this type.
...it is invalid to attempt to define a new value of this type or to attempt to
switch an existing value to this type.
TextEncoder.prototype.encodeInto() - Web APIs
st textencoder = new textencoder(); const utf8 = new uint8array(string.length); let encodedresults = textencoder.encodeinto(string, utf8); resultpara.textcontent += 'bytes read: ' + encodedresults.read + ' | bytes written: ' + encodedresults.written + ' | encoded result: ' + utf8; polyfill the polyfill below may be a bit long because of the
switch cases and utilization of native textencoder.prototype.encode in safari when available, but it is well worth the length because of the gains in performance.
... "" : ("" + inputstring).replace(/[\x80-\ud7ff\udc00-\uffff]|[\ud800-\udbff][\udc00-\udfff]?/g, encoderreplacer); var len=encodedstring.length|0, i=0, char=0, read=0, u8arrlen = u8arr.length|0, inputlength=inputstring.length|0; if (u8arrlen < len) len=u8arrlen; putchars: for (; i<len; i=i+1|0) { char = encodedstring.charcodeat(i) |0;
switch(char >>> 4) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: read = read + 1|0; // extension points: case 8: case 9: case 10: case 11: ...
WebGLRenderingContext.isContextLost() - Web APIs
the user's computer has multiple graphics processors (such as a laptop with both mobile and desktop class gpus, the former used primarily when on battery power), and the user or system decides to
switch gpus.
... in this case, all contexts are lost, then restored after
switching gpus.
Clearing with colors - Web APIs
there are many "dials" and "
switches" that affect drawing with webgl.
...by tweaking those "dials" and "
switches" you can modify the internal state of the webgl machine, which in turn changes how input (in this case, a clear command) translates into output (in this case, all pixels are set to green).
WebRTC connectivity - Web APIs
because during renegotiation, an offer might be rejected because it proposes an incompatible format, it's necessary that each endpoint have the ability to propose a new format but not actually
switch to it until it's accepted by the other peer.
...in other words, if the local peer is in the state have-local-offer, indicating that the local peer had previously sent an offer, calling setremotedescription() with a received offer triggers rollback so that the negotiation
switches from the remote peer being the caller to the local peer being the caller.
Writing a WebSocket server in C# - Web APIs
uid specified by rfc 6455) compute sha-1 and base64 hash of the new value write the hash back as the value of "sec-websocket-accept" response header in an http response if (new system.text.regularexpressions.regex("^get").ismatch(data)) { const string eol = "\r\n"; // http/1.1 defines the sequence cr lf as the end-of-line marker byte[] response = encoding.utf8.getbytes("http/1.1 101
switching protocols" + eol + "connection: upgrade" + eol + "upgrade: websocket" + eol + "sec-websocket-accept: " + convert.tobase64string( system.security.cryptography.sha1.create().computehash( encoding.utf8.getbytes( new system.text.regularexpressions.regex("sec-websocket-key: (.*)").match(data).groups[1].value.trim() + "258eafa5-...
...5-e914-47da-95ca-c5ab0dc85b11"; byte[] swkasha1 = system.security.cryptography.sha1.create().computehash(encoding.utf8.getbytes(swka)); string swkasha1base64 = convert.tobase64string(swkasha1); // http/1.1 defines the sequence cr lf as the end-of-line marker byte[] response = encoding.utf8.getbytes( "http/1.1 101
switching protocols\r\n" + "connection: upgrade\r\n" + "upgrade: websocket\r\n" + "sec-websocket-accept: " + swkasha1base64 + "\r\n\r\n"); stream.write(response, 0, response.length); } else { bool fin = (bytes[0] & 0b10000000) != 0, mask = (bytes[1] & 0b10000000) != 0; // must be ...
Inputs and input sources - Web APIs
for example, if you need to keep up with which controller is held in each of the player's hands, you might do something like this: let inputsourcelist = null; let lefthandsource = null; let righthandsource = null; xrsession.addeventlistener("inputsourceschange", event => { inputsourcelist = event.session.inputsources; inputsourcelist.foreach(source => {
switch(source) { case "left": lefthandsource = source; break; case "right": righthandsource = source; break; } }); }); the inputsourceschange event is also fired once when the session's creation callback first completes execution, so you can use it to fetch the input source list as soon as it's available at startup time.
... the corresponding code for keyboard input might look something like this: document.addeventlistener("keydown", event => {
switch(event.key) { case: "a": case: "a": avatar.posdelta.x -= accel_x; break; case "d": case "d": avatar.posdelta.x += accel_x; break; case "w": case "w": avatar.posdelta.y += accel_y; break; case "s": case "s": avatar.posdelta.y -= accel_y; break; default: break; } }); this is a simple example, where accelerat...
Starting up and shutting down a WebXR session - Web APIs
let webxrpolyfill = null; function getxr(usepolyfill) { let tempxr; let temppoly;
switch(usepolyfill) { case "if-needed": if (!navigator.xr) { webxrpolyfill = new webxrpolyfill(); } tempxr = navigator.xr; break; case "yes": webxrpolyfill = new webxrpolyfill(); tempxr = navigator.xr; break; case "no": default: tempxr = navigator.xr; break; } return tempxr; } const xr = getxr("no"); // get the native x...
... session.onvisibilitychange = (event) => {
switch(event.session.visibilitystate) { case "hidden": myframerate = 10; break; case "blurred-visible": myframerate = 30; break; case "visible": default: myframerate = 60; break; } }; this example changes a variable myframerate depending on the visibility state as it changes.
Using IIR filters - Web APIs
the play button html looks like this: <button class="button-play" role="
switch" data-playing="false" aria-pressed="false">play</button> and the click event listener starts like so: playbutton.addeventlistener('click', function() { if (this.dataset.playing === 'false') { srcnode = playsourcenode(audioctx, sample); ...
...first, the html: <button class="button-filter" role="
switch" data-filteron="false" aria-pressed="false" aria-describedby="label" disabled></button> the filter button's click handler then connects the iirfilter up to the graph, between the source and the detination: filterbutton.addeventlistener('click', function() { if (this.dataset.filteron === 'false') { srcnode.disconnect(audioctx.destination); srcnode.connect(iirfilter).connect(audioctx.destination); ...
Web audio spatialization basics - Web APIs
function moveboombox(direction) {
switch (direction) { case 'left': if (transform.xaxis > leftbound) { transform.xaxis -= 5; panner.positionx.value -= 0.1; } break; case 'up': if (transform.yaxis > topbound) { transform.yaxis -= 5; panner.positiony.value -= 0.3; } break; case 'right': ...
... function moveboombox(direction, prevmove) {
switch (direction) { case 'left': if (transform.xaxis > leftbound) { transform.xaxis -= 5; panner.positionx.value -= 0.1; } break; case 'up': if (transform.yaxis > topbound) { transform.yaxis -= 5; panner.positiony.value -= 0.3; } break; case 'right': ...
Using Web Workers - Web APIs
passing data examples example #1: advanced passing json data and creating a
switching system if you have to pass some complex data and have to call many different functions both on the main page and in the worker, you can create a system which groups everything together.
...rymethodarguments': array.prototype.slice.call(arguments, 1) }); } onmessage = function(oevent) { if (oevent.data instanceof object && oevent.data.hasownproperty('querymethod') && oevent.data.hasownproperty('querymethodarguments')) { queryablefunctions[oevent.data.querymethod].apply(self, oevent.data.querymethodarguments); } else { defaultreply(oevent.data); } }; it is possible to
switch the content of each mainpage -> worker and worker -> mainpage message.
Worker.prototype.postMessage() - Web APIs
main thread code: var myworker = new chromeworker(self.path + 'myworker.js'); function handlemessagefromworker(msg) { console.log('incoming message from worker, msg:', msg);
switch (msg.data.atopic) { case 'do_sendmainarrbuff': sendmainarrbuff(msg.data.abuf) break; default: throw 'no atopic on incoming message to chromeworker'; } } myworker.addeventlistener('message', handlemessagefromworker); // ok lets create the buffer and send it var arrbuf = new arraybuffer(8); console.info('arrbuf.bytelength pre transfer:', arr...
...buf.bytelength); myworker.postmessage( { atopic: 'do_sendworkerarrbuff', abuf: arrbuf // the array buffer that we passed to the transferrable section 3 lines below }, [ arrbuf // the array buffer we created 9 lines above ] ); console.info('arrbuf.bytelength post transfer:', arrbuf.bytelength); worker code self.onmessage = function (msg) {
switch (msg.data.atopic) { case 'do_sendworkerarrbuff': sendworkerarrbuff(msg.data.abuf) break; default: throw 'no atopic on incoming message to chromeworker'; } } function sendworkerarrbuff(abuf) { console.info('from worker, pre send back abuf.bytelength:', abuf.bytelength); self.postmessage({atopic:'do_sendmainarrbuff', abuf:abuf}, [abuf]...
WorkerGlobalScope - Web APIs
offline fired when the browser has lost access to the network and the value of navigator.online
switched to false.
... online fired when the browser has gained access to the network and the value of navigator.online
switched to true.
ARIA: application role - Accessibility
to be able to interact with a web page, a standard set of widgets is recognized that, when pressing a certain key (usually the enter key) this mode is
switched off.
...escape is the most common way of
switching back to browse mode.
ARIA: document role - Accessibility
generally used in complex composite widgets or applications, the document role can inform assistive technologies to
switch context to a reading mode: the document role tells assistive technologies with reading or browse modes to use the document mode to read the content contained within this element.
... assistive technologies should
switch context back to document mode, possibly intercepting from controls rewired for the parent's dynamic context, re-enabling the standard input events, such as up or down arrow keyboard events, to control the reading cursor.
ARIA: grid role - Accessibility
+ '"]'); if (tgt && (tgt.getattribute('role')==='gridcell') ) { array.prototype.foreach.call(document.queryselectorall('[role=gridcell]'), function(el, i){ el.setattribute('tabindex', '-1'); }); tgt.setattribute('tabindex', '0'); tgt.focus(); return true; } else { return false; } } document.queryselector('table').addeventlistener("keydown", function(event) {
switch (event.key) { case "arrowright": moveto(parseint(event.target.dataset.row, 10), parseint(event.target.dataset.col, 10) + 1); break; case "arrowleft": moveto(parseint(event.target.dataset.row, 10), parseint(event.target.dataset.col, 10) - 1); break; case "arrowdown": moveto(parseint(event.target.dataset.row, 10) + 1, parseint(event.target.dataset.col, 10))...
...+ '"]'); if (tgt && (tgt.getattribute('role')==='gridcell') ) { array.prototype.foreach.call(document.queryselectorall('[role=gridcell]'), function(el, i){ el.setattribute('tabindex', '-1'); }); tgt.setattribute('tabindex', '0'); tgt.focus(); return true; } else { return false; } } document.queryselector('table').addeventlistener("keydown", function(event) {
switch (event.key) { case "arrowright": moveto(parseint(event.target.dataset.row, 10), parseint(event.target.dataset.col, 10) + 1); break; case "arrowleft": moveto(parseint(event.target.dataset.row, 10), parseint(event.target.dataset.col, 10) - 1); break; case "arrowdown": moveto(parseint(event.target.dataset.row, 10) + 1, parseint(event.target.dataset.col, 10))...
WAI-ARIA Roles - Accessibility
dialogs can be either non-modal (it's still possible to interact with content outside of the dialog) or modal (only the content in the dialog can be interacted with).aria: document rolegenerally used in complex composite widgets or applications, the document role can inform assistive technologies to
switch context to a reading mode: the document role tells assistive technologies with reading or browse modes to use the document mode to read the content contained within this element.aria: feed rolea feed is a dynamic scrollable list of articles in which articles are added to or removed from either end of the list as the user scrolls.
...this should be used on an element that wraps an element with an insertion role, and one with a deletion role.aria:
switch rolethe aria
switch role is functionally identical to the checkbox role, except that instead of representing "checked" and "unchecked" states, which are fairly generic in meaning, the
switch role represents the states "on" and "off."aria: tab rolethe aria tab role indicates an interactive element inside a tablist that, when activated, displays its associated tabpanel.aria: table rolethe table val...
An overview of accessible web applications and widgets - Accessibility
for example, consider an "inline edit" widget: a component that allows users to edit a piece of text in place, without
switching contexts.
...a developer might be tempted to implement the "view" mode using a read-only text <input> element and setting its aria role to button, then
switching to "edit" mode by making the element writable and removing the role attribute in "edit" mode (since <input> elements have their own role semantics).
Implementing a Microsoft Active Accessibility (MSAA) Server - Accessibility
pturestart event_system_captureend event_system_movesizestart event_system_movesizeend event_system_contexthelpstart event_system_contexthelpend event_system_dragdropstart event_system_dragdropend event_system_dialogstart event_system_dialogend event_system_scrollingstart event_system_scrollingend [possibly important, talk to at vendor] event_system_
switchstart event_system_
switchend event_system_minimizestart event_system_minimizeend event_object_create [don't implement, watching system generated versions of this event causes assistive technology crashes] event_object_destroy [don't implement, watching system generated versions of this event causes assistive technology crashes] event_object_show [can be important, depending ...
...queryinterface() can be used to
switch between the interfaces used in the two trees (iaccessible and isimpledomnode).
Accessibility documentation index - Accessibility
60 aria: document role aria, aria role, document, reference generally used in complex composite widgets or applications, the document role can inform assistive technologies to
switch context to a reading mode: the document role tells assistive technologies with reading or browse modes to use the document mode to read the content contained within this element.
... 72 aria:
switch role aria, aria role, accessibility, on/off, reference,
switch, a11y, toggle the aria
switch role is functionally identical to the checkbox role, except that instead of representing "checked" and "unchecked" states, which are fairly generic in meaning, the
switch role represents the states "on" and "off." 73 aria: tab role aria, aria role, aria tab, aria widget, reference...
Aligning Items in a Flex Container - CSS: Cascading Style Sheets
once again we can
switch our flex-direction to column in order to see how this property behaves when we are working by column.
... you can
switch them to display in the block direction for the language of your document by selecting flex-direction: column.
Ordering Flex Items - CSS: Cascading Style Sheets
the second two values ​​reverse the items by
switching the start and end lines.
...also, try changing flex-direction to row-reverse and see what happens — the start line is
switched so the ordering begins from the opposite side.
Linear-gradient Generator - CSS: Cascading Style Sheets
ddd; background-image: url("images/alpha.png"); float: left; position: relative; } .ui-color-picker .preview:before { height: 100%; width: 50%; left: 50%; top: 0; content: ""; background: #fff; position: absolute; z-index: 1; } .ui-color-picker .preview-color { width: 100%; height: 100%; background-color: rgba(255, 0, 0, 0.5); position: absolute; z-index: 1; } .ui-color-picker .
switch_mode { width: 10px; height: 20px; position: relative; border-radius: 5px 0 0 5px; border: 1px solid #ddd; background-color: #eee; left: -12px; top: -1px; z-index: 1; transition: all 0.5s; } .ui-color-picker .
switch_mode:hover { background-color: #ccc; cursor: pointer; } /* * ui component */ .ui-input-slider { height: 20px; font-family: "segoe ui", arial, helvetica, sans-serif; ...
...hild(input); this.node.appendchild(wrapper); input.addeventlistener('change', onchangefunc); input.addeventlistener('click', function() { this.select(); }); this.subscribe(topic, function(value) { input.value = value; }); }; colorpicker.prototype.createchangemodebutton = function createchangemodebutton() { var button = document.createelement('div'); button.classname = '
switch_mode'; button.addeventlistener('click', function() { if (this.picker_mode === 'hsv') this.setpickermode('hsl'); else this.setpickermode('hsv'); }.bind(this)); this.node.appendchild(button); }; /*************************************************************************/ // updates properties of ui elements /*************************************************************...
font-smooth - CSS: Cascading Style Sheets
switching from subpixel rendering to antialiasing for light text on dark backgrounds makes it look lighter.
...
switching from subpixel rendering to antialiasing for light text on dark backgrounds makes it look lighter.
Audio and Video Delivery - Developer guides
if you need something extra, it's possible to add features that are not currently present in default players, such as playback rate, quality stream
switches or even audio spectrums.
... your audio and custom controls in html: <audio id="my-audio" src="http://jplayer.org/audio/mp3/miaow-01-tempered-song.mp3"></audio> <button id="my-control">play</button> add a bit of javascript to detect events to play and pause the audio: window.onload = function() { var myaudio = document.getelementbyid('my-audio'); var mycontrol = document.getelementbyid('my-control'); function
switchstate() { if (myaudio.paused == true) { myaudio.play(); mycontrol.innerhtml = "pause"; } else { myaudio.pause(); mycontrol.innerhtml = "play"; } } function checkkey(e) { if (e.keycode == 32 ) { //spacebar
switchstate(); } } mycontrol.addeventlistener('click', function() {
switchstate(); }, false); window.addeventlistener( "keypre...
Making content editable - Developer guides
ipboard.clipboard.cutcopy", "allaccess"); user_pref("capability.policy.allowclipboard.clipboard.paste", "allaccess"); example: a simple but complete rich text editor <!doctype html> <html> <head> <title>rich text editor</title> <script type="text/javascript"> var odoc, sdeftxt; function initdoc() { odoc = document.getelementbyid("textbox"); sdeftxt = odoc.innerhtml; if (document.compform.
switchmode.checked) { setdocmode(true); } } function formatdoc(scmd, svalue) { if (validatemode()) { document.execcommand(scmd, false, svalue); odoc.focus(); } } function validatemode() { if (!document.compform.
switchmode.checked) { return true ; } alert("uncheck \"show html\"."); odoc.focus(); return false; } function setdocmode(btosource) { var ocontent; if (btosource) { ocontent ...
...+/fvrvv8/f///////////////////////////////////////////////yh5baeaab8alaaaaaawabyaaawn4ceozgmeakqubgsuspvbsyfjjvds6njlb0khr4akbcmfscgbqaocwjf5gwquvyksfbwze+awibv0ghfog2ewidchjwriqo9e2fx4xd5r+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.
<a>: The Anchor element - HTML: Hypertext Markup Language
implicit aria role link when href attribute is present, otherwise no corresponding role permitted aria roles when href attribute is present: button checkbox menuitem menuitemcheckbox menuitemradio option radio
switch tab treeitem when href attribute is not present: any dom interface htmlanchorelement examples linking to an absolute url html <a href="https://www.mozilla.com"> mozilla </a> result linking to relative urls html <a href="//example.com">scheme-relative url</a> <a href="/docs/web/html">origin-relative url</a> <a href="./p">directo...
... skip links are especially useful for people who navigate with the aid of assistive technology such as
switch control, voice command, or mouth sticks/head wands, where the act of moving through repetitive links can be laborious.
<input type="number"> - HTML: Hypertext Markup Language
d+span:after { position: absolute; content: '✓'; padding-left: 5px; } and finally, the javascript: let metersinputgroup = document.queryselector('.metersinputgroup'); let feetinputgroup = document.queryselector('.feetinputgroup'); let metersinput = document.queryselector('#meters'); let feetinput = document.queryselector('#feet'); let inchesinput = document.queryselector('#inches'); let
switchbtn = document.queryselector('input[type="button"]');
switchbtn.addeventlistener('click', function() { if(
switchbtn.getattribute('class') === 'meters') {
switchbtn.setattribute('class', 'feet');
switchbtn.value = 'enter height in meters'; metersinputgroup.style.display = 'none'; feetinputgroup.style.display = 'block'; feetinput.setattribute('required', ''); inchesinput...
....setattribute('required', ''); metersinput.removeattribute('required'); metersinput.value = ''; } else {
switchbtn.setattribute('class', 'meters');
switchbtn.value = 'enter height in feet and inches'; metersinputgroup.style.display = 'block'; feetinputgroup.style.display = 'none'; feetinput.removeattribute('required'); inchesinput.removeattribute('required'); metersinput.setattribute('required', ''); feetinput.value = ''; inchesinput.value = ''; } }); after declaring a few variables, an event listener is added to the button to control the
switching mechanism.
<input type="password"> - HTML: Hypertext Markup Language
mobile devices with virtual keyboards, for example, may opt to
switch to a numeric keypad layout instead of a full keyboard, to make entering the password easier.
... the inputmode is set to numeric to encourage devices with virtual keyboards to
switch to a numeric keypad layout for easier entry.
Large-Allocation - HTTP
these windows must remain in the same process as their opener, as they can communicate, meaning that we cannot allow them to
switch processes.
...this is for the same reason as above, namely that they can communicate and thus we cannot allow them to
switch processes.
Protocol upgrade mechanism - HTTP
upgrading http/1.1 connections the upgrade header field is used by clients to invite the server to
switch to one of the listed protocols, in descending preference order.
... if the server decides to upgrade the connection, it sends back a 101
switching protocols response status with an upgrade header that specifies the protocol(s) being
switched to.
Intl.DateTimeFormat.prototype.formatToParts() - JavaScript
for example by using array.prototype.map(), arrow functions, a
switch statement, template literals, and array.prototype.reduce().
... var datestring = formatter.formattoparts(date).map(({type, value}) => {
switch (type) { case 'dayperiod': return `<b>${value}</b>`; default : return value; } }).reduce((string, part) => string + part); this will make the day period bold, when using the formattoparts() method.
Intl.NumberFormat.prototype.formatToParts() - JavaScript
for example by using array.prototype.map(), arrow functions, a
switch statement, template literals, and array.prototype.reduce().
... var numberstring = formatter.formattoparts(number).map(({type, value}) => {
switch (type) { case 'currency': return `<strong>${value}</strong>`; default : return value; } }).reduce((string, part) => string + part); this will make the currency bold, when using the formattoparts() method.
String.prototype.replace() - JavaScript
to perform a global search and replace, include the g
switch in the regular expression.
...
switching words in a string the following script
switches the words in the string.
Statements and declarations - JavaScript
break terminates the current loop,
switch, or label statement and transfers program control to the statement following the terminated statement.
...
switch evaluates an expression, matching the expression's value to a case clause, and executes statements associated with that case.
Codecs used by WebRTC - Web media technologies
other requirements for the purposes of supporting
switching between portrait and landscape orientations, there are two methods that can be used.
...avc implementations for webrtc are required to support the special "filler payload" and "full frame freeze" sei messages; these are used to support
switching among multiple input streams seamlessly.
Understanding latency - Web Performance
network throttling to emulate the latency of a low bandwidth network, you can use developer tools and
switch to a lower end network connection.
... in the developer tools, under the network table, you can
switch the throttling option to 2g, 3g, etc.
SVG 2 support in Mozilla - SVG: Scalable Vector Graphics
ation status unknown auto as initial value for width and height attributes of <svg> implementation status unknown baseprofile and version attributes removed from <svg> implementation status unknown svgsvgelement.forceredraw() deprecated turned into a no-op (bug 733764) svgsvgelement.deselectall() deprecated not yet deprecated (bug 1302705) <
switch> not affecting <style> implementation status unknown requiredfeatures attribute removed implementation status unknown svgsvgelement.currentview and svgsvgelement.usecurrentview removed svgsvgelement.currentview was never implemented, svgsvgelement.usecurrentview not removed yet (bug 1174097) svgunknownelement not implemented (bug 1239218) lang attri...
...bute without namespace implemented (bug 721920) svgsvgelement.viewport removed never implemented xml:base attribute removed implementation status unknown reorder descendent elements of <
switch> having systemlanguage attribute according to allowreorder smil attribute implementation status unknown made <tspan> and <textpath> graphics elements implementation status unknown allow x, y, width, and height on <symbol> implementation status unknown made <use> element shadow trees consistent with shadow dom spec implementation status unknown role mapping of <a> element depending on whether it is a valid link implementation status unknown aria state and property attributes animatable implementation status un...
Interacting with page scripts - Archive of obsolete content
w the page script can call the function as foo.greetme(): <html> <head> </head> <body> <input id="test" type="button" value="click me"/> <script> var test = document.getelementbyid("test"); test.addeventlistener("click", function() { alert(window.foo.greetme("page script")); }, false); </script> </body> </html> reverting to the old behavior you can
switch firefox back to the old behavior in which content scripts could expose objects and functions to page scripts using unsafewindow.
widget - Archive of obsolete content
var tabs = require("sdk/tabs"); var windows = require("sdk/windows").browserwindows; var widget = require("sdk/widget").widget({ id: "window-specific-test", label: "widget with content specific to each window", content: " ", width: 50 }); // observe tab
switch or document changes in each existing tab: function updatewidgetstate(tab) { var view = widget.getview(tab.window); if (!view) return; // update widget displayed text: view.content = tab.url.match(/^https/) ?
Implementing the widget - Archive of obsolete content
main.js now in the lib directory open main.js and add the following code: var widgets = require('sdk/widget'); var data = require('sdk/self').data; var annotatorison = false; function toggleactivation() { annotatorison = !annotatorison; return annotatorison; } exports.main = function() { var widget = widgets.widget({ id: 'toggle-
switch', label: 'annotator', contenturl: data.url('widget/pencil-off.png'), contentscriptwhen: 'ready', contentscriptfile: data.url('widget/widget.js') }); widget.port.on('left-click', function() { console.log('activate/deactivate'); widget.contenturl = toggleactivation() ?
Storing annotations - Archive of obsolete content
finally we need to connect this to the widget's right-click message: var widget = widgets.widget({ id: 'toggle-
switch', label: 'annotator', contenturl: data.url('widget/pencil-off.png'), contentscriptwhen: 'ready', contentscriptfile: data.url('widget/widget.js') }); widget.port.on('left-click', function() { console.log('activate/deactivate'); widget.contenturl = toggleactivation() ?
IsDefaultNamespace - Archive of obsolete content
// http://www.w3.org/tr/dom-level-3-core/core.html#node3-isdefaultnamespace // http://www.w3.org/tr/dom-level-3-core/namespaces-algorithms.html#isdefaultnamespacealgo function isdefaultnamespace(node, namespaceuri) { if (node.isdefaultnamespace) { return node.isdefaultnamespace(namespaceuri); }
switch (node.nodetype) { case 1: // element_node if (!node.prefix) { return (node.namespaceuri === namespaceuri); } if (node.attributes.length) { for (var i=0; i < node.attributes.length; i++) { var att = node.attributes[i]; if (att.localname === 'xmlns') { return ...
LookupNamespaceURI - Archive of obsolete content
unction lookupnamespaceuri (prefix) { return lookupnamespaceurihelper(this, prefix); } function lookupnamespaceurihelper (node, prefix) { // adapted directly from http://www.w3.org/tr/dom-level-3-core/namespaces-algorithms.html#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 (nod...
LookupPrefix - Archive of obsolete content
tr/dom-level-3-core/namespaces-algorithms.html#lookupnamespaceprefixalgo // (the above had a few apparent 'bugs' in the pseudo-code which were corrected here) if (node.lookupprefix && htmlmode !== 'text/html') { // shouldn't use this in text/html for mozilla as will return null return node.lookupprefix(namespaceuri); } if (namespaceuri === null || namespaceuri === '') { return null; }
switch (node.nodetype) { case 1: // node.element_node return _lookupnamespaceprefix(namespaceuri, node); case 9: // node.document_node return _lookupnamespaceprefix(namespaceuri, node.documentelement); case 6: // node.entity_node case 12: // node.notation_node case 11: // node.document_fragment_node case 10: // node.document_type_node return null; // type is unknown case 2: // no...
Miscellaneous - Archive of obsolete content
sses; const ci = components.interfaces; components.utils.import("resource://gre/modules/xpcomutils.jsm"); const gobserver = cc['@mozilla.org/observer-service;1'].getservice(ci.nsiobserverservice); const gioservice = cc["@mozilla.org/network/io-service;1"].getservice(ci.nsiioservice); function certsservice() {} certsservice.prototype = { observe: function(asubject, atopic, adata) {
switch(atopic) { case "app-startup": gobserver.addobserver(this,"xpcom-shutdown",false); gobserver.addobserver(this,"final-ui-startup",false); break; case "xpcom-shutdown": gobserver.removeobserver(this,"final-ui-startup"); gobserver.removeobserver(this,"xpcom-shutdown"); break; ...
Page Loading - Archive of obsolete content
page loading on page load how to execute code each time a new page is loaded in browser/mail progress listeners progress listeners allow extensions to be notified of events associated with documents loading in the browser and with tab
switching events.
Migrating from Internal Linkage to Frozen Linkage - Archive of obsolete content
#define compare(str1, str2, comp) (str1).compare(str2, comp) #define last() endreading()[-1] #define setcharat(c, i) replace(i, 1, ch) #define ns_newisupportsarray(result) callcreateinstance(ns_supportsarray_contractid, static_cast<nsisupportsarray**>(result)); ideally we would
switch to nsimutablearray, but in the mean time there's no point changing the same code twice.
XUL Questions and Answers - Archive of obsolete content
{ // this fires when all load finish } if ( aflag & listobj.wpl.state_is_network ) { // fires when all load are really over, // do something "final" here // (my two cents) } else { // this fires when a load finishes } } } return 0; } // this fires when the location bar changes i.e load event is confirmed // or when the user
switches tabs listobj.onlocationchange = function(aprogress, arequest, auri) { // do whatever you want to do return 0; } // for definitions of the remaining functions see xulplanet.com listobj.onprogresschange = function() { return 0 }; listobj.onstatuschange = function() { return 0 }; listobj.onsecuritychange = function() { return 0 }; listobj.onlinkiconavailable = function() { return 0 }; /* i u...
panel - Archive of obsolete content
noautohide type: boolean if false, the default value, the panel will be hidden when the user clicks outside the panel or
switches focus to another application.
progressmeter - Archive of obsolete content
attributes max, mode, value properties accessibletype, max, mode, value examples <progressmeter mode="determined" value="82"/> <progressmeter mode="undetermined"/> <!--
switching modes while the mouse is over a button --> <progressmeter mode="determined" id="myprogress"/> <button label="example" onmouseover="setloading(true)" onmouseout="setloading(false)"/> function setloading(state){ document.getelementbyid('myprogress').mode = (state) ?
window - Archive of obsolete content
fullscreenbutton type: boolean set this attribute to true to display a button in the window chrome to allow the user to
switch the window into full screen mode.
XULRunner - Archive of obsolete content
firefox (from version 3) ships with a private xulrunner package, which can run any compatible xulrunner application using the -app
switch: firefox -app application.ini is equivalent to xulrunner -app application.ini older builds are also available.
Mozilla release FAQ - Archive of obsolete content
/usr/include/stdlib.h:196: previous declaration of `seed48' see section 3.7 nothing looks much like an error, except something returned error status your compiler has a
switch (probably) that prints everything it's doing (i.e.
2006-11-22 - Archive of obsolete content
new mailing list for nvda steve lee was pleased to announce that the mozilla foundation has approved a grant spearheaded by himself and aaron leventhal for "improved
switch access to firefox".
2006-10-06 - Archive of obsolete content
announcements new svg build dependency coming on october 2nd t rowley announced that: soon svg on the trunk will be
switching to use thebes directly (instead of the current choice of direct cairo or punching a hole through thebes to cairo).
2006-11-24 - Archive of obsolete content
announcements svg build dependency on cairo gfx on 11/22 november 21st: t rowley announced that: he will be landing his patch that starts the process of
switching svg over to thebes (bug 354866).
XEmbed Extension for Mozilla Plugins - Archive of obsolete content
once you've verified that the browser has the compatibility you require, you can modify your npp_getvalue call like so: nperror npp_getvalue(void *future, nppvariable variable, void *value) { nperror err = nperr_no_error;
switch (variable) { case nppvpluginneedsxembed: *((prbool *)value) = pr_true; break; default: err = nperr_generic_error; } return err; } once you have set those variables, it should be relatively easy to set up a plugin.
Settings - Archive of obsolete content
the debugger has its own settings menu, which you can access from an icon in the toolbar: each setting is a simple on/off
switch: auto prettify minified sources with this option enabled, the debugger will automatically detect minified js files and pretty-print them.
Using workers in extensions - Archive of obsolete content
observe: function(subject, topic, data) { if (topic != "nspref:changed") { return; }
switch(data) { case "symbol": this.tickersymbol = this.prefs.getcharpref("symbol").touppercase(); this.worker.postmessage(this.tickersymbol); break; } }, the key here is line 10, which sends the new ticker symbol to monitor to the ticker thread by calling its postmessage() method.
New in JavaScript 1.2 - Archive of obsolete content
s function.arity new methods array.prototype.concat() array.prototype.slice() string.prototype.charcodeat() string.prototype.concat() string.fromcharcode() string.prototype.match() string.prototype.replace() string.prototype.search() string.prototype.slice() string.prototype.substr() new operators delete equality operators (== and !=) new statements labeled statements
switch do...while import export other new features regular expressions signed scripts changed functionality in javascript 1.2 you can now nest functions within functions.
New in JavaScript 1.3 - Archive of obsolete content
statements label
switch do...while export import built-in objects regexp methods of built-in objects tosource() object.prototype.watch() object.prototype.unwatch() function.arity function.prototype.apply() function.prototype.call() array.prototype.concat() array.prototype.pop() array.prototype.push() array.prototype.shift() array.prototype.slice() array.prototype.splice() string.prototype.concat...
New in JavaScript 1.7 - Archive of obsolete content
in html or xul code, use: <script type="application/javascript;version=1.7"></script> when using the javascript shell, you need to set the version you wish to use using the -version 170
switch on the command line or using the version() function: version(170); the features that require the use of the new keywords "yield" and "let" require you to specify version 1.7 because existing code might use those keywords as variable or function names.
Implementation Status - Archive of obsolete content
container form controls section title status notes bugs 9.1.1 group supported 9.2.1
switch partial @selected not working inside repeats 339937; 9.2.2 case partial 302497; 329143; 9.3 repeat module partial 264329; 273706; 9.3.1 repeat partial we do not support number attribute 302026; 9.3.2 nested repeats supported ...
Introducing a complete toolchain - Learn web development
this is general practice for tool configuration — you tend to find the config files in the project root, which more often than not contain configuration options expressed in a json structure (though our tools and many others also support yaml, which you can
switch to if that's your preferred flavour of configuration file).
Accessibility Features in Firefox
custom searches can be added to this quick search bar and the user can
switch between them by choosing from a drop down available via the standard alt+down arrow key combination.
Accessible Toolkit Checklist
msaa support, including checkbox state and statechange event tab panels ctrl+[shift]+tab or ctrl+pgup/pgdn to
switch tabs tabs can be focused, and then left/right arrow to
switch first click on a tab
switches to it, second click focuses it msaa support.
Debugging Safari
to enable the very useful debug menu in safari use the following: defaults write com.apple.safari includeinternaldebugmenu 1 it is often useful to
switch into single process mode by turning off "use multi-process windows" ...
Debugging Table Reflow
it can be invoked by set gecko_block_debug_flags=reflow the available options are: reflow really-noisy-reflow max-element-size space-manager verify-lines damage-repair lame-paint-metrics lame-reflow-metrics disable-resize-opt these options can be combined with a comma separated list messages generated by the reflow
switch: block(div)(1)@00be5ac4: reflowing dirty lines computedwidth=9000 computedheight=1500 this message is generated inside of nsresult nsblockframe::reflowdirtylines(nsblockreflowstate& astate) it first shows the block id and address and then the computed width and height from the htmlreflowstate.
Debugging on Windows
debug and optimized) simultaneously by setting the environment variable moz_no_remote: set moz_no_remote=1 or, starting with firefox 2 and other gecko 1.8.1-based applications, you can use the -no-remote command-line
switch instead (implemented in bug 325509).
pymake
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.
PopupNotifications.jsm
the first parameter to the callback is a string identifying the state change, and may be one of the following: "dismissed" the notification has been dismissed by the user (for example, by clicking away or by
switching tabs).
Index
to make the tool continue to accept connections,
switch on looping mode with the -l option.
NSS Sample Code Sample_1_Hashing
progname + 1 : argv[0]; rv = nss_nodb_init("/tmp"); if (rv != secsuccess) { fprintf(stderr, "%s: nss_init failed in directory %s\n", progname, "/tmp"); return -1; } /* parse command line arguments */ optstate = pl_createoptstate(argc, argv, "t:"); while ((status = pl_getnextopt(optstate)) == pl_opt_ok) {
switch (optstate->option) { case 't': require_arg(optstate->option, optstate->value); hashname = strdup(optstate->value); break; } } if (!hashname) usage(progname); /* convert and validate */ hashoidtag = hashnametooidtag(hashname); if (hashoidtag == sec_oid_unknown) { fprintf(stderr, "%s: invalid digest type - %s\...
NSS Sample Code Sample_2_Initialization of NSS
progname + 1 : argv[0]; /* parse command line arguments */ optstate = pl_createoptstate(argc, argv, "d:p:q:f:g:"); while ((status = pl_getnextopt(optstate)) == pl_opt_ok) {
switch (optstate->option) { case 'd': dbdir = strdup(optstate->value); break; case 'p': plainpass = strdup(optstate->value); break; case 'f': pwfile = strdup(optstate->value); break; default: usage(progname); break; } } pl_destroyoptstate(optstate); ...
NSS Sample Code Utilities_1
of the next passphrase */ while ( (i<nb) analyze="" char="" current="" getmodulepassword="" if="" int="" now="" passphrase="" phrase="&phrases[startphrase];" phraselen="" pk11slotinfo="" pwdata="=" pwdata-="" retry="" return="" secupwdata="" the="" void="" while="">source != pw_none) { pr_fprintf(pr_stderr, "incorrect password/pin entered.\n"); return null; }
switch (pwdata->source) { case pw_none: sprintf(prompt, "enter password or pin for \"%s\":", pk11_gettokenname(slot)); return getpassword(stdin, stdout, prompt, checkpassword); case pw_fromfile: pw = filepasswd(slot, retry, pwdata->data); pwdata->source = pw_plaintext; pwdata->data = pl_strdup(pw); return pw; case pw_plaintext: ...
Hashing - sample 1
progname + 1 : argv[0]; rv = nss_nodb_init("/tmp"); if (rv != secsuccess) { fprintf(stderr, "%s: nss_init failed in directory %s\n", progname, "/tmp"); return -1; } /* parse command line arguments */ optstate = pl_createoptstate(argc, argv, "t:"); while ((status = pl_getnextopt(optstate)) == pl_opt_ok) {
switch (optstate->option) { case 't': require_arg(optstate->option, optstate->value); hashname = strdup(optstate->value); break; } } if (!hashname) usage(progname); /* convert and validate */ hashoidtag = hashnametooidtag(hashname); if (hashoidtag == sec_oid_unknown) { fprintf(stderr, "%s: invalid digest type - %s\...
Initialize NSS database - sample 2
progname + 1 : argv[0]; /* parse command line arguments */ optstate = pl_createoptstate(argc, argv, "d:p:q:f:g:"); while ((status = pl_getnextopt(optstate)) == pl_opt_ok) {
switch (optstate->option) { case 'd': dbdir = strdup(optstate->value); break; case 'p': plainpass = strdup(optstate->value); break; case 'f': pwfile = strdup(optstate->value); break; default: usage(progname); break; } } pl_destroyoptstate(optstate); ...
Utilities for nss samples
return phrase; } /* * getmodulepassword */ char* getmodulepassword(pk11slotinfo *slot, int retry, void *arg) { char prompt[255]; secupwdata *pwdata = (secupwdata *)arg; char *pw; if (pwdata == null) { return null; } if (retry && pwdata->source != pw_none) { pr_fprintf(pr_stderr, "incorrect password/pin entered.\n"); return null; }
switch (pwdata->source) { case pw_none: sprintf(prompt, "enter password or pin for \"%s\":", pk11_gettokenname(slot)); return getpassword(stdin, stdout, prompt, checkpassword); case pw_fromfile: pw = filepasswd(slot, retry, pwdata->data); pwdata->source = pw_plaintext; pwdata->data = pl_strdup(pw); return pw; case pw_plaintext: ...
sample1
progname + 1 : argv[0]; rv = nss_nodb_init("/tmp"); if (rv != secsuccess) { fprintf(stderr, "%s: nss_init failed in directory %s\n", progname, "/tmp"); return -1; } /* parse command line arguments */ optstate = pl_createoptstate(argc, argv, "t:"); while ((status = pl_getnextopt(optstate)) == pl_opt_ok) {
switch (optstate->option) { case 't': require_arg(optstate->option, optstate->value); hashname = strdup(optstate->value); break; } } if (!hashname) usage(progname); /* convert and validate */ hashoidtag = hashnametooidtag(hashname); if (hashoidtag == sec_oid_unknown) { fprintf(stderr, "%s: invalid dig...
nss tech note4
* the extension is not critical */ } /* value attribute of the extension */ /* secitem ext_value has type (secitemtype), data (unsigned char *) and len (unsigned int) fields - the application interprets these */ secoidtag oidtag = secoid_findoidtag(ext_oid);
switch (oidtag) { case a_tag_that_app_recognizes: .....
Python binding for NSS
mozilla source code management (scm) information on march 21, 2013 the nss project
switched from using cvs as it's source code manager (scm) to mercurial, also known as hg.
Build instructions
hg clone https://hg.mozilla.org/projects/nspr hg clone https://hg.mozilla.org/projects/nss if you want to build a releases other than the tips of these repositories, then
switch to the release tags: cd nspr hg update nspr_4_9_5_rtm cd ../nss hg update nss_3_14_2_rtm cd ..
NSS tools : ssltab
to make the tool continue to accept connections,
switch on looping mode with the -l option.
NSS tools : ssltap
to make the tool continue to accept connections,
switch on looping mode with the -l option.
troubleshoot.html
you may need to
switch the shell back and forthdepending on which product you are building.
NSS Tools ssltap
to make the tool continue to accept connections,
switch on looping mode with the -l option.
NSS tools : ssltap
to make the tool continue to accept connections,
switch on looping mode with the -l option.
Hacking Tips
the other being disable this check in "about:config", by temporarily
switching "security.fileuri.strict_origin_policy" to false note 2: the files can be very big and take a long time to load in the browser.
Invariants
however, there is another internal api, js::
switchtocompartment, that lets you break this invariant, and of course in xpconnect we use that from time to time when we know we aren't going to be creating any new objects (other than global objects, which have no parent or prototype) or doing anything that might call back into native code that could create objects.
SpiderMonkey Internals
interpreter like many portable interpreters, spidermonkey's interpreter is mainly a single, tremendously long function that steps through the bytecode one instruction at a time, using a
switch statement (or faster alternative, depending on the compiler) to jump to the appropriate chunk of code for the current instruction.
JS::CallArgs
embedders should start internally
switching away from using argc and vp directly, except to create a callargs.
JS_CStringsAreUTF8
api users should
switch to functions which take utf-8 explicitly or handle their own string encoding and decoding.
JS_DefinePropertyWithTinyId
those getters and setters can use
switch (jsval_to_int(id)), instead of checking the value of id as a string, to determine which property is being accessed.
SpiderMonkey 1.8.5
this change to a struct means that certain tricks, such as writing
switch statements in c with jsval cases are no longer legal.
SpiderMonkey 1.8.7
this change to a struct means that certain tricks, such as writing
switch statements in c with jsval cases are no longer legal.
DocShell
at the moment, the transition from webshell to docshell is not fully completed, but the long-term goal is to remove webshell and
switch over entirely to docshell.
Embedded Dialog API
its promptservice dialogs can be
switched between default and overridden by moving the override dll into or out of the library search path.
Querying Places
example of detecting the type of a node
switch(node.type) { case node.result_type_uri: dump("uri result " + node.uri + "\n"); break; case node.result_type_visit: var visit = node.queryinterface(ci.nsinavhistoryvisitresultnode); dump("visit result " + node.uri + " session = " + visit.sessionid + "\n"); break; case node.result_type_full_visit: var fullvisit = node.queryinterface(ci.nsinavhistoryfullvisitresultnode)...
Using the Places history service
if database initialization completes correctly a "places-init-complete" topic is notified, at this point is possible to look for database status: var databasestatus = historyservice.databasestatus;
switch (databasestatus) { case historyservice.database_status_ok: // database did already exist and has been correctly initialized.
Avoiding leaks in JavaScript XPCOM components
consider this example from bug 285065: function _filterradiogroup(anode) {
switch (anode.localname) { case "radio": return nodefilter.filter_accept; case "template": case "radiogroup": return nodefilter.filter_reject; default: return nodefilter.filter_skip; } } var iterator = this.ownerdocument.createtreewalker(this, nodefilter.show_element, _filterradiogroup, true); while...
Starting WebLock
another area of code, such as a "profile manager" that starts up and lets users choose which profile to use, may unconditionally call unlock on such a component when
switching a profile.
Using XPCOM Components
this service, which is defined in the basic nsisupports interface and implemented by all xpcom components, allows you to query and
switch interfaces on a component as part of the runtime object typing capabilities of xpcom.
Using XPCOM Utilities to Make Things Easier
although we haven't formally introduced these two interfaces, the next code sample shows how simple it is to
switch between these two interfaces: someclass::dosomething(nsifile* afile) { if (!afile) return ns_error_null_pointer; nsresult rv; nscomptr<nsilocalfile> localfile = do_queryinterface(afile, &rv); // ...
Index
these values map onto the values defined in mozilla/security/nss/lib/softoken/pkcs11t.h and are
switched to ckm_*_hmac constant.
Components.lastResult
try { var i = foo.bar();
switch (components.lastresult) { case components.results.ns_ok: // ns_ok is good!
Monitoring HTTP activity
// define a reference to the interfacevar nsihttpactivityobserver = components.interfaces.nsihttpactivityobserver; var httpobserver = { observeactivity: function(ahttpchannel, aactivitytype, aactivitysubtype, atimestamp, aextrasizedata, aextrastringdata) { if (aactivitytype == nsihttpactivityobserver.activity_type_http_transaction) {
switch(aactivitysubtype) { case nsihttpactivityobserver.activity_subtype_response_header: // received response header break; case nsihttpactivityobserver.activity_subtype_response_complete: // received complete http response break; } } } }; then you need to install your activity observer.
nsICryptoHMAC
these values map onto the values defined in mozilla/security/nss/lib/softoken/pkcs11t.h and are
switched to ckm_*_hmac constant.
nsIDownloadProgressListener
onsecuritychange() called when the level of security being used while downloading changes; for example, if the initial request is made via https but the download
switches to http, this function gets called to notify you of that transition.
nsIEditor
in nsidomnode node, in nsidomnode parent, in long aposition); void splitnode(in nsidomnode existingrightnode, in long offset, out nsidomnode newleftnode); void joinnodes(in nsidomnode leftnode, in nsidomnode rightnode, in nsidomnode parent); void deletenode(in nsidomnode child); void marknodedirty(in nsidomnode node); direction controller void
switchtextdirection(); output methods astring outputtostring(in astring formattype, in unsigned long flags); example: // flags are declared in base/public/nsidocumentencoder.idl // outputselectiononly = 1, outputformatted = 2, // outputraw = 4, outputbodyonly = 8, // outputpreformatted = 16, outputwrap = 32, // outputformatflowed = 64, ...
nsIFrameScriptLoader
if present and set to true, this flag
switches off that behavior, meaning that the script's scope is shared with any other frame scripts in the same frame that have also set the flag.
nsIPrivateBrowsingService
lastchangedbycommandline boolean indicates whether or not the last private browsing mode transition was performed on the command line (using either the -private or -private-toggle
switches) rather than the user interface.
nsITextInputProcessorCallback
example of simple js-ime: var simpleime = { _hasfocus: false, _hasrightstocompose: false, _tip: null, _callback: function simpleime_callback(atip, anotification) { try {
switch (anotification.type) { case "request-to-commit": atip.commitcomposition(); break; case "request-to-cancel": atip.cancelcomposition(); break; case "notify-focus": this._hasfocus = true; break; case "notify-blur": this._hasfocus = false; break; case "notify-detached": th...
nsITreeBoxObject
void endupdatebatch(); clearstyleandimagecaches() called on a theme
switch to flush out the tree's style and image caches.
nsIXMLHttpRequest
tzsche.do", true); req.send('your=data&and=more&stuff=here'); example 2 var {cu: utils, cc: classes, ci: instances} = components; cu.import('resource://gre/modules/services.jsm'); function xhr(url, cb) { let xhr = cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createinstance(ci.nsixmlhttprequest); let handler = ev => { evf(m => xhr.removeeventlistener(m, handler, !1));
switch (ev.type) { case 'load': if (xhr.status == 200) { cb(xhr.response); break; } default: services.prompt.alert(null, 'xhr error', 'error fetching package: ' + xhr.statustext + ' [' + ev.type + ':' + xhr.status + ']'); break; } }; let evf = f => ['load', 'er...
Troubleshooting XPCOM components registration
(the -r
switch from gnu ldd lists function relocations; adjust as suitable for your version) trace shared library loading by setting the environment variable ld_debug=all while launching firefox (see `man ld.so` for details).
Mozilla technologies
at the moment, the transition from webshell to docshell is not fully completed, but the long-term goal is to remove webshell and
switch over entirely to docshell.embedded dialog apifeed content access apifirefox 2 and thunderbird 2 introduce a series of interfaces that make it easy for extension authors to access rss and atom feeds.life after xul: building firefox interfaces with htmlthis page gathers technical solutions to common problems encountered by teams shipping html-based interfaces inside firefox.morkmork is a database f...
Account Provisioner
if the user already has an email account, the user can
switch to the original account setup wizard.
Index
if the user already has an email account, the user can
switch to the original account setup wizard.
Using the Mozilla source server
ollowing 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!
Working with ArrayBuffers
var lib;
switch (os.constants.sys.name.tolowercase()) { case 'winnt': case 'winmo': case 'winnt': //windows lib = ctypes.open('msvcrt'); break; case 'darwin': // mac lib = ctypes.open('libc.dylib'); break; case 'freebsd': lib = ctypes.open('libc.so.7'); break; case 'openbsd': lib = ctypes.open('libc.so.61.0'); break; case...
Drawing and Event Handling - Plugins
the browser is also responsible for sending the plug-in all events targeted to an instance, such as mouse clicks when the cursor is within the instance rectangle or suspend and resume events when the application is
switched in and out.
Set event listener breakpoints - Firefox Developer Tools
so if we choose to log keyboard events, for example, the code no longer pauses as each event is fired: instead, we can then
switch to the console, and whenever we press a key we are given a log of where related events were fired.
Index - Firefox Developer Tools
after firefox 48, the default view is the tree map view, and you can
switch to the aggregate view using the dropdown labeled "view:": 39 basic operations before firefox 50, the memory tool is not enabled by default.
Network request details - Firefox Developer Tools
the tabs at the top of this pane enable you to
switch between the following pages: headers messages (only for websocket items) cookies params response cache timings security (only for secure pages) stack trace (only when the request has a stack trace, e.g.
Network Monitor - Firefox Developer Tools
this means you can start debugging a page in, for example, the web console, then
switch to the network monitor to see network activity without having to reload the page.
Page inspector 3-pane mode - Firefox Developer Tools
enabling the 3-pane inspector pre-firefox 62 in earlier versions of firefox (since firefox 59/60), you can enable 3 pane mode in release/beta by going to about:config and flipping the following prefs to true: devtools.inspector.split-rule-enabled — this
switches 3-pane mode on and off.
Work with animations - Firefox Developer Tools
right-click in the box and select "inspect element" make sure the selected element is the <div class="channel">
switch over to the "animations" tab play the animation let's take a closer look at the contents of the animation inspector here: it shows a synchronized timeline for every animation applied to the selected element or its children.
Paint Flashing Tool - Firefox Developer Tools
margin: 2%; padding: 2%; background-color: blue; color: white; font-size: 24px; } #moving-box-left-margin { transition: margin-left 4s; } #moving-box-transform { transition: transform 4s; } body:hover #moving-box-left-margin{ margin-left: 74%; } body:hover #moving-box-transform { transform: translate(300%); } to see the transition, move the mouse into the space below: now
switch paint flashing on, and try it again.
Allocations - Firefox Developer Tools
if you click this link, the devtools
switches to the allocations view, and selects the region of time from the end of the last gc cycle to the start of the one you clicked on.
Frame rate - Firefox Developer Tools
switch to the flame chart to see the call stack at that point: the offending function is called dopointlesscomputations(), and it's defined in "main.js".
How to - Firefox Developer Tools
select a tool to
switch between the waterfall, call tree, and flame chart tools, use the buttons in the toolbar: configure markers displayed to control which markers are shown in the waterfall, use the button in the toolbar: zoom in to zoom into a slice of the recording, select that slice in the recording overview: ...
Toolbox - Firefox Developer Tools
toolbox-hosted tools then there is an array of labeled buttons which enables you to
switch between the different tools hosted by the toolbox.
Rich output - Firefox Developer Tools
atus: "to do", description: "normalize table", datecreated: 1552404533790 } ​ length: 4 ​ <prototype>: array [] debugger eval code:1:9 undefined highlighting and inspecting dom nodes if you hover the mouse over any dom element in the console output, it's highlighted on the page: in the screenshot above you'll also see a blue "target" icon next to the node in the console output: click it to
switch to the inspector with that node selected.
Managing screen orientation - Web APIs
if application a is locked to landscape and application b is locked to portrait,
switching from application a to b or b to a will not fire an orientationchange event because both applications will keep the orientation they had.
Compositing example - Web APIs
0, v = o.v / 100, r, g, b; var a, b, c, d; if (s == 0) { r = g = b = math.round(v * 255); } else { if (h >= 1) h = 0; h = 6 * h; d = h - math.floor(h); a = math.round(255 * v * (1 - s)); b = math.round(255 * v * (1 - (s * d))); c = math.round(255 * v * (1 - (s * (1 - d)))); v = math.round(255 * v);
switch (math.floor(h)) { case 0: r = v; g = c; b = a; break; case 1: r = b; g = v; b = a; break; case 2: r = a; g = v; b = c; break; case 3: r = a; ...
Document.execCommand() - Web APIs
when an html document has been
switched to designmode, its document object exposes an execcommand method to run commands that manipulate the current editable region, such as form inputs or contenteditable elements.
Document.hasFocus() - Web APIs
to test the functionality of hasfocus(), click on the button to open a new window, and try
switching between the two pages.
Document.ononline - Web APIs
the document.online event is fired on the <body> of each page when the browser
switches between online and offline mode.
Document.queryCommandState() - Web APIs
example html <div contenteditable="true">select a part of this text!</div> <button onclick="makebold();">test the state of the 'bold' command</button> javascript function makebold() { var state = document.querycommandstate("bold");
switch (state) { case true: alert("the bold formatting will be removed from the selected text."); break; case false: alert("the selected text will be displayed in bold."); break; case null: alert("the state of the 'bold' command is indeterminable."); break; } document.execcommand('bold'); } result specifications specification status ...
Document.readyState - Web APIs
examples different states of readiness
switch (document.readystate) { case "loading": // the document is still loading.
Document - Web APIs
fullscreenerror fired if an error occurs while attempting to
switch into or out of full-screen mode.
Document Object Model (DOM) - Web APIs
ement svgmaskelement svgmeshelement svgmeshgradientelement svgmeshpatchelement svgmeshrowelement svgmetadataelement svgmissingglyphelement svgmpathelement svgpathelement svgpatternelement svgpolylineelement svgpolygonelement svgradialgradientelement svgrectelement svgscriptelement svgsetelement svgsolidcolorelement svgstopelement svgstyleelement svgsvgelement svg
switchelement svgsymbolelement svgtextcontentelement svgtextelement svgtextpathelement svgtextpositioningelement svgtitleelement svgtrefelement svgtspanelement svguseelement svgunknownelement svgviewelement svgvkernelement svg data type interfaces here are the dom apis for data types used in the definitions of svg properties and attributes.
EffectTiming.direction - Web APIs
"reverse" the animation runs backwards, or "rewinds." "alternate" the animation
switches direction after each iteration, going forward through the animation sequence the first iteration, then backward through the sequence the second iteration, and so forth.
EffectTiming - Web APIs
direction optional whether the animation runs forwards (normal), backwards (reverse),
switches direction after each iteration (alternate), or runs backwards and
switches direction after each iteration (alternate-reverse).
Element.animate() - Web APIs
direction optional whether the animation runs forwards (normal), backwards (reverse),
switches direction after each iteration (alternate), or runs backwards and
switches direction after each iteration (alternate-reverse).
Element - Web APIs
fullscreenerror sent to an element if an error occurs while attempting to
switch it into or out of full-screen mode.
Using the Frame Timing API - Web APIs
var observe_all = new performanceobserver(function(list) { var perfentries = list.getentries(); for (var i=0; i < perfentries.length; i++) {
switch (perfentries[i].entrytype) { case "frame": process_frame(perfentries[i]); break; case "mark": process_mark(perfentries[i]); break; case "measure": process_measure(perfentries[i]); break; case "resource": process_resource(perfentries[i]); break; default: console.log("unexpected performance entry type: " + perfentries[i].entrytype); } } }); // observe fra...
FullscreenOptions.navigationUI - Web APIs
let elem = document.documentelement; elem.requestfullscreen({ navigationui: "show" }).then({}).catch(err => { alert(`an error occurred while trying to
switch into full-screen mode: ${err.message} (${err.name})`); }); the promise's resolve handler does nothing, but if the promise is rejected, an error message is displayed by calling alert().
GlobalEventHandlers.onpointerdown - Web APIs
var targetbox = document.getelementbyid("target"); targetbox.onpointerdown = handledown; function handledown(evt) { var action;
switch(evt.pointertype) { case "mouse": action = "clicking"; break; case "pen": action = "tapping"; break; case "touch": action = "touching"; break; default: action = "interacting with"; break; } targetbox.innerhtml = "<strong>thanks for " + action + " me!</strong>"; evt.preventdefault(); } this simply uses onpointerdown to establis...
HTMLAreaElement - Web APIs
element.accesskey is a domstring containing a single character that
switches input focus to the control.
HTMLImageElement.sizes - Web APIs
buttons at the bottom of the example let you actually modify the sizes property slightly,
switching the largest of the three widths for the image between 40em and 50em.
HTMLInputElement - Web APIs
accesskey string: returns a string containing a single character that
switches input focus to the control when pressed.
HTMLSelectElement.type - Web APIs
example
switch (select.type) { case 'select-multiple': // multiple values may be selected break; case 'select-one': // only one value may be selected break; default: // non-standard value (or this isn't a select element) } specifications specification status comment html living standardthe definition of 'htmlselectelement' in that specification.
In depth: Microtasks and the JavaScript runtime environment - Web APIs
consider the javascript program below: let outputelem = document.getelementbyid("output"); let userlanguages = { "mike": "en", "teresa": "es" }; function greetuser(user) { function localgreeting(user) { let greeting; let language = userlanguages[user];
switch(language) { case "es": greeting = `¡hola, ${user}!`; break; case "en": default: greeting = `hello, ${user}!`; break; } return greeting; } outputelem.innerhtml += localgreeting(user) + "<br>\r"; } greetuser("mike"); greetuser("teresa"); greetuser("veronica"); this short program contains three execution contexts, some of which are cre...
Drag Operations - Web APIs
although the exact keys used vary by platform, typically the shift and control keys would be used to
switch between copying, moving, and linking.
Checking when a deadline is due - Web APIs
switch(cursor.value.month) { case "january": var monthnumber = 0; break; case "february": var monthnumber = 1; break; // other lines removed from listing for brevity case "december": var monthnumber = 11; break; default: alert('incorrect month entered in database.'); } the first thing w...
Using IndexedDB - Web APIs
switching direction is accomplished by passing prev to the opencursor() function as the second argument: objectstore.opencursor(boundkeyrange, "prev").onsuccess = function(event) { var cursor = event.target.result; if (cursor) { // do something with the entries.
compareVersion - Web APIs
extension, theme, and plug-in developers must
switch away from install.js based packages to the new packaging scheme with an install.rdf manifest.
getVersion - Web APIs
extension, theme, and plug-in developers must
switch away from install.js based packages to the new packaging scheme with an install.rdf manifest.
KeyboardEvent.code - Web APIs
window.addeventlistener("keydown", function(event) { if (event.defaultprevented) { return; // do nothing if event already handled }
switch(event.code) { case "keys": case "arrowdown": // handle "back" updateposition(-moverate); break; case "keyw": case "arrowup": // handle "forward" updateposition(moverate); break; case "keya": case "arrowleft": // handle "turn left" angle -= turnrate; break; case "keyd": case "arrowright": // handle "turn ri...
KeyboardEvent.key - Web APIs
window.addeventlistener("keydown", function (event) { if (event.defaultprevented) { return; // do nothing if the event was already processed }
switch (event.key) { case "down": // ie/edge specific value case "arrowdown": // do something for "down arrow" key press.
KeyframeEffect.KeyframeEffect() - Web APIs
direction optional whether the animation runs forwards (normal), backwards (reverse),
switches direction after each iteration (alternate), or runs backwards and
switches direction after each iteration (alternate-reverse).
KeyframeEffectOptions - Web APIs
direction optional whether the animation runs forwards (normal), backwards (reverse),
switches direction after each iteration (alternate), or runs backwards and
switches direction after each iteration (alternate-reverse).
MediaError.message - Web APIs
the error handler looks like this: audioelement.onerror = function() { let s = ""; let err = audioelement.error;
switch(err.code) { case mediaerror.media_err_aborted: s += "the user canceled the audio."; break; case mediaerror.media_err_network: s+= "a network error occurred while fetching the audio."; break; case mediaerror.media_err_decode: s+= "an error occurred while decoding the audio."; break; case mediaerror.media_err_src_not_supported:...
MediaQueryList - Web APIs
removelistener() removes the specified listener callback from the callbacks to be invoked when the mediaquerylist changes media query status, which happens any time the document
switches between matching and not matching the media queries listed in the mediaquerylist.
MediaRecorder.onerror - Web APIs
function recordstream(stream) { let recorder = null; let bufferlist = []; try { recorder = new mediarecorder(stream); } catch(err) { return err.name; /* return the error name */ } recorder.ondataavailable = function(event) { bufferlist.push(event.data); }; recorder.onerror = function(event) { let error = event.error;
switch(error.name) { case invalidstateerror: shownotification("you can't record the video right " + "now.
MediaSession.setActionHandler() - Web APIs
g multiple actions in one handler function you can also, if you prefer, use a single function to handle multiple action types, by checking the value of the mediasessionactiondetails object's action property: let skiptime = 7; navigator.mediasession.setactionhandler("seekforward", handleseek); navigator.mediasession.setactionhandler("seekbackward", handleseek); function handleseek(details) {
switch(details.action) { case "seekforward": audio.currenttime = math.min(audio.currenttime + skiptime, audio.duration); break; case "seekbackward": audio.currenttime = math.max(audio.currenttime - skiptime, 0); break; } } here, the handleseek() function handles both seekbackward and seekforward actions.
Media Session action types - Web APIs
g multiple actions in one handler function you can also, if you prefer, use a single function to handle multiple action types, by checking the value of the mediasessionactiondetails object's action property: let skiptime = 7; navigator.mediasession.setactionhandler("seekforward", handleseek); navigator.mediasession.setactionhandler("seekbackward", handleseek); function handleseek(details) {
switch(details.action) { case "seekforward": audio.currenttime = math.min(audio.currenttime + skiptime, audio.duration); break; case "seekbackward": audio.currenttime = math.max(audio.currenttime - skiptime, 0); break; } } here, the handleseek() function handles both seekbackward and seekforward actions.
MediaSessionActionDetails - Web APIs
g multiple actions in one handler function you can also, if you prefer, use a single function to handle multiple action types, by checking the value of the mediasessionactiondetails object's action property: let skiptime = 7; navigator.mediasession.setactionhandler("seekforward", handleseek); navigator.mediasession.setactionhandler("seekbackward", handleseek); function handleseek(details) {
switch(details.action) { case "seekforward": audio.currenttime = math.min(audio.currenttime + skiptime, audio.duration); break; case "seekbackward": audio.currenttime = math.max(audio.currenttime - skiptime, 0); break; } } here, the handleseek() function handles both seekbackward and seekforward actions.
MediaStreamTrack.getConstraints() - Web APIs
function
switchcameras(track, camera) { const constraints = track.getconstraints(); constraints.facingmode = camera; track.applyconstraints(constraints); } specifications specification status comment media capture and streamsthe definition of 'getconstraints()' in that specification.
Capabilities, constraints, and settings - Web APIs
function
switchcameras(track, camera) { let constraints = track.getconstraints(); constraints.facingmode = camera; track.applyconstraints(constraints); } this function accepts a mediastreamtrack and a string indicating the camera facing mode to use, fetches the current constraints, sets the value of the mediatrackconstraints.facingmode to the specified value, then applies the updated constraint set.
MouseEvent.button - Web APIs
example html <button id="button" oncontextmenu="event.preventdefault();">click here with your mouse...</button> <p id="log"></p> javascript let button = document.queryselector('#button'); let log = document.queryselector('#log'); button.addeventlistener('mouseup', logmousebutton); function logmousebutton(e) { if (typeof e === 'object') {
switch (e.button) { case 0: log.textcontent = 'left button clicked.'; break; case 1: log.textcontent = 'middle button clicked.'; break; case 2: log.textcontent = 'right button clicked.'; break; default: log.textcontent = `unknown button code: ${e.button}`; } } } result specifications specification stat...
MutationObserver.MutationObserver() - Web APIs
the callback function function callback(mutationlist, observer) { mutationlist.foreach( (mutation) => {
switch(mutation.type) { case 'childlist': /* one or more children have been added to and/or removed from the tree.
MutationObserverInit.attributeFilter - Web APIs
function callback(mutationlist) { mutationlist.foreach(function(mutation) {
switch(mutation.type) { case "attributes":
switch(mutation.attributename) { case "status": userstatuschanged(mutation.target.username, mutation.target.status); break; case "username": usernamechanged(mutation.oldvalue, mutation.target.username); break; } break; } }); } var userlistelement = document.
MutationObserverInit.attributeOldValue - Web APIs
function callback(mutationlist) { mutationlist.foreach(function(mutation) {
switch(mutation.type) { case "attributes": notifyuser("attribute name " + mutation.attributename + " changed to " + mutation.target[mutation.attributename] + " (was " + mutation.oldvalue + ")"); break; } }); } var targetnode = document.queryselector("#target"); var observer = new mutationobserver(callback); observer.observe(targetnode, { attributes...
MutationObserverInit.attributes - Web APIs
function callback(mutationlist) { mutationlist.foreach(function(mutation) {
switch(mutation.type) { case "attributes": notifyuser("attribute name " + mutation.attributename + " changed to " + mutation.target[mutation.attributename] + " (was " + mutation.oldvalue + ")"); break; } }); } var targetnode = document.queryselector("#target"); var observer = new mutationobserver(callback); observer.observe(targetnode, { attributes...
Using Navigation Timing - Web APIs
the new code looks like this: window.addeventlistener("load", function() { let now = new date().gettime(); let loadingtime = now - performance.timing.navigationstart; output = "load time: " + loadingtime + " ms<br/>"; output += "navigation type: ";
switch(performance.navigation.type) { case performancenavigation.type_navigate: output += "navigation"; break; case performancenavigation.type_reload: output += "reload"; break; case performancenavigation.type_back_forward: output += "history"; break; default: output += "unknown"; break; } output += "<br/>redirects: " + ...
Network Information API - Web APIs
a real-world use case would likely use a
switch statement or some other method to check all of the possible values of networkinformation.type.
Notifications API - Web APIs
these are outside the top-level browsing context viewport, so therefore can be displayed even when the user has
switched tabs or moved to a different app.
PaymentMethodChangeEvent.methodDetails - Web APIs
request.onpaymentmethodchange = function(ev) { const { type: cardtype } = ev.methoddetails; const newstuff = {}; if (ev.methodname === "https://apple.com/apple-pay") {
switch (cardtype) { case "visa": // do apple pay specific handling for visa card...
PaymentMethodChangeEvent.methodName - Web APIs
request.onpaymentmethodchange = function(ev) { const { type: cardtype } = ev.methoddetails; const newstuff = {}; if (ev.methodname === "https://apple.com/apple-pay") {
switch (cardtype) { case "visa": // do apple pay specific handling for visa card...
PaymentMethodChangeEvent - Web APIs
the paymentmethodchangeevent interface of the payment request api describes the paymentmethodchange event which is fired by some payment handlers when the user
switches payment instruments (e.g., a user selects a "store" card to make a purchase while using apple pay).
PaymentRequest - Web APIs
paymentmethodchange secure context with some payment handlers (e.g., apple pay), dispatched whenever the user changes payment instrument, like
switching from a credit card to a debit card.
Payment Request API - Web APIs
paymentmethodchangeevent represents the user changing payment instrument (e.g.,
switching from a credit card to debit card).
PointerEvent.pointerType - Web APIs
targetelement.addeventlistener('pointerdown', function(event) { // call the appropriate pointer type handler
switch (event.pointertype) { case 'mouse': process_pointer_mouse(event); break; case 'pen': process_pointer_pen(event); break; case 'touch': process_pointer_touch(event); break; default: console.log(`pointertype ${event.pointertype} is not suported`); } }, false); specifications specification status comment pointer ev...
Pointer events - Web APIs
pressure handler } function process_non_primary(event) { // non primary handler } function down_handler(ev) { // calculate the touch point's contact area var area = ev.width * ev.height; // compare cached id with this event's id and process accordingly if (id == ev.identifier) process_id(ev); // call the appropriate pointer type handler
switch (ev.pointertype) { case "mouse": process_mouse(ev); break; case "pen": process_pen(ev); break; case "touch": process_touch(ev); break; default: console.log("pointertype " + ev.pointertype + " is not suported"); } // call the tilt handler if (ev.tiltx != 0 && ev.tilty != 0) proc...
RTCDTMFSender - Web APIs
the primary purpose for webrtc's dtmf support is to allow webrtc-based communication clients to be connected to a public-
switched telephone network (pstn) or other legacy telephone service, including extant voice over ip (voip) services.
RTCDataChannel: error event - Web APIs
id mandatory parameter", "unrecognized parameters", "no user data (sctp data chunk has no data)", "cookie received while shutting down", "restart of an association with new addresses", "user-initiated abort", "protocol violation" ]; dc.addeventlistener("error", ev => { const err = ev.error; console.error("webrtc error: ", err.message); // handle specific error detail types
switch(err.errordetail) { case "sdp-syntax-error": console.error(" sdp syntax error in line ", err.sdplinenumber); break; case "idp-load-failure": console.error(" identity provider load failure: http error ", err.httprequeststatuscode); break; case "sctp-failure": if (err.sctpcausecode < sctpcausecodes.length) { console.error(" ...
RTCDataChannel.protocol - Web APIs
example var pc = new rtcpeerconnection(); var dc = pc.createdatachannel("my channel", { protocol: "json" }); function handlechannelmessage(datachannel, msg) {
switch(datachannel.protocol) { case "json": /* process json data */ break; case "raw": /* process raw binary data */ break; } } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcdatachannel.protocol' in that specification.
RTCDataChannel.readyState - Web APIs
example var datachannel = peerconnection.createdatachannel("file transfer"); var sendqueue = []; function sendmessage(msg) {
switch(datachannel.readystate) { case "connecting": console.log("connection not open; queueing: " + msg); sendqueue.push(msg); break; case "open": sendqueue.foreach((msg) => datachannel.send(msg)); break; case "closing": console.log("attempted to send message while closing: " + msg); break; case "closed": console.log("error!
RTCDtlsTransport.state - Web APIs
*/ function tallysenders(pc) { let results = { transportmissing: 0, connectionpending: 0, connected: 0, closed: 0, failed: 0, unknown: 0 }; let senderlist = pc.getsenders(); senderlist.foreach(sender => { let transport = sender.transport; if (!transport) { results.transportmissing++; } else {
switch(transport.state) { case "new": case "connecting": results.connectionpending++; break; case "connected": results.connected++; break; case "closed": results.closed++; break; case "failed": results.failed++; break; default: results.unknown++; break; } ...
RTCDtlsTransport - Web APIs
*/ function tallysenders(pc) { let results = { transportmissing: 0, connectionpending: 0, connected: 0, closed: 0, failed: 0, unknown: 0 }; let senderlist = pc.getsenders(); senderlist.foreach(sender => { let transport = sender.transport; if (!transport) { results.transportmissing++; } else {
switch(transport.state) { case "new": case "connecting": results.connectionpending++; break; case "connected": results.connected++; break; case "closed": results.closed++; break; case "failed": results.failed++; break; default: results.unknown++; break; } ...
RTCIceCandidate.relatedAddress - Web APIs
switch(candidate.type) { case "host": console.log("host candidate's ip address is " + candidate.ip); break; case "srflx": console.log("server reflexive candidate's base address is " + candidate.relatedaddress + "; reachable at " + candidate.ip); break; case "prflx": console.log("peer reflexive candidate's base address is " + candidate.relatedaddress + "; reachab...
RTCIceCandidateStats - Web APIs
const isusablenetworktype = stats => {
switch(stats.networktype) { case "ethernet": case "vpn": return true; case "bluetooth": case "cellular": case "wimax": case "unknown": default: return false; } } if (rtcstats && rtcstats.type === "local-candidate") { if (!isusablenetworktype(rtcstats)) { abortconnection(); return; } } this code calls a function called abortconnection() if the rtc...
RTCInboundRtpStreamStats.qpSum - Web APIs
function calculateaverageqp(stats) { let framecount = 0;
switch(stats.type) { case "inbound-rtp": case "remote-inbound-rtp": framecount = stats.framesdecoded; break; case "outbound-rtp": case "remote-outbound-rtp": framecount = stats.framesencoded; break; default: return 0; } return status.qpsum / framecount; } specifications specification status comment identifiers for webrtc's...
RTCOutboundRtpStreamStats.qpSum - Web APIs
function calculateaverageqp(stats) { let framecount = 0;
switch(stats.type) { case "inbound-rtp": case "remote-inbound-rtp": framecount = stats.framesdecoded; break; case "outbound-rtp": case "remote-outbound-rtp": framecount = stats.framesencoded; break; default: return 0; } return status.qpsum / framecount; } specifications specification status comment identifiers for webrtc's...
RTCPeerConnection.currentLocalDescription - Web APIs
unlike rtcpeerconnection.localdescription, this value represents the actual current state of the local end of the connection; localdescription may specify a description which the connection is currently in the process of
switching over to.
RTCPeerConnection.currentRemoteDescription - Web APIs
unlike rtcpeerconnection.remotedescription, this value represents the actual current state of the local end of the connection; remotedescription may specify a description which the connection is currently in the process of
switching over to.
RTCPeerConnection: icegatheringstatechange event - Web APIs
pc.onicegatheringstatechange = ev => { let connection = ev.target;
switch(connection.icegatheringstate) { case "gathering": /* collection of candidates has begun */ break; case "complete": /* collection of candidates is finished */ break; } } likewise, you can use addeventlistener() to add a listener for icegatheringstatechange events: pc.addeventlistener("icegatheringstatechange", ev => { let connection = ev.target;
switch(con...
RTCPeerConnection: icecandidate event - Web APIs
if you need to perform any special actions when there are no further candidates expected, you're much better off watching the ice gathering state by watching for icegatheringstatechange events: pc.addeventlistener("icegatheringstatechange", ev => {
switch(pc.icegatheringstate) { case "new": /* gathering is either just starting or has been reset */ break; case "gathering": /* gathering has begun or is ongoing */ break; case "complete": /* gathering has ended */ break; } }); as you can see in this example, the icegatheringstatechange event lets you know when the value of the rtcpeerconnection prope...
RTCPeerConnection.onconnectionstatechange - Web APIs
example pc.onconnectionstatechange = function(event) {
switch(pc.connectionstate) { case "connected": // the connection has become fully connected break; case "disconnected": case "failed": // one or more transports has terminated unexpectedly or in an error break; case "closed": // the connection has been closed break; } } specifications specification status comment webrtc ...
RTCPeerConnection.onicegatheringstatechange - Web APIs
the status is simply presented as text in a <div> element: <div id="icestatus"></div> the actual event handler looks like this: pc.onicegatheringstatechange = function() { let label = "unknown";
switch(pc.icegatheringstate) { case "new": case "complete": label = "idle"; break; case "gathering": label = "determining route"; break; } document.getelementbyid("icestatus").innerhtml = label; } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnection.onice...
RTCPeerConnection: signalingstatechange event - Web APIs
pc.addeventlistener("signalingstatechange", ev => {
switch(pc.signalingstate) { case "stable": updatestatus("ice negotiation complete"); break; } }, false); using onsignalingstatechange, it looks like this: pc.onsignalingstatechange = ev => {
switch(pc.signalingstate) { case "stable": updatestatus("ice negotiation complete"); break; } }; specifications specification status comment webrt...
RTCRtpStreamStats.qpSum - Web APIs
function calculateaverageqp(stats) { let framecount = 0;
switch(stats.type) { case "inbound-rtp": case "remote-inbound-rtp": framecount = stats.framesdecoded; break; case "outbound-rtp": case "remote-outbound-rtp": framecount = stats.framesencoded; break; default: return 0; } return status.qpsum / framecount; } specifications specification status comment identifiers for webrtc's...
SVGTransform - Web APIs
it is invalid to attempt to define a new value of this type or to attempt to
switch an existing value to this type.
SVGUnitTypes - Web APIs
it is invalid to attempt to define a new value of this type or to attempt to
switch an existing value to this type.
SVGZoomAndPan - Web APIs
it is invalid to attempt to define a new value of this type or to attempt to
switch an existing value to this type.
ServiceWorkerGlobalScope: push event - Web APIs
self.addeventlistener("push", event => { let message = event.data.json();
switch(message.type) { case "init": doinit(); break; case "shutdown": doshutdown(); break; } }, false); specifications specification status comment push apithe definition of 'push' in that specification.
TextRange - Web APIs
ie9 and later also gave up the document.selection object and
switched to the standard interface (although textrange has been reserved, it has lost its function in most cases).
TextTrack.mode - Web APIs
you can read this value to determine the current mode, and you can change this value to
switch modes.
Touch.force - Web APIs
for (var i=0; i < e.targettouches.length; i++) { // add code to "
switch" based on the force value.
TouchEvent.touches - Web APIs
switch (e.touches.length) { case 1: handle_one_touch(e); break; case 2: handle_two_touches(e); break; case 3: handle_three_touches(e); break; default: console.log("not supported"); break; } }, false); specifications specification status comment touch events – level 2 draft non-stable version.
Multi-touch interaction - Web APIs
function update_background(ev) { // change background color based on the number simultaneous touches // in the event's targettouches list: // yellow - one tap (or hold) // pink - two taps // lightblue - more than two taps
switch (ev.targettouches.length) { case 1: // single tap` ev.target.style.background = "yellow"; break; case 2: // two simultaneous touches ev.target.style.background = "pink"; break; default: // more than two simultaneous touches ev.target.style.background = "lightblue"; } } event logging the functions are used to log event activity to the applicatio...
Using Touch Events - Web APIs
// touchstart handler function process_touchstart(ev) { // use the event's data to call out to the appropriate gesture handlers
switch (ev.touches.length) { case 1: handle_one_touch(ev); break; case 2: handle_two_touches(ev); break; case 3: handle_three_touches(ev); break; default: gesture_not_supported(ev); break; } } access the attributes of a touch point.
Touch events - Web APIs
it is only intended as a guide.) function ontouch(evt) { evt.preventdefault(); if (evt.touches.length > 1 || (evt.type == "touchend" && evt.touches.length > 0)) return; var newevt = document.createevent("mouseevents"); var type = null; var touch = null;
switch (evt.type) { case "touchstart": type = "mousedown"; touch = evt.changedtouches[0]; break; case "touchmove": type = "mousemove"; touch = evt.changedtouches[0]; break; case "touchend": type = "mouseup"; touch = evt.changedtouches[0]; break; } newevt.initmouseevent(type, true, true, evt.originaltarget.ownerdocument.defaultview, 0...
TrackEvent - Web APIs
xttracks.addeventlistener("removetrack", handletrackevent, false); function handletrackevent(event) { var trackkind; if (event.target instanceof(videotracklist)) { trackkind = "video"; } else if (event.target instanceof(audiotracklist)) { trackkind = "audio"; } else if (event.target instanceof(texttracklist)) { trackkind = "text"; } else { trackkind = "unknown"; }
switch(event.type) { case "addtrack": console.log("added a " + trackkind + " track"); break; case "removetrack": console.log("removed a " + trackkind + " track"); break; } } the event handler uses the javascript instanceof operator to determine which type of track the event occurred on, then outputs to console a message indicating what kind of track it is and whether ...
TransformStream - Web APIs
async transform(chunk, controller) { chunk = await chunk
switch (typeof chunk) { case 'object': // just say the stream is done i guess if (chunk === null) controller.terminate() else if (arraybuffer.isview(chunk)) controller.enqueue(new uint8array(chunk.buffer, chunk.byteoffset, chunk.bytelength)) else if (array.isarray(chunk) && chunk.every(value => typeof value === 'number')) controller.enqueue(new u...
VideoPlaybackQuality.corruptedVideoFrames - Web APIs
example this example determines the percentage of frames which have been corrupted, and if the value is greater than 5%, calls a funciton called downgradevideo() that would be implemented to
switch to a different video that might tax the network less.
VideoPlaybackQuality.totalVideoFrames - Web APIs
var videoelem = document.getelementbyid("my_vid"); var quality = videoelem.getvideoplaybackquality(); if ((quality.corruptedvideoframes + quality.droppedvideoframes)/quality.totalvideoframes > 0.1) { lostframesthresholdexceeded(); } a similar algorithm might be used to attempt to
switch to a lower-resolution video that requires less bandwidth, in order to avoid dropping frames.
Creating 3D objects using WebGL - Web APIs
to do this efficiently, we're going to
switch from drawing using the vertices directly by calling the gl.drawarrays() method to using the vertex array as a table, and referencing individual vertices in that table to define the positions of each face's vertices, by calling gl.drawelements().
WebGL best practices - Web APIs
teximage/texsubimage uploads (particularly with videos) can cause pipeline flushes most texture uploads from dom elements will incur a processing pass that will temporarily
switch gl progams internally, causing a pipeline flush.
WebRTC API - Web APIs
telephony these interfaces and events are related to interactivity with public-
switched telephone networks (ptsns).
Writing WebSocket client applications - Web APIs
the client might receive, such as: login handshake message text user list updates the code that interprets these incoming messages might look like this: examplesocket.onmessage = function(event) { var f = document.getelementbyid("chatbox").contentdocument; var text = ""; var msg = json.parse(event.data); var time = new date(msg.date); var timestr = time.tolocaletimestring();
switch(msg.type) { case "id": clientid = msg.id; setusername(); break; case "username": text = "<b>user <em>" + msg.name + "</em> signed in at " + timestr + "</b><br>"; break; case "message": text = "(" + timestr + ") <b>" + msg.name + "</b>: " + msg.text + "<br>"; break; case "rejectusername": text = "<b>your username has been set to <em>"...
Writing WebSocket servers - Web APIs
that header looks something like the following (remember each header line ends with \r\n and put an extra \r\n after the last one to indicate the end of the header): http/1.1 101
switching protocols upgrade: websocket connection: upgrade sec-websocket-accept: s3pplmbitxaq9kygzzhzrbk+xoo= additionally, the server can decide on extension/subprotocol requests here; see miscellaneous for details.
Writing a WebSocket server in Java - Web APIs
if (get.find()) { matcher match = pattern.compile("sec-websocket-key: (.*)").matcher(data); match.find(); byte[] response = ("http/1.1 101
switching protocols\r\n" + "connection: upgrade\r\n" + "upgrade: websocket\r\n" + "sec-websocket-accept: " + base64.getencoder().encodetostring(messagedigest.getinstance("sha-1").digest((match.group(1) + "258eafa5-e914-47da-95ca-c5ab0dc85b11").getbytes("utf-8"))) + "\r\n\r\n").getbytes("utf-8"); out.write(response, 0, response.length); decoding messages after a succ...
Movement, orientation, and motion: A WebXR example - Web APIs
function handlekeydown(event) {
switch(event.key) { case "w": case "w": verticaldistance -= move_distance; break; case "s": case "s": verticaldistance += move_distance; break; case "a": case "a": transversedistance += move_distance; break; case "d": case "d": transversedistance -= move_distance; break; case "arrowup": axialdistance += move_distan...
Web Audio API best practices - Web APIs
if you have buttons that
switch audio on and off, using the aria role="
switch" attribute on them is a good option for signalling to assistive technology what the button's exact purpose is, and therefore making the app more accessible.
Using the Web Audio API - Web APIs
we have a play button that changes to a pause button when the track is playing: <button data-playing="false" role="
switch" aria-checked="false"> <span>play/pause</span> </button> before we can play our track we need to connect our audio graph from the audio source/input node to the destination.
Web Audio API - Web APIs
the keyboard allows you to
switch among the standard waveforms as well as one custom waveform, and you can control the master gain using a volume slider beneath the keyboard.
Window.fullScreen - Web APIs
notes
switching between regular window and full screen will fire the "resize" event on the corresponding window.
Window: offline event - Web APIs
the offline event of the window interface is fired when the browser has lost access to the network and the value of navigator.online
switches to false.
Window: online event - Web APIs
the online event of the window interface is fired when the browser has gained access to the network and the value of navigator.online
switches to true.
Window: pageshow event - Web APIs
javascript const events = [ "pagehide", "pageshow", "unload", "load" ]; const eventlogger = event => {
switch (event.type) { case "pagehide": case "pageshow": let ispersisted = event.persisted ?
XRPermissionDescriptor.mode - Web APIs
let xrpermissiondesc = { name: "xr", mode: "immersive-vr" }; if (navigator.permissions) { navigator.permissions.query(xrpermissiondesc).then(({state}) => {
switch(state) { case "granted": setupxr(); break; case "prompt": promptandsetupxr(); break; default: /* do nothing otherwise */ break; } .catch(err) { console.log(err); } } else { setupxr(); } specifications specification status comment webxr device apithe definition of 'xrpermissiondescriptor.mod...
XRPermissionDescriptor.optionalFeatures - Web APIs
xrreferencespace usage notes examples let xrpermissiondesc = { name: "xr", mode: "immersive-vr", optionalfeatures: [ "bounded-floor" ] }; if (navigator.permissions) { navigator.permissions.query(xrpermissiondesc).then(({state}) => {
switch(state) { case "granted": setupxr(); break; case "prompt": promptandsetupxr(); break; default: /* do nothing otherwise */ break; } .catch(err) { console.log(err); } } else { setupxr(); } specifications specification status comment webxr device apithe definition of 'xrpermissiondescriptor.opt...
XRPermissionDescriptor.requiredFeatures - Web APIs
let xrpermissiondesc = { name: "xr", mode: "immersive-ar", requiredfeatures: [ "local-floor" ] }; if (navigator.permissions) { navigator.permissions.query(xrpermissiondesc).then(({state}) => {
switch(state) { case "granted": setupxr(); break; case "prompt": promptandsetupxr(); break; default: /* do nothing otherwise */ break; } .catch(err) { console.log(err); } } else { setupxr(); } specifications specification status comment webxr device apithe definition of 'xrpermissiondescriptor.req...
XRPermissionDescriptor - Web APIs
let xrpermissiondesc = { name: "xr", mode: "immersive-vr", requiredfeatures: [ "local-floor" ] }; if (navigator.permissions) { navigator.permissions.query(xrpermissiondesc).then(({state}) => {
switch(state) { case "granted": setupxr(); break; case "prompt": promptandsetupxr(); break; default: /* do nothing otherwise */ break; } .catch(err) { console.log(err); } } else { setupxr(); } specifications specification status comment webxr device apithe definition of 'xrpermissiondescriptor' in...
XRSession: selectend event - Web APIs
xrsession.addeventlistener("select", onselectionevent); xrsession.addeventlistener("selectend", onselectionevent); function onselectionevent(event) { let source = event.inputsource; let targetobj = null; if (source.targetraymode != "tracked-pointer") { return; } let targetraypose = event.frame.getpose(source.targetrayspace, myrefspace); if (!targetraypose) { return; }
switch(event.type) { case "selectstart": targetobj = mybegintracking(targetraypose.matrix); break; case "select": mydropobject(targetobj, targetraypose.matrix); break; case "selectend": mystoptracking(targetobj, targetraypose.matrix); break; } } you can of course also set up a handler for selectend events by setting the xrsession object's onselectend e...
XRSession: selectstart event - Web APIs
xrsession.addeventlistener("select", onselectionevent); xrsession.addeventlistener("selectend", onselectionevent); function onselectionevent(event) { let source = event.inputsource; let targetobj = null; if (source.targetraymode != "tracked-pointer") { return; } let targetraypose = event.frame.getpose(source.targetrayspace, myrefspace); if (!targetraypose) { return; }
switch(event.type) { case "selectstart": targetobj = mybegintracking(targetraypose.matrix); break; case "select": mydropobject(targetobj, targetraypose.matrix); break; case "selectend": mystoptracking(targetobj, targetraypose.matrix); break; } } you can of course also set up a handler for selectend events by setting the xrsession object's onselectend e...
XRSession: squeezeend event - Web APIs
nt); xrsession.addeventlistener("squeeze", onsqueezeevent); xrsession.addeventlistener("squeezeend", onsqueezeevent); function onsqueezeevent(event) { let source = event.inputsource; let targetobj = null; if (source.targetraymode != "tracked-pointer") { return; } let targetraypose = event.frame.getpose(source.targetrayspace, myrefspace); if (!targetraypose) { return; }
switch(event.type) { case "squeezestart": targetobj = mybegintracking(targetraypose.matrix); break; case "squeeze": mydropobject(targetobj, targetraypose.matrix); break; case "squeezeend": mystoptracking(targetobj, targetraypose.matrix); break; } } you can of course also set up a handler these events by setting the xrsession object's onsqueezeend event...
XRSession: squeezestart event - Web APIs
nt); xrsession.addeventlistener("squeeze", onsqueezeevent); xrsession.addeventlistener("squeezeend", onsqueezeevent); function onsqueezeevent(event) { let source = event.inputsource; let targetobj = null; if (source.targetraymode != "tracked-pointer") { return; } let targetraypose = event.frame.getpose(source.targetrayspace, myrefspace); if (!targetraypose) { return; }
switch(event.type) { case "squeezestart": targetobj = mybegintracking(targetraypose.matrix); break; case "squeeze": mydropobject(targetobj, targetraypose.matrix); break; case "squeezeend": mystoptracking(targetobj, targetraypose.matrix); break; } } you can of course also set up a handler these events by setting the xrsession object's onsqueezeend event...
XRSession: visibilitychange event - Web APIs
examples this example demonstrates how to listen for a visibilitychange event on a webxr session, using addeventlistener() to begin listening for the event: navigator.xr.requestsession("inline").then((xrsession) => { xrsession.addeventlistener("visibilitychange", e => {
switch(e.session.visiblitystate) { case "visible": case "visible-blurred": mysessionvisible(true); break; case "hidden": mysessionvisible(false); break; } }); }); when a visibility state change occurs, the event is received and dispatched to a function mysessionvisible(), with a boolean parameter indicating whether or not the session is presently...
XRSessionEvent() - Web APIs
xrsession.addeventlistener("visibilitystate", e => {
switch(e.session.visibilitystate) { case "visible": case "visible-blurred": mysessionvisible(true); break; case "hidden": mysessionvisible(false); break; } }); specifications specification status comment webxr device apithe definition of 'xrsessionevent() constructor' in that specification.
XRSessionEvent.session - Web APIs
xrsession.addeventlistener("visibilitychange", e => {
switch(e.session.visibilitystate) { case "hidden": myenablerendering(true); break; case "visible": case "visible-blurred": myenablerendering(false); break; } }); this calls a function that reacts to the session's visibility state change.
XRSessionEvent - Web APIs
xrsession.addeventlistener("visibilitystate", e => {
switch(e.session.visibilitystate) { case "visible": case "visible-blurred": mysessionvisible(true); break; case "hidden": mysessionvisible(false); break; } }); specifications specification status comment webxr device apithe definition of 'xrsessionevent' in that specification.
XRSystem - Web APIs
to determine this, we call issessionsupported(), passing it the desired session option before enabling the button, immersivebutton, which the user can then use to
switch to immersive mode only if immersive vr mode is available.
msthumbnailclick - Web APIs
igger specific events on your site from the taskbar // add an event handlerdocument.addeventlistener('msthumbnailclick', onbuttonclicked, false); // add the buttons var btnplay = window.external.mssitemodeaddthumbbarbutton(iconuri, tooltip); // refresh the taskbar window.external.mssitemodeshowthumbbar(); // call a javascript function when the button is pressed function onbuttonclicked(e) {
switch (e.buttonid) { case btnplay: play(); break;} } see also microsoft api extensions ...
Web APIs
ent svgmatrix svgmeshelement svgmetadataelement svgmissingglyphelement svgnumber svgnumberlist svgpathelement svgpatternelement svgpoint svgpolygonelement svgpolylineelement svgpreserveaspectratio svgradialgradientelement svgrect svgrectelement svgrenderingintent svgsvgelement svgscriptelement svgsetelement svgsolidcolorelement svgstopelement svgstringlist svgstylable svgstyleelement svg
switchelement svgsymbolelement svgtrefelement svgtspanelement svgtests svgtextcontentelement svgtextelement svgtextpathelement svgtextpositioningelement svgtitleelement svgtransform svgtransformlist svgtransformable svgurireference svgunittypes svguseelement svgvkernelement svgviewelement svgzoomandpan screen screenorientation scriptprocessornode scrolltooptions securitypolicyviolationevent sele...
ARIA live regions - Accessibility
a working example of a simple year control for better understanding: <div id="date-input"> <label>year: <input type="text" id="year" value="1990" onblur="change(event)"/> </label> </div> <div id="date-output" aria-live="polite"> the set year is: <span id="year-output">1990</span> </div> function change(event) { var yearout = document.getelementbyid("year-output");
switch (event.target.id) { case "year": yearout.innerhtml = event.target.value; break; default: return; } }; without aria-atomic="true" the screenreader announces only the changed value of year.
Using the article role - Accessibility
possible effects on user agents and assistive technology when the user navigates an element assigned the role of article, assistive technologies that typically intercept standard keyboard events should
switch to document browsing mode, as opposed to passing keyboard events through to the web application.
Using ARIA: Roles, states, and properties - Accessibility
roles widget roles button checkbox gridcell link menuitem menuitemcheckbox menuitemradio option progressbar radio scrollbar searchbox separator (when focusable) slider spinbutton
switch tab tabpanel textbox treeitem composite roles the techniques below describe each composite role as well as their required and optional child roles.
ARIA Test Cases - Accessibility
- voiceover (leopard) n/a n/a - fail window-eyes fail fail - - nvda fail n/a - - zoom (leopard) pass n/a pass pass zoomtext - - - - orca - - - - document application with inner document expected at behavior: if a document/browser/virtual reading mode exists,
switch to that mode when the document or descendant of the document receives focus document is also treated as a landmark markup used: notes: results: at firefox ie opera safari jaws 9 - - n/a n/a jaws 10 - - - - voiceover (leopard) n/a n/a - fail window-eyes - - - - nvda - n/a ...
ARIA: article role - Accessibility
inside an application or other widget that causes screen readers and other assistive technologies to be in pass-through mode, an article can be used to indicate that these should
switch back to treating the enclosed content as regular web content.
ARIA: checkbox role - Accessibility
abelledby="chk1-label"></span> <label id="chk1-label" onclick="changecheckbox()" onkeypress="changecheckbox()">remember my preferences</label> css [role="checkbox"] { padding:5px; } [aria-checked="true"]::before { content: "[x]"; } [aria-checked="false"]::before { content: "[ ]"; } javascript function changecheckbox(event) { let item = document.getelementbyid('chkpref');
switch(item.getattribute('aria-checked')) { case "true": item.setattribute('aria-checked', "false"); break; case "false": item.setattribute('aria-checked', "true"); break; } } accessibility concerns when the checkbox role is added to an element, the user agent should do the following: expose the element as having a checkbox role ...
Operable - Accessibility
understanding target size 2.5.6 concurrent input mechanisms (aaa) added in 2.1 make sure people can use and
switch between different modes of input when interacting with digital content including touchscreen, keyboard, mouse, voice commands, or alternative input devices.
Text labels and names - Accessibility
this applies to all types of <input> items, as well as <button>, <output>, <select>, <textarea>, <progress> and <meter> elements, as well as any element with the
switch aria role.
: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.
Creating a cross-browser video player - Developer guides
- offer download --> <a href="video/tears-of-steel-battle-clip-medium.mp4">download mp4</a> </video> <figcaption>© blender foundation | <a href="http://mango.blender.org">mango.blender.org</a></figcaption> </figure> even though this player will define its own custom control set, the controls attribute is still added to the <video> element, and the player's default control set is
switched off later with javascript.
Overview of events and handlers - Developer guides
events and event handling become central to web programming with the addition of the language to browsers, accompanying a
switch in the rendering architecture of browsers from fetch and load page rendering to event driven, reflow based, page rendering.
Introduction to HTML5 - Developer guides
also, if you are not currently using utf-8, it's recommended that you
switch to it in your web pages, as it simplifies character handling in documents using different scripts.
Mobile Web Development - Developer guides
their screens are usually smaller, obviously, but they also usually automatically
switch the screen orientation between portrait and landscape mode as the user rotates the device.
The HTML autocomplete attribute - HTML: Hypertext Markup Language
form layout flexibility given that different countries write their address in different ways, with each field in different places within the address, and even different sets and numbers of fields entirely, it can be helpful if, when possible, your site is able to
switch to the layout expected by your users when presenting an address entry form, given the country the address is located within.
<img>: The Image Embed element - HTML: Hypertext Markup Language
implicit aria role with non-empty alt attribute or no alt attribute: img with empty alt attribute: no corresponding role permitted aria roles with non-empty alt attribute: button checkbox link menuitem menuitemcheckbox menuitemradio option progressbar scrollbar separator slider
switch tab treeitem with empty alt attribute, none or presentation with no alt attribute, no role permitted dom interface htmlimageelement specifications specification status comment referrer policythe definition of 'referrer attribute' in that specification.
<input>: The Input (Form Input) element - HTML: Hypertext Markup Language
with no list attribute: textbox with list attribute: combobox type=url with no list attribute: textbox with list attribute: combobox type=color|date|datetime-local|file|hidden|month|password|time|week: no corresponding role permitted aria roles type=button: link, menuitem, menuitemcheckbox, menuitemradio, option, radio,
switch, tab type=checkbox: button when used with aria-pressed, menuitemcheckbox, option,
switch type=image: link, menuitem, menuitemcheckbox, menuitemradio, radio,
switch type=radio: menuitemradio type=text with no list attribute: combobox, searchbox, spinbutton type=color|date|datetime|datetime-local|email|file|hidden|month|number|password|range|reset|search|submit|tel|url|week or t...
<p>: The Paragraph element - HTML: Hypertext Markup Language
switch back!">use pilcrow for paragraphs</button> </p> css p { margin: 0; text-indent: 3ch; } p.pilcrow { text-indent: 0; display: inline; } p.pilcrow + p.pilcrow::before { content: " ¶ "; } javascript document.queryselector('button').addeventlistener('click', function (event) { document.queryselectorall('p').foreach(function (paragraph) { paragraph.classlist.toggle('pilcrow'); ...
Cross-Origin Resource Sharing (CORS) - HTTP
what values webkit/safari consider “nonstandard” is not documented, except in the following webkit bugs: require preflight for non-standard cors-safelisted request headers accept, accept-language, and content-language allow commas in accept, accept-language, and content-language request headers for simple cors
switch to a blacklist model for restricted accept headers in simple cors requests no other browsers implement these extra restrictions, because they’re not part of the spec.
HTTP Index - HTTP
219 101
switching protocols http, http status code, informational, reference, websockets the http 101
switching protocols response code indicates the protocol the server is
switching to as requested by a client which sent the message including the upgrade request header.
HTTP Messages - HTTP
no changes are needed in the apis used by web developers to utilize http frames; when available in both the browser and the server, http/2 is
switched on and used.
HTTP response status codes - HTTP
101
switching protocol this code is sent in response to an upgrade request header from the client, and indicates the protocol the server is
switching to.
JavaScript Guide - JavaScript
chapters this guide is divided into several chapters: introduction about this guide about javascript javascript and java ecmascript tools hello world grammar and types basic syntax & comments declarations variable scope variable hoisting data structures and types literals control flow and error handling if...else
switch try/catch/throw error objects loops and iteration for while do...while break/continue for..in for..of functions defining functions calling functions function scope closures arguments & parameters arrow functions expressions and operators assignment & comparisons arithmetic operators bitwise & logical operators conditional (ternary) o...
Default parameters - JavaScript
'hi', 'happy birthday!') // ["david", "hi", "happy birthday!"] this functionality can be approximated like this, which demonstrates how many edge cases are handled: function go() { return ':p' } function withdefaults(a, b = 5, c = b, d = go(), e = this, f = arguments, g = this.value) { return [a, b, c, d, e, f, g] } function withoutdefaults(a, b, c, d, e, f, g) {
switch (arguments.length) { case 0: a; case 1: b = 5; case 2: c = b; case 3: d = go(); case 4: e = this; case 5: f = arguments; case 6: g = this.value; default: } return [a, b, c, d, e, f, g]; } withdefaults.call({value: '=^_^='}); // [undefined, 5, 5, ":p", {value:"=^_^="}, arguments, "=^_^="] withoutdefaults.call({value: '...
InternalError - JavaScript
example cases are mostly when something is too large, e.g.: "too many
switch cases", "too many parentheses in regular expression", "array initializer too large", "too much recursion".
eval() - JavaScript
parsing json (converting strings to javascript objects) if the string you're calling eval() on contains data (for example, an array: "[1, 2, 3]"), as opposed to code, you should consider
switching to json, which allows the string to use a subset of javascript syntax to represent data.
Lexical grammar - JavaScript
keywords reserved keywords as of ecmascript 2015 break case catch class const continue debugger default delete do else export extends finally for function if import in instanceof new return super
switch this throw try typeof var void while with yield future reserved keywords the following are reserved as future keywords by the ecmascript specification.
JavaScript reference - JavaScript
intl.locale intl.numberformat intl.pluralrules intl.relativetimeformat webassembly webassembly webassembly.module webassembly.instance webassembly.memory webassembly.table webassembly.compileerror webassembly.linkerror webassembly.runtimeerror statements javascript statements and declarations control flowblock break continue empty if...else
switch throw try...catch declarations var let const functions and classes function function* async function return class iterations do...while for for each...in for...in for...of for await...of while other debugger import label with expressions and operators javascript expressions and operators.
JavaScript
statements and declarations learn how do-while, for-in, for-of, try-catch, let, var, const, if-else,
switch, and more javascript statements and keywords work.
icons - Web app manifests
for example, they can be used to represent the web application amongst a list of other applications, or to integrate the web application with an os's task
switcher and/or system preferences.
theme_color - Web app manifests
this sometimes affects how the os displays the site (e.g., on android's task
switcher, the theme color surrounds the site).
Installing and uninstalling web apps - Progressive web apps (PWAs)
by reducing the user experience differential between the web app and native apps on the user's device, you reduce both the loss of any muscle memory they have revolving around the native interface of the device and the sensation of "something isn't quite right" that users can experience when
switching between native and web-based apps.
class - SVG: Scalable Vector Graphics
onvolvematrix> <fediffuselighting> <fedisplacementmap> <feflood> <fegaussianblur> <feimage> <femerge> <femorphology> <feoffset> <fespecularlighting> <fetile> <feturbulence> <filter> <font> <foreignobject> <g> <glyph> <glyphref> <image> <line> <lineargradient> <marker> <mask> <missing-glyph> <path> <pattern> <polygon> <polyline> <radialgradient> <rect> <stop> <svg> <
switch> <symbol> <text> <textpath> <title> <tref> <tspan> <use> ...
color-interpolation - SVG: Scalable Vector Graphics
as a presentation attribute, it can 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-rendering - SVG: Scalable Vector Graphics
as a presentation attribute, it can 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> html, body, svg { height: 100%; } <svg viewbox="0 0 480 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="white"/> <stop offset="100%" stop-color="darkseagreen"/> </radialgradient> </defs> <circle cx="...
enable-background - SVG: Scalable Vector Graphics
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> ]?
onclick - SVG: Scalable Vector Graphics
thirty-seven elements are using this attribute: <a>, <altglyph>, <animate>, <animatemotion>, <animatetransform>, <circle>, <defs>, <desc>, <ellipse>, <foreignobject>, <g>, <image>, <line>, <lineargradient>, <marker>, <metadata>, <mpath>, <path>, <pattern>, <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 spec...
opacity - SVG: Scalable Vector Graphics
as a presentation attribute, it can be applied to any element but it has effect only on the following elements: <a>, <audio>, <canvas>, <circle>, <ellipse>, <foreignobject>, <g>, <iframe>, <image>, <line>, <marker>, <path>, <polygon>, <polyline>, <rect>, <svg>, <
switch>, <symbol>, <text>, <textpath>, <tspan>, <use>, <unknown>, and <video> html, body, svg { height: 100%; } <svg viewbox="0 0 200 100" xmlns="http://www.w3.org/2000/svg"> <defs> <lineargradient 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> ...
pointer-events - SVG: Scalable Vector Graphics
// let's apply our color in the // element we actually clicked 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.
transform - SVG: Scalable Vector Graphics
as a presentation attribute, transform can be used by any element (in svg 1.1, only these 16 elements were allowed to use it: <a>, <circle>, <clippath>, <defs>, <ellipse>, <foreignobject>, <g>, <image>, <line>, <path>, <polygon>, <polyline>, <rect>, <
switch>, <text>, and <use>).
<a> - SVG: Scalable Vector Graphics
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 specification status comment scalable vector graphics (svg) 2the definition of '<a>' in that specification.
<defs> - SVG: Scalable Vector Graphics
fect, 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> specifications specification status comment scalable vector graphics (svg) 2the definition of '<defs>' in that specification.
<g> - SVG: Scalable Vector Graphics
-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> specifications specification status comment scalable vector graphics (svg) 2the definition of '<g>' in that specification.
<glyph> - SVG: Scalable Vector Graphics
usage context categoriestext content 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> attributes global attributes core attributes presentation attributes class style specific attributes d horiz-adv-x vert-origin-x vert-origin-y vert-adv-y unicode glyph-name orientation arabic-form lang dom interface this element implements the svgglyphelement interface.
<marker> - SVG: Scalable Vector Graphics
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 specification status comment svg markersthe definition of '<marker>' in that specification.
<mask> - SVG: Scalable Vector Graphics
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 specification status comment css masking module level 1the definition of '<mask>' in that specification.
<missing-glyph> - SVG: Scalable Vector Graphics
usage context categoriesnonepermitted contentany number of the following elements, in any order:animation elementsdescriptive elementsshape elementsstructural elementsgradient elements<a>, <altglyphdef>, <clippath>, <color-profile>, <cursor>, <filter>, <font>, <font-face>, <foreignobject>, <image>, <marker>, <mask>, <pattern>, <script>, <style>, <
switch>, <text>, <view> attributes global attributes core attributes presentation attributes class style specific attributes d horiz-adv-x vert-origin-x vert-origin-y vert-adv-y dom interface this element implements the svgmissingglyphelement interface.
<pattern> - SVG: Scalable Vector Graphics
ttributes 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 specification status comment scalable vector graphics (svg) 2the definition of '<pattern>' in that specification.
<style> - SVG: Scalable Vector Graphics
value type: <string>; default value: all; animatable: no title this attribute the title of the style sheet which can be used to
switch between alternate style sheets.
<svg> - SVG: Scalable Vector Graphics
-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> specifications specification status comment scalable vector graphics (svg) 2the definition of '<svg>' in that specification.
<symbol> - SVG: Scalable Vector Graphics
-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: a <symbol> element itself is not meant to be rendered.
SVG documentation index - SVG: Scalable Vector Graphics
369 <
switch> element, needsexample, svg, svg container the <
switch> svg element evaluates any requiredfeatures, requiredextensions and systemlanguage attributes on its direct child elements in order, and then renders the first child where these attributes evaluate to true.
Scripting - SVG: Scalable Vector Graphics
ge){ this.message=message this.rect=document.createelementns("http://www.w3.org/2000/svg","rect") this.rect.setattributens(null,"x",x) this.rect.setattributens(null,"y",y) this.rect.setattributens(null,"width",w) this.rect.setattributens(null,"height",h) document.documentelement.appendchild(this.rect) this.rect.addeventlistener("click",this,false) this.handleevent= function(evt){
switch (evt.type){ case "click": alert(this.message) break; } } } inter-document scripting: referencing embedded svg when using svg within html, adobe's svg viewer 3.0 automatically includes a window property called svgdocument that points to the svg document.