Search completed in 1.46 seconds.
String.prototype.toLowerCase() - JavaScript
the to
lowercase() method returns the calling string value converted to
lower case.
... syntax str.to
lowercase() return value a new string representing the calling string converted to
lower case.
... description the to
lowercase() method returns the value of the string converted to
lower case.
...And 2 more matches
Low-Level APIs - Archive of obsolete content
modules in this section implement
low-level apis.
... privileged modules that expose powerful
low-level capabilities such as window/utils and net/xhr.
... chrome the chrome module gives an add-on sdk add-on access to the components object, which in turn gives it access to a large set of privileged
low-level firefox apis.
... event/core the event/core module al
lows the creation of apis to broadcast and subscribe to events.
-ms-overflow-style - Archive of obsolete content
the -ms-overf
low-style css property is a microsoft extension controlling the behavior of scrollbars when the content of an element overf
lows.
... none scrollbars are never displayed, although the element can still be scrolled if the element's content overf
lows.
... scrollbar "traditional" scrollbars are displayed if the element's content overf
lows.
... -ms-autohiding-scrollbar auto-hiding scrollbars are used if the element's content overf
lows.
overflow-clip-box-block
the overf
low-clip-box-block css property specifies relative to which box the clipping happens when there is an overf
low — in the block direction.
... /* keyword values */ overf
low-clip-box-block: padding-box; overf
low-clip-box-block: content-box; /* global values */ overf
low-clip-box-block: inherited; overf
low-clip-box-block: initial; overf
low-clip-box-block: unset; note: on gecko, by default, padding-box is used everywhere, but <input type="text"> and similar use the value content-box.
... examples padding-box html <div class="things"> <input value="abcdefghijklmnopqrstuvwxyzÅÄÖ" class="scroll padding-box"> <div class="scroll padding-box"><span>abcdefghijklmnopqrstuvwxyzÅÄÖ</span></div> </div> css .scroll { overf
low: auto; padding: 0 30px; width: 6em; border: 1px solid black; background: lime content-box; } .padding-box { overf
low-clip-box-block: padding-box; } javascript function scrollsomeelements() { var elms = document.queryselectorall('.scroll'); for (i=0; i < elms.length; ++i) { elms[i].scrollleft=80; } } var elt = document.queryelementsbytagname('body')[0]; elt.addeventlistener...
...("load", scrollsomeelements, false); result specifications this property has been proposed to the w3c csswg; it is not yet on the standard track but, if accepted, should appear in css overf
low module level 3.
overflow-clip-box-inline
the overf
low-clip-box-inline css property specifies relative to which box the clipping happens when there is an overf
low — in the inline direction.
... /* keyword values */ overf
low-clip-box-inline: padding-box; overf
low-clip-box-inline: content-box; /* global values */ overf
low-clip-box-inline: inherited; overf
low-clip-box-inline: initial; overf
low-clip-box-inline: unset; note: on gecko, by default, padding-box is used everywhere, but <input type="text"> and similar use the value content-box.
... examples padding-box html <div class="things"> <input value="abcdefghijklmnopqrstuvwxyzÅÄÖ" class="scroll padding-box"> <div class="scroll padding-box"><span>abcdefghijklmnopqrstuvwxyzÅÄÖ</span></div> </div> css .scroll { overf
low: auto; padding: 0 30px; width: 6em; border: 1px solid black; background: lime content-box; } .padding-box { overf
low-clip-box-inline: padding-box; } javascript function scrollsomeelements() { var elms = document.queryselectorall('.scroll'); for (i=0; i < elms.length; ++i) { elms[i].scrollleft=80; } } var elt = document.queryelementsbytagname('body')[0]; elt.addeventlistene...
...r("load", scrollsomeelements, false); result specifications this property has been proposed to the w3c csswg; it is not yet on the standard track but, if accepted, should appear in css overf
low module level 3.
Element: underflow event - Web APIs
the non-standard underf
low event, which is specific to firefox, is fired when an element is no longer overf
lowed by its content.
... this only works for elements for which overf
low is not set to visible.
... the counterpart overf
low event is fired when overf
low occurs.
... bubbles yes cancelable yes interface uievent event handler property unknown examples <div id="wrapper"> <div id="child"></div> </div> <br/> <label><input type="checkbox" id="toggle" checked/> overf
low</label> <style> #wrapper { width: 20px; height: 20px; background: #000; padding: 5px; overf
low: hidden; } #child { width: 40px; height: 40px; border: 2px solid grey; background: #ccc; } </style> <script> var wrapper = document.getelementbyid("wrapper"), child = document.getelementbyid("child"), toggle = document.getelementbyid("toggle"); wrapper.addeventlistener("overf
low", function( event ) { console.log( event ); }, false); wrapper.addeventlistener("underf
low"...
x-ms-aria-flowfrom - Accessibility
the x-ms-aria-f
lowfrom property specifies the id of the previous element in an alternative reading order, al
lowing assistive technology to override the general default of reading in document source order.
... the property serves to define element relationships utilizing aria relationship attributes and the aria-f
lowto property.
... syntax x-ms-aria-f
lowfrom="elementid"; value the x-ms-aria-f
lowfrom property value uses an id selector to define which previous element the reading order will f
low from.
... example <div tabindex="0" class="foo" id="element2" role="option" aria-posinset="1" aria-setsize="15" aria-f
lowto="element8" x-ms-aria-f
lowfrom="element5"> see also aria relationship attributes microsoft api extensions ...
overflow-anchor - CSS: Cascading Style Sheets
the overf
low-anchor css property provides a way to opt out of the browser's scroll anchoring behavior, which adjusts scroll position to minimize content shifts.
... syntax /* keyword values */ overf
low-anchor: auto; overf
low-anchor: none; /* global values */ overf
low-anchor: inherit; overf
low-anchor: initial; overf
low-anchor: unset; values auto the element becomes a potential anchor when adjusting scroll position.
... formal definition initial valueautoapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax auto | none examples prevent scroll anchoring to prevent scroll anchoring in a document, use the overf
low-anchor property.
... body { overf
low-anchor: none; } specifications specification status comment css scroll anchoring module level 1the definition of 'overf
low-anchor' in that specification.
Reason: invalid token ‘xyz’ in CORS header ‘Access-Control-Allow-Headers’ - HTTP
reason reason: invalid token ‘xyz’ in cors header ‘access-control-al
low-headers’ what went wrong?
... the response to the cors request that was sent by the server includes an access-control-al
low-headers header which includes at least one invalid header name.
... the access-control-al
low-headers header is sent by the server in response to a preflight request; it lets the client know which http headers are permitted in cors requests.
... this is a problem that most likely can only be fixed on the server side, by modifying the server's configuration to no longer send the invalid or unknown header name with the access-control-al
low-headers header.
Reason: invalid token ‘xyz’ in CORS header ‘Access-Control-Allow-Methods’ - HTTP
reason reason: invalid token ‘xyz’ in cors header ‘access-control-al
low-methods’ what went wrong?
... the response to the cors request that was sent by the server includes an access-control-al
low-methods header which includes at least one invalid method name.
... the access-control-al
low-methods header is sent by the server to let the client know what http request methods it supports for cors requests.
... this is a problem that most likely can only be fixed on the server side, by modifying the server's configuration to no longer send the invalid or unknown method name with the access-control-al
low-methods header.
Reason: Did not find method in CORS header ‘Access-Control-Allow-Methods’ - HTTP
reason reason: did not find method in cors header ‘access-control-al
low-methods’ what went wrong?
... the http method being used by the cors request is not included in the list of methods specified by the response's access-control-al
low-methods header.
... for example, if the response includes: access-control-al
low-methods: get,head,post trying to use a put request will fail with this error.
... note: if the server includes any unrecognized or undefined method names in its access-control-al
low-methods header, a different error occurs: reason: invalid token ‘xyz' in cors header ‘access-control-al
low-methods’.
Access-Control-Allow-Methods - HTTP
the access-control-al
low-methods response header specifies the method or methods al
lowed when accessing the resource in response to a preflight request.
... header type response header forbidden header name no syntax access-control-al
low-methods: <method>, <method>, ...
... access-control-al
low-methods: * directives <method> comma-delimited list of the al
lowed http request methods.
... examples access-control-al
low-methods: post, get, options access-control-al
low-methods: * specifications specification status comment fetchthe definition of 'access-control-al
low-methods' in that specification.
JSSecurityCallbacks.contentSecurityPolicyAllows
the jssecuritycallbacks.contentsecuritypolicyal
lows callback is called when a script attempts to access an object property.
... description check whether runtime code generation is al
lowed for the current global.
... jssecuritycallbacks.contentsecuritypolicyal
lows is invoked once per global object upon the first attempt to evaluate js code from a string (either through eval or the function constructor).
Element: overflow event - Web APIs
the overf
low event is fired when an element has been overf
lowed by its content or has been rendered for the first time in this state (only works for elements styled with overf
low != visible).
... bubbles yes cancelable yes interface uievent event handler property unknown examples <div id="wrapper"> <div id="child"></div> </div> <br/> <label><input type="checkbox" id="toggle" checked/> overf
low</label> <style> #wrapper { width: 20px; height: 20px; background: #000; padding: 5px; overf
low: hidden; } #child { width: 40px; height: 40px; border: 2px solid grey; background: #ccc; } </style> <script> var wrapper = document.getelementbyid("wrapper"), child = document.getelementbyid("child"), toggle = document.getelementbyid("toggle"); wrapper.addeventlistener("overf
low", function( event ) { console.log( event...
... ); }, false); wrapper.addeventlistener("underf
low", function( event ) { console.log( event ); }, false); toggle.addeventlistener("change", function( event ) { if ( event.target.checked ) { child.style.width = "40px"; child.style.height = "40px"; } else { child.style.width = "10px"; child.style.height = "10px"; } }, false); </script> specifications not part of any specification.
flex-flow - CSS: Cascading Style Sheets
the flex-f
low css shorthand property specifies the direction of a flex container, as well as its wrapping behavior.
... constituent properties this property is a shorthand for the fol
lowing css properties: flex-direction flex-wrap syntax /* flex-f
low: <'flex-direction'> */ flex-f
low: row; flex-f
low: row-reverse; flex-f
low: column; flex-f
low: column-reverse; /* flex-f
low: <'flex-wrap'> */ flex-f
low: nowrap; flex-f
low: wrap; flex-f
low: wrap-reverse; /* flex-f
low: <'flex-direction'> and <'flex-wrap'> */ flex-f
low: row nowrap; flex-f
low: column wrap; flex-f
low: column-reverse wrap-reverse; /* global values */ flex-f
low: inherit; flex-f
low: initial; flex-f
low: unset; values se...
...flex items are laid out in multiple lines */ flex-f
low: column-reverse wrap; } specifications specification status comment css flexible box layout modulethe definition of 'flex-f
low' in that specification.
CSS values and units - CSS: Cascading Style Sheets
be
low is an overview of most of these data types.
... when viewing css property value syntax in a css specification or the mdn property page, al
lowable keywords will be listed in the fol
lowing form.
... the fol
lowing values are the pre-defined keyword values al
lowed for float.
...And 13 more matches
HTML attribute reference - HTML: Hypertext Markup Language
al
low <iframe> specifies a feature-policy for the iframe.
...al
lowed values are ltr (left-to-right) or rtl (right-to-left) dirname <input>, <textarea> disabled <button>, <command>, <fieldset>, <input>, <keygen>, <optgroup>, <option>, <select>, <textarea> indicates whether the user can interact with the element.
... high <meter> indicates the
lower bound of the upper range.
...And 13 more matches
<input type="datetime-local"> - HTML: Hypertext Markup Language
in other words, an implementation should al
low any valid combination of year, month, day, hour, and minute - even if such a combination is invalid in the user's local time zone (such as times within a daylight saving time spring-forward transition gap).
... for those of you not using a supporting browser, the chrome/opera datetime-local control looks like the be
low screenshot.
... clicking the down arrow on the right hand side brings up a date picker to al
low you to choose a date; you have to enter the time manually.
...And 13 more matches
CSP: form-action - HTTP
not setting this al
lows anything.
... syntax one or more sources can be set for the form-action policy: content-security-policy: form-action <source>; content-security-policy: form-action <source> <source>; sources <source> can be one of the fol
lowing: <host-source> internet hosts by name or ip address, as well as an optional url scheme and/or port number.
...unlike other values be
low, single quotes shouldn't be used.
...And 13 more matches
CSP: navigate-to - HTTP
this is an enforcement on what navigations this document initiates not on what this document is al
lowed to navigate to.
...not setting this al
lows anything.
... syntax one or more sources can be set for the navigate-to policy: content-security-policy: navigate-to <source>; content-security-policy: navigate-to <source> <source>; sources <source> can be one of the fol
lowing: <host-source> internet hosts by name or ip address, as well as an optional url scheme and/or port number.
...And 13 more matches
jpm - Archive of obsolete content
jpm usage is: jpm [command] [options] jpm supports the fol
lowing global options: -h, --help - show a help message and exit -v, --version - print the jpm version number --addon-dir - directory for your source code, defaulting to the current directory installation jpm is distributed with the node package manager npm.
...add the fol
lowing line to the end of the file $home/.profile to add it to your path permanently (as the file .profile is executed every time a new terminal is opened): export path="$home/node_modules/.bin/:$path" installing jpm from git alternatively, you can also get the latest version of jpm using git: git clone https://github.com/mozilla-jetpack/jpm.git cd jpm npm install npm link after installing jpm ...
... command reference jpm supports the fol
lowing commands: jpm init create a skeleton add-on as a starting point for your add-on.
...And 12 more matches
Extension Versioning, Update and Compatibility - Archive of obsolete content
as a rough overview this is a version string split by periods, some examples: 2.0 1.0b1 3.0pre1 5.0.1.2 note: before firefox 1.5 the more basic firefox version format was used: major.minor.release.build[+] where only digits were al
lowed.
... the toolkit version format supports the firefox version format but al
lows greater flexibility.
...this al
lows you to say that your add-on will install into any toolkit based application.
...And 12 more matches
The Essentials of an Extension - Archive of obsolete content
<em:id>hel
loworld@xulschool.com</em:id> this is the unique identifier for the extension.
...a localized description and name can be added with the fol
lowing code: <em:localized> <description> <em:locale>es-es</em:locale> <em:name>xul school hola mundo</em:name> <em:description>bienvenido a xul school!</em:description> </description> </em:localized> the es-es locale string indicates that this is the spanish (es) localization for spain (es).
...if the application or version range don't match, you won't be al
lowed to install the extension, or the extension will be installed in a disabled state.
...And 12 more matches
jspage - Archive of obsolete content
var mootools={version:"1.2.4",build:"0d9113241a90b9cd5643b926795852a2026710d4"};var native=function(k){k=k||{};var a=k.name;var i=k.legacy;var b=k.protect; var c=k.implement;var h=k.generics;var f=k.initialize;var g=k.afterimplement||function(){};var d=f||i;h=h!==false;d.constructor=native;d.$family={name:"native"}; if(i&&f){d.prototype=i.prototype;}d.prototype.constructor=d;if(a){var e=a.to
lowercase();d.prototype.$family={name:e};native.typize(d,e);}var j=function(n,l,o,m){if(!b||m||!n.prototype[l]){n.prototype[l]=o; }if(h){native.genericize(n,l,b);}g.call(n,l,o);return n;};d.alias=function(n,l,p){if(typeof n=="string"){var o=this.prototype[n];if((n=o)){return j(this,l,n,p); }}for(var m in n){this.alias(m,n[m],l);}return this;};d.implement=function(m,l,o){if(typeof m=="string"){return ...
...,initialize:a[h],protect:true}); }var d={"boolean":boolean,"native":native,object:object};for(var c in d){native.typize(d[c],c);}var f={array:["concat","indexof","join","lastindexof","pop","push","reverse","shift","slice","sort","splice","tostring","unshift","valueof"],string:["charat","charcodeat","concat","indexof","lastindexof","match","replace","search","slice","split","substr","substring","to
lowercase","touppercase","valueof"]}; for(var e in f){for(var b=f[e].length;b--;){native.genericize(a[e],f[e][b],true);}}})();var hash=new native({name:"hash",initialize:function(a){if($type(a)=="hash"){a=$unlink(a.getclean()); }for(var b in a){this[b]=a[b];}return this;}});hash.implement({foreach:function(b,c){for(var a in this){if(this.hasownproperty(a)){b.call(c,this[a],a,this); }}},getclean:funct...
...n $unlink(c){var b;switch($type(c)){case"object":b={};for(var e in c){b[e]=$unlink(c[e]); }break;case"hash":b=new hash(c);break;case"array":b=[];for(var d=0,a=c.length;d<a;d++){b[d]=$unlink(c[d]);}break;default:return c;}return b;}var browser=$merge({engine:{name:"unknown",version:0},platform:{name:(window.orientation!=undefined)?"ipod":(navigator.platform.match(/mac|win|linux/i)||["other"])[0].to
lowercase()},features:{xpath:!!(document.evaluate),air:!!(window.runtime),query:!!(document.queryselector)},plugins:{},engines:{presto:function(){return(!window.opera)?false:((arguments.callee.caller)?960:((document.getelementsbyclassname)?950:925)); },trident:function(){return(!window.activexobject)?false:((window.xmlhttprequest)?((document.queryselectorall)?6:5):4);},webkit:function(){return(naviga...
...And 12 more matches
splitter - Archive of obsolete content
the vbox is used to hold the .png image that a user clicks on to resize the search bar.--> <splitter tooltiptext="resize the search box" oncommand="alert('the splitter was dragged')"> <vbox id="example_vbox" /> </splitter> attributes collapse type: one of the values be
low determines which side of the splitter is collapsed when its grippy is clicked.
... both either the element immediately before the splitter, or the element immediately after the splitter can be collapsed, if the size of that element would fall be
low the minimum size due to the position of the splitter.
... resizeafter type: one of the values be
low this attribute indicates which element to the right or be
low the splitter should be resized when the splitter is repositioned.
...And 12 more matches
RDF in Mozilla FAQ - Archive of obsolete content
both datasources refer to "website" by url: this is the "key" that al
lows the datasources to be "merged" effectively.
...var ds = rdf.getdatasource("http://www.mozilla.org/some-rdf-file.rdf"); // note that ds will load asynchronously, so assertions will not // be immediately available alternatively, you can create one directly using the xpcom component manager, as the fol
lowing code fragment illustrates: // create an rdf/xml datasource using the xpcom component manager var ds = components .classes["@mozilla.org/rdf/datasource;1?name=xml-datasource"] .createinstance(components.interfaces.nsirdfdatasource); // the nsirdfremotedatasource interface has the interfaces // that we need to setup the datasource.
... for this reason, there is an observer interface that al
lows you to spy on a datasource's progress.
...And 12 more matches
Building up a basic demo with the PlayCanvas engine - Game development
add the fol
lowing code to the bottom of your second <script> element: var app = new pc.application(canvas); app.start(); the pc global object contains all the playcanvas functions available in the engine.
...again, add the fol
lowing lines at the bottom of your script.
...let's start with the camera — add these lines to your code, be
low the previous ones.
...And 12 more matches
Accessible multimedia - Learn web development
the problem with native html5 controls html5 video and audio instances even come with a set of inbuilt controls that al
low you to control the media straight out of the box.
... different browsers give the native controls differing styling and functionality, and they aren't stylable, meaning that they can't be easily made to fol
low a site style guide.
... creating custom audio and video controls html5 video and audio share an api — html media element — which al
lows you to map custom functionality to buttons and other controls — both of which you define yourself.
...And 12 more matches
Advanced styling effects - Learn web development
box shadows box-shadow al
lows you to apply one or more drop shadows to an element's box.
...lass="simple"> <p><strong>warning</strong>: the thermostat on the cosmic transcender has reached a critical level.</p> </article> now the css: p { margin: 0; } article { max-width: 500px; padding: 10px; background-color: red; background-image: linear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,0.25)); } .simple { box-shadow: 5px 5px 5px rgba(0,0,0,0.7); } this gives us the fol
lowing result: you'll see that we've got four items in the box-shadow property value: the first length value is the horizontal offset — the distance to the right the shadow is offset from the original box (or left, if the value is negative).
... black, inset 2px 3px 5px rgba(0,0,0,0.3), inset -2px -3px 5px rgba(255,255,255,0.5); } button:focus, button:hover { background-image: linear-gradient(to bottom right, #888, #eee); } button:active { box-shadow: inset 2px 2px 1px black, inset 2px 3px 5px rgba(0,0,0,0.3), inset -2px -3px 5px rgba(255,255,255,0.5); } this gives us the fol
lowing result: here we've set up some button styling along with focus/hover/active states.
...And 12 more matches
Manipulating documents - Learn web development
there are a few really obvious bits you'll reference regularly in your code — consider the fol
lowing diagram, which represents the main parts of a browser directly involved in viewing web pages: the window is the browser tab that a web page is loaded into; this is represented in javascript by the window object.
...img is not a child of body, as it is two levels be
low it in the tree, but it is a descendant of body.
...inside your script element, add the fol
lowing line: const link = document.queryselector('a'); now we have the element reference stored in a variable, we can start to manipulate it using properties and methods available to it (these are defined on interfaces like htmlanchorelement in the case of <a> element, its more general parent interface htmlelement, and node — which represents all nodes in a dom).
...And 12 more matches
Updating Commands - Archive of obsolete content
a simple way of doing this is the fol
lowing: var controller = document.commanddispatcher.getcontrollerforcommand("cmd_paste"); if (controller && controller.iscommandenabled("cmd_paste")){ controller.docommand(command); } the code above first retrieves the controller for the 'cmd_paste' command from the command dispatcher.
...the only other thing you need to do is ensure that the enabled status of the paste command, and therefore the button, is updated at the right time, which is described be
low.
... command updaters a command updater is a feature of the commandset element which al
lows it to update commands when certain events happen.
...And 2 more matches
key - Archive of obsolete content
the disabled attribute is al
lowed only for form controls.
... modifiers type: space-separated list of the values be
low a list of modifier keys that should be pressed to invoke the keyboard shortcut.
... properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlist...
...And 2 more matches
listbox - Archive of obsolete content
there are numerous methods which al
low the items in the listbox to be retrieved and modified.
... the disabled attribute is al
lowed only for form controls.
... seltype type: one of the values be
low used to indicate whether multiple selection is al
lowed.
...And 2 more matches
listitem - Archive of obsolete content
crop type: one of the values be
low if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute.
...for example, for a menuitem in a menu you can add the fol
lowing css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } current type: boolean this attribute will be set to true if the listitem is the current item.
... the disabled attribute is al
lowed only for form controls.
...And 2 more matches
menulist - Archive of obsolete content
crop type: one of the values be
low if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute.
...for example, for a menuitem in a menu you can add the fol
lowing css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disableautoselect type: boolean if this attribute is true or omitted, the selected item on the menu will update to match what the user entered in the textbox.
... the disabled attribute is al
lowed only for form controls.
...And 2 more matches
preference - Archive of obsolete content
the disabled attribute is al
lowed only for form controls.
...a change event is fired in different ways for different xul input elements as listed be
low: onchange type: script code textbox when enter key is pressed radio/check box when the state is changed select list when the selected item is changed what is accessible the script context at this point can only access the fol
lowing things: global values/functions i.e.
... the window object event object example <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="findfile-window" title="find files" orient="horizontal" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script type="text/javascript"> function myfunction(e){ /* do something cool here or just say the be
low */ alert(e.target.nodename); } </script> <textbox id="find-text" onchange="return myfunction(event);"/> </window> readonly type: boolean if set to true, then the user cannot change the value of the element.
...And 2 more matches
radio - Archive of obsolete content
attributes accesskey, command, crop, disabled, focused, group, image, label, selected, tabindex, value properties accesskey, accessibletype, control, crop, disabled, image, label, radiogroup, selected, tabindex, value examples <radiogroup> <radio id="orange" label="red" accesskey="r"/> <radio id="violet" label="green" accesskey="g" selected="true"/> <radio id="yel
low" label="blue" accesskey="b" disabled="true"/> </radiogroup> attributes accesskey type: character this should be set to a character that is used as a shortcut key.
... crop type: one of the values be
low if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute.
...for example, for a menuitem in a menu you can add the fol
lowing css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled type: boolean indicates whether the element is disabled or not.
...And 2 more matches
<statusbarpanel> - Archive of obsolete content
attributes crop, image, label properties image, label style classes statusbarpanel-iconic, statusbarpanel-iconic-text, statusbarpanel-menu-iconic examples <statusbar> <statusbarpanel label="left panel"/> <spacer flex="1"/> <progressmeter mode="determined" value="82"/> <statusbarpanel label="right panel"/> </statusbar> attributes crop type: one of the values be
low if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute.
...for example, for a menuitem in a menu you can add the fol
lowing css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } image type: uri the uri of the image to appear on the element.
... inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlist...
...And 2 more matches
tab - Archive of obsolete content
crop type: one of the values be
low if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute.
...for example, for a menuitem in a menu you can add the fol
lowing css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled type: boolean indicates whether the element is disabled or not.
... the disabled attribute is al
lowed only for form controls.
...And 2 more matches
timepicker - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] the timepicker is used to al
low the user to enter a time.
...arrow buttons next to the fields al
low the values to be adjusted with the mouse.
... a fourth textbox appears for 12 hour clocks which al
lows selection of am or pm.
...And 2 more matches
XULRunner 1.8.0.1 Release Notes - Archive of obsolete content
the fol
lowing directory is recommended: c:\program files\mozilla xulrunner\1.8.0.1 .
... mac os x open the .pkg file within the installer and fol
low the directions.
...the fol
lowing directory is recommended: /opt/xulrunner/1.8.0.1 .
...And 2 more matches
XULRunner 1.8.0.4 Release Notes - Archive of obsolete content
the fol
lowing directory is recommended: c:\program files\mozilla xulrunner\1.8.0.4 .
... mac os x open the .pkg file within the installer and fol
low the directions.
...the fol
lowing directory is recommended: /opt/xulrunner/1.8.0.4 .
...And 2 more matches
XULRunner 1.9.1 Release Notes - Archive of obsolete content
the fol
lowing directory is recommended: c:\program files\mozilla xulrunner\1.9.1 .
... mac os x open the .pkg file within the installer and fol
low the directions.
...the fol
lowing directory is recommended: /opt/xulrunner/1.9.1 .
...And 2 more matches
XULRunner 1.9.2 Release Notes - Archive of obsolete content
the fol
lowing directory is recommended: c:\program files\mozilla xulrunner\1.9.2 .
... mac os x open the .pkg file within the installer and fol
low the directions.
...the fol
lowing directory is recommended: /opt/xulrunner/1.9.2 .
...And 2 more matches
XULRunner 1.9 Release Notes - Archive of obsolete content
the fol
lowing directory is recommended: c:\program files\mozilla xulrunner\1.9 .
... mac os x open the .pkg file within the installer and fol
low the directions.
...the fol
lowing directory is recommended: /opt/xulrunner/1.9 .
...And 2 more matches
Using shadow DOM - Web Components
as an example, consider the fol
lowing html fragment: <!doctype html> <html> <head> <meta charset="utf-8"> <title>simple dom example</title> </head> <body> <section> <img src="dinosaur.png" alt="a red tyrannosaurus rex: a two legged dinosaur standing upright like a human, with small arms, and a large head with lots of sharp teeth."> <p>here we will add a link to the <a href="https://www.mozilla.
...org/">mozilla homepage</a></p> </section> </body> </html> this fragment produces the fol
lowing dom structure: shadow dom al
lows hidden dom trees to be attached to elements in the regular dom tree — this shadow dom tree starts with a shadow root, underneath which can be attached to any elements you want, in the same way as the normal dom.
...the difference is that none of the code inside a shadow dom can affect anything outside it, al
lowing for handy encapsulation.
...And 2 more matches
Web Components
web components is a suite of different technologies al
lowing you to create reusable custom elements — with their functionality encapsulated away from the rest of your code — and utilize them in your web apps.
... custom elements: a set of javascript apis that al
low you to define custom elements and their behaviour, which can then be used as desired in your user interface.
... extensions for creating custom built-in elements the is global html attribute: al
lows you to specify that a standard html element should behave like a registered custom built-in element.
...And 2 more matches
XPath snippets - XPath
node-specific evaluator function the fol
lowing custom utility function can be used to evaluate xpath expressions on given xml nodes.
...scripts in a web document which might be accessed by edge or internet explorer users should replace the call to new xpathevaluator() with the fol
lowing fragment: // xpathevaluator is implemented on objects that implement document var xpe = anode.ownerdocument || anode; in that case the creation of the xpathnsresolver can be simplified as: var nsresolver = xpe.creatensresolver(xpe.documentelement); note however that creatensresolver should only be used if you are sure the namespace prefixes in the xpath expression match those in th...
... sample usage assume we have the fol
lowing xml document (see also how to create a dom tree and parsing and serializing xml): example: an xml document to use with the custom evaluatexpath() utility function <?xml version="1.0"?> <people> <person first-name="eric" middle-initial="h" last-name="jung"> <address street="321 south st" city="denver" state="co" country="usa"/> <address street="123 main st" city="arlington" state="...
...And 2 more matches
Index - XSLT: Extensible Stylesheet Language Transformations
the example al
lows sorting the content multiple times, alternating between ascending and descending order.
... 14 an overview needshelp, needsmarkupwork, transforming_xml_with_xslt, xml, xslt the extensible stylesheet language/transform is a very powerful language, and a complete discussion of it is well beyond the scope of this article, but a brief discussion of some basic concepts will be helpful in understanding the description of netscape's capabilities that fol
lows.
...sometimes, however, it is useful to be able to force the processor to use a template rule from the (
lower precedence) imported stylesheet rather than an equivalent rule in the main stylesheet.
...And 2 more matches
Cross-domain Content Scripts - Archive of obsolete content
on's package.json under the "cross-domain-content" key, which itself lives under the "permissions" key: "permissions": { "cross-domain-content": ["http://example.org/", "http://example.com/"] } the domains listed must include the scheme and fully qualified domain name, and these must exactly match the domains serving the content - so in the example above, the content script will not be al
lowed to access content served from https://example.com/.
... wildcards are not al
lowed.
... cross-domain iframes the fol
lowing "main.js" creates a page-worker which loads a local html file called "page.html", attaches a content script called "page.js" to the page, waits for messages from the script, and logs the payload.
... cross-domain xmlhttprequest the fol
lowing add-on creates a panel whose content is the summary weather forecast for shetland.
Content Scripts - Archive of obsolete content
there are five basic principles: the add-on's main code, including "main.js" and other modules in "lib", can use the sdk high-level and
low-level apis, but can't access web content directly content scripts can't use the sdk's apis (no access to globals exports, require) but can access web content sdk apis that use content scripts, like page-mod and tabs, provide functions that enable the add-on's main code to load content scripts into web pages content scripts can be loaded in as strings, but are more often stored as separate file...
... a message-passing api al
lows the main code and content scripts to communicate with each other this complete add-on illustrates all of these principles.
...the content script simply replaces the content of the page: // main.js var tabs = require("sdk/tabs"); var contentscriptstring = 'document.body.innerhtml = "<h1>this page has been eaten</h1>";' tabs.activetab.attach({ contentscript: contentscriptstring }); the fol
lowing high-level sdk modules can use content scripts to modify web pages: page-mod: enables you to attach content scripts to web pages that match a specific url pattern.
...the fol
lowing add-on shows a content script added by page-mod receiving a customevent sent from a context-menu item when the context menu item is clicked.
Module structure of the SDK - Archive of obsolete content
low-level modules like heritage and namespace provide more powerful functionality, and are typically less stable and more complex.
...for high-level modules this is just sdk/<module_name>, and for
low-level modules it is sdk/<path_to_module>/<module_name>: // load the high-level "tabs" module var tabs = require("sdk/tabs"); // load the
low-level "uuid" module var uuid = require('sdk/util/uuid'); the path to specify for a
low-level module is given along with the module name itself in the title of the module's documentation page (for example, system/environment).
... for example, the fol
lowing add-on contains an additional module directly under "lib", and other modules under subdirectories of "lib": my-addon lib main.js password-dialog.js secrets hash.js storage password-store.js to import modules into main: // main.js code var dialog = require("./password-dialog"); var hash = ...
...just call the fol
lowing: const { require } = cu.import("resource://gre/modules/commonjs/toolkit/require.js", {}) this will import require() into your scope.
tabs - Archive of obsolete content
you can't attach style sheets to a tab using tab.attach(), but from firefox 34 onwards you can attach and detach them using the
low-level stylesheet/style and content/mod apis.
... converting to xul tabs to convert from the high-level tab objects used in this api to the
low-level xul tab objects used in the tabs/utils api and by traditional add-ons, use the viewfor() function exported by the viewfor module.
... here's an example converting from a high-level tab to a xul tab and then back the other way: var { modelfor } = require("sdk/model/core"); var { viewfor } = require("sdk/view/core"); var tabs = require("sdk/tabs"); var tab_utils = require("sdk/tabs/utils"); function maphighlevelto
lowlevel(tab) { // get the xul tab that corresponds to this high-level tab var
lowleveltab = viewfor(tab); // now we can, for example, access the tab's content directly var browser = tab_utils.getbrowserfortab(
lowleveltab); console.log(browser.contentdocument.body.innerhtml); // get the high-level tab back from the xul tab var highleveltab = modelfor(
lowleveltab); console.log(highleve...
...ltab.url); } tabs.on("ready", maphighlevelto
lowlevel); note that directly accessing xul objects and web content like this means you're no longer protected by the compatibility guarantees made by the sdk's high-level apis.
content/loader - Archive of obsolete content
loader adds code to initialize and validate a set of properties for managing content scripts: contenturl contentscript contentscriptfile contentscriptwhen contentscriptoptions al
low when certain of these properties are set, the loader emits a propertychange event, enabling its users to take the appropriate action.
... example: the fol
lowing code creates a wrapper on a hidden frame that reloads a web page in the frame every time the contenturl property is changed: var hiddenframes = require("sdk/frame/hidden-frame"); var { loader } = require("sdk/content/content"); var pageloader = loader.compose({ constructor: function pageloader(options) { options = options || {}; if (options.contenturl) this.contenturl = options.contenturl; this.on('propertychange', this._...
...this may take one of the fol
lowing values: "start": load content scripts immediately after the document element for the page is inserted into the dom, but before the dom content itself has been loaded "ready": load content scripts once dom content has been loaded, corresponding to the domcontentloaded event "end": load content scripts once all the content (dom, js, css, images) for the page has been loaded, at the time the...
... al
low permissions for the content, with the fol
lowing keys: ...
content/worker - Archive of obsolete content
worker worker is composed from the eventemitter trait, therefore instances of worker and their descendants expose all the public properties exposed by eventemitter along with additional public properties that are listed be
low.
... properties port object that al
lows you to: send customized messages to the worker using the port.emit function receive events from the worker using the port.on function url the url of the content.
... events message this event al
lows the content worker to receive messages from its associated content scripts.
... error this event al
lows the content worker to react to an uncaught runtime script error that occurs in one of the content scripts.
core/promise - Archive of obsolete content
if (error) return ui.displayerror(error); twitter.gettweetsfor(handle, funtion continuewith(error, tweets) { if (error) return ui.displayerror(error); ui.showtweets(tweets); }); }); }); doing things in parallel is even harder: var tweets, answers, checkins; twitter.gettweetsfor(user, function continuewith(result) { tweets = result; somethingfinished(); }); stackoverf
low.getanswersfor(question, function continuewith(result) { answers = result; somethingfinished(); }); foursquare.getcheckinsby(user, function continuewith(result) { checkins=result; somethingfinished(); }); var finished = 0; function somethingfinished() { if (++finished === 3) ui.show(tweets, answers, checkins); } this also makes error handling quite an adventure.
... in the add-on sdk we fol
low commonjs promises/a specification and model a promise as an object with a then method, which can be used to get the eventual return (fulfillment) value or thrown exception (rejection): foo().then(function success(value) { // ...
...in the fol
lowing example we implement functions that take multiple promises and return one that resolves to first one being fulfilled: function race() { let { promise, resolve } = defer(); array.slice(arguments).foreach(function(promise) { promise.then(resolve); }); return promise; } var asyncaorb = race(readasync(urla), readasync(urlb)); note: that this implementation forgives failures and woul...
...in such cases it's useful to put a timer on such tasks: function timeout(promise, ms) { let deferred = defer(); promise.then(deferred.resolve, deferred.reject); delay(ms, 'timeout').then(deferred.reject); return deferred.promise; } var tweets = readasync(url); timeout(tweets, 20).then(function(data) { ui.display(data); }, function() { alert('network is being too s
low, try again later'); }); alternative promise apis there may be cases where you will want to provide more than just then method on your promises.
lang/functional - Archive of obsolete content
this) as the first parameter, fol
lowed by any parameters passed into the method.
... compose(fn...) returns the composition of a list of functions, where each function consumes the return value of the function that fol
lows.
... wrap(fn, wrapper) returns the first function passed as an argument to the second, al
lowing you to adjust arguments, run code before and after, and conditionally execute the original function.
...useful for speeding up s
low-running computations.
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 fol
lowing: 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 d...
... detach this event is emitted when a worker is detached from a sidebar, as a result of either of the fol
lowing: 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.
...worker) { var index = workerarray.indexof(worker); if(index != -1) { workerarray.splice(index, 1); } } var sidebar = require("sdk/ui/sidebar").sidebar({ id: 'my-sidebar', title: 'my sidebar', url: require("sdk/self").data.url("sidebar.html"), onattach: attachworker, ondetach: detachworker }); show this event is emitted when the sidebar is shown, as a result of any of the fol
lowing: 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 hide this event is emitted when the sidebar ...
...is hidden, as a result of either of the fol
lowing: 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 ...
Creating Event Targets - Archive of obsolete content
this tutorial describes the use of
low-level apis.
...then open "index.js" and add the fol
lowing code: var {cc, ci} = require("chrome"); var { xpcomutils } = require("resource://gre/modules/xpcomutils.jsm"); var bookmarkservice = cc["@mozilla.org/browser/nav-bookmarks-service;1"] .getservice(ci.nsinavbookmarksservice); var bookmarkobserver = { onitemadded: function(aitemid, afolder, aindex) { console.log("added ", bookmarkservice.getbookmarkuri(aitemid).s...
... create a new file in "lib" called "bookmarks.js", and add the fol
lowing code: var { emit, on, once, off } = require("sdk/event/core"); var {cc, ci} = require("chrome"); var { xpcomutils }= require("resource://gre/modules/xpcomutils.jsm"); var bookmarkservice = cc["@mozilla.org/browser/nav-bookmarks-service;1"] .getservice(ci.nsinavbookmarksservice); var bookmarkobserver = { onitemadded: function(aitemid, afolder, aindex) { emit(e...
...for example, we can adapt "index.js" as fol
lows: var bookmarks = require("./bookmarks"); function logadded(uri) { console.log("added: " + uri); } function logvisited(uri) { console.log("visited: " + uri); } exports.main = function() { bookmarks.on("added", logadded); bookmarks.on("visited", logvisited); }; exports.onunload = function() { bookmarks.removelistener("added", logadded); bookmarks.removelistener("visited", logvisit...
Using XPCOM without chrome - Archive of obsolete content
using sdk xpcom with the
low-level module sdk/platform/xpcom , it's possible to exclude chrome and xpcomutils in some cases.
... be
low is an example for the xpcom bookmark observer.
... examples bookmarks observer normally, a bookmark observer would require chrome components and xpcomutils as described in the fol
lowing links: (observing changes to bookmarks and tags) , (creating event targets).
... be
low is an example, where we extend the xpcom module's unknown class with an nsinavbookmarkobserverinterface and one of its optional interface methods (onitemchanged).
Dialogs and Prompts - Archive of obsolete content
add ok and cancel buttons in an order that is consistent with os default (but the button set and layout is highly customizable, see be
low).
... simple dialog code the fol
lowing xul code defines a simple dialog with two buttons, ok and cancel (buttons="accept,cancel" attribute on dialog).
...for example, to add an apply button to your dialog, use the fol
lowing code: <dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="..." buttons="accept,cancel,extra1" ondialogaccept="onaccept();" ondialogextra1="onapply();" buttonlabelextra1="apply" buttonaccesskeyextra1="a"> <!-- content --> </dialog> you can even get the element object for any of predefined buttons with gdialog.getbutton(dlgtype);, where gdialog is th...
... passing arguments and displaying a dialog the fol
lowing code demonstrates how to pass custom arguments to a dialog, process those arguments in the dialog, and return user-modified arguments to the caller.
Finding window handles - Archive of obsolete content
os specific examples using javascript (js-ctypes) nsibasewindow -> nativehandle in all of the examples be
low, the native handle to the most recent navigator:browser is obtained and then it is focused.
... run the snippets be
low from the scratchpad in environment > browser.
... recall that nsibasewindow -> nativehandle returns the fol
lowing in the different operating systems: windows - hwnd mac os x - nswindow* linux - gdkwindow* (it will be gdkwindow* no matter what desktop/window manager) is in use, for explanation why see the article: standard os libraries - unix section) windows components.utils.import('resource://gre/modules/services.jsm'); var browserwindow = services.wm.getmostrecentwindow('navigator:browser'); if (!browserwindow) { throw new error('no browser window found'); } var basewindow = browserwindow.queryinterface(ci.nsiinterfacerequestor) .getinterface(ci.nsiwebnavigation) .queryinterface(ci.nsidocshelltreeitem) .treeowner ...
.../ return is a number of ms since the computer (xserver) was on // var rez_gwpwt = gtk_window_present_with_time(browserwindow_madeintogtkwindowptr, rez_gst); // console.info('rez_gwaf:', rez_gwpwt, uneval(rez_gwpwt)); var rez_gwp = gtk_window_present(browserwindow_madeintogtkwindowptr); console.info('rez_gwaf:', rez_gwaf, uneval(rez_gwaf)); gdk.close(); gtk.close(); x11 warning this example be
low does not focus a window yet, it does convert from a gdkwindow* to a xid and that's it, the code for focusing the window is soon to come.
Progress Listeners - Archive of obsolete content
progress listeners progress listeners al
low extensions to be notified of events associated with documents loading in the browser and with tab switching events.
... in the examples be
low the progress listener is attached to the tabbrowser, which means you don't get any notifications for inactive tabs.
...s see related documentation onprogresschange: function(awebprogress, arequest, curself, maxself, curtot, maxtot) {}, onstatuschange: function(awebprogress, arequest, astatus, amessage) {}, onsecuritychange: function(awebprogress, arequest, astate) {} } attach the progress listener to a <browser> or a <tabbrowser> element using addprogresslistener, for example for firefox put the fol
lowing code in a load listener of a main window: gbrowser.addprogresslistener(mylistener); when used with a browser, the second argument is a mask which determines the type of events that will be received.
...using the fol
lowing 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.
Displaying web content in an extension without security issues - Archive of obsolete content
the fol
lowing article explains these security mechanisms, ideally an extension that needs to display web content (which is always potentially dangerous) will use all of them.
...for example, "chrome://foo/content/foo.xhtml" will have full privileges, "http://example.com/foo.xhtml" will be al
lowed to access example.com, "file:///c:/foo.xhtml" will be al
lowed to read files from disk (with some restrictions).
...it won’t harm disabling everything else as well unless it is really required: frame.docshell.al
lowauth = false; frame.docshell.al
lowimages = false; frame.docshell.al
lowjavascript = false; frame.docshell.al
lowmetaredirects = false; frame.docshell.al
lowplugins = false; frame.docshell.al
lowsubframes = false; but what about interactivity, for example if you want a certain reaction to mouse clicks?
...for example, your template document might have this code: <style type="text/css"> #entrytemplate { display: none; } </style> <div id="entrytemplate"> <div class="title"></div> <div class="description"></div> </div> now to insert a new entry in the document you would do the fol
lowing: var template = doc.getelementbyid("entrytemplate"); var entry = template.clonenode(true); entry.removeattribute("id"); entry.getelementsbyclassname("title")[0].textcontent = title; entry.getelementsbyclassname("description")[0].textcontent = description; template.parentnode.appendchild(entry); the important difference here is that the result will always have the same structure as the templat...
Listening to events in Firefox extensions - Archive of obsolete content
simple dom events registering for a dom event is done using with code such as the fol
lowing: function callback(evt) { // do your processing here.
...both browser and tabbrowser elements support the fol
lowing: var progresslistener = { // add nsiwebprogressimplementation here } b.addprogresslistener(progresslistener); where b is the browser or tabbrowser you want to listen to events for.
...in order to listen to events from all browsers, including those not currently being displayed, the fol
lowing example can be used: var tabsprogresslistener = { // add tabs progress listener implementation here } gbrowser.addtabsprogresslistener(tabsprogresslistener); this lets you receive events related to all tabs.
...it is used to detect when a webpage attempts to refresh itself and al
low the user to block the attempt.
Adding sidebars - Archive of obsolete content
they al
low you to stack content on top of other content and switch between different sections easily.
...in the fol
lowing example, the second child will be displayed, not the first which would be the default.
...it al
lows you to decompose complex ui into individual layers, broadening the layout possibilities.
... it should be evident at this point that hand-coding a tree would take quite some time and yields a great deal of xml code that is hard to fol
low.
Appendix A: Add-on Performance - Archive of obsolete content
add-on developers need to make sure that they minimize their add-ons' performance impact, and here are a few simple guidelines that should be fol
lowed to achieve that.
... luckily, minimizing your startup time is easy, if you fol
low these guidelines: do not load or run code before it’s needed.
...this is what you should do first to make sure that you filter out all cases that don't interest you so that your add-on doesn't s
low down other requests.
...even if it is not as important as other areas, firefox shutdown can also be s
lowed down because of add-ons.
Appendix F: Monitoring DOM changes - Archive of obsolete content
dom mutation events were introduced to html several years ago in order to al
low web applications to monitor changes to the dom by other scripts.
...for instance, when you want to modify the result of dom mutations that you know are the result of the doawesomedomstuff() function, you can wrap it as fol
lows: { let originaldoawesomedomstuff = doawesomedomstuff; doawesomedomstuff = function _doawesomedomstuff() { let res = originaldoawesomedomstuff.apply(this, arguments); doawesomerdomstuff(res, arguments); return res; }; } now, whenever doawesomedomstuff() is called, the original function will be called, fol
lowed by your own doawesomerdomstuff() fu...
...and because it is css-based, and is triggered when css is being applied anyway, it does not s
low dom mutations.
... the code be
low contains an inefficient fallback implementation for older browsers.
Mozilla Documentation Roadmap - Archive of obsolete content
xulplanet al
lowed you to navigate between interfaces and their related components, which makes locating components very easy.
... there are several useful feeds that you can fol
low using a feed reader, such as thunderbird.
... here are some important feeds you should consider fol
lowing: planet mozilla.
...it can be hard to fol
low due of the sheer mass of information coming out of it (dozens of posts per day), but you'll certainly be up to date with pretty much everything if you take the time to read at least part of it.
User Notifications and Alerts - Archive of obsolete content
they interrupt the user's workf
low, demanding immediate action before anything else can be done.
...you should look for the level that better fits your message, and use the
lowest applicable level, to prevent the user from getting used to dismissing high-level notifications.
...the best locations for this kind of box are above and be
low the tab browser.
... be
low is preferrable because it only cuts the bottom part of the current page, as opposed to pushing down all tabs and content.
Extensions support in SeaMonkey 2 - Archive of obsolete content
some urls are listed be
low: url in firefox url in seamonkey overlays chrome://browser/content/browser.xul chrome://navigator/content/navigator.xul main browser window chrome://browser/content/pageinfo/pageinfo.xul chrome://navigator/content/pageinfo/pageinfo.xul page info window chrome://browser/content/preferences/permissions.xul ...
...some important menu ids are listed be
low, menu ids are based on firefox 3 source code: menu id in firefox menu id in seamonkey 1.x and 2.0 seamonkey 2.1 overlays menu_filepopup menu_filepopup menu_filepopup file menu popup menu_editpopup menu_edit_popup menu_editpopup edit menu popup menu_viewpopup menu_view_popup menu_v...
... for example, if you overlay some chrome before the status bar, like this: <vbox id="browser-bottombox"> <something insertbefore="status-bar" /> </vbox> use the fol
lowing technique to make your overlay work on both seamonkey 2 and firefox 3: <window id="main-window"> <vbox id="browser-bottombox" insertbefore="status-bar"> <something insertbefore="status-bar" /> </vbox> </window> thunderbird 3 gfolderdisplay api seamonkey 2.0 only supports a reduced set of methods: selectedcount selectedmessage selectedmessageisfeed selectedmessageisimap sele...
... in javascript code you can use the fol
lowing technique to detect the application: const firefox_id = "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"; const thunderbird_id = "{3550f703-e582-4d05-9a08-453d09bdfdc6}"; const seamonkey_id = "{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}"; var appinfo = components.classes["@mozilla.org/xre/app-info;1"] .getservice(components.interfaces.nsixulappinfo); if(appinfo.id == firefox_id) { ...
Session store API - Archive of obsolete content
after that, the fol
lowing steps are taken for each tab being restored: either an existing tab is reused or a new tab is created.
... saving a value with a tab the fol
lowing code will attach a key/value pair to a tab, so that when the tab is restored, that pair is still associated with it.
... fetching a saved value you can fetch a value associated with a tab at any time (whether the tab is in the process of being restored or not), using code similar to the fol
lowing: var ss = components.classes["@mozilla.org/browser/sessionstore;1"] .getservice(components.interfaces.nsisessionstore); var currenttab = gbrowser.selectedtab; var retrieveddata = ss.gettabvalue(currenttab, "key-name-here"); after this code executes, the variable retrieveddata contains the value saved for the key "key-name-here".
... deleting a value associated with a tab to delete a value from a tab, you can use code similar to the fol
lowing: var ss = components.classes["@mozilla.org/browser/sessionstore;1"] .getservice(components.interfaces.nsisessionstore); var currenttab = gbrowser.selectedtab; ss.deletetabvalue(currenttab, "key-name-here"); remarks the window value save and restore functions work exactly like the tab-based functions by similar names.
Setting up an extension development environment - Archive of obsolete content
it even al
lows the running of simultaneous versions, at the same time.
... in the fol
lowing example, the described command starts a new instance of firefox, with a profile called dev; even if an instance of firefox is already running.
... development preferences there is a set of development preferences that, when enabled, al
lows you to view more information about application activity, thus making debugging easier.
...see be
low.
Signing an extension - Archive of obsolete content
the fol
lowing instructions also apply to a theme and other xpi files.
... sudo port install nss export your certificate if you have your certificate in firefox, export it by fol
lowing the steps be
low.
... sign the basic usage of the signing tool is as fol
lows: nss-signtool \ -d (path to the directory that contains your certificate database files) \ -k (your certificate nickname) \ -p (your certificate password) \ -x -z (output path/name of signed file) \ (path to your extension working directory that contains chrome directory, chrome.manifest file, install.rdf file, etc.) writing your password directly in the script is dangerous.
... signing a firefox extension with a windows authenticode ssl certificate / key - note that some cas do not al
low (or support) to divert an authenticode certificate to object signing.
An Interview With Douglas Bowman of Wired News - Archive of obsolete content
wired news redesign in a nutshell driven by xhtml 1.0 transitional and css; al
lows centralized control over layout and appearance for thousands of pages; simple markup al
lows for rapid changes to templates; average page weight dropped by almost half; page layout accomplished with simple css positioning; vastly increased accessibility without special coding or user agent detection.
... using absolute positioning for left and right columns al
lowed the markup for each column to fall in any order.
...but positioning did al
low the center column to fall first in the markup.
...this al
lows us to temporarily display on screen the same formatting to be used for printing that page.
Localizing an extension - Archive of obsolete content
create a properties file the first thing we do is create a property file for the literal strings used by the javascript code in stockwatcher2.js: changestring=chg: openstring=open:
lowstring=
low: highstring=high: volumestring=vol: the stockwatcher2.properties file shown above maps five keys (changestring, openstring,
lowstring, highstring, and volumestring) to the corresponding text in english.
...we do this by creating a string bundle, using the fol
lowing code: <stringbundleset id="stringbundleset"> <stringbundle id="string-bundle" src="chrome://stockwatcher2/locale/stockwatcher2.properties"/> </stringbundleset> this establishes a new string bundle, referenced by the id "string-bundle", whose keys and values are to be loaded from the stockwatcher2.properties file we've already created.
...we add to refreshinformation() the fol
lowing code: var stringsbundle = document.getelementbyid("string-bundle"); var changestring = stringsbundle.getstring('changestring') + " "; var openstring = stringsbundle.getstring('openstring') + " "; var
lowstring = stringsbundle.getstring('
lowstring') + " "; var highstring = stringsbundle.getstring('highstring') + " "; var volumestring = stringsbundle.getstring('volumestring') + " "; this ...
...then we replace any occurrences of the literal strings with the appropriate variables: samplepanel.tooltiptext = changestring + fieldarray[4] + " | " + openstring + fieldarray[5] + " | " +
lowstring + fieldarray[6] + " | " + highstring + fieldarray[7] + " | " + volumestring + fieldarray[8]; localizing the description in install.rdf see localizing extension descriptions.
Bookmark Keywords - Archive of obsolete content
that's pretty interesting on its own, but mozilla takes it a step further by al
lowing the user to define an "entry point" for added information.
... with that done, all you have to do in the future is type <tt>bz</tt> fol
lowed by a space and the bug's number into mozilla's address bar, and the browser will jump right to the bug with that number.
...thus we could type any of the fol
lowing into the address bar and get back useful results: <tt>google geitost</tt> <tt>google mozilla keyword bookmark</tt> <tt>google bookmark site:developer.netscape.com</tt> <tt>google netscape xml support -site:netscape.com</tt> a few examples in the course of writing this article, a number of potentially useful bookmarks were considered as possible examples.
... instead of just throwing them away, we're providing them for you in the fol
lowing table.
Structure of an installable bundle - Archive of obsolete content
basic structure of a bundle a bundle may include any of the fol
lowing files: path from the root of the bundle description version information /install.rdf extension/theme install manifest /application.ini application launch manifest /bootstrap.js the bootstrap script for extensions not requiring a restart (those with <em:bootstrap>true</em:bootstrap> in their install.rdf).
... platform-specific files gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) removed support for platform-specific subdirectories, described be
low.
...for example, if a plugin vendor wanted to make a plugin available for consumer computers running linux(of the form: /platform/linux*/), macintosh(of the form: /platform/darwin*/), and windows(of the form: /platform/win*/), it would provide the fol
lowing files: /platform/linux_x86-gcc3/plugins/libmyplugin.so /platform/winnt_x86-msvc/plugins/myplugin.dll /platform/darwin_ppc-gcc3/plugins/libmyplugin.dylib because xpt files are not platform-specific, any associated xpt files would go in the generic components directory: /components/myplugin.xpt if an extension has non-binary platform-specific code (such as code which uses the windows regis...
...tform/winnt/components/registerdoctype.js when platform-specific jar files are used, each platform directory should have its own chrome.manifest file: chrome.manifest chrome/mytheme-base.jar platform/darwin/chrome.manifest platform/darwin/chrome/mytheme-mac.jar platform/winnt/chrome.manifest platform/winnt/chrome/mytheme-win.jar the app/extension loader processes the base directory first, fol
lowed by the applicable platform directories (first /{os_target}/, then /{os_target}_{target_xpcom_abi}/).
Using Dehydra - Archive of obsolete content
example: printing the location of type declarations save the fol
lowing c++ code dumptypes.cc: typedef int myint; struct foo { int i; char *c; }; save the fol
lowing analysis script dumptypes.js: function process_type(t) { print("type found: " + t.name + " location: " + t.loc); } function input_end() { print("hello, world!"); } compile using the fol
lowing command: $ g++ -fplugin=~/dehydra/gcc_dehydra.so -fplugin-arg=~/dumptypes.js -o/dev/null -c dumptypes.cc note:for g++4.5 and up use -fplugin-arg-gcc_dehydra-script= rather than -fplugin-arg it should print the fol
lowing results: type f...
... see documentation for: process_type, input_end, print, .loc property example: using attributes to mark a class as "final" save the fol
lowing code as final.cc: // this class should not be subclassed!
... class __attribute__((user("final"))) myclass { }; // this subclass should be an error class subclass : public myclass { }; save the fol
lowing analysis script final.js: /** * helper function: returns true if a class is marked with the "final" attribute.
...*/ function isfinal(c) { if (!c.attributes) return false; for each (let a in c.attributes) if (a.name == 'user' && a.value == 'final') return true; return false; } function process_type(t) { if (t.bases) for each (let base in t.bases) if (isfinal(base.type)) error("class " + t.name + " extends final class " + base.type.name, t.loc); } compile using the fol
lowing command: $ g++ -fplugin=~/dehydra/gcc_dehydra.so -fplugin-arg=~/final.js -o/dev/null -c final.cc it should print the fol
lowing results and return with an error code: final.cc:8: error: class subclass extends final class myclass see documentation for: process_type, error, .bases property, .attributes property ...
Embedding Mozilla in a Java Application using JavaXPCOM - Archive of obsolete content
xulrunner ships with the javaxpcom component, which al
lows java code to interact with xpcom objects.
... if your code cannot find the gre and keeps throwing filenotfoundexceptions during the getgrepathwithproperties(...) call, check whether you already registered the gre on your system: gre registration the initembedding method kicks off the embedding process, al
lowing the java application to work with xpcom and mozilla.
...in addition to retrieving and calling methods on xpcom objects, javaxpcom al
lows the java application to pass java class objects to xpcom methods.
... fol
lowing on from the above example, to create a new window, we would do the fol
lowing: // first, get the event queue service.
Layout FAQ - Archive of obsolete content
how do you find out if there are any ref
lows that are pending and wait to show the view until afterwards, but if none are pending, show the view immediately?
... on the ref
low branch you could check the dirty and dirty_children framestate flags.
... that won't help with pending style changes, but it'll work to detect cases when the popup or something in it needs to be ref
lown.
... what are the
lowercase items called "line"?
Introducing the Audio API extension - Archive of obsolete content
this event has the fol
lowing attributes: mozchannels: number of channels mozsamplerate: sample rate per second mozframebufferlength: number of samples collected in all channels this information is needed later to decode the audio data stream.
... the fol
lowing example extracts the data from an audio element: <!doctype html> <html> <head> <title>javascript metadata example</title> </head> <body> <audio id="audio-element" src="song.ogg" controls="true" style="width: 512px;"> </audio> <script> function loadedmetadata() { channels = audio.mozchannels; rate = audio.mozsamplerate; framebufferlength = audio.mozframebufferlength; } var audio = document.getelementbyid('audio-element'); audio.addeventlistener('loadedmetadata', loadedmetadata, false); </script> </body> </html> the mozaudioavailable event as the audio is played, sample data is made available to the audio layer and the audio buffer (size defined...
...you can see an example be
low: // write samples using a js array var samples = [0.242, 0.127, 0.0, -0.058, -0.242, ...]; var numbersampleswritten = audiooutput.mozwriteaudio(samples); // write samples using a typed array var samples = new float32array([0.242, 0.127, 0.0, -0.058, -0.242, ...]); var numbersampleswritten = audiooutput.mozwriteaudio(samples); in the fol
lowing example, we create an audio pulse: <!doctype html...
...cript"> function playtone() { var output = new audio(); output.mozsetup(1, 44100); var samples = new float32array(22050); for (var i = 0; i < samples.length ; i++) { samples[i] = math.sin( i / 20 ); } output.mozwriteaudio(samples); } </script> </head> <body> <p>this demo plays a one second tone when you click the button be
low.</p> <button onclick="playtone();">play</button> </body> </html> the mozcurrentsampleoffset() method gives the audible position of the audio stream, meaning the position of the last heard sample.
Selection - Archive of obsolete content
this api currently lives in the future and must be imported for use: jetpack.future.import("selection"); getting and setting the selection the current version of jetpack.selection includes these formats: .text and .html getting the selection the fol
lowing is an example of getting the selection from the user.
... jetpack.import.future("selection");var textofsel = jetpack.selection.text;var htmlofsel = jetpack.selection.html; setting the selection the fol
lowing is an example of getting the selection from the user.
... jetpack.import.future("selection");jetpack.selection.text = 'hello';jetpack.selection.html = '<b>hello</b>'; methods onselection(func function)this method al
lows you to execute an event function when a selection is made.
...function adding a selection event jetpack.selection.onselection( fn ); removal of a selection event jetpack.selection.onselection.unbind( fn ); verbose example the fol
lowing example will bold the html that you select.
Selection - Archive of obsolete content
this api currently lives in the future and must be imported for use: jetpack.future.import("selection"); getting and setting the selection the current version of jetpack.selection includes these formats: .text and .html getting the selection the fol
lowing is an example of getting the selection from the user.
... jetpack.import.future("selection"); var textofsel = jetpack.selection.text; var htmlofsel = jetpack.selection.html; setting the selection the fol
lowing is an example of getting the selection from the user.
... jetpack.import.future("selection"); jetpack.selection.text = 'hello'; jetpack.selection.html = '<b>hello</b>'; methods onselection(func function)this method al
lows you to execute an event function when a selection is made.
...function adding a selection event jetpack.selection.onselection( fn ); removal of a selection event jetpack.selection.onselection.unbind( fn ); verbose example the fol
lowing example will bold the html that you select.
Selection - Archive of obsolete content
this api currently lives in the future and must be imported for use: jetpack.future.import("selection"); getting and setting the selection the current version of jetpack.selection includes these formats: .text and .html getting the selection the fol
lowing is an example of getting the selection from the user.
... jetpack.import.future("selection"); var textofsel = jetpack.selection.text; var htmlofsel = jetpack.selection.html; setting the selection the fol
lowing is an example of getting the selection from the user.
... jetpack.import.future("selection"); jetpack.selection.text = 'hello'; jetpack.selection.html = '<b>hello</b>'; methods onselection(func function)this method al
lows you to execute an event function when a selection is made.
...function adding a selection event jetpack.selection.onselection( fn ); removal of a selection event jetpack.selection.onselection.unbind( fn ); verbose example the fol
lowing example will bold the html that you select.
Plug-n-Hack - Archive of obsolete content
pnh al
lows security tools to declare the functionality that they support which is suitable for invoking directly from the browser.
... a browser that supports pnh can then al
low the user to invoke such functionality without having to switch to and from the tool.
... while some of the pnh capabilities do have a fixed meaning, particularly around proxy configuration, most of the capabilities are completely generic, al
lowing tools to expose whatever functionality they want.
...plug-n-hack topics phase 1 this provides simplified integration and al
lows tools to advertize their capabilities to browsers phase 2 this will al
low browsers to advertize their capabilities to security tools tools supporting pnh the browsers and tools known to support or be working on support for pnh get involved how to implement pnh in your tool or get involved with pnh development ...
Styling - Archive of obsolete content
prism al
lows for some client-side web application styling.
... the web application bundle is al
lowed to hold a css file named webapp.css (called the webapp style).
...this al
lows prism webapps to take on an os-specific look.
...the folder names must match the fol
lowing: windows - winnt mac os x - darwin linux - linux the folder names are pulled from mozilla and are the same as those used in other mozilla projects, such as extension and xul applications.
Static Analysis for Windows Code under Linux - Archive of obsolete content
we highly recommend you to read the cross compiling manual and the dehydra build manual before you start the fol
lowing reading.
...fol
low that instructions strictly for making a cross compiler.
...so, please fol
low this link exactly.
...just fol
low this and this to compile both dehydra and treehydra shared libraries.
Running Tamarin performance tests - Archive of obsolete content
to run performance tests on the android shell see 'testing the android shell' be
low.
... running the performance tests requires the fol
lowing steps: set the avm environment variable to the path of the avmshell executable.
...performance test options there are a variety of options available with runtests.py - here is the help text fol
lowed by explanations for some options: $ ./runtests.py -h usage: runtests.py [options] [tests] -v --verbose enable additional output -e --avm avmplus command to use -a --asc compiler to use -g --globalabc deprecated but still works - use builtin.abc (used to be location of global.abc) -b --builtinabc location of builtin.abc -s --shellabc location of shell_toplev...
...just type the fol
lowing commands after making sure you've set the environment variables correctly.
The life of an HTML HTTP request - Archive of obsolete content
if there are several frames created from a content node, then the first of these are called the "primary" node, and the fol
lowing frames can be found by using the getnextinf
low() method of nsiframe.
... the initial ref
low is done by the nshtmlcontentsink::startlayout(), startlayout() calls presshell::initialref
low().
... todo: how are nsiframes ref
lowed after a change when they already exist?
...when the presshell [note: not true, who really does the call?] has layouted (ref
lowed) the frames it calls nsiframe::paint() method of all frames.
Adding Labels and Images - Archive of obsolete content
an example is shown be
low: example 1 : source view <label value="this is some text"/> the value attribute can be used to specify the text that you wish to have displayed.
...if the text needs to wrap, you can place the text content inside opening and closing tags as in the fol
lowing example: example 2 : <label>this is some longer text that will wrap onto several lines.</label> as with html, line breaks and extra whitespace are collapsed into a single space.
...</description> you can set the text via script using the textcontent property, as in the fol
lowing example: <description id="text" width="200"/> document.getelementbyid('text').textcontent = "some lengthy word wrapped text goes here."; internally, both the label element and the description elements are the same.
...the example be
low shows this: <image src="images/banner.jpg"/> although you can use this syntax, it would be better in order to support different themes to use a style sheet to set the image url.
Adding Style Sheets - Archive of obsolete content
in this file, we'll add the style declarations, as shown be
low: #find-text { min-width: 15em; } #progmeter { margin: 4px; } .springspace { width: 10px; } .titlespace { height: 10px; } notice how these styles are equivalent to the styles we had before.
...an example is shown be
low: <?xml-stylesheet href="chrome://bookmarks/skin/" type="text/css"?> this might be the first lines of a bookmarks window.
...this can be done with the code be
low, al
lowing you to remove the import from the xul file: style import from xul: <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> style import from css: @import url(chrome://global/skin/); the second syntax is preferred because it reduces the number of dependencies within the xul file itself.
...the fol
lowing list summarizes some of the selectors available: button matches all button tags.
Cross Package Overlays - Archive of obsolete content
be
low, we'll add a find files toolbar to the browser.
...mozilla al
lows you to add a list of overlays to the contents.rdf file that you use to list chrome packages, skins and locales.
...the code be
low should be added into contents.rdf just before the closing rdf tag.
...the fol
lowing example shows how: <rdf:seq about="urn:mozilla:stylesheets"> <rdf:li resource="chrome://messenger/content/messenger.xul"/> </rdf:seq> <rdf:seq about="chrome://messenger/content/messenger.xul"> <rdf:li>chrome://blueswayedshoes/skin/myskinfile.css</rdf:li> </rdf:seq> next, we'll see how to create an installer for a xul application.
Custom Tree Views - Archive of obsolete content
for instance, 5000 rows of treeitems would load too s
lowly.
...the fol
lowing example shows this: <tree id="my-tree" flex="1"> <treecols> <treecol id="namecol" label="name" flex="1"/> <treecol id="datecol" label="date" flex="1"/> </treecols> <treechildren/> </tree> to assign data to be displayed in the tree, the view object needs to be created which is used to indicate the value of each cell, the total number of rows plus other optional information.
...three methods that you should implement are listed be
low.
... function setview(){ document.getelementbyid('my-tree').view = treeview; } the fol
lowing presents the example together.
Manipulating Lists - Archive of obsolete content
the syntax is as fol
lows: list.insertitemat(3, "thursday", "thu"); list.removeitemat(3); the insertitemat() function takes an additional argument, the position to insert the new item.
... getting the selected item these two properties are commonly inspected during a select event, as in the fol
lowing example: example 2 : source view <listbox id="thelist" onselect="alert(this.selecteditem.label);"> <listitem label="short"/> <listitem label="medium"/> <listitem label="tall"/> </listbox> the select event is fired for a listbox when an item in the list is selected.
... deleting selected items the fol
lowing example shows a method of deleting the selected items properly: example 4 : source view <script> function deleteselection(){ var list = document.getelementbyid('thelist'); var count = list.selectedcount; while (count--){ var item = list.selecteditems[0]; list.removeitemat(list.getindexofitem(item)); } } </script> <button label="delete" oncommand="deleteselection();"/> <list...
... list scrolling if there are more rows in the listbox than can be displayed, a scroll bar will appear to al
low the user to scroll the list.
Modifying a XUL Interface - Archive of obsolete content
for example, the fol
lowing will add a button to a xul window: example 1 : source view <script> function addbutton(){ var abox = document.getelementbyid("abox"); var button = document.createelement("button"); button.setattribute("label","a new button"); abox.appendchild(button); } </script> <box id="abox" width="200"> <button label="add" oncommand="addbutton();"/> </box> this example has two parts ...
...the syntax of these functions is as fol
lows: parent.appendchild(child); parent.insertbefore(child, referencechild); parent.replacechild(newchild, oldchild); parent.removechild(child); it should be fairly straightforward from the function names what these functions do.
...you can also retrieve the current label or value using these properties, as in the fol
lowing example: example 5 : source view <button label="hello" oncommand="alert(this.label);"/> toggling a checkbox checkboxes have a checked property which may be used to check or uncheck the checkbox.
...for example, in a preferences dialog, one might have the choice of several possibilities, but one choice al
lows additional customization.
More Tree Features - Archive of obsolete content
the topmost items in the tree will have a level of 0, the children of those items will have a level of 1, the children be
low that will have a level of 2, and so on.
...you do this by adding the container attribute to it as fol
lows: <treeitem container="true" /> this al
lows the user to click on the row that corresponds to the treeitem to expand and collapse the inner rows.
...example hierarchical tree the fol
lowing is a simple example: example 1 : source view <tree rows="6"> <treecols> <treecol id="firstname" label="first name" primary="true" flex="3" /> <treecol id="lastname" label="last name" flex="7" /> </treecols> <treechildren> <treeitem container="true" open="true"> <treerow> <treecell label="guys" /> </treerow> <treechildren> <treeitem>...
...you will need to save a number of attributes as indicated in the example be
low: example 2 : source view <tree enablecolumndrag="true" flex="1"> <treecols> <treecol id="runner" label="runner" flex="2" persist="width ordinal hidden" /> <splitter class="tree-splitter" /> <treecol id="city" label="home city" flex="2" persist="width ordinal hidden" /> <splitter class="tree-splitter" /> <treecol id="starttime" label="start time" flex="1" persist="width ordin...
The Chrome URL - Archive of obsolete content
« previousnext » the fol
lowing section will describe how to refer to xul documents and other chrome files.
...the basic syntax of a chrome url is as fol
lows: chrome://<package name>/<part>/<file.xul> the text <package name> is the package name, such as messenger or editor.
... all package names are case insensitive, but
lowercase names are preferred.
...the fol
lowing url will refer to the bookmarks window, listed for firefox: chrome://browser/content/bookmarks/bookmarksmanager.xul you can enter chrome urls anywhere normal urls can be used.
XBL Attribute Inheritance - Archive of obsolete content
inherited attributes xbl al
lows us to build composite widgets while hiding their actual implementation.
...this al
lows both the flexibility of the textbox and the label of the button to be different for each use of the binding.
...the fol
lowing demonstrates this: xul: <box class="labeledtextbox" title="enter some text:" value="ok"/> css: box.labeledtextbox { -moz-binding: url('chrome://example/skin/example.xml#labeledtextbox'); } xbl: <binding id="labeledtextbox"> <content> <xul:label xbl:inherits="value=title"/> <xul:textbox xbl:inherits="value"/> </content> </binding> the textbox inherits the value attribute d...
...the result is as fol
lows: <box class="okcancel" oktitle="ok" canceltitle="cancel" image="happy.png"> <button label="ok" image="happy.png"/> <button label="cancel"/> </box> note that the attributes are duplicated on the inner (anonymous) content.
XBL Example - Archive of obsolete content
navigation buttons along the bottom will al
low the user to cycle through the objects while a text widget between the buttons will display the current page.
... the fol
lowing xul file produces the result in the image.
...the label element could be changed to a field where the user could enter the page to go to, or a popup could be added to al
low selection of the page from a menu.
... the final code the final code is as fol
lows: example 2 : source <binding id="slideshow"> <content> <xul:vbox flex="1"> <xul:deck xbl:inherits="selectedindex" selectedindex="0" flex="1"> <children/> </xul:deck> <xul:hbox> <xul:button xbl:inherits="label=previoustext" oncommand="parentnode.parentnode.parentnode.page--;"/> <xul:description flex="1"/> <xul:button xbl:inherits="label=nexttext" oncommand="parentnode.parentnode.parentnode.page++;"/> </xul:hbox> </xul:vbox> </content> <implementation> <constructor> var totalpages=this.childnodes.length; document.getanonymousnodes(this)[0].c...
Using Remote XUL - Archive of obsolete content
this also means you can't load xul using file:// urls unless you set the preference dom.al
low_xul_xbl_for_file to true.
...the remote xul manager extension lets you manage this whitelist, which is maintained using nsipermissionmanager, by creating entries of type "al
lowxulxbl", like this: components.classes["@mozilla.org/permissionmanager;1"] .getservice(components.interfaces.nsipermissionmanager) .add(uri, 'al
lowxulxbl', components.interfaces.nsipermissionmanager.al
low_action); xul (pronounced like "zool"), which is short for xml-based user interface language, is an xml-based language for describing application interfaces.
...html-based navigation bars take up too much space, dhtml menus are s
low and buggy, and site maps make you go to an intermediate page to find the information you want.
...for apache, you can do this by adding the fol
lowing line to your mime.types file: application/vnd.mozilla.xul+xml .xul alternately, add this line to your httpd.conf file or, if the apache server is configured to al
low it, to the .htaccess file in the directory from which the xul file is served: addtype application/vnd.mozilla.xul+xml .xul then restart your web server.
XUL accessibility tool - Archive of obsolete content
the version currently on xulplanet is compatible with the fol
lowing xul applications: firefox 1.5+ thunderbird 3.0a+ recent sunbird builds recent songbird builds.
... future work the fol
lowing things have been suggested or are planned for a future version of the tool: new tests: (aaronlev) warning: hardcoded color and pixel sizings (aaronlev) error: duplicate accesskey in a dialog (already have this for menus) (aaronlev) error: form control without accesskey (aaronlev) warning: accesskey as
lowercase letter with descender (underlined g,j,y,q,p are hard to read, not recommended...
... known bugs: test for
lowercase i or l as accesskey (sometimes?) flags upppercase i and l too.
... possible false positives in some of the other tests processing is s
lower than we would like.
XML - Archive of obsolete content
you must be very careful about your syntax, and in particular about these four cardinal rules of xul: all events and attributes must be written in
lowercase.
...all of the events and attributes -- even the javascript event listeners normally formatted in the javascript world with uppercase verbs (e.g., onclick, onload) -- must be
lowercase or they are invalid.
... html al
lows some elements, such as <br> and <hr>, to be neither closed nor matched with a closing element.
...as the figure be
low indicates, xul is an amalgam of these different standards: css for styling or "skinning", dom for the object model and scriptable access, javascript for the linking and behavior, rdf for resources, xml for the structure, and html for the content and some little extras.
description - Archive of obsolete content
ption value="this is a long section of text that will not word wrap"> </description> this is a long section of dynamically controlled text that will word wrap <description id="desc" style="width: 300px"></description> document.getelementbyid('desc').textcontent = "this is a long section of dynamic message text that will word wrap"; attributes crop type: one of the values be
low if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute.
...for example, for a menuitem in a menu you can add the fol
lowing css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled type: boolean indicates whether the element is disabled or not.
... the disabled attribute is al
lowed only for form controls.
... value type: string the string attribute al
lows you to associate a data value with an element.
dialog - Archive of obsolete content
buttons type: comma-separated list of the values be
low a comma-separated list of buttons to appear in the dialog box.
...the fol
lowing values can be used in the list: accept: the ok button, which will accept the changes when pressed.
... properties buttons type: comma-separated list of the values be
low a comma-separated list of buttons to appear on the dialog box.
...the fol
lowing values can be used in the list: accept: the ok button, which will accept the changes when pressed.
label - Archive of obsolete content
crop type: one of the values be
low if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute.
...for example, for a menuitem in a menu you can add the fol
lowing css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled type: boolean indicates whether the element is disabled or not.
... the disabled attribute is al
lowed only for form controls.
...odes(), insertbefore(), isdefaultnamespace(), isequalnode, issamenode, issupported(), lookupnamespaceuri, lookupprefix, normalize(), queryselector(), queryselectorall(), removeattribute(), removeattributenode(), removeattributens(), removechild(), removeeventlistener(), replacechild(), setattribute(), setattributenode(), setattributenodens(), setattributens(), setuserdata style classes the fol
lowing classes may be used to style the element.
listcell - Archive of obsolete content
attributes crop, disabled, image, label, type properties disabled style classes listcell-iconic, examples (example needed) attributes crop type: one of the values be
low if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute.
...for example, for a menuitem in a menu you can add the fol
lowing css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled type: boolean indicates whether the element is disabled or not.
... the disabled attribute is al
lowed only for form controls.
... inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlist...
menupopup - Archive of obsolete content
attributes ignorekeys, left, onpopuphidden, onpopuphiding, onpopupshowing, onpopupshown, position, top properties accessibletype, anchornode, popupboxobject, position, state, triggernode methods hidepopup, moveto, openpopup, openpopupatscreen, setconsumerollupevent, showpopup, sizeto examples the fol
lowing example shows how a menupopup may be attached to a menulist.
... <menulist> <menupopup> <menuitem label="mozilla" value="http://mozilla.org"/> <menuitem label="slashdot" value="http://slashdot.org"/> <menuitem label="sourceforge" value="http://sf.net"/> <menuitem label="freshmeat" value="http://freshmeat.net"/> </menupopup> </menulist> the fol
lowing example shows how a menupopup can be used as a context menu for an element.
...this al
lows you to place the popup on one side of a button.
...this is what you might do to show a popup be
low a button, for example.
notificationbox - Archive of obsolete content
this element is used, for example, to implement the yel
low information bar in various firefox windows.
... properties currentnotification, allnotifications, notificationshidden methods appendnotification, getnotificationwithvalue, removeallnotifications, removecurrentnotification, removenotification, removetransientnotifications, attributes inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
... priority levels (defined as properties of notificationbox) : priority_info_
low priority_info_medium priority_info_high priority_warning_
low priority_warning_medium priority_warning_high priority_critical_
low priority_critical_medium priority_critical_high priority_critical_block buttons : the buttons argument is an array of button descriptions.
... each description is an object with the fol
lowing properties: accesskey - the accesskey to appear on the button callback - function to be called when the button is activated.
resizer - Archive of obsolete content
ze;"/> <resizer dir="bottomleft" height="2" style="cursor: sw-resize;"/> </vbox> <vbox flex="1"> <resizer dir="top" height="2" style="background-color: grey; cursor: n-resize;"/> <browser flex="1" id="browser" type="content-primary"/> <resizer dir="bottom" height="2" style="background-color: grey; cursor: s-resize;"/> </vbox> <vbox width="2" style="background-color: grey; overf
low: hidden;"> <resizer dir="topright" height="2" style="cursor: ne-resize;"/> <resizer dir="right" flex="1" style="cursor: e-resize;"/> <resizer dir="bottomright" height="2" style="cursor: se-resize;"/> </vbox> </hbox> </window> resizing an element <stack style="border: 1px solid black;"> <button id="button" label="resizable" left="18" top="18" right="18" bottom="18"/> <resizer di...
..."0" top="0" width="16" height="16"/> <resizer dir="bottomleft" style="background: black; -moz-appearance: none;" element="button" left="0" bottom="0" width="16" height="16"/> <resizer dir="bottomright" style="background: black; -moz-appearance: none;" element="button" right="0" bottom="0" width="16" height="16"/> </stack> attributes dir type: one of the values be
low the direction that the window is resized.
... inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
richlistbox - Archive of obsolete content
the disabled attribute is al
lowed only for form controls.
... seltype type: one of the values be
low used to indicate whether multiple selection is al
lowed.
...(default in tree.) for trees, you can also use the fol
lowing values: cell individual cells can be selected text rows are selected; however, the selection highlight appears only over the text of the primary column.
... value type: string the string attribute al
lows you to associate a data value with an element.
separator - Archive of obsolete content
attributes orient style classes groove, groove-thin, thin examples <separator class="groove-thin"/> attributes orient type: one of the values be
low used to specify whether the separator is a horizontal or vertical separator.
... inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherite...
...d properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserda...
...es(), insertbefore(), isdefaultnamespace(), isequalnode, issamenode, issupported(), lookupnamespaceuri, lookupprefix, normalize(), queryselector(), queryselectorall(), removeattribute(), removeattributenode(), removeattributens(), removechild(), removeeventlistener(), replacechild(), setattribute(), setattributenode(), setattributenodens(), setattributens(), setuserdata style classes the fol
lowing classes may be used to style the element.
titlebar - Archive of obsolete content
if you don't want this behavior, you can override it by setting al
lowevents="true" on the titlebar element.
... style="background: rgba(30, 30, 30, 0.9); -moz-border-radius: 10px; -moz-box-shadow: 0 1px 8px rgba(0, 0, 0, 0.8); margin: 8px 12px 16px;"/> </window> it can be opened from the error console like this: open("file:///users/markus/sites/hudwindow.xul", "", "chrome=1, titlebar=0") attributes inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width note: the al
lowevents attribute did not work for title bars prior to firefox 3.
... properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamen...
tooltip - Archive of obsolete content
reen, showpopup, sizeto examples <tooltip id="moretip" orient="vertical" style="background-color: #33dd00;"> <label value="click here to see more information"/> <label value="really!" style="color: red;"/> </tooltip> <vbox> <button label="simple" tooltiptext="a simple popup"/> <button label="more" tooltip="moretip"/> </vbox> attributes crop type: one of the values be
low if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute.
...for example, for a menuitem in a menu you can add the fol
lowing css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } default type: boolean if true, the tooltip is used as the default popup for displaying tooltips in the window.
...this al
lows you to place the popup on one side of a button.
...this is what you might do to show a popup be
low a button, for example.
treecell - Archive of obsolete content
attributes editable, label, mode, properties, ref, src, value attributes editable type: boolean al
lows the contents of individual cells in the column to be changed, especially useful when <treecol type="checkbox">.
... mode type: one of the values be
low for columns that are progress meters, this determines the type of progress meter to use.
... value type: string the string attribute al
lows you to associate a data value with an element.
... properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlist...
Application Update - Archive of obsolete content
getting started you will need the fol
lowing utility scripts from http://lxr.mozilla.org/mozilla/sourc...ate-packaging/ (or local source of xulrunner) common.sh make_full_update.sh you will need mar / mar.exe to build a complete update patch.
... application settings you will need to configure the fol
lowing settings in your application: branding the update process uses branding information, setup branding for your application as described here: xulrunner tips icons the updater process for linux systems requires updater.png to be in your <application folder>/icons/, see https://bugzilla.mozilla.org/show_bug.cgi?id=706846 preferences // whether or not app updates are enabled pref("app.update.
...enabled", true); // this preference turns on app.update.mode and al
lows automatic download and // install to take place.
...pref("app.update.incompatible.mode", 0); update server fol
low the instructions here to setup an update server for your xulrunner application to query.
Building XULRunner with Python - Archive of obsolete content
you will also want to disable any virus scanner resident monitoring as that will s
low builds.
... set cvsroot=:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot having created amozilla project directory (e.g.c:\projects\mozilla or/c/projects/mozilla in msys) create the fol
lowing .mozconfig file.
...ons --disable-activex ac_add_options --disable-activex-scripting ac_add_options --disable-tests ac_add_options --enable-optimize to check out all the required source code and build it the first time with no local client.mk file, execute cd /c/projects cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co mozilla/client.mk cd mozilla make -f client.mk for subsequent updates from cvs fol
lowed by a build, use cd /c/projects/mozilla make -f client.mk which will also checkout client.mk itself for build only, without checkouts, use make -f client.mk build and see client.mk for other options.
... using python in xul applications add the fol
lowing to yourprefs.js during development pref("browser.dom.window.dump.enabled", true); pref("javascript.options.showinconsole", true); pref("javascript.options.strict", true); pref("nglayout.debug.disable_xul_cache", true); pref("nglayout.debug.disable_xul_fastload", true); html <script> tags specify that python is used withtype="application/x-python" attribute.
Creating a Windows Inno Setup installer for XULRunner applications - Archive of obsolete content
my app's example fol
lows.
... my app's .iss file sample as fol
lows: ; script generated by the inno setup script wizard.
... [setup] appname=my app appvername=my app 1.0 apppublisher=mark finkle apppublisherurl=http://developer.mozilla.org/en/docs/getting_started_with_xulrunner appsupporturl=http://developer.mozilla.org/en/docs/getting_started_with_xulrunner appupdatesurl=http://developer.mozilla.org/en/docs/getting_started_with_xulrunner defaultdirname={pf}\my app defaultgroupname=my app al
lownoicons=yes outputdir=..\build\output outputbasefilename=myapp-1.0-win32 ; setupiconfile= compression=lzma solidcompression=yes [languages] name: english; messagesfile: compiler:default.isl [components] name: main; description: my app; types: full compact custom; flags: fixed name: runtime; description: xul runner runtime; types: full custom [tasks] name: desktopicon; description: {cm:createdes...
...ns] name: {group}\my app; filename: {app}\myapp.exe name: {group}\{cm:uninstallprogram,xul explorer}; filename: {uninstallexe} name: {userdesktop}\my app; filename: {app}\myapp.exe; tasks: desktopicon name: {userappdata}\microsoft\internet explorer\quick launch\my app; filename: {app}\myapp.exe; tasks: quicklaunchicon [run] filename: {app}\myapp.exe; description: {cm:launchprogram,my app}; onlybe
lowversion: 0,6; flags: nowait postinstall skipifsilent step 4: building an installer once your script is ready, start the inno setup compiler, load the script file, and compile it.
Deploying XULRunner - Archive of obsolete content
the installed files should be arranged in the fol
lowing directory structure: installdir/ application.ini components/ ...
...copy xulrunner/ to this directory when deploying with xulrunner 2.0 and above do the fol
lowing: move chrome.manifest to the root directory, and adjust resource paths inside chrome.manifest accordingly with xulrunner 9.0 or 10.0 you may need to copy "mozutils.dll" and/or "mozcrt19.dll" from the xulrunner directory to the root directory.
...the complete bundle structure is as fol
lows: myapp.app/ contents/ info.plist pkginfo frameworks/ xul.framework/ files copied from /library/frameworks/xul.framework/versions/1.8/...
...the archive should be structured as fol
lows: appname/ application.ini components/ ...
calICalendarView - Archive of obsolete content
this al
lows lack of required predictability al
lows calicalendarview implementations to be re-used in a variety of sitatuations.
...this link al
lows the calicalendarview to have a way of creating, modifying, and deleting events based on user interaction with the dom nodes it controls, often without requiring any other user interaction.
... supportsdisjointdates consumers of calicalendarview should check this attribute to determine whether or not the implementation al
lows for calls to setdatelist.
... if an implementation returns true for this attribute, it must al
low for any arbitrary set of dates to be displayed.
Styling the Amazing Netscape Fish Cam Page - Archive of obsolete content
<div class="card"> <img src="thumb_c
lown_trigger.jpg" alt="c
lown trigger" border="0" width="150" height="115"> <h3>c
lown trigger</h3> <p> our c
lown trigger is a bold little fish, though for a few weeks he slept a lot and didn't look well in general.
... unfortunately, a few browsers don't get this right, and end up f
lowing the cards as a single vertical column instead of putting the fish side by side.
... after a bit of fiddling to try to fix this, i decided that trying to overcome this error in document f
low wasn't worth the effort.
...rather than try to fight it or push the image be
low the h3's element box, i let the image mostly overlap the h3, but with a slight offset.
XForms Select Element - Archive of obsolete content
introduction al
lows the user to choose one or more selections from a list of pre-defined items (see the spec).
...this attribute, when set to 'open', al
lows the user to provide free entry to the list.
...the data binding restriction to simple content may be relaxed when an itemset element is used, which al
lows the available choices to be obtained from an xforms model.
... representations the xforms select element can be represented by the fol
lowing widgets for the specified appearance attribute values: list - default representation (xhtml/xul) check group- used when appearance = 'full' (xhtml/xul) list displaying a listbox is the default representation (xhtml/xul).
XForms Select1 Element - Archive of obsolete content
introduction al
lows the user to choose a single value from a list of pre-defined values (see the spec).
... single-node binding special selection - this attribute, when set to 'open', al
lows the user to provide free entry to the list.
...the data binding restriction to simple content may be relaxed when an itemset element is used, which al
lows the available choices to be obtained from an xforms model.
... representations the xforms select1 element can be represented by the fol
lowing widgets for the specified appearance attribute values: combobox - default representation (xhtml/xul) listbox - used when appearance = 'compact' (xhtml/xul) radio group - used when appearance = 'full' (xhtml/xul) combobox displaying a combobox is the default representation (xhtml/xul).
Describing microformats in JavaScript - Archive of obsolete content
microformat definition format the microformat definition must contain the fol
lowing entries: mfversion specifies the version number of the microformat api to which the definition was written.
...the adr microformat is defined as fol
lows: var adr_definition = { mfversion: 0.8, mfobject: adr, classname: "adr", properties: { "type" : { plural: true, types: ["work", "home", "pref", "postal", "dom", "intl", "parcel"] }, "post-office-box" : { }, "street-address" : { plural: true }, "extended-address" : { }, "locality" : { }, "region" : { }, "postal-code" :...
...this al
lows an address to be marked as being, for example, a work address for receiving parcels.
...this al
lows multiple lines of address information to be contained in the street-address array.
Popup Window Controls - Archive of obsolete content
mozilla and firefox al
low users to control most unsolicited attempts to open new windows such as popup and popunder windows.
... popup window controls configuration using the preference for privacy & security > popup windows, users can: al
low all sites to open popup windows except for sites which the user has explicity denied permission what popup windows are suppressed?
... mozilla will attempt to suppress all calls to window.open() which occur in the fol
lowing circumstances: global script which is executed as the document is loading script executed as part of a onload event handler script executed in settimeout() or setinterval() what popup windows are not suppressed?
...empt to open an unsolicited window var popup = window.open('about:blank', 'popup'); if (!popup) { // the user has suppressed the popup } // --> </script> </head> <body> <!-- your page here --> </body> </html> if your popup window is crucial to the operation of your web site you can notify the user and ask them to add your site to the list of sites which are al
lowed to use unsolicited popup windows.
Game distribution - Game development
you've fol
lowed a tutorial or two and created an html5 game — that's great!
...this can range from
low-end smartphones or tablets, through laptops and desktop computers, to smart tvs, watches or even a fridge if it can handle a modern enough browser.
... google play's requirements are less strict, so the store is polluted with
low quality games.
...it's more like an excellent promotional opportunity than a way to earn a lot of money, however, as the prices paid for the games in a bundle are usually quite
low.
Explaining basic 3D theory - Game development
terminology used in the diagram above is as fol
lows: a primitive: an input to the pipeline — it's built from vertices and can be a triangle, point or line.
...applying textures onto objects during the fragment processing stage of the rendering pipeline al
lows us to adjust it by wrapping and filtering it if necessary.
... texture wrapping al
lows us to repeat the 2d image around the 3d object.
...if you want to move on to practice and see some demos in action, fol
low up with the tutorials be
low: building up a basic demo with three.js building up a basic demo with babylon.js building up a basic demo with playcanvas building up a basic demo with a-frame go ahead and create some cool cutting-edge 3d experiments yourself!
Implementing game control mechanisms - Game development
in the fol
lowing articles we will show how to implement various different control mechanisms for captain rogers to support different platforms — from touch on mobile, through keyboard/mouse/gamepad on desktop, to more unconventional ones like tv remote, shouting to or waving your hand in front of the laptop, or squeezing bananas.
...it will be explained in the given articles themselves be
low, but you can play with it already, and use the code however you want for learning purposes.
... the articles javascript is the perfect choice for mobile gaming because of html5 being truly multiplatform; all of the fol
lowing articles focus on the apis provided for interfacing with different control mechanisms: mobile touch controls — the first article will kick off with touch, as the mobile first approach is very popular.
... desktop gamepad controls — the gamepad api rather usefully al
lows gamepads to be used for controlling web apps on desktop/laptop, for that console feel.
Build the brick field - Game development
add the fol
lowing lines to your code be
low the variables which you have previously declared in your program.
...add the fol
lowing just be
low your variables: var bricks = []; for(var c=0; c<brickcolumncount; c++) { bricks[c] = []; for(var r=0; r<brickrowcount; r++) { bricks[c][r] = { x: 0, y: 0 }; } } the code above will loop through the rows and columns and create the new bricks.
... the final version of the drawbricks() function, after assigning the brickx and bricky values as the coordinates instead of (0,0) each time, will look like this — add this into your code be
low the drawpaddle() function: function drawbricks() { for(var c=0; c<brickcolumncount; c++) { for(var r=0; r<brickrowcount; r++) { var brickx = (c*(brickwidth+brickpadding))+brickoffsetleft; var bricky = (r*(brickheight+brickpadding))+brickoffsettop; bricks[c][r].x = brickx; bricks[c][r].y = bricky; ctx.beginpath(); ...
...add the fol
lowing just above the drawball() call: drawbricks(); compare your code at this point, the game has got a little more interesting again : exercise: try changing the number of bricks in a row or a column, or their positions.
Create the Canvas and draw on it - Game development
using your favourite text editor, create a new html document, save it as index.html, in a sensible location, and add the fol
lowing code to it: <!doctype html> <html> <head> <meta charset="utf-8" /> <title>gamedev canvas workshop</title> <style> * { padding: 0; margin: 0; } canvas { background: #eee; display: block; margin: 0 auto; } </style> </head> <body> <canvas id="mycanvas" width="480" height="320"></canvas> <script> // javascript code goes here </script> </body> </html> we have a char...
...the <canvas> element has an id of mycanvas to al
low us to easily grab a reference to it, and it is 480 pixels wide and 320 pixels high.
...add the fol
lowing be
low your opening <script> tag.
...add this be
low your previous lines of javascript, then load your index.html in a browser to try it out.
Finishing up - Game development
let's first add a variable to store the number of lives in the same place where we declared our other variables: var lives = 3; drawing the life counter looks almost the same as drawing the score counter — add the fol
lowing function to your code, be
low the drawscore() function: function drawlives() { ctx.font = "16px arial"; ctx.fillstyle = "#0095dd"; ctx.filltext("lives: "+lives, canvas.width-65, 20); } instead of ending the game immediately, we will decrease the number of lives until they are no longer available.
...so, in the draw() function replace the fol
lowing three lines: alert("game over"); document.location.reload(); clearinterval(interval); // needed for chrome to end game with this, we can add slightly more complex logic to it as given be
low: lives--; if(!lives) { alert("game over"); document.location.reload(); clearinterval(interval); // needed for chrome to end game } else { x = canvas.width/2; y = canvas.height-30; dx = 2; dy = -2; paddlex = (canvas.width-paddlewidth)/2; } now, when the ball hits the bottom edge of the screen, we're subtracting one life from the lives variable.
... rendering the lives display now you need to add a call to drawlives() inside the draw() function and add it be
low the drawscore() call.
...replace the fol
lowing line: var interval = setinterval(draw, 10); with simply: draw(); and remove each instance of: clearinterval(interval); // needed for chrome to end game then, at the very bottom of the draw() function (just before the closing curly brace), add in the fol
lowing line, which causes the draw() function to call itself over and over again: requestanimationframe(draw); the draw() function is now getting executed again and again within a requestanimationframe()...
Mouse controls - Game development
add the fol
lowing line in the same place as the other event listeners, just be
low the keyup event: document.addeventlistener("mousemove", mousemovehandler, false); anchoring the paddle movement to the mouse movement we can update the paddle position based on the pointer coordinates — the fol
lowing handler function will do exactly that.
... add the fol
lowing function to your code, be
low the previous line you added: function mousemovehandler(e) { var relativex = e.clientx - canvas.offsetleft; if(relativex > 0 && relativex < canvas.width) { paddlex = relativex - paddlewidth/2; } } in this function we first work out a relativex value, which is equal to the horizontal mouse position in the viewport (e.clientx) minus the distance between the left edge of the canvas and left edge of the viewport (canvas.offsetleft) — effectively this is equal to the distance between the canvas left edge and the mouse pointer.
... if the relative x pointer position is greater than zero and
lower than the canvas width, the pointer is within the canvas boundaries, and the paddlex position (anchored on the left edge of the paddle) is set to the relativex value minus half the width of the paddle, so that the movement will actually be relative to the middle of the paddle.
... the paddle will now fol
low the position of the mouse cursor, but since we're restricting the movement to the size of the canvas, it won't disappear completely off either side.
Buttons - Game development
add these lines be
low your other variable definitions: var playing = false; var startbutton; loading the button spritesheet we can load the button spritesheet the same way we loaded the ball's wobble animation.
... add the fol
lowing to the bottom of the preload() function: game.load.spritesheet('button', 'img/button.png', 120, 40); a single button frame is 120 pixels wide and 40 pixels high.
...add the fol
lowing lines to the bottom of your create() function: startbutton = game.add.button(game.world.width*0.5, game.world.height*0.5, 'button', startgame, this, 1, 0, 2); startbutton.anchor.set(0.5); the button() method's parameters are as fol
lows: the button's x and y coordinates the name of the graphic asset to be displayed for the button a callback function that will be executed when the button is pressed a reference to this to specify the execution context the frames that will be used for the over, out and down events.
... compare your code you can check the finished code for this lesson in the live demo be
low, and play with it to understand better how it works: next steps the last thing we will do in this article series is make the gameplay even more interesting by adding some randomization to the way the ball bounces off the paddle.
Extra lives - Game development
new variables add the fol
lowing new variables be
low the existing ones in your code: var lives = 3; var livestext; var lifelosttext; these respectively will store the number of lives, the text label that displays the number of lives that remain, and a text label that will be shown on screen when the player loses one of their lives.
...add the fol
lowing lines be
low the existing scoretext definition inside your create() function: livestext = game.add.text(game.world.width-5, 5, 'lives: '+lives, { font: '18px arial', fill: '#0095dd' }); livestext.anchor.set(1,0); lifelosttext = game.add.text(game.world.width*0.5, game.world.height*0.5, 'life lost, click to continue', { font: '18px arial', fill: '#0095dd' }); lifelosttext.anchor.set(0.5); lifelosttext.visible = false; the livestext and lifelosttext objects look very similar to the scoretext one — they define a position on the screen, the actual text to display, and the font styling.
...instead of executing an anonymous function and showing the alert right away : ball.events.onoutofbounds.add(function(){ alert('game over!'); location.reload(); }, this); we will assign a new function called ballleavescreen; delete the previous event handler (shown above) and replace it with the fol
lowing line: ball.events.onoutofbounds.add(ballleavescreen, this); we want to decrease the number of lives every time the ball leaves the canvas.
... compare your code you can check the finished code for this lesson in the live demo be
low, and play with it to understand better how it works: next steps lives made the game more forgiving — if you lose one life, you still have two more left and can continue to play.
Physics - Game development
add the physics.startsystem() method at the beginning of the create function (make it the first line inside the function), as shown be
low: game.physics.startsystem(phaser.physics.arcade); next, we need to enable our ball for the physics system — phaser object physics is not enabled by default.
... add the fol
lowing line at the bottom of the create() function: game.physics.enable(ball, phaser.physics.arcade); next, if we want to move our ball on the screen, we can set velocity on its body.
... add the fol
lowing line, again at the bottom of create(): ball.body.velocity.set(150, 150); removing our previous update instructions remember to remove our old method of adding values to x and y from the update() function: function update() { ball.x += 1; ball.y += 1; } we are now handling this properly, with a physics engine.
... compare your code you can check the finished code for this lesson in the live demo be
low, and play with it to understand better how it works: next steps now we can move to the next lesson and see how to make the ball bounce off the walls.
Randomizing gameplay - Game development
making rebounds more random we can change the ball's velocity depending on the exact spot it hits the paddle, by modifying the x velocity each time the ballhitpaddle() function is run using a line along the lines of the be
low.
... compare your code you can check the finished code for this lesson in the live demo be
low, and play with it to understand better how it works: summary you've finished all the lessons — congratulations!
... exercises to fol
low you can do a lot more in the game — add whatever you feel would be best to make it more fun and interesting.
...be
low are some suggestions as to how you could expand our little game, to get you started: add a second ball or paddle.
Visual JS GE - Game development
installing modules navigate to server_instance/, then in the node.js command prompt or console enter the fol
lowing installation commands: npm install mysql npm install delivery npm install express npm install mkdirp npm install socket.io npm install nodemailer@0.7.0 setting up config.js you will find config.js in the server_instance folder: all node.js applications use the same folder — server_instance.
...you need to edit the config file to include the correct paths to the node app and project instance, as indicated be
low: module.exports = { version : "0.5", path_of_node_app : "d:/path_to_server_instance_folder/server/" , // edit here path_of_www : "d:/xamp/htdocs/project_instance/", // path_to_www edit here editor_port : "1013", reg_path : "users/", account_port : 3666 , destroy_session_after_x_mseconds : 20000, }; local node.js application tools (uses in developer mode only) the fol
lowing section provides information about the tools involved in visual-js game engine.
... after this has finished processing, restart the web page by entering the fol
lowing in the console: resource.test_res.
...contains the fol
lowing tools.
Gecko FAQ - Gecko Redirect 1
gecko has been known previously by the code names "raptor" and "nglayout"; the new name was chosen fol
lowing a trademark infringement dispute.
... by the end of calendar year 2000, gecko is expected to support the fol
lowing recommended open internet standards fully except for the areas noted be
low and open bugs documented in bugzilla: html 4.0 - full support except for: elements: bdo, basefont attributes: shape attribute on the a element, abbr, axis, headers, scope-row, scope-col, scope-rowgroup, scope-colgroup, charoff, datasrc, datafld, dataformat, datapagesize, summary, event, dir, align on table c...
...so long as qa testing and test case development continues, there will always be known bugs at any given point in time in the open-source gecko codebase, and it fol
lows that every commercial product that has ever shipped and ever will ship based on gecko will have known bugs at the time of its release.
... gecko includes the fol
lowing components: document parser (handles html and xml) layout engine with content model style system (handles css, etc.) javascript runtime (spidermonkey) image library networking library (necko) platform-specific graphics rendering and widget sets for win32, x, and mac user preferences library mozilla plug-in api (npapi) to support the navigator plug-in interface open java interface (...
Grid Lines - MDN Web Docs Glossary: Definitions of Web-related terms
in the fol
lowing example there is a grid with three column tracks and two row tracks.
...the image be
low shows the line numbers of the grid, assuming the language is left-to-right.
...in the fol
lowing example the item is positioned from column line 1 to column line 3, and from row line 1 to row line 3.
...when placing an item, you can then use these names instead of the line number, as demonstrated be
low.
Network throttling - MDN Web Docs Glossary: Definitions of Web-related terms
network throttling is an intentional s
lowing down of internet speed.
... in web performance, network throttling, or network condition emulation, it is used to emulate
low bandwidth conditions experienced by likely a large segment of a site's target user base.
...the network speeds of a mobile user accessing that web application, possibly while traveling or in a remote area with poor data plan covereage, will likely be very s
low, if they are able to get online at all.
... browser developer tools generally have network throttling options, to al
low you to test your app under s
low network conditions.
Quality values - MDN Web Docs Glossary: Definitions of Web-related terms
it is a special syntax al
lowed in some http headers and in html.
... the importance of a value is marked by the suffix ';q=' immediately fol
lowed by a value between 0 and 1 included, with up to three decimal digits, the highest value denoting the highest priority.
... examples the fol
lowing syntax text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 indicates the order of priority: value priority text/html and application/xhtml+xml 1.0 application/xml 0.9 */* 0.8 if there is no priority defined for the first two values, the order in the list is irrelevant.
... nevertheless, with the same quality, more specific values have priority over less specific ones: text/html;q=0.8,text/*;q=0.8,*/*;q=0.8 value priority text/html 0.8 (but totally specified) text/* 0.8 (partially specified) */* 0.8 (not specified) some syntax, like the one of accept, al
low additional specifiers like text/html;level=1.
Thread - MDN Web Docs Glossary: Definitions of Web-related terms
because these things are all happening in one thread, a s
low website or app script s
lows down the entire browser; worse, if a site or app script enters an infinite loop, the entire browser will hang.
...this al
lows s
low, complex, or long-running tasks to be executed independently of the main thread, preserving the overall performance of the site or app—as well as that of the browser overall.
... this also al
lows individuals to take advantage of modern multi-core processors.
...they help minimise the context switching time, enables more efficient communication and al
lows further use of the multiprocessor architecture.
Test your skills: CSS and JavaScript accessibility - Learn web development
note: you can try out solutions in the interactive editors be
low, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
... try updating the live code be
low to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor.
... try updating the live code be
low to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor.
...clicking one of the animal names causes a further description of that animal to appear in a box be
low the list.
Accessibility - Learn web development
the fol
lowing video provides a nice introduction to it: looking to become a front-end web developer?
... this article starts off the module with a good look at what accessibility is — this includes what groups of people we need to consider and why, what tools different people use to interact with the web, and how we can make accessibility part of our web development workf
low.
... css and javascript accessibility best practices css and javascript, when used properly, also have the potential to al
low for accessible web experiences, but if misused they can significantly harm accessibility.
... wai-aria basics fol
lowing on from the previous article, sometimes making complex ui controls that involve unsemantic html and dynamic javascript-updated content can be difficult.
Test your skills: backgrounds and borders - Learn web development
note: you can try out solutions in the interactive editors be
low, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
... the finished example should look like the image be
low.
... try updating the live code be
low to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor.
... the finished example should look like the image be
low: try updating the live code be
low to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor.
Test your skills: values and units - Learn web development
note: you can try out solutions in the interactive editors be
low, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
... try updating the live code be
low to recreate the finished example: for assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor.
... try updating the live code be
low to recreate the example as displayed in the image: for assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor.
... try updating the live code be
low to recreate the example as displayed in the image: for assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor.
Test your skills: Multicol - Learn web development
note: you can try out solutions in the interactive editors be
low, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
... try updating the live code be
low to recreate the finished example: for assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor.
... try updating the live code be
low to recreate the finished example: for assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor.
... try updating the live code be
low to recreate the finished example: for assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor.
Test your skills: position - Learn web development
note: you can try out solutions in the interactive editors be
low, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
... try updating the live code be
low to recreate the finished example: as an extra challenge, can you change the target to display underneath the text?
... position two in the be
low example if you scroll the box the sidebar scrolls with the content.
... try updating the live code be
low to recreate the finished example: for assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor.
How do you make sure your website works properly? - Learn web development
you might be surprised at how many problems come up: images don't show up, pages don't load or load s
lowly, and so on.
... 403: forbidden you aren't al
lowed to display the resource.
...we'll discuss how to solve this be
low.
...resources like webpagetest.org or browser add-ons like ys
low can tell you a few interesting things: grades go from a to f.
What HTML features promote accessibility? - Learn web development
the fol
lowing content describes specific features of html that can be used to make a web page more accessible to people with different disabilities.
...the tabindex attribute al
lows you to define this order.
... <a href="somepage.html" accesskey="s">some page</a> skip links to aid tabbing, you can supply links that al
low users to jump over chunks of your web page.
... you might want to al
low someone to jump over a plethora of navigation links, for example, so they can just read a page’s main content rather than cycle through all of the links.
How do you set up a local testing server? - Learn web development
if the web address path starts with file:// fol
lowed by the path to the file on your local hard drive, a local file is being used.
...if you are a windows user, you can get an installer from the python homepage and fol
low the instructions to install it: go to python.org under the download section, click the link for python "3.xxx".
...to check python is installed, enter the fol
lowing command: python -v # or you might have the py command available, # in which case try py -v this should return a version number.
... note: if you already have something running on port 8000, you can choose another port by running the server command fol
lowed by an alternative port number, e.g.
Example 2 - Learn web development
<span class="value">cherry</span> <ul class="optlist hidden"> <li class="option">cherry</li> <li class="option">lemon</li> <li class="option">banana</li> <li class="option">strawberry</li> <li class="option">apple</li> </ul> </div> <form> css content .widget select, .no-widget .select { position : absolute; left : -5000em; height : 0; overf
low : hidden; } /* --------------- */ /* required styles */ /* --------------- */ .select { position: relative; display : inline-block; } .select.active, .select:focus { box-shadow: 0 0 3px 1px #227755; outline: none; } .select .optlist { position: absolute; top : 100%; left : 0; } .select .optlist.hidden { max-height: 0; visibility: hidden; } /* ------------ */ /* fanc...
... 100px */ border : 0.2em solid #000; /* 2px */ border-radius : 0.4em; /* 4px */ box-shadow : 0 0.1em 0.2em rgba(0,0,0,.45); /* 0 1px 2px */ background : #f0f0f0; background : -webkit-linear-gradient(90deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); background : linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); } .select .value { display : inline-block; width : 100%; overf
low : hidden; white-space : nowrap; text-overf
low : ellipsis; vertical-align: top; } .select:after { content : "▼"; position: absolute; z-index : 1; height : 100%; width : 2em; /* 20px */ top : 0; right : 0; padding-top : .1em; -moz-box-sizing : border-box; box-sizing : border-box; text-align : center; border-left : .2em solid #000; border-radius: 0...
...background-color : #000; color : #fff; } .select .optlist { z-index : 2; list-style: none; margin : 0; padding: 0; background: #f0f0f0; border: .2em solid #000; border-top-width : .1em; border-radius: 0 0 .4em .4em; box-shadow: 0 .2em .4em rgba(0,0,0,.4); -moz-box-sizing : border-box; box-sizing : border-box; min-width : 100%; max-height: 10em; /* 100px */ overf
low-y: auto; overf
low-x: hidden; } .select .option { padding: .2em .3em; } .select .highlight { background: #000; color: #ffffff; } javascript content window.addeventlistener("load", function () { var form = document.queryselector('form'); form.classlist.remove("no-widget"); form.classlist.add("widget"); }); result for js no js html content <form class="no-widget"> <select name="m...
... <span class="value">cherry</span> <ul class="optlist hidden"> <li class="option">cherry</li> <li class="option">lemon</li> <li class="option">banana</li> <li class="option">strawberry</li> <li class="option">apple</li> </ul> </div> <form> css content .widget select, .no-widget .select { position : absolute; left : -5000em; height : 0; overf
low : hidden; } result for no js ...
Test your skills: HTML5 controls - Learn web development
note: you can try out solutions in the interactive editors be
low, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
...create appropriate inputs for a user to update their details for: email website phone number favourite color try updating the live code be
low to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor.
... html5 controls 2 next, we want you to implement a slider control to al
low the user to choose a maximum number of people to invite to their party.
... try updating the live code be
low to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor.
Publishing your website - Learn web development
all registrars will have a feature to al
low you to check if the domain name you want is available.
...it al
lows you to upload code repositories for storage in the git version control system.
...github has a very useful feature called github pages, which al
lows you to expose website code live on the web.
... using a web-based ide such as codepen there are a number of web apps that emulate a website development environment, al
lowing you to enter html, css and javascript, and then display the result of that code as a website — all in one browser tab.
Add a hitmap on top of an image - Learn web development
the image must make it clear what happens when people fol
low image links.
... for a circle, provide the center's x and y coordinates, fol
lowed by the length of the radius.
...you may leave this attribute blank if you don’t want the current area to link anywhere (say, if you’re making a hol
low circle.) alt a mandatory attribute, telling people where the link goes or what it does.
...try fol
lowing links with your keyboard alone.
Debugging HTML - Learn web development
for example, the fol
lowing shows an error reported when trying to compile a simple program written in the rust language.
... note: html is parsed permissively because when the web was first created, it was decided that al
lowing people to get their content published was more important than making sure the syntax was absolutely correct.
... you will know when all your errors are fixed when you see the fol
lowing banner in your output: summary so there we have it, an introduction to debugging html, which should give you some useful skills to count on when you start to debug css, javascript, and other types of code later on in your career.
... this also marks the end of the introduction to html module learning articles — now you can go on to testing yourself with our assessments: the first one is linked be
low.
Test your skills: Advanced HTML text - Learn web development
note: you can try out solutions in the interactive editors be
low, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
... try updating the live code be
low to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor.
... advanced html text 2 in this task we want you to add some semantics to the provided html as fol
lows: turn the second paragraph into a block-level quote, and semantically indicate that the quote is taken from accessibility.
... try updating the live code be
low to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor.
Test your skills: HTML text basics - Learn web development
note: you can try out solutions in the interactive editors be
low, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
...try updating the live code be
low to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor.
... try updating the live code be
low to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor.
... try updating the live code be
low to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor.
Test your skills: HTML images - Learn web development
note: you can try out solutions in the interactive editors be
low, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
... try updating the live code be
low to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor.
... try updating the live code be
low to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor.
... try updating the live code be
low to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor.
Mozilla splash page - Learn web development
the fol
lowing subsections detail what you need to do: preparing images using your favourite image editor, create 400px wide and 120px wide versions of: firefox_logo-only_rgb.png firefox-addons.jpg mozilla-dinosaur-head.png call them something sensible, e.g.
... adding a video to the main article content just inside the <article> element (right be
low the opening tag), embed the youtube video found at https://www.youtube.com/watch?v=ojcncvb1olg, using the appropriate youtube tools to generate the code.
... example the fol
lowing screenshots show what the splash page should look like after being correctly marked up, on a wide and narrow screen display.
...glitch is probably better for this example, as it al
lows you upload assets like images, whereas some of the other tools don't.
Test your skills: Multimedia and embedding - Learn web development
note: you can try out solutions in the interactive editors be
low, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
... try updating the live code be
low to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor.
... try updating the live code be
low to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor.
... try updating the live code be
low to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor.
Multimedia and Embedding - Learn web development
guides this module contains the fol
lowing articles which will take you through all the fundamentals of embedding multimedia on webpages.
... from <object> to <iframe> — other embedding technologies at this point we'd like to take somewhat of a sideways step, looking at a couple of elements that al
low you to embed a wide variety of content types into your webpages: the <iframe>, <embed> and <object> elements.
... <iframe>s are for embedding other web pages, and the other two al
low you to embed pdfs, svg, and even flash — a technology on its way out, but which you may still see semi-regularly.
... assessments the fol
lowing assessments will test your understanding of the html basics covered in the guides above: mozilla splash page in this assessment, we'll test your knowledge of some of the techniques discussed in this module's articles, getting you to add some images and video to a funky splash page all about mozilla!
Silly story generator - Learn web development
project brief you have been provided with some raw html/css and a few text strings and javascript functions; you need to write the necessary javascript to turn this into a working program, which does the fol
lowing: generates a silly story when the "generate random story" button is pressed.
... will generate another random silly story if you press the button again (and again...) the fol
lowing screenshot shows an example of what the finished program should output: to give you more of an idea, have a look at the finished example (no peeking at the source code!) steps to complete the fol
lowing sections describe what you need to do.
...what you need to do is as fol
lows: look up the formulae for converting pounds to stone, and fahrenheit to centigrade.
...the fol
lowing for example turns the background of the <html> element red — so the entire browser window should go red if the javascript is applied properly: document.queryselector('html').style.backgroundcolor = 'red'; math.round() is a built-in javascript method that simply rounds the result of a calculation to the nearest whole number.
Test your skills: Math - Learn web development
note: you can try out solutions in the interactive editors be
low, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
... note: in the examples be
low, if there is an error in your code it will be outputted into the results panel on the page, to help you try to figure out the answer (or into the browser's javascript console, in the case of the downloadable version).
... so, try updating the live code be
low to recreate the finished example, fol
lowing these steps: create four variables that contain numbers.
... try updating the live code be
low to recreate the finished example, fol
lowing these steps: write a calculation that multiplies result and result2 together and assigns the result back to result.
What is web performance? - Learn web development
previous overview: performance next web performance is all about making web sites fast, including making s
low processes seem fast.
... does the site load quickly, al
low the user to start interacting with it quickly, and offer reassuring feedback if something is taking time to load (e.g.
...this includes the fol
lowing major areas: reducing overall load time: how long does it take the files required to render the web site to download on to the user's computer?
...the browser fol
lows a well-defined set of steps, and optimizing the critical rendering path to prioritize the display of content that relates to the current user action will lead to significant improvements in content rendering time.
The business case for web performance - Learn web development
a performance budget is a set of limits that are set to specify limits, such as maximum number of http requests al
lowed, the maximum total size of all the assets combined, the minimum al
lowable fps on a specific device, etc, that must be maintained.
...when a business site is s
low, it can prevent users from completing their intended task.
... this can lead to
low conversion rates.
...when a site performance s
lowly, users are more likely to abandon the site prematurely which can lead to
low time on site metrics.
Ember resources and troubleshooting - Learn web development
for framework-specific things, there is the ember-inspector add-on, which al
lows inspection of: routes & controllers components services promises data (i.e: from a remote api — from ember-data, by default) deprecation information render performance for general javascript debugging, check out our guides on javascript debugging as well as interacting with the browser's other debugging tools.
...the intentional minimalism forces certain decisions, and al
lows for more consistent code, while keeping the template more structural rather than having them filled with bespoke logic.
... mut was not covered in this tutorial and is really baggage from a transitional time when ember was moving from two-way bound data to the more common and easier-to-reason-about one-way bound data f
low.
... more concretely, using mut al
lows for template-only settings functions to be declared: <checkbox @value={{this.somedata}} @ontoggle={{fn (mut this.somedata) (not this.somedata)}} /> whereas, without mut, a component class would be needed: import component from '@glimmer/component'; import { tracked } from '@glimmer/tracking'; import { action } from '@ember/object'; export default class example extends component { @tracked somedata = false; @action setdata(newvalue) { this.somedata = newvalue; } } which would then be called in the template like so: <checkbox @data={{this.somedata}} @onchange={{this.setdata}} /> due to the conciseness of using mut, it may be desireable to r...
Using Vue computed properties - Learn web development
adding a summary counter add the fol
lowing code to your app component object, be
low the methods property.
... add the described <h2> and update the <ul> inside your app's template as fol
lows: <h2 id="list-summary">{{listsummary}}</h2> <ul aria-labelledby="list-summary" class="stack-large"> <li v-for="item in todoitems" :key="item.id"> <to-do-item :label="item.label" :done="item.done" :id="item.id"></to-do-item> </li> </ul> you should now see the list summary in your app, and the total number of items update as you add more todo items!
... in app.vue, add a new method called updatedonestatus(), be
low your addtodo() method.
...update your <to-do-item></to-do-item> call as fol
lows: <to-do-item :label="item.label" :done="item.done" :id="item.id" @checkbox-changed="updatedonestatus(item.id)"> </to-do-item> now if you check a todoitem, you should see the summary update appropriately!
Focus management with Vue refs - Learn web development
we'll look at using vue refs to handle this — an advanced feature that al
lows you to have direct access to the underlying dom nodes be
low the virtual dom, or direct access from one component to the internal dom structure of a child component.
...the list of lifecycle methods are be
low, in the order that they fire.
... inside app.vue, update your <h2> as fol
lows: <h2 id="list-summary" ref="listsummary" tabindex="-1">{{listsummary}}</h2> note: tabindex is a really powerful tool for handling certian accessibility problems.
...you should also almost never use tabindex > = 0, as it can cause problems for users since it can make the dom f
low and the tab-order mismatch, and/or add non-interactive elements to the tab order.
Mozilla accessibility architecture
for example, this al
lows the msaa client to invalidate parts of its own cache or data model based on dom mutation events.
... this architecture al
lows us to quickly wipe away an entire document's worth of cached nodes when a document goes away, simply by destroying the document accessible's cache.
...the member variables keeping track of the number of children, parent, first child and next sibling al
low us to have instant traversal around accessible nodes that have already been visited.
...in other words, the
lowest common denominator for objects we must cache is nsaccessnode.
Accessibility information for UI designers and developers
your content can then be better consumed by users with
low vision and people with color deficiencies.
...ensure your design is flexible enough to al
low for this.
... text spacing users should be able to make the fol
lowing changes to their text spacing: set line height (leading) to at least 1.5 times the font size set spacing fol
lowing paragraphs to at least 2 times the font size set letter spacing (tracking) to at least 0.12 times the font size set word spacing to at least 0.16 times the font size this does not mean that your page needs to offer controls to make such changes, merely that if someone does these things in a custom stylesheet, they should not break the interface.
...placeholders are best avoided for this, as they are often too
low in contrast.
Multiprocess on Windows
when an incoming rpc invokes a method on an interceptor, the interceptor dispatches a callback that al
lows us to do whatever we want with that request.
...the required steps are as fol
lows: ensure that you generate typelibs for all of your com interfaces; ensure that those interfaces are registered; register any outparams that consist of arrays of interfaces.
...for example, if interface ifoo inherits from iunknown, the
lowest possible mmethodindex for ifoo could be 3, because indices 0, 1, and 2 are occupied by the functions that ifoo inherited from iunknown.
...there is also a mozilla::mscom::getter_addrefs() function that al
lows these pointers to receive outparams.
Index
found 689 pages: # page tags and summary 1 add-ons add-ons, extension, extensions, landing, mozilla add-ons al
low developers to extend and modify the functionality of firefox.
... 680 resources for publishers add-ons, extensions, distribution, publication now your add-on is published on amo, check out the fol
lowing resources: 681 retiring your extension extensions, webextension, end-of-life, publication there may be occasions where you want to retire one of your extensions.
... this article suggests the steps you might want to fol
low, as well as offering some pointers to a suitable timeline.
... 684 themes add-ons, look & feel, themes themes al
low you to change the look and feel of the user interface and personalize it to your tastes.
Adding a new event
this type of event al
lows c++ code to handle it easier.
... each event class should implement fol
lowing methods manually.
...e.g., if your event shouldn't cause dom event, you need to modify widgetevent::isal
lowedtodispatchdomevent().
...if all information of the event is stored by its internal event, c++ event handlers can access them with fol
lowing code: ns_imethodimp aneventlistener::handleevent(nsidomevent* aevent) { internalfooevent* internalevent = aevent->getinternalnsevent()->asfooevent(); if (ns_warn_if(!internalevent)) { return ns_error_unexpected; } dosomethingwith(internalevent->mbar); aevent->preventdefault(); return ns_ok; } implement dom event class generate dom event implementation if it's possible ...
What to do and what not to do in Bugzilla
getting/upgrading bugzilla privileges if you want to get bugzilla privileges (as described be
low), please see this page.
... canconfirm privilege the canconfirm privilege al
lows you to confirm bugs and also to start your bug reports in the confirmed state (new).
...when verifying a bug, you should remember the fol
lowing: verifying duplicates is the easiest task, so start with that.
...when performing bug reassignments, keep the fol
lowing things in mind: always remember to check the reassign to default owner and qa contact radio button under the comment textbox.
Building SpiderMonkey with UBSan
save the fol
lowing bash script, fixing llvm_root to point to your installation.
.../bin/sh if [ -z $1 ] ; then echo "usage: $0 <dirname>" elif [ -d $1 ] ; then echo "directory $1 already exists" else autoconf2.13 autoconf213 mkdir $1 cd $1 llvm_root="$home/llvm" sanflag="-fsanitize=undefined -fno-sanitize=alignment,float-cast-overf
low,float-divide-by-zero,vptr -dxmalloc=myxmalloc" \ cc="$llvm_root/build/release+asserts/bin/clang" \ cxx="$llvm_root/build/release+asserts/bin/clang++" \ cflags="$sanflag" \ cxxflags="$sanflag" \ moz_llvm_hacks=1 \ ../configure --enable-debug --disable-optimize make -j 8 fi 3.
...this enables all the cheap undefined behavior checks other than: alignment, which hits known bugs in spidermonkey, and is more implementation-defined (s
low on x86 / crash on arm) than undefined behavior float-cast-overf
low, which hits known bugs in spidermonkey, and isn't exploited by today's compilers float-divide-by-zero, which jesse doesn't think is actually undefined behavior (aside from the question of whether cpu overf
low flags are set) vptr, a check that requires rtti, which is disabled by default in spidermonkey 4.
...[-fsanitize=float-cast-overf
low] in the status whiteboard.
Makefile - variables
local_includes al
low use of moz_objdir in .mozconfig with older gnu gcc on beos.
... moz_url_classifier moz_widget_toolkit android, beos, cocoa, gtk2, os2, qt, windows moz_xpctools moz_xul moz_x11 test variable description enable_tests boolean value that should wrapper all unit tests to al
low disabling on demand[1].
... sdk_headers makefile generation description no_makefile_rule [pending] inhibit makefile.in deps that would al
low $obj/makefile to be generated.
... l10nbasedir moz_chrome_multilocale a list of locale names to process moz_chrome_file_format both, file, jar, omni, symlink packager_no_libs hack to al
low one makefile to include another without pulling in libs:: target definitions.
Simple Instantbird build
build prerequisites hardware requirements: while you can build instantbird on older hardware it can take quite a bit of time to compile on s
lower machines, and having 8gb of ram is recommended (though you can probably still get away with 4gb).
...so firstly complete the instructions for your os and then continue fol
lowing these build instructions.
...linux builds on a fast box may take under 15 minutes, but windows builds on a s
low box may take several hours.
... then just re-run the mach command above (you may need to clobber (see be
low), or you can do the addition before running make for the first time).
Contributing to the Mozilla code base
if you're having any trouble fol
lowing this documentation, or hit a barrier you can't get around, please contact mike hoye at mhoye@mozilla.com.
... mozilla is a large project and we are thrilled to have contributors with very diverse skills be
low is a table with our currently available projects to contribute to, along with the skills needs and links to their documentation.
... when you commit your code, please use the fol
lowing format for your commit message: `bug number - what your patch does; r?reviewer` for example, a commit message may look like `bug 1234567 - remove ref
low by caching element size.
... step 4b: fol
low it up once you've asked for a review, a reviewer will often respond within a day or two, reviewing the patch, or saying when they will be able to review it, perhaps due to a backlog.
mach
mach's logic for determining which mozconfig to use is effectively the fol
lowing: if a .mozconfig file (some say it is the file mozconfig without the dot) exists in the current directory, use that.
... for example: $ cd devtools/client $ mach build webconsole # rebuild only the files in the devtools/client/webconsole directory $ mach mochitest webconsole/test # run mochitests in devtools/client/webconsole/test enable tab completion to enable tab completion in bash, run the fol
lowing command.
...if you don't use mach, you have to find another solution for the fol
lowing problems: discovering what commands or make targets are available (mach exposes everything through mach help while inside "mozilla-central" , else you'll just get a cryptic error message) making more sense out of command output (mach offers terminal colorization and structured logging) getting productive tools in the hands of others (mach "advertises" tools to people through mach help (un...
... even if a mach module were established, mach command modules (see be
low) would likely never belong to it.
Profiling with Xperf
the standard symbol path that includes both mozilla's and microsoft's symbol server configuration is as fol
lows: _nt_symcache_path: c:\symbols _nt_symbol_path: srv*c:\symbols*http://msdl.microsoft.com/download/symbols;srv*c:\symbols*http://symbols.mozilla.org/firefox/ to add symbols from your own builds, add c:\path\to\objdir\dist\bin to _nt_symbol_path.
...tips in the summary views, the yel
low bar can be dragged left and right to change the grouping -- for example, drag it to the left of the module column to have grouping happen only by process (stuff that's to the left), so that you get symbols in order of weight, regardless of what module they're in.
...also experiment with turning columns on and off; removing a column will al
low data to be aggregated without considering that column's contributions.
... building firefox to get good data from a firefox build, it is important to build with the fol
lowing options in your mozconfig: export cflags="-oy-" export cxxflags="-oy-" this disables frame-pointer optimization which lets xperf do a much better job unwinding the stack.
Midas editor module security preferences
add these lines to user.js: user_pref("capability.policy.policynames", "al
lowclipboard"); user_pref("capability.policy.al
lowclipboard.sites", "https://www-archive.mozilla.org"); user_pref("capability.policy.al
lowclipboard.clipboard.cutcopy", "allaccess"); user_pref("capability.policy.al
lowclipboard.clipboard.paste", "allaccess"); change the url https://www.mozilla.org to the site for which you want to enable this function.
...for example: user_pref("capability.policy.al
lowclipboard.sites", "http://www-archive.mozilla.org") is not the same as: user_pref("capability.policy.al
lowclipboard.sites", "https://www-archive.mozilla.org") this is because the first uses http while the second uses https.
... if you want to al
low multiple urls to access the paste operation, separate the urls with a space.
... for example: user_pref("capability.policy.al
lowclipboard.sites", "https://www-archive.mozilla.org https://developer.mozilla.org") again, keep in mind the security risks involved here and be sure to remove permission to access the clipboard once you no longer need it enabled.
Cached Monitors
this arrangement al
lows a cached monitor to be associated with another object without preallocating a monitor for all objects.
... important cached monitors are s
lower to use than their uncached counterparts.
... cached monitors functions cached monitors al
low the client to associate monitoring protection and state change synchronization in a lazy fashion.
... the monitoring capability is associated with the protected object only during the time it is required, al
lowing the monitor object to be reused.
NSPR Error Handling
pr_connect_refused_error the peer has refused to al
low the connection to be established.
... pr_buffer_overf
low_error the value retrieved is too large to be stored in the buffer provided.
... pr_name_too_long_error filename is longer than al
lowed by the host operating system.
... pr_max_directory_entries_error attempt to add new filename to directory would exceed the limit al
lowed.
NSPR LOG MODULES
syntax modulename:level[, modulename:level]* modulename is the name specified in a pr_newlogmodule call or one of the handy magic names listed be
low.
... level is a numeric value between 0 and 5, with the values having the fol
lowing meanings: 0 = pr_log_none: nothing should be logged 1 = pr_log_always: important; intended to always be logged 2 = pr_log_error: errors 3 = pr_log_warning: warnings 4 = pr_log_debug: debug messages, notices 5: everything!
...to enable all log module calls to pr_log, set the variable as fol
lows: set nspr_log_modules=all:5 timestamp including timestamp results in a timestamp of the form "2015-01-15 21:24:26.049906 utc - " prefixing every logged line.
... this ensures that all log messages are flushed to the operating system as they are written, but may s
low the program down.
PRIntervalTime
important note the counters used for interval times are al
lowed to overf
low.
...the proper coding style to test the expiration of an interval is as fol
lows: if ((printervaltime)(now - epoch) > interval) <...
... interval has expired ...> as long as the interval and the elapsed time (now - epoch) do not exceed half the namespace al
lowed by a printervaltime (231-1), the expression shown above provides the expected result even if the signs of now and epoch differ.
...at that rate, a 32-bit register will overf
low in approximately 28 hours, making the maximum useful interval approximately 6 hours.
PRThreadPriority
syntax #include <prthread.h> typedef enum prthreadpriority { pr_priority_first = 0, pr_priority_
low = 0, pr_priority_normal = 1, pr_priority_high = 2, pr_priority_urgent = 3, pr_priority_last = 3 } prthreadpriority; enumerators pr_priority_first placeholder.
... pr_priority_
low the
lowest possible priority.
... pr_priority_last placeholder description in general, an nspr thread of higher priority has a statistically better chance of running relative to threads of
lower priority.
...at best they are intended to specify a preference in the amount of cpu time that a higher-priority thread might expect relative to a
lower-priority thread.
PR_Open
syntax #include <prio.h> prfiledesc* pr_open( const char *name, printn flags, printn mode); parameters the function has the fol
lowing parameters: name the pathname of the file to be opened.
...it is a bitwise or of the fol
lowing bit flags.
...possible values of the mode parameter are listed in the table be
low.
... permission, group pr_ixgrp 0010 execute/search permission, group pr_irwxo 0007 read, write, execute/search by others pr_iroth 0004 read permission, others pr_iwoth 0002 write permission, others pr_ixoth 0001 execute/search permission, others returns the function returns one of the fol
lowing values: if the file is successfully opened, a pointer to a dynamically allocated prfiledesc for the newly opened file.
PR_Poll
syntax #include <prio.h> print32 pr_poll( prpolldesc *pds, printn npds, printervaltime timeout); parameters the function has the fol
lowing parameters: pds a pointer to the first element of an array of prpolldesc structures.
... the prpolldesc structure is defined as fol
lows: struct prpolldesc { prfiledesc* fd; print16 in_flags; print16 out_flags; }; typedef struct prpolldesc prpolldesc; the structure has the fol
lowing fields: fd a pointer to a prfiledesc object representing a socket or a pollable event.
... in_flags a bitwise or of the fol
lowing bit flags: pr_poll_read: fd is readable.
... out_flags a bitwise or of the fol
lowing bit flags: pr_poll_read pr_poll_write pr_poll_except pr_poll_err: fd has an error.
PR_Writev
syntax #include <prio.h> print32 pr_writev( prfiledesc *fd, priovec *iov, print32 size, printervaltime timeout); #define pr_max_iovector_size 16 parameters the function has the fol
lowing parameters: fd a pointer to a prfiledesc object for a socket.
...if it is, the function will fail and the error will be set to pr_buffer_overf
low_error.
... returns one of the fol
lowing values: a positive number indicates the number of bytes successfully written.
... this is the type definition for priovec: typedef struct priovec { char *iov_base; int iov_len; } priovec; the priovec structure has the fol
lowing fields: iov_base a pointer to the beginning of the buffer.
Building NSS
to check out the latest sources for nss and nspr--which may not be part of a stable release--use the fol
lowing commands: hg clone https://hg.mozilla.org/projects/nspr hg clone https://hg.mozilla.org/projects/nss to get the source of a specific release, see nss releases.
... this supports some alternative options, but can be a lot s
lower.
...be
low are some of the variables, along with possible values they may be set to.
... if you don't have a domain suffix you can add an entry to /etc/hosts (on windows, c:\windows\system32\drivers\etc\hosts) as fol
lows: 127.0.0.1 localhost.localdomain validate this opening a command shell and typing: ping localhost.localdomain.
NSS 3.16.4 release notes
the bug fixes in nss 3.16.4 are described in the "bugs fixed" section be
low.
...nss 3.16.4 source distributions are available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_16_4_rtm/src/ new in nss 3.16.4 this release consists primarily of ca certificate changes as listed be
low, and includes a small number of bug fixes.
... notable changes in nss 3.16.4 the fol
lowing 1024-bit root ca certificate was restored to al
low more time to develop a better transition strategy for affected sites.
...the inclusion of the intermediate certificate is a temporary measure to al
low those sites to function, by al
lowing them to find a trust path to another 2048-bit root ca certificate.
NSS 3.18.1 release notes
the bug fixes in nss 3.18.1 are described in the "bugs fixed" section be
low.
... notable changes in nss 3.18.1 the fol
lowing ca certificate had the websites and code signing trust bits restored to their original state to al
low more time to develop a better transition strategy for affected sites.
... ou = equifax secure certificate authority sha1 fingerprint: d2:32:09:ad:23:d3:14:23:21:74:e4:0d:7f:9d:62:13:97:86:63:3a the fol
lowing ca certificate was removed after discussion about it in the mozilla.dev.security.policy forum.
... cn = e-guven kok elektronik sertifika hizmet saglayicisi sha1 fingerprint: dd:e1:d2:a9:01:80:2e:1d:87:5e:84:b3:80:7e:4b:b1:fd:99:41:34 the fol
lowing intermediate ca certificate has been added as actively distrusted because it was misused to issue certificates for domain names the holder did not own or control.
NSS 3.25 release notes
nss 3.25 source distributions are available on ftp.mozilla.org for secure https download at the fol
lowing location.
... removed the limitation that al
lowed nss to only support certificate_verify messages that used the same signature hash algorithm as the prf when using tls 1.2 client authentication.
... new functions in nssckfw.h nssckfwslot_getslotid nssckfwsession_getfwslot nssckfwinstance_destroysessionhandle nssckfwinstance_findsessionhandle notable changes in nss 3.25 an ssl socket can no longer be configured to al
low both tls 1.3 and ssl v3.
... the fol
lowing ca certificate was removed cn = sonera class1 ca sha-256 fingerprint: cd:80:82:84:cf:74:6f:f2:fd:6e:b5:8a:a1:d5:9c:4a:d4:b3:ca:56:fd:c6:27:4a:89:26:a7:83:5f:32:31:3d the fol
lowing ca certificates were added cn = hellenic academic and research institutions rootca 2015 sha-256 fingerprint: a0:40:92:9a:02:ce:53:b4:ac:f4:f2:ff:c6:98:1c:e4:49:6f:75:5e:6d:45:fe:0b:2a:69:2b:cd:52:52:3f:36 cn = hellenic academic and research institutions ecc rootca 2015 sha-256 fingerprint: 44:b5:45:aa:8a:25:e6:5a:73:ca:15:dc:27:fc:36:d2:4c:1c:b9:95:3a:06:65:39:b...
NSS 3.48 release notes
because using an iteration count higher than 1 with the legacy dbm (key3.db) storage creates files that are incompatible with previous versions of nss, applications that wish to enable it for key3.db are required to set environment variable nss_al
low_legacy_dbm_iteration_count=1.
... applications may set environment variable nss_min_mp_pbe_iteration_count to request a higher iteration count than the library's default, or nss_max_mp_pbe_iteration_count to request a
lower iteration count for test environments.
... certificate authority changes the fol
lowing ca certificates were added: bug 1591178 - entrust root certification authority - g4 cert sha-256 fingerprint: db3517d1f6732a2d5ab97c533ec70779ee3270a62fb4ac4238372460e6f01e88 upcoming changes in nss 3.49 the legacy dbm database, libnssdbm, will no longer be built by default.
... bugs fixed in nss 3.48 bug 1600775 - require nspr 4.24 for nss 3.48 bug 1593401 - fix race condition in self-encrypt functions bug 1599545 - fix assertion and add test for early key update bug 1597799 - fix a crash in nssckfwobject_getattributesize bug 1591178 - add entrust root certification authority - g4 certificate to nss bug 1590001 - prevent negotiation of versions
lower than 1.3 after helloretryrequest bug 1596450 - added a simplified and unified mac implementation for hmac and cmac behind pkcs#11 bug 1522203 - remove an old pentium pro performance workaround bug 1592557 - fix prng known-answer-test scripts bug 1586176 - encryptupdate should use maxout not block size (cve-2019-11745) bug 1593141 - add `notbefore` or similar "beginning-of-validity-period" ...
NSS Config Options
nss config options format the specified ciphers will be al
lowed by policy, but an application may al
low more by policy explicitly: config="al
low=curve1:curve2:hash1:hash2:rsa-1024..." only the specified hashes and curves will be al
lowed: config="disal
low=all al
low=sha1:sha256:secp256r1:secp384r1" only the specified hashes and curves will be al
lowed, and rsa keys of 2048 or more will be accepted, and dh key exchange with 1024-bit primes or more: config="disal
low=all al
low=sha1:sha256:secp256r1:secp384r1:min-rsa=2048:min-dh=1024" a policy that enables the aes ciphersuites and the secp256/384 curves: config="al
low=aes128-cbc:aes128-gcm::hmac-sha1:sha1:sha256:sha384:rsa:ecdhe-rsa:secp256r1:secp384r1" turn off md5 config="disal
low=md5" turn off md5 and sha1 only for ssl con...
...fig="disal
low=md5(ssl):sha1(ssl)" disal
low values are parsed first, and then al
low values, independent of the order in which they appear.
...disable: turn off ciphersuites by default without disal
lowing them by policy.
... flags: turn on the fol
lowing flags: ssl-lock: turn off the ability for applications to change policy with the ssl_setcipherpolicy (or ssl_setpolicy).
NSS Developer Tutorial
curly braces: both of the fol
lowing styles are al
lowed: if (condition) { action1(); } else { action2(); } or: if (condition) { action1(); } else { action2(); } the former style is more common.
... multiple-line comments should be formatted as fol
lows: /* * line1 * line2 */ or /* ** line 1 ** line 2 */ the fol
lowing styles are also common, because they conserve vertical space: /* line1 * line2 */ or /* line1 ** line2 */ or /* line1 * line2 */ naming public functions are named foo_dooneaction.
... variable, and function parameter names, always start with a
lowercase letter.
...unfortunately, this can be a source of integer overf
low bugs on 64-bit systems.
nss tech note4
cert); some info is readily available cert->subjectname (char*) cert->issuername (char*) cert->emailaddr (char*) or char *cert_getcertificateemailaddress(certcertificate *cert); cert->keyusage (unsigned int) to break the issuer and subject names into components pass &(cert->issuer) or &(cert->subject) to the fol
lowing functions char *cert_getcommonname(certname *name); char *cert_getcertemailaddress(certname *name); char *cert_getcountryname(certname *name); char *cert_getlocalityname(certname *name); char *cert_getstatename(certname *name); char *cert_getorgname(certname *name); char *cert_getorgunitname(certname *name); char *cert_getdomaincomponentname(...
...certname *name); char *cert_getcertuid(certname *name); example code to illustrate access to the info is given be
low.
... background on cert extensions an extension has the fol
lowing attributes object id (oid) : a unique oid represents an algorithm, a mechanism, a piece of information, etc.
... { sec_asn1decodercontext * context = sec_asn1decoderstart(null, &data, mycertexttemplate); rv = sec_asn1decoderupdate( context, (const char *)(myextvalue.data), myextvalue.len); if (rv == secsuccess) { /* now you can extract info from secitem fields of your extension data structure */ /* see "misc helper functions" be
low */ .......
Overview of NSS
nss provides a complete open-source implementation of the crypto libraries used by aol, red hat, google, and other companies in a variety of products, including the fol
lowing: mozilla products, including firefox, thunderbird, seamonkey, and firefox os.
... interoperability and open standards you can use nss to support a range of security standards in your application, including the fol
lowing: ssl v3.
... the secure sockets layer (ssl) protocol al
lows mutual authentication between a client and server and the establishment of an authenticated and encrypted connection.
...every nss release is backward compatible with previous releases, al
lowing nss users to upgrade to the new nss shared libraries without recompiling or relinking their applications.
PKCS11 Implement
currently pkcs #12 isn't al
lowed to import onto a token.
...to do so, the user should fol
low these steps: click the security icon near the top of any communicator window.
... random-number generation and simple digesting the nss requires that the fol
lowing functions operate without authenticating to the token: c_seedrandom, c_generaterandom, and c_digest (for sha, md5, and md2).
... read/write and read-only requirements the nss assumes that the fol
lowing operations always require a read/write session: creating a token object, such as with c_createobject (token) or c_destroyobject (token) changing a password initializing a token creating session objects must work with a read-only session.
NSS tools : modutil
this directory should be one be
low which it is appropriate to store dynamic library files, such as a server's root directory.
...renableflags{0x0001} files { unix/fort.so { relativepath{%root%/lib/fort.so} absolutepath{/usr/local/netscape/lib/fort.so} filepermissions{555} } xplat/instr.html { relativepath{%root%/docs/inst.html} absolutepath{/usr/local/netscape/docs/inst.html} filepermissions{555} } } } irix:6.2:mips { equivalentplatform { sunos:5.5.1:sparc } } } script grammar the script is basic java, al
lowing lists, key-value pairs, strings, and combinations of all of them.
...nss has some flexibility that al
lows applications to use their own, independent database engine while keeping a shared database and working around the access issues.
... by default, the tools (certutil, pk12util, modutil) assume that the given security databases fol
low the more common legacy type.
sslintro.html
upgraded documentation may be found in the current nss reference overview of an ssl application chapter 1 overview of an ssl application ssl and related apis al
low compliant applications to configure sockets for authenticated, tamper-proof, and encrypted communications.
...functions used in the initialization part of an application can include the fol
lowing: pr_init.
... callbacks and helper functions al
low you to specify such things as how authentication is accomplished and what happens if it fails.
... functions that can be used by both clients and servers during communication include the fol
lowing: pr_send or pr_write pr_read or pr_recv pr_geterror pr_getpeername pr_sleep pr_malloc pr_free pr_poll pr_now pr_intervaltomilliseconds pr_millisecondstointerval pr_shutdown pr_close ssl_invalidatesession after establishing a connection, an application first calls pr_send, pr_recv, pr_read, pr_write, or ssl_forcehandshake to initiate the handshake.
TLS Cipher Suite Discovery
tls does not al
low all possible combinations of choices from those categories to be used.
... instead, tls al
lows only certain well-defined combinations of those choices, known as cipher suites, defined in the ietf rfc standards.
...the table and the number of entries are declared in "ssl.h", as fol
lows: /* constant table enumerating all implemented ssl 2 and 3 cipher suites.
...this function is declared in "ssl.h" as fol
lows: ssl_import secstatus ssl_getciphersuiteinfo( pruint16 ciphersuite, sslciphersuiteinfo *info, pruintn len); the application provides the cipher suite number for which it wants information, the address of a block of memory allocated to receive that information, and the size in bytes of that block of memory.
NSS tools : modutil
this directory should be one be
low which it is appropriate to store dynamic library files, such as a server's root directory.
...al/netscape/lib/fort.so} filepermissions{555} } xplat/instr.html { relativepath{%root%/docs/inst.html} absolutepath{/usr/local/netscape/docs/inst.html} filepermissions{555} } } } irix:6.2:mips { equivalentplatform { sunos:5.5.1:sparc } } } script grammar the script is basic java, al
lowing lists, key-value pairs, strings, and combinations of all of them.
...nss has some flexibility that al
lows applications to use their own, independent database engine while keeping a shared database and working around the access issues.
... by default, the tools (certutil, pk12util, modutil) assume that the given security databases fol
low the more common legacy type.
Necko Architecture
necko provides the fol
lowing libraries: necko - core networking functionality.
... handlers & channels nsichannel provides a data access interface which al
lows you to read or write data from or to a uri.
...streams provide a generic interface to the data and al
low for many underlying implementations that permit multiple data sources to be used.
... dependencies necko requires the fol
lowing libraries for linking: nspr xpcom original document information author(s): jud valeski last updated date: november 8, 1999 copyright information: portions of this content are © 1998–2007 by individual mozilla.org contributors; content available under a creative commons license | details.
GC Rooting Guide
if you use these types directly, or create classes, structs or arrays that contain them, you must fol
low the rules set out in this guide.
...::rootedscript js::rooted<jsid> js::rootedid for example, instead of this: jsobject* localobj = js_getobjectofsomesort(cx); you would write this: js::rootedobject localobj(cx, js_getobjectofsomesort(cx)); spidermonkey makes it easy to remember to use js::rooted<t> types instead of a raw pointer because all of the api methods that may gc take a js::handle<t>, as described be
low, and js::rooted<t> autoconverts to js::handle<t> but a bare pointer does not.
...lass typedef js::handle<js::value> js::handlevalue js::handle<jsobject*> js::handleobject js::handle<jsstring*> js::handlestring js::handle<jsscript*> js::handlescript js::handle<jsid> js::handleid you should use js::handle<t> for all function parameters taking gc thing pointers (except out-parameters, which are described be
low).
... js::heap<t> pointers must also continue to be traced in the normal way, which is covered be
low.
Invariants
in particular, native objects' fields are protected by property locking (be
low); and several things are protected by the request model, such that there may be either one writer (in gc) or many readers (in requests).
...as implemented for native objects, the locking is not really that fine-grained, but that is a transparent optimization as long as we fol
low the rules.) a thread holding a property lock never leaves or suspends the current request.
...jsop_bindname performs this lookup.) the rules be
low (not exactly invariants) govern the bytecode emitted for nameexpressions.
...failing that, jsop_{get,call,set}local and jsop_{get,call,set}arg are the fastest, fol
lowed by jsop_{get,call}upvar, jsop_{get,call}dslot, jsop_{get,call,set}gvar, and lastly jsop_{,call,set}name.
SpiderMonkey Internals
if (eval(sumofdivisors[divisor]) == divisor) { print("" + divisor + " = " + sumofdivisors[divisor]); } } delete sumofdivisors; print("that's all."); } the line number to pc and back mappings can be tested using the js program with the fol
lowing script: load("perfect.js"); print(perfect); dis(perfect); print(); for (var ln = 0; ln <= 40; ln++) { var pc = line2pc(perfect, ln); var ln2 = pc2line(perfect, pc); print("\tline " + ln + " => pc " + pc + " => line " + ln2); } the result of the for loop over lines 0 to 40 inclusive is: line 0 => pc 0 => line 16 line 1 => pc 0 => line 16 line 2 => pc 0 => line 16 line 3 => pc 0 ...
...all of the fol
lowing happen here: creating objects by class and prototype, and finalizing objects; defining, looking up, getting, setting, and deleting properties; creating and destroying properties and binding names to them.
... jsarena.cpp, jsarena.h last-in-first-out allocation macros that amortize malloc costs and al
low for en-masse freeing.
...certain assertions are fol
lowed by run-time tests that cope with assertion failure, but only where i'm too smart or paranoid to believe the assertion will never fail...
Property attributes
the jsapi expresses property attributes as a value of type unsigned, the bitwise or of zero or more of the jsprop flags described be
low.
...in javascript 1.2 and
lower, it is an error to attempt to assign a value to a read-only property.
...in javascript 1.2 and
lower, it is an error to attempt to delete a permanent property.
...added in spidermonkey 17 mxr id search for jsfun_constructor jsprop_redefine_nonconfigurable if set, will al
low redefining a non-configurable property, but only on a non-dom global.
SpiderMonkey 24
it also contains new language and api features described in detail be
low.
... the fol
lowing features in earlier versions of spidermonkey have been dropped.
... these and other changes are explained in detail be
low.
... typedef changes the fixed-size integer types introduced in spidermonkey 17 are defined in one of the fol
lowing ways (xxx update for msvc<10 deprecation): if the environment variable moz_custom_stdint_h is set, that file will be included to provide definitions for these types.
Running Automated JavaScript Tests
for a smoke test or if you are not changing language-level functionality, you may wish to use jstests.py path_to_js_shell --exclude=test262 other options al
low you to show the test command lines being run, command output and return codes, run tests named in a given file, exclude tests named in a given file, hide the progress bar, change the timeout, run skipped tests, print output in tinderbox format, run a test in the debugger, or run tests in valgrind.
... running jstest in a browser jstests also runs on browser, with the fol
lowing command: ./mach jstestbrowser to run specific test, you can use --filter=pattern command-line argument, where pattern is a regexp pattern that is tested against file:///{path_to_obj_dir}/dist/test-stage/jsreftest/tests/jsreftest.html?test={relative_path_to_test_from_js/src/tests} string: ./mach jstestbrowser --filter=pattern running jstests on treeherder when viewing treeherder after a push to the mozilla repositories, jstests run in the browser are shown as r(j) meaning "ja...
...basic usage is the same: jit_test.py path_to_js_shell developers will usually want to run like this to skip the s
low tests and cover the most important options: jit_test.py --no-s
low path_to_js_shell you can select specific tests to run in the same way as the jstests shell harness.
... the --jitflags option al
lows you to test the js executable with different flags.
TPS Tests
set up an environment and run a test to run tps, you should create a new firefox account using a restmail.net email address (strictly speaking, restmail isn't required, but it will al
low tps to automatically do account confirmation steps for you.
... tps tests tend to be broken down into three sections, in the fol
lowing order (we'll cover these out of order, for the sake of simplicity) phase declarations (mandatory).
...tps iterates through the phase blocks in alphanumeric order, and for each phase, it does the fol
lowing: launches firefox with the profile from the phases object that corresponds to this test phase.
... otherwise, a special sync can be performed if one of the fol
lowing are passed: sync_wipe_server, sync_wipe_client, sync_reset_client.
Mozilla Projects
mccoy is an application that al
lows add-on authors to provide secure updates to their users.
...this information al
lows c++ to be automatically rewritten in a precise way.
... web replay web replay al
lows firefox content processes to record their behavior, replay it later, and rewind to earlier states.
...the
low level, yet flexible architecture (described here) provides an extremely powerful platform for implementing debugging and analysis features.
Components.utils.Sandbox
principal the security principal defined for a sandbox determines what code running in that sandbox will be al
lowed to do.
...this parameter is an object with the fol
lowing optional properties: freshzone if true creates a new gc region separate from both the calling context's and the sandbox prototype's region.
...this helps to improve memory usage by al
lowing sandboxes to be discarded when that zone goes away.
... the fol
lowing objects are supported: -promise (removed in firefox 37) css indexeddb (web worker only) xmlhttprequest textencoder textdecoder url urlsearchparams atob btoa blob file crypto rtcidentityprovider fetch (added in fir...
Components.utils.cloneInto
options : object this optional parameter is an object with the fol
lowing optional properties: clonefunctions: a boolean value that determines if functions should be cloned.
...see cloning objects that have functions be
low.
...see cloning objects that contain dom elements be
low.
...if you pass the {wrapreflectors:true} flag, then the object you clone is al
lowed to contain these objects: // add-on script var addonscriptobject = { body: contentwindow.document.body }; contentwindow.addonscriptobject = cloneinto(addonscriptobject, contentwindow, {wrapreflectors: true}); // page script var test = document.getelementbyid("test"); test.addeventlistener("click", functi...
Observer Notifications
observer topics the fol
lowing are topics that you can observe during the course of an application.
... profile-before-change-qm called to shut down the quotamanager; this is separated from profile-before-change to al
low everything inside profile-before-change to continue using it.
... profile-before-change-telemetry called to shut down telemetry, again separated to al
low everything before this event to continue using it.
...the channel is available to al
low you to modify headers and such.
operator+=
return values this operator returns a reference back to the object being modified to al
low operator chaining.
... return values this operator returns a reference back to the object being modified to al
low operator chaining.
... return values this operator returns a reference back to the object being modified to al
low operator chaining.
... return values this operator returns a reference back to the object being modified to al
low operator chaining.
nsDependentCString
ubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char
lowercaseequalsascii
lowercaseequalsliteral(const char
lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity setlength truncate getdata getmutabledata set...
... parameters nsacstring_internal& str assertvalid void assertvalid() - source verify restrictions rebind void rebind(const char*) - source al
low this class to be bound to a different string...
...parameters char* data equalsliteral(const char prbool equalsliteral(const char (&)[n]) const - source equalsliteral(char prbool equalsliteral(char (&)[n]) const - source
lowercaseequalsascii prbool
lowercaseequalsascii(const char*, pruint32) const - source parameters char* data pruint32 len prbool
lowercaseequalsascii(const char*) const - source parameters char* data
lowercaseequalsliteral(const char prbool
lowercaseequalsliteral(const char (&)[n]) const - source
lowercaseequalsliteral(char prbool
lowercaseequalsliteral(char (&)[n]) const - s...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to
low-memory conditions.
nsDependentString
ubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char
lowercaseequalsascii
lowercaseequalsliteral(const char
lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity setlength truncate getdata getmutabledata set...
...- source parameters prunichar* data pruint32 length void nsdependentstring(const prunichar*) - source parameters prunichar* data void nsdependentstring(const nsastring_internal&) - source parameters nsastring_internal& str void nsdependentstring() - source assertvalid void assertvalid() - source verify restrictions rebind void rebind(const prunichar*) - source al
low this class to be bound to a different string...
...parameters char* data equalsliteral(const char prbool equalsliteral(const char (&)[n]) const - source equalsliteral(char prbool equalsliteral(char (&)[n]) const - source
lowercaseequalsascii prbool
lowercaseequalsascii(const char*, pruint32) const - source parameters char* data pruint32 len prbool
lowercaseequalsascii(const char*) const - source parameters char* data
lowercaseequalsliteral(const char prbool
lowercaseequalsliteral(const char (&)[n]) const - source
lowercaseequalsliteral(char prbool
lowercaseequalsliteral(char (&)[n]) const - s...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to
low-memory conditions.
operator=
return values this operator returns a reference back to the object being modified to al
low operator chaining.
... return values this operator returns a reference back to the object being modified to al
low operator chaining.
... return values this operator returns a reference back to the object being modified to al
low operator chaining.
... return values this operator returns a reference back to the object being modified to al
low operator chaining.
operator=
return values this operator returns a reference back to the object being modified to al
low operator chaining.
... return values this operator returns a reference back to the object being modified to al
low operator chaining.
... return values this operator returns a reference back to the object being modified to al
low operator chaining.
... return values this operator returns a reference back to the object being modified to al
low operator chaining.
IAccessibleTable2
the behavior should mimic that of the application, but for those applications which do not have a means in the gui to select a full column of cells the behavior should be as fol
lows: first any selected columns in the table are unselected.
...the behavior should mimic that of the application, but for those applications which do not have a means in the gui to select a full row of cells the behavior should be as fol
lows: first any selected rows in the table are unselected.
...the behavior should mimic that of the application, but for those applications which do not have a means in the gui to unselect a full column of cells the behavior should be as fol
lows: the entire column of cells for the specified column is unselected.
...the behavior should mimic that of the application, but for those applications which do not have a means in the gui to unselect a full row of cells the behavior should be as fol
lows: the entire row of cells for the specified row is unselected.
imgIContainer
constants constant value description type_raster 0 enumerated values for the 'type' attribute (be
low).
... asubimage the area of the image, in pixels, that we are al
lowed to sample from.
...if the lock count drops to zero, the image is al
lowed to discard its frame data to save memory.
...in other words, the lock count is not al
lowed to be negative.
nsIAccessibleStates
more than 1 al
lowed.
... state_selected 0x00000002 the object is selected, that is it indicates this object is the child of an object that al
lows its children to be selected and that this child is one of those children that has been selected.
... state_alert_
low 0x04000000 this information is of
low priority.
... state_required state_alert_
low state_important state_alert_medium currently unused.
nsIAlertsService
however, certain notification systems (such as growl on mac os x) al
low the user to disable alerts by name.
... example simple usage the fol
lowing code was used to display the above notification.
...s.wm.getmostrecentwindow('navigator:firefox'), 'focus firefox', 'will now focus fireox and then focus the tab'); } else if (atopic == 'alertshow') { console.log('just showed notification'); } else if (atopic == 'alertfinished') { console.log('just alertfinished') } } }; as.showalertnotification('chrome://branding/content/icon64.png', 'stackoverf
low - new messages', 'there are ## new messages.
... click here to focus the tab', true, null, notiflistener, 'stackoverf
low notifier'); closealert() closes alerts created by the service.
Using nsIDirectoryService
this implementation will al
low you to get(), set(), define(), and undefine() nsifile.
...in the example be
low, prop is a string that references your requested file locations.
...apart from this interface there is a function, registerprovider which will al
low you to register a nsidirectoryserviceprovider, which implements the getfile callback function: var provider = { getfile : function(prop, persistant) { // return an nsifile }, } components.classes["@mozilla.org/file/directory_service;1"] .getservice(components.interfaces.nsidirectoryservice).registerprovider(provider); when the callback is called, it will be passed the string key, and shoul...
...the persistant flag al
lows you to specify if you want the nsdirectoryservice to cache this value.
Working with out parameters
when working with xpcom components, you might come across method declarations like the fol
lowing one: [scriptable, uuid(8b5314bc-db01-11d2-96ce-0060b0fb9956)] interface nsitransferable : nsisupports { ...
...usage in order to use such a method from javascript via xpconnect, you have to fol
low a specific rule.
...assuming you have an object called transferable, you would invoke gettransferdata() as fol
lows: var adata = {}; var adatalen = {}; transferable.gettransferdata("text/unicode", adata, adatalen); var data = adata.value; var datalen = adatalen.value; as you can see, after the call to gettransferdata(), the out values are then contained in the value properties of adata and adatalen.
...you would implement gettransferdata() as fol
lows: gettransferdata: function(aflavor, adata, adatalen) { ..
xptcall FAQ
xptcall is a small
low level xpcom method call library.
...the information in the typelibs al
lows xpconnect to convert function parameters and build the nsxptcvariant array required to make this call.
... the stubs (or impersonation) facility of xptcall al
lows for implementing a class which can, at runtime, pretend to be any xpcom interface.
...non-functional stub code exists to al
low building xptcall on non-supported platforms.
Xptcall Porting Guide
the invoke functionality requires the implementation of the fol
lowing on each platform (from xptcall/public/xptcall.h): xptc_public_api(nsresult) ns_invokebyindex(nsisupports* that, pruint32 methodindex, pruint32 paramcount, nsxptcvariant* params); calling code is expected to supply an array of nsxptcvariant structs.
...#include "xptcstubsdecl.inc" // the fol
lowing methods must be provided by inheritor of this class.
...the win32 version is somewhat tighter because the __declspec(naked) feature al
lows for very small stubs.
... however, the __stdcall requires the callee to clean up the stack, so it is imperative that the interface information scheme al
low the code to determine the correct stack pointer fixup for return without fail, else the process will crash.
Address book sync client design
the general architecture for the sync component is the fol
lowing: mozilla ui ab sync logic mork ab database sync protocol encoding sync protocol decoding http "post" api mozilla networking c...
... // // the client keeps a sync mapping table which holds the fol
lowing: // // serverrecordid - unique id for a record provided by the // uab server.
...this interface is defined in mozilla/mailnews/addrbook/public/nsiabsyncdriver.idl #include "nsrootidl.idl" #include "nsiabsynclistener.idl" [scriptable, uuid(91fdfee1-efbc-11d3-8f97-000073757374)] interface nsiabsyncdriver : nsiabsynclistener { void kickit(); }; as you can see, this is a very simple interface which al
lows for the starting of the address book sync operation.
...this interface is as fol
lows: #include "nsisupports.idl" #include "nsrootidl.idl" #include "nsifilespec.idl" [scriptable, uuid(e0ed29e0-098a-11d4-8fd6-00a024a7d144)] interface nsiabsynclistener : nsisupports { /** * notify the observer that the ab sync authorization operation has begun.
The libmime module
there is one header file and one source file for each class (for example, the mimeinlinetext class is defined in "mimetext.h" and "mimetext.c".) each header file fol
lows the fol
lowing boiler-plate form: typedefs these come first to avoid circular dependencies.
... }; then, in the corresponding .c file, the fol
lowing structure is used: class definition first we pull in the appropriate include file (which includes all necessary include files for the parent classes) and then we define the class object using the mimedefclass macro: #include "foobar.h" #define mime_superclass parentlclass mimedefclass(foobar, foobarclass, foobarclass, &mime_superclass); the definition of mime_superclass is ju...
...st to move most of the knowlege of the exact class hierarchy up to the file's header, instead of it being scattered through the various methods; see be
low.
... the easiest way to do this is to make use of the mime_superclass macro that was defined at the top of the file, as shown be
low.
Theme Packaging
theme file layout thunderbird themes are packaged in an xpi file with the fol
lowing structure: theme.xpi: install.rdf preview.png icon.png chrome/ browser/files communicator/files global/files mozapps/files ...
...nstall.rdf your install.rdf manifest will look something like this: <?xml version="1.0"?> <rdf xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#"> <description about="urn:mozilla:install-manifest"> <em:type>4</em:type> more properties </description> </rdf> required install.rdf properties your install.rdf file must have the fol
lowing properties.
... <em:name>new theme 1</em:name> <em:description>a test theme for thunderbird</em:description> <em:creator>ben goodger</em:creator> <em:contributor>john doe</em:contributor> <em:homepageurl>http://www.bengoodger.com/</em:homepageurl> <!-- front end integration hooks (used by theme manager)--> <em:internalname>newtheme1</em:internalname> </description> </rdf> the fol
lowing are some common target application guids that you can use in your targetapplication properties: thunderbird {3550f703-e582-4d05-9a08-453d09bdfdc6} seamonkey {92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} pale moon {8de7fcbb-c55c-4fbe-bfc5-fc555c87dbc4} official references for toolkit api official references.
...note that this page is included from the pages listed be
low.
Using the Multiple Accounts API
in the above example, the list of identities would be as fol
lows: alec flett <alecf@mywork.com>) alec flett <alecf@myisp.com>) alec flett <alecfnospam@myisp.com>) relevant api calls: nsimsgaccount.identities nsimsgaccountmanager.allservers: a list of all servers across all accounts storage the accounts are stored in the preferences.
... to create accounts using the api, you should do the fol
lowing: create a fresh identity with createidentity(); assign values to the various identity properties as necessary.
...- boolean, should we download new messags on biff (true) or just alert user that there is new mail (false) preference: mail.server.server.directory - local platform-specific path to store messages and folder indexes preference: mail.server.server.name - user-visible name of server the fol
lowing are specific to imap: preference: mail.server.server.admin_url - administration url for server preference: mail.server.server.using_subscription - boolean, should we use subscriptions?
...ference: mail.server.server.capability - list of capabilities of this server preference: mail.server.server.namespace.public - the server's namespace for public folders preference: mail.server.server.namespace.personal - the server's namespace for personal folders preference: mail.server.server.namespace.other_users - the server's namespace for other user's folders the fol
lowing are specific to pop: the fol
lowing are specific to news: preference: mail.server.server.leave_on_server - boolean, should we leave messages on the server after we have downloaded them?
Toolkit version format
versions in at least the fol
lowing places must conform to this format: addon's and target application's version in install and update manifests.
... the fol
lowing preferences: app.extensions.version, extensions.lastappversion versions returned by nsixulappinfo.
... see older version formats be
low for description of the older version format used in firefox/thunderbird 1.0.
...note, that since missing version parts are treated as if they were 0, the fol
lowing version strings are equal: 1, 1.0, 1.0., 1.0.0, and even 1.0...
Using the Mozilla symbol server
this al
lows debugging of those builds without forcing all users to download large debugging files.
...in the examples be
low, a local cache directory is used to avoid repeatedly fetching the pdb from the server.
...to use only the mozilla symbol server, add the fol
lowing entry to your symbol path (note: you can replace c:\symcache\ with any writable directory on your computer, if you'd prefer a different location for downloaded symbols): srv*c:\symcache\*https://symbols.mozilla.org/ set this string as _nt_symbol_path in the environment, using the windbg menus, or by typing the .sympath command.
... symbol indices are named like so: symbols.mozilla.org/{
lowercased:name}/{
lowercased:name}-{version}-{platform}-{buildid}-symbols.txt.
Type conversion
var buffer = ctypes.char.array(10)(); var somecfunction = library.declare("somecfunction", ctypes.default_abi, ctypes.void_t, ctypes.char.ptr); somecfunction(buffer); // here ctypes.char.array(10)() is converted to ctypes.char.ptr type implicit conversion can be tested in the fol
lowing way: var mystruct = ctypes.structtype("mystructtype", [ { "v": ctypes.bool } ])(); mystruct.v = 1; console.log(mystruct.v.tostring()); // 'true' boolean type target type source converted value ctypes.bool js boolean src js number (0 or 1) if src == 0: false if src == 1: true var mystruct = ctypes.structtype("mystructtype", [ { "v...
... note that the fol
lowing table does not contain environment dependent types (ctypes.long, etc.).
...type("mystructtype", [ { "v": ctypes.int16_t.ptr } ])(); mystruct.v = ctypes.int16_t.array(10)(); console.log(mystruct.v.tostring()); // 'ctypes.int16_t.ptr(ctypes.uint64("0x11d6ff400"))' mystruct.v = null; console.log(mystruct.v.tostring()); // 'ctypes.int16_t.ptr(ctypes.uint64("0x0"))' mystruct.v = ctypes.int32_t.array(10)(); // throws error only in functiontype argument, the fol
lowing rules are also applied: target type source converted value ctypes.char.ptr js string pointer to temporary allocated null-terminated utf8 string ctypes.signed_char.ptr ctypes.unsigned_char.ptr ctypes.char16.ptr js string pointer to temporary allocated null-terminated utf16 string any pointer types any arraybuffer object...
... (only if the object has properties for all fields and no other properties) implicitly convert each enumerable property to corresponding field explicit convert in js-ctypes, data could be converted explicitly, when passing to cdata constructor: ctypes.int32_t("123"); // string "123" is parsed as 10-base string explicit convert tries implicit convert first, and if it fails, the fol
lowing rules are applied: boolean type target type source converted value ctype.bool js value toboolean(src) console.log(ctypes.bool("123").tostring()); // 'ctypes.bool(true)' console.log(ctypes.bool("").tostring()); // 'ctypes.bool(false)' integer types target type source converted value any integer types js number except -infin...
js-ctypes
js-ctypes al
lows application and extension code to call back and forth to native code written in c.
...unlike binary xpcom components, it al
lows developers to ship a single binary for use with multiple versions of firefox.
... documentation if you are brand new to js-ctypes, and have no idea about it, the pages you should read first is - ctypes.open fol
lowed by standard os libraries.
... mailing list newsgroup rss feed stackoverf
low - jsctypes related topics xpcom in gecko 2 - binary components ...
DOM Inspector FAQ - Firefox Developer Tools
the file menu contains approaches which will al
low you to inspect a document.
... inspect a url this just focuses the dom inspector's address bar, which al
low you to inspect arbitrary documents which can be accessed via a url.
... dom inspector al
lows you to force the :hover, :active, and :focus pseudo-classes to apply to a given node.
...you should notice the set pseudo-classes menu item, which will al
low you to set the content state for the aforementioned pseudo-classes.
Debugging service workers - Firefox Developer Tools
when you open the application panel’s service workers view on a page that doesn't have a service worker registered, you'll get the fol
lowing output shown: this gives you some advice on what to do if you don't have a service worker registered, and were perhaps expecting there to be one registered!
... the server worker’s status, which can be one of the fol
lowing: stopped: the service worker is installed, but not currently running.
... when the service worker is stopped, a start button is provided to start it running, al
lowing you to trigger the service worker lifecycle.
...be
low the list of installed extensions you'll find a list of all the service workers you have registered.
Debugger.Environment - Firefox Developer Tools
this al
lows the code using each debugger instance to place whatever properties it likes on its own debugger.object instances, without worrying about interfering with other debuggers.) if a debugger.environment instance’s referent is not a debuggee environment, then attempting to access its properties (other than inspectable) or call any its methods throws an instance of error.
... accessor properties of the debugger.environment prototype object a debugger.environment instance inherits the fol
lowing accessor properties from its prototype: inspectable true if this environment is a debuggee environment, and can therefore be inspected.
... type the type of this environment object, one of the fol
lowing values: “declarative”, indicating that the environment is a declarative environment record.
... function properties of the debugger.environment prototype object the methods described be
low may only be called with a this value referring to a debugger.environment instance; they may not be used as methods of other kinds of objects.
BeforeUnloadEvent - Web APIs
when a non-empty string is assigned to the returnvalue event property, a dialog box appears, asking the users for confirmation to leave the page (see example be
low).
... <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overf
low: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/event" target="_top"><rect x="1" y="1" width="75" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignme...
...pointer-events: all;} bubbles no cancelable yes target objects defaultview interface event examples window.addeventlistener("beforeunload", function( event ) { event.returnvalue = "\o/"; }); // is equivalent to window.addeventlistener("beforeunload", function( event ) { event.preventdefault(); }); webkit-derived browsers don't fol
low the spec for the dialog box.
... an almost-cross-browser working example would be close to the be
low example.
CSS.registerProperty() - Web APIs
the css.registerproperty() method registers custom properties, al
lowing for property type checking, default values, and properties that do or do not inherit their value.
... registering a custom property al
lows you to tell the browser how the custom property should behave; what are al
lowed types, whether the custom property inherits its value, and what the default value of the custom property is.
... syntax css.registerproperty(propertydefinition); parameters a propertydefinition dictionary object, which can contain the fol
lowing members: name a domstring indicating the name of the property being defined.
... examples the fol
lowing will register a custom property, --my-color, using registerproperty(), as a color, give it a default value, and have it not inherit its value: window.css.registerproperty({ name: '--my-color', syntax: '<color>', inherits: false, initialvalue: '#c0ffee', }); in this example, the custom property --my-color has been registered using the syntax <color> .
Using dynamic styling information - Web APIs
the css object model (cssom), part of the dom, exposes specific interfaces al
lowing manipulation of a wide amount of information regarding css.
...however, there are cases where actually obtaining or manipulating the rules can be useful (whether for whole stylesheets or individual elements), and that is described in further detail be
low.
... modify an element's style the element style property (see also the section "dom style object" be
low) can also be used to get and set the styles on an element.
... to change a particular element's style, you can adapt the fol
lowing example for the element(s) you want to style.
CSS Painting API - Web APIs
the css painting api — part of the css houdini umbrella of apis — al
lows developers to write javascript functions that can draw directly into an element's background, border, or content.
... concepts and usage essentially, the css painting api contains functionality al
lowing developers to create custom values for paint(), a css <image> function.
... we create our paintworklet called 'hol
lowhighlights' using the registerpaint() function: registerpaint('hol
lowhighlights', class { static get inputproperties() { return ['--boxcolor']; } static get inputarguments() { return ['*','<length>']; } static get contextoptions() { return {alpha: true}; } paint(ctx, size, props, args) { const x = 0; const y = size.height * 0.3; const blockwidth = size.width * 0.33; const bloc...
...i> <li>item 14</li> <li>item 15</li> <li>item 16</li> <li>item 17</li> <li>item 18</li> <li>item 19</li> <li>item 20</li> </ul> css.paintworklet.addmodule('https://mdn.github.io/houdini-examples/csspaint/intro/worklets/hilite.js'); then we can use the <image> with the css paint() function: li { --boxcolor: hsla(55, 90%, 60%, 1.0); background-image: paint(hol
lowhighlights, stroke, 2px); } li:nth-of-type(3n) { --boxcolor: hsla(155, 90%, 60%, 1.0); background-image: paint(hol
lowhighlights, filled, 3px); } li:nth-of-type(3n+1) { --boxcolor: hsla(255, 90%, 60%, 1.0); background-image: paint(hol
lowhighlights, stroke, 1px); } we've included a custom property in the selector block defining a boxcolor.
Using the CSS properties and values API - Web APIs
the css properties and values api — part of the css houdini umbrella of apis — al
lows the registration of css custom properties, al
lowing for property type checking, default values, and properties that do or do not inherit their value.
... registering a custom property registering a custom property al
lows you to tell the browser how the custom property should behave; what are al
lowed types, whether the custom property inherits its value, and what the default value of the custom property is.
... css.registerproperty the fol
lowing will register a css custom properties, --my-prop, using css.registerproperty, as a color, give it a default value, and have it not inherit its value: window.css.registerproperty({ name: '--my-prop', syntax: '<color>', inherits: false, initialvalue: '#c0ffee', }); @property the same registration can take place in css.
... the fol
lowing will register a css custom properties, --my-prop, using @property, as a color, give it a default value, and have it not inherit its value: @property --my-prop { syntax: '<color>'; inherits: false; initial-value: #c0ffee; } using registered custom properties one of the advantages of registering a property is that the browser now knows how it should handle your custom property through things like transitions!
CanvasRenderingContext2D.filter - Web APIs
syntax ctx.filter = "<filter-function1> [<filter-function2>] [<filter-functionn>]"; ctx.filter = "none"; values the filter property accepts a value of "none" or one or more of the fol
lowing filter functions in a domstring.
...a drop shadow is effectively a blurred, offset version of the drawing's alpha mask drawn in a particular color, composited be
low the drawing.
...negative values are not al
lowed.
... examples to view these examples, make sure to use a browser that supports this feature; see the compatibility table be
low.
Advanced animations - Web APIs
the fol
lowing code will set us up.
...to do so, we add the fol
lowing checks to the draw method: if (ball.y + ball.vy > canvas.height || ball.y + ball.vy < 0) { ball.vy = -ball.vy; } if (ball.x + ball.vx > canvas.width || ball.x + ball.vx < 0) { ball.vx = -ball.vx; } first demo let's see how it looks in action so far.
... } raf = window.requestanimationframe(draw); } canvas.addeventlistener('mouseover', function(e) { raf = window.requestanimationframe(draw); }); canvas.addeventlistener('mouseout', function(e) { window.cancelanimationframe(raf); }); ball.draw(); acceleration to make the motion more real, you can play with the velocity like this, for example: ball.vy *= .99; ball.vy += .25; this s
lows down the vertical velocity each frame, so that the ball will just bounce on the floor in the end.
...s.width || ball.x + ball.vx < 0) { ball.vx = -ball.vx; } raf = window.requestanimationframe(draw); } canvas.addeventlistener('mouseover', function(e) { raf = window.requestanimationframe(draw); }); canvas.addeventlistener('mouseout', function(e) { window.cancelanimationframe(raf); }); ball.draw(); adding mouse control to get some control over the ball, we can make it fol
low our mouse using the mousemove event, for example.
Drawing text - Web APIs
the fol
lowing diagram from the whatwg demonstrates the various baselines supported by the textbaseline property.
... a textbaseline example edit the code be
low and see your changes update live in the canvas: ctx.font = '48px serif'; ctx.textbaseline = 'hanging'; ctx.stroketext('hello world', 0, 100); playable code <canvas id="canvas" width="400" height="200" class="playable-canvas"></canvas> <div class="playable-buttons"> <input id="edit" type="button" value="edit" /> <input id="reset" type="button" value="reset" /> </div> <textarea id="code" class="playable-code"> ctx.font = "48px serif"; ctx.textbaseline = "hanging"; ctx.stroketext("hello world", 0, 100);</textarea> var canvas = document.getelementbyid('canvas'); var ctx = canvas.getcontext('2d'); var textarea = document.getelementbyid('code'); var reset = document.getelementbyid('reset'); var edit = document.getelementbyid('edit'); var code...
...dth, canvas.height); eval(textarea.value); } reset.addeventlistener('click', function() { textarea.value = code; drawcanvas(); }); edit.addeventlistener('click', function() { textarea.focus(); }) textarea.addeventlistener('input', drawcanvas); window.addeventlistener('load', drawcanvas); advanced text measurements in the case you need to obtain more details about the text, the fol
lowing method al
lows you to measure it.
... the fol
lowing code snippet shows how you can measure a text and get its width.
Hit regions and accessibility - Web APIs
the fol
lowing guidelines can help to make it more accessible.
...the hit region api al
lows you to define an area of your canvas and provides another possibility to expose interactive content on a canvas to accessibility tools.
... it al
lows you to make hit detection easier and lets you route events to dom elements.
... the api has the fol
lowing three methods (which are still experimental in current web browsers; check the browser compatibility tables).
DOMError - Web APIs
properties domerror.name read only returns a domstring representing one of the error type names (see be
low).
... error types type description indexsizeerror the index is not in the al
lowed range (e.g.
... nomodificational
lowederror the object can not be modified.
... namespaceerror the operation is not al
lowed by namespaces in xml invalidaccesserror the object does not support the operation or argument.
DOMMatrixReadOnly - Web APIs
the dommatrix interrface—which is based upon dommatrixreadonly—adds mutability, al
lowing you to alter the matrix after creating it.
... this interface should be available inside web workers, though some implementations doesn't al
low it yet.
...these are aliases for specific components of a 4×4 matrix, as shown be
low.
...none of the fol
lowing methods alter the original matrix.
DOMTokenList - Web APIs
domtokenlist.entries() returns an iterator, al
lowing you to go through all key/value pairs contained in this object.
... domtokenlist.keys() returns an iterator, al
lowing you to go through all keys of the key/value pairs contained in this object.
... domtokenlist.values() returns an iterator, al
lowing you to go through all values of the key/value pairs contained in this object.
... examples in the fol
lowing simple example, we retrieve the list of classes set on a <p> element as a domtokenlist using element.classlist, add a class using domtokenlist.add(), and then update the node.textcontent of the <p> to equal the domtokenlist.
DataTransfer.dropEffect - Web APIs
on setting, if the new value is one of the values listed be
low, then the property's current value will be set to the new value and other values will be ignored.
... example this example shows the use of the dropeffect and effectal
lowed properties.
.../p> </div> <div id="target" ondrop="drop_handler(event);" ondragover="dragover_handler(event);">drop zone</div> css content div { margin: 0em; padding: 2em; } #source { color: blue; border: 1px solid black; } #target { border: 1px solid black; } javascript content function dragstart_handler(ev) { console.log("dragstart: dropeffect = " + ev.datatransfer.dropeffect + " ; effectal
lowed = " + ev.datatransfer.effectal
lowed); // add this element's id to the drag payload so the drop handler will // know which element to add to its tree ev.datatransfer.setdata("text", ev.target.id); ev.datatransfer.effectal
lowed = "move"; } function drop_handler(ev) { console.log("drop: dropeffect = " + ev.datatransfer.dropeffect + " ; effectal
lowed = " + ev.datatransfer.effectal
lowed)...
...; ev.preventdefault(); // get the id of the target and add the moved element to the target's dom var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } function dragover_handler(ev) { console.log("dragover: dropeffect = " + ev.datatransfer.dropeffect + " ; effectal
lowed = " + ev.datatransfer.effectal
lowed); ev.preventdefault(); // set the dropeffect to move ev.datatransfer.dropeffect = "move" } specifications specification status comment html living standardthe definition of 'dropeffect' in that specification.
DataTransferItem.webkitGetAsEntry() - Web APIs
<p>drag files and/or directories to the box be
low!</p> <div id="dropzone"> <div id="boxtitle"> drop files here </div> </div> <h2>directory tree:</h2> <ul id="listing"> </ul> css content the styles used by the example are shown here.
...in chromium-based browsers, the fol
lowing example will only return a max of 100 entries.
...any of them which are files are simply inserted into the list; any which are directories are inserted into the list and a new level of the list's hierarchy is added be
low, and so forth.
... result you can see how this works by trying it out be
low.
DirectoryReaderSync - Web APIs
about this document this document was last updated on march 2, 2012 and fol
lows the w3c specifications (working draft) drafted on april 19, 2011.
... example in the fol
lowing code snippet from html5rocks, we create web workers and pass data from it to the main app.
... console.log(fileentry.name); }); }); }; worker.postmessage({'cmd': 'list'}); the fol
lowing is worker.js code that gets the contents of the directory.
... entrysync readentries ( ) raises (fileexception); returns parameter none exceptions this method can raise a fileexception with the fol
lowing codes: exception description not_found_err the directory does not exist.
Document.createElement() - Web APIs
when called on an html document, createelement() converts tagname to
lower case before creating the element.
...("div"); // and give it some content const newcontent = document.createtextnode("hi there and greetings!"); // add the text node to the newly created div newdiv.appendchild(newcontent); // add the newly created element and its content into the dom const currentdiv = document.getelementbyid("div1"); document.body.insertbefore(newdiv, currentdiv); } web component example the fol
lowing example snippet is taken from our expanding-list-web-component example (see it live also).
... } } // define the new element customelements.define('expanding-list', expandinglist, { extends: "ul" }); if we wanted to create an instance of this element programmatically, we'd use a call along the fol
lowing lines: let expandinglist = document.createelement('ul', { is : 'expanding-list' }) the new element will be given an is attribute whose value is the custom element's tag name.
... note: for backwards compatibility with previous versions of the custom elements specification, some browsers will al
low you to pass a string here instead of an object, where the string's value is the custom element's tag name.
Document.getElementsByTagNameNS() - Web APIs
syntax elements = document.getelementsbytagnamens(namespace, name) elements is a live nodelist (but see the note be
low) of found elements in the order they appear in the tree.
... example in the fol
lowing example getelementsbytagnamens starts from a particular parent element, and searches topdown recursively through the dom from that parent element, looking for child elements matching the tag name parameter.
... to use the fol
lowing example, just copy/paste it into a new file saved with the .xhtml extension.
...(to accommodate explorer, one could call an xpath wrapper instead of the xpath in the function be
low (as explorer supports xpath with a different api), such as this wrapper class.) function getelementsbytagnamenswrapper (ns, elname, doc, context) { if (!doc) { doc = document; } if (!context) { context = doc; } var result = doc.evaluate('//*[local-name()="'+elname+'" and namespace-uri() = "'+ns+'"]', context, null, xpathresult.ordered_node_snapshot_type, null); var a = []; ...
Document - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overf
low: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/eventtarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text...
... properties included from documentorshadowroot the document interface includes the fol
lowing properties defined on the documentorshadowroot mixin.
... document.mozsetimageelement() al
lows you to change the element being used as the background image for a specified element id.
... methods included from documentorshadowroot the document interface includes the fol
lowing methods defined on the documentorshadowroot mixin.
Element.innerHTML - Web APIs
nomodificational
lowederror an attempt was made to insert the html into a node whose parent is a document.
...doing so causes the user agent to fol
low these steps: the specified value is parsed as html or xml (based on the document type), resulting in a documentfragment object representing the new set of dom nodes for the new elements.
... css the fol
lowing css styles our example content.
... .box { width: 600px; height: 300px; border: 1px solid black; padding: 2px 4px; overf
low-y: scroll; overf
low-x: auto; } .log { margin-top: 8px; font-family: monospace; } result the resulting content looks like this.
Element.scrollHeight - Web APIs
the element.scrollheight read-only property is a measurement of the height of an element's content, including content not visible on the screen due to overf
low.
... padding-bottom left top right bottom margin-top margin-bottom border-top border-bottom problems and solutions determine if an element has been totally scrolled the fol
lowing equivalence returns true if an element is at the end of its scroll, false if it isn't.
... element.scrollheight - element.scrolltop === element.clientheight when the container does not scroll, but has overf
lowing children, these checks determine if the container can scroll: window.getcomputedstyle(element).overf
lowy === 'visible' window.getcomputedstyle(element).overf
lowy !== 'hidden' scrollheight demo associated with the onscroll event, this equivalence can be useful to determine whether a user has read a text or not (see also the element.scrolltop and element.clientheight properties).
..."thank you." : "please, scroll and read the fol
lowing text."; } onload = function () { var otoberead = document.getelementbyid("rules"); checkreading.noticebox = document.createelement("span"); document.registration.accept.checked = false; checkreading.noticebox.id = "notice"; otoberead.parentnode.insertbefore(checkreading.noticebox, otoberead); otoberead.parentnode.insertbefore(document.createelement("br"), otoberead); otoberead.o...
Element.scrollWidth - Web APIs
the element.scrollwidth read-only property is a measurement of the width of an element's content, including content not visible on the screen due to overf
low.
... example <!doctype html> <html> <head> <title>example</title> <style> div { overf
low: hidden; white-space: nowrap; text-overf
low: ellipsis; } #adiv { width: 100px; } button { margin-bottom: 2em; } </style> </head> <body> <div id="adiv"> foobar-foobar-foobar-foobar </div> <button id="abutton"> check for overf
low </button> <div id="...
...anotherdiv"> foobar-foobar-foobar-foobar </div> <button id="anotherbutton"> check for overf
low </button> </body> <script> var buttonone = document.getelementbyid('abutton'), buttontwo = document.getelementbyid('anotherbutton'), divone = document.getelementbyid('adiv'), divtwo = document.getelementbyid('anotherdiv'); //check to determine if an overf
low is happening function isoverf
lowing(element) { return (element.scrollwidth > element.offsetwidth); } function alertoverf
low(element) { if (isoverf
lowing(element)) { alert('contents are overf
lowing the container.'); } else { alert('no overf
lows!'); } } buttonone.addeventlistener('click', function() { alertoverf
low...
...(divone); }); buttontwo.addeventlistener('click', function() { alertoverf
low(divtwo); }); </script> </html> result specification specification status comment css object model (cssom) view modulethe definition of 'element.scrollwidth' in that specification.
Event.eventPhase - Web APIs
the eventphase read-only property of the event interface indicates which phase of the event f
low is currently being evaluated.
... syntax let phase = event.eventphase; value returns an integer value which specifies the current evaluation phase of the event f
low.
... constants event phase constants these values describe which phase the event f
low is currently being evaluated.
... for more details, see section 3.1, event dispatch and dom event f
low, of the dom level 3 events specification.
FeaturePolicy - Web APIs
featurepolicy methods featurepolicy.al
lowsfeature returns a boolean that indicates whether or not a particular feature is enabled in the specified context.
...feature whose name appears on the list might not be al
lowed by the feature policy of the current execution context and/or might not be accessible because of user's permissions.
... featurepolicy.al
lowedfeatures returns a list of names of all features supported by the user agent and al
lowed by the feature policy.
... featurepolicy.getal
lowlistforfeature returns the al
low list for the specified feature.
FileException - Web APIs
when errors occur, forward them to the main app using postmessage() as in the fol
lowing: function onerror(e) { postmessage('error:' + e.tostring()); } try { //error is thrown if "log.txt" already exists.
... invalid_modification_err 9 the modification requested is not al
lowed.
... no_modification_al
lowed_err 6 the state of the underlying file system prevents any writing to a file or a directory.
... security_err 2 access to the files were denied for one of the fol
lowing reasons: the files might be unsafe for access within a web application.
FileSystemDirectoryReader.readEntries() - Web APIs
<p>drag files and/or directories to the box be
low!</p> <div id="dropzone"> <div id="boxtitle"> drop files here </div> </div> <h2>directory tree:</h2> <ul id="listing"> </ul> css content the styles used by the example are shown here.
...in chromium-based browsers, the fol
lowing example will only return a max of 100 entries.
...any of them which are files are simply inserted into the list; any which are directories are inserted into the list and a new level of the list's hierarchy is added be
low, and so forth.
... result you can see how this works by trying it out be
low.
Using the Geolocation API - Web APIs
note: by default, getcurrentposition() tries to answer as fast as possible with a
low accuracy result.
...the callback function is called multiple times, al
lowing the browser to either update your location as you move, or provide a more accurate location as different techniques are used to geolocate you.
... this object al
lows you to specify whether to enable high accuracy, a maximum age for the returned position value (up until this age it will be cached and reused if the same position is requested again; after this the browser will request fresh position data), and a timeout value that dictates how long the browser should attempt to get the position data for, before it times out.
... you could use it like so: function errorcallback(error) { alert(`error(${error.code}): ${error.message}`); }; examples in the fol
lowing example the geolocation api is used to retrieve the user's latitude and longitude.
HTMLAnchorElement - Web APIs
this interface corresponds to <a> element; not to be confused with <link>, which is represented by htmllinkelement) <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overf
low: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/eventtarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" tex...
... living standard the fol
lowing property has been added: download.
... the fol
lowing properties are now obsolete: charset, coords, name, rev, and shape.
... the fol
lowing properties have been added: hash, host, hostname, media, pathname, port, protocol, rellist, search, and text.
HTMLAreaElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overf
low: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/eventtarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle"...
... living standard the fol
lowing property has been added: download.
... the fol
lowing property is now obsolete: nohref.
... the fol
lowing properties have been added: rel, rellist, media, hreflang, type, host, hostname, pathname, port, protocol, search, and hash.
HTMLElement.hidden - Web APIs
javascript document.getelementbyid("okbutton") .addeventlistener("click", function() { document.getelementbyid("welcome").hidden = true; document.getelementbyid("awesome").hidden = false; }, false); this code sets up a handler for the welcome panel's "ok" button that hides the welcome panel and makes the fol
low-up panel—with the curious name "awesome"—visible in its place.
... the fol
low-up panel once the user clicks the "ok" button in the welcome panel, the javascript code swaps the two panels by changing their respective values for hidden.
... the fol
low-up panel looks like this in html: <div id="awesome" class="panel" hidden> <h1>thanks!</h1> <p>thank you <strong>so</strong> much for agreeing to be awesome today!
... now get out there and do awesome things awesomely to make the world more awesome!</p> </div> css the content is styled using the css be
low.
HTMLImageElement.align - Web APIs
syntax htmlimageelement.align = alignmode; alignmode = htmlimageelement.align; value a domstring specifying one of the fol
lowing strings which set the alignment mode for the image.
...instead, they cause the image to "float" to the left or right margin, al
lowing the fol
lowing text to f
low around the image.
...any text that fol
lows will f
low against the image's right edge.
...subsequent text will f
low along the image's left edge.
HTMLImageElement.loading - Web APIs
preventing element shift during image lazy loads when an image whose loading has been delayed by the loading attribute being set to lazy is finally loaded, the browser will determine the final size of the <img> element based on the style and intrinsic size of the image, then ref
low the document as needed to update the positions of elements based on any size change made to the element to fit the image.
... to prevent this ref
low from occurring, you should explicitly specify the size of the image's presentation using the image element's width and height attributes.
... by establishing the intrinsic aspect ratio in this manner, you prevent elements from shifting around while the document loads, which can be disconcerting or offputting at best and can cause users to click the wrong thing at worst, depending on the exact timing of the deferred loads and ref
lows.
... example the addimagetolist() function shown be
low adds a photo thumbnail to a list of items, using lazy-loading to avoid loading the image from the network until it's actually needed.
HTMLLinkElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overf
low: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/eventtarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" tex...
... living standard adds the fol
lowing properties: crossorigin, referrerpolicy, and as.
... recommendation the fol
lowing properties are now obsolete: charset, rev, and shape.
... the fol
lowing properties have been added: rellist, and sizes.
HTMLObjectElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overf
low: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/eventtarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" tex...
... the fol
lowing properties are now obsolete: align, archive, border, code, codebase, codetype, declare, hspace, standby, and vspace.
... the fol
lowing properties have been added: typemustmatch, contentwindow, willvalidate, validity, and validationmessage.
... the fol
lowing methods have been added: checkvalidity() and setcustomvalidity().
HTMLOptionsCollection - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overf
low: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/htmlcollection" target="_top"><rect x="1" y="1" width="140" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="71" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" t...
...e="#d4dde4" stroke-width="2px" /><text x="286" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmloptionscollection</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties name type description length unsigned long as optionally al
lowed by the spec, this property isn't read-only.
... you can either remove options from the end by
lowering the value, or add blank options at the end by raising the value.
... mozilla al
lows this, while other implementations could potentially throw a domexception.
HTMLOrForeignElement.dataset - Web APIs
it must contain only letters, numbers, and the fol
lowing characters: dash (-), dot (.), colon (:), underscore (_)—but not any ascii capital letters (a to z).
... in addition to the information be
low, you'll find a how-to guide for using html data attributes in our article using data attributes.
... name conversion dash-style to camelcase conversion a custom data attribute name is transformed to a key for the domstringmap entry with the fol
lowing rules the prefix data- is removed (including the dash); for any dash (u+002d) fol
lowed by an ascii
lowercase letter a to z, the dash is removed, and the letter is transformed into its uppercase counterpart; other characters (including other dashes) are left unchanged.
... camelcase to dash-style conversion the opposite transformation, which maps a key to an attribute name, uses the fol
lowing rules: restriction: before the transformation, a dash must not be immediately fol
lowed by an ascii
lowercase letter a to z; the prefix data- is added; any ascii uppercase letter a to z is transformed into a dash, fol
lowed by its
lowercase counterpart; other characters are left unchanged.
HTMLTableElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overf
low: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/eventtarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="midd...
... obsolete properties warning: the fol
lowing properties are obsolete.
...it reflects the obsolete frame attribute and can take one of the fol
lowing values: "void", "above", "be
low", "hsides", "vsides", "lhs", "rhs", "box", or "border".
...it reflects the obsolete rules attribute and can take one of the fol
lowing values: "none", "groups", "rows", "cols", or "all".
HashChangeEvent - Web APIs
the fragment identifier is the part of the url that fol
lows (and includes) the # symbol.
... <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overf
low: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/event" target="_top"><rect x="1" y="1" width="75" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">event</text></a><polyline points="76,25 86,20 86,30 76,25" stroke="#d4dde4" fill="none"/><line x1="86" y1="25" x2="116" y2="25" stroke="#d4dde4"/><a xlink:href="/docs/web/api/hashchangeevent" tar...
... examples syntax options for a hash change you can listen for the hashchange event using any of the fol
lowing options: window.onhashchange = funcref; or <body onhashchange="funcref();"> or window.addeventlistener("hashchange", funcref, false); basic example function locationhashchanged() { if (location.hash === '#somecoolfeature') { somecoolfeature(); } } window.addeventlistener('hashchange', locationhashchanged); polyfill there are several fallback scripts listed on the moder...
...here is a version that al
lows only one handler to be bound to the onhashchange property: ;(function(window) { // exit if the browser implements that event if ( "onhashchange" in window.document.body ) { return; } var location = window.location, oldurl = location.href, oldhash = location.hash; // check the location hash on a 100ms interval setinterval(function() { var newurl = location.href, newhash = location.hash; // if the hash has changed and a handler has been bound...
IDBIndex.unique - Web APIs
the unique read-only property returns a boolean that states whether the index al
lows duplicate keys.
... syntax var isunique = idbindex.unique; value a boolean: value effect true the current index does not al
low duplicate values for a key.
... false the current index al
lows duplicate key values.
... example in the fol
lowing example we open a transaction and an object store, then get the index lname from a simple contacts database.
IDBObjectStore.delete() - Web APIs
either a key or an idbkeyrange can be passed, al
lowing one or multiple records to be deleted from a store.
... exceptions this method may raise a domexception of the fol
lowing types: exception description transactioninactiveerror this object store's transaction is inactive.
... example in the fol
lowing code snippet, we open a read/write transaction on our database and delete one specific record out of our object store using delete() — a sample record with the key "walk dog".
...this is used a lot be
low db = dbopenrequest.result; // run the deletedata() function to delete a record from the database deletedata(); }; function deletedata() { // open a read/write db transaction, ready for deleting the data var transaction = db.transaction(["todolist"], "readwrite"); // report on the success of the transaction completing, when everything is done transaction.oncomplete = function(event) { note.innerhtml += '<li>transaction ...
IDBTransaction.abort() - Web APIs
syntax transaction.abort(); exceptions this method may raise a domexception of the fol
lowing type: exception description invalidstateerror the transaction has already been committed or aborted.
... example in the fol
lowing code snippet, we open a read/write transaction on our database and add some data to an object store.
...this is used a lot be
low db = dbopenrequest.result; // run the adddata() function to add the data to the database adddata(); }; function adddata() { // create a new object ready for being inserted into the idb var newitem = [ { tasktitle: "walk dog", hours: 19, minutes: 30, day: 24, month: "december", year: 2013, notified: "no" } ]; // open a read/write db transaction, ready for adding the data var trans...
...duplicate items not al
lowed.</li>'; }; // create an object store on the transaction var objectstore = transaction.objectstore("todolist"); // add our newitem object to the object store var objectstorerequest = objectstore.add(newitem[0]); objectstorerequest.onsuccess = function(event) { // report the success of the request (this does not mean the item // has been stored successfully in the db - for that you need transactio...
IDBTransaction.objectStore() - Web APIs
exceptions this method may raise a domexception of one of the fol
lowing types: exception description notfounderror the requested object store is not in this transaction's scope.
... example in the fol
lowing code snippet, we open a read/write transaction on our database and add some data to an object store.
... // this is used a lot be
low db = dbopenrequest.result; // run the adddata() function to add the data to the database adddata(); }; function adddata() { // create a new object ready for being inserted into the idb var newitem = [ { tasktitle: "walk dog", hours: 19, minutes: 30, day: 24, month: "december", year: 2013, notified: "no" } ]; // open a read/write db transaction, ready for adding the data var trans...
...duplicate items not al
lowed.</li>'; }; // create an object store on the transaction var objectstore = transaction.objectstore("todolist"); // add our newitem object to the object store var objectstorerequest = objectstore.add(newitem[0]); objectstorerequest.onsuccess = function(event) { // report the success of the request (this does not mean the item // has been stored successfully in the db - for that you need transaction...
Browser storage limits and eviction criteria - Web APIs
note: the information be
low should be fairly accurate for most modern browsers, but browser specifics are called out where known.
... in firefox, the fol
lowing technologies make use of browser data storage to store data when required.
...here's the actual mapping to directories under a user's firefox profile (other browsers may differ slightly): <profile>/storage — the main top-level directory for storages maintained by the quota manager (see be
low) <profile>/storage/permanent — persistent data storage repository <profile>/storage/temporary — temporary data storage repository <profile>/storage/default — default data storage repository note: after introducing storage api, the "permanent" folder can be considered obsolete; the "permanent" folder only stores indexeddb persistent-type databases.
...if you had a really
low memory situation where the global limit was, say, 8 mb, then the group limit would also be 8 mb.
KeyframeEffect.KeyframeEffect() - Web APIs
the keyframeeffect() constructor of the web animations api returns a new keyframeeffect object instance, and also al
lows you to clone an existing keyframe effect object instance.
... keyframeoptions optional either an integer representing the animation's duration (in milliseconds), or an object containing one or more of the fol
lowing: delay optional the number of milliseconds to delay the start of the animation.
...its parameter is as fol
lows: sourcekeyframes a keyframeeffect object that you want to clone.
... examples in the fol
low the white rabbit example, the keyframeeffect constructor is used to create a set of keyframes that dictate how the white rabbit should animate down the hole: var rabbitdownkeyframes = new keyframeeffect( whiterabbit, // element to animate [ { transform: 'translatey(0%)' }, // keyframe { transform: 'translatey(100%)' } // keyframe ], { duration: 3000, fill: 'forwards' } // keyframe options ); specifications specification status comment web animations level 2the definition of 'keyframeeffectoptions.iterationcomposite' in that specification.
KeyframeEffect.setKeyframes() - Web APIs
the easing to apply between keyframes can be specified by providing an easing value as illustrated be
low.
... element.animate({ opacity: [ 0, 1 ], // offset: 0, 1 backgroundcolor: [ "red", "yel
low", "green" ], // offset: 0, 0.5, 1 }, 2000); the special keys offset, easing, and composite (described be
low) may be specified alongside the property values.
... offset, which must be written as cssoffset since "offset" represents the keyframe offset as described be
low.
... the fol
lowing special attributes may also be specified: offset the offset of the keyframe specified as a number between 0.0 and 1.0 inclusive or null.
LocalFileSystemSync - Web APIs
about this document this document was last updated on march 2, 2012 and fol
lows the w3c specifications (working draft) drafted on april 19, 2011.
... exceptions this method can raise an fileexception with the fol
lowing code: exception description security_error the application does not have permission to access the file system interface.
... resolvelocalfilesystemsyncurl() al
lows the user to look up the entry for a file or directory referred to by a local url.
... exceptions this method can raise a fileexception with the fol
lowing codes: exception description encoding_err the syntax of the url was invalid.
Location - Web APIs
-space:nowrap;} [title] {position:relative; display:inline-block; box-sizing:border-box; /*border-bottom:.5em solid;*/ line-height:2em; cursor:pointer;} [title]:before {content:attr(title); font-family:monospace; position:absolute; top:100%; width:100%; left:50%; margin-left:-50%; font-size:40%; line-height:1.5; background:black;} [title]:hover:before, :target:before {background:black; color:yel
low;} [title] [title]:before {margin-top:1.5em;} [title] [title] [title]:before {margin-top:3em;} [title]:hover, :target {position:relative; z-index:1; outline:50em solid rgba(255,255,255,.8);} javascript [].foreach.call(document.queryselectorall('[title][id]'), function (node) { node.addeventlistener("click", function(e) { e.preventdefault(); e.stoppropagation(); window.location.ha...
... location.pathname is a usvstring containing an initial '/' fol
lowed by the path of the url.
... location.search is a usvstring containing a '?' fol
lowed by the parameters or "querystring" of the url.
... location.hash is a usvstring containing a '#' fol
lowed by the fragment identifier of the url.
MediaStreamConstraints.audio - Web APIs
examples for browsers with feature policy enabled, the samples be
low need the microphone feature enabled.
... html content <p>click the start button be
low to begin the demonstration.</p> <div id="startbutton" class="button"> start </div> <audio id="audio" autoplay controls></audio><br> <div id="log"></div> css content body { font: 14px "open sans", "arial", sans-serif; } audio { margin-top: 20px; border: 1px solid black; width: 160px; } .button { cursor: pointer; width: 160px; border: 1px solid black; font-size: 16px; text-align: center; padding-top: 2px; padding-bottom: ...
... result using a mediatrackconstraints object now let's look at a similar example that uses a set of constraints based on the mediatrackconstraints dictionary: html content <p>click the start button be
low to begin the demonstration.</p> <div id="startbutton" class="button"> start </div> <audio id="audio" autoplay controls></audio><br> <div id="log"></div> css content body { font: 14px "open sans", "arial", sans-serif; } audio { margin-top: 20px; border: 1px solid black; width: 160px; } .button { cursor: pointer; width: 160px; border: 1px solid black; font-size: 16px; text-a...
...as long as an audio input device is available and the user al
lows it to be used, an audio track will be included in the resulting stream, and it will match the specified constraints as well as possible.
MediaStreamTrackAudioSourceNode - Web APIs
next, we feed this source audio into a
low pass biquadfilternode (which effectively serves as a bass booster), then a audiodestinationnode.
... the range slider be
low the <video> element controls the amount of gain given to the
lowpass filter — increase the value of the slider to make the audio sound more bass heavy!
...ction(e) { video.play(); video.muted = true; }; // create a mediastreamaudiosourcenode // feed the htmlmediaelement into it var audioctx = new audiocontext(); var source = audioctx.createmediastreamsource(stream); // create a biquadfilter var biquadfilter = audioctx.createbiquadfilter(); biquadfilter.type = "
lowshelf"; biquadfilter.frequency.value = 1000; biquadfilter.gain.value = range.value; // connect the audiobuffersourcenode to the gainnode // and the gainnode to the destination, so we can play the // music and adjust the volume using the mouse cursor source.connect(biquadfilter); biquadfilter.connect(audioctx.destination); // get new...
... mouse pointer coordinates when mouse is moved // then set new gain value range.oninput = function() { biquadfilter.gain.value = range.value; } }) .catch(function(err) { console.log('the fol
lowing gum error occured: ' + err); }); } else { console.log('getusermedia not supported on your browser!'); } // dump script to pre element pre.innerhtml = myscript.innerhtml; note: as a consequence of calling createmediastreamsource(), audio playback from the media stream will be re-routed into the processing graph of the audiocontext.
NDEFWriter.write() - Web APIs
signal -- optional abortsignal that al
lows to cancell this write operation.
... exceptions this method doesn't throw true exceptions; instead, it rejects the returned promise, passing into it a domexception whose name is one of the fol
lowing: aborterror the write operation was aborted with abortsignal passed in options.
... notal
lowederror the permission for this operation was rejected or overwrite is false and there are already records on the tag.
... notreadableerror the ua is not al
lowed to access underlying nfc adapter (e.g., due to user preference).
Navigator.getBattery() - Web APIs
exceptions this method doesn't throw true exceptions; instead, it rejects the returned promise, passing into it a domexception whose name is one of the fol
lowing: securityerror the user agent does not expose battery information to insecure contexts and this method was called from insecure context.
... note: old versions of some user agents might al
low use of this feature in insecure contexts.
... notal
lowederror note: no user agent currently throws this exception, but the specification describes the fol
lowing behaviors: this document is not al
lowed to use this feature.
... for example, it might not be explicitly al
lowed or restricted via feature-policy battery feature.
Navigator.msLaunchUri() - Web APIs
this proprietary method is specific to internet explorer, and microsoft edge versions 18 and
lower.
... to help protect a user's privacy, windows displays a prompt for the user to al
low the service or app to be launched.
...if a handler doesn't exist, and the developer doesn't provide a nohandlercallback, then internet explorer displays a dialog that asks the user if they want to al
low the action.
... if the user al
lows it, the user is then prompted to look in the windows store for an app to handle the protocol.
Navigator - Web APIs
it al
lows scripts to query it and to register themselves to carry on some activities.
... navigator.geolocation read only returns a geolocation object al
lowing accessing the location of the device.
... navigator.registercontenthandler() obsolete since gecko 59 al
lows web sites to register themselves as a possible handler for a given mime type.
... navigator.registerprotocolhandler() al
lows web sites to register themselves as a possible handler for a given protocol.
Notifications API - Web APIs
the notifications api al
lows web pages to control the display of system notifications to the end user.
...this should be done in response to a user gesture, such as clicking a button, for example: btn.addeventlistener('click', function() { let promise = notification.requestpermission(); // wait for permission }) this is not only best practice — you should not be spamming users with notifications they didn't agree to — but going forward browsers will explicitly disal
low notifications not triggered in response to a user gesture.
... this will spawn a request dialog, along the fol
lowing lines: from here the user can choose to al
low notifications from this origin, or block them.
... in addition, the notifications api spec specifies a number of additions to the serviceworker api, to al
low service workers to fire notifications.
PaymentRequest.show() - Web APIs
if this is provided, show() will not al
low the user to interact with the payment interface until the promise is fulfilled, so that data can be updated prior to the user engaging with the payment process.
... the validateresponse() method, be
low, is called once show() returns, in order to look at the returned response and either submit the payment or reject the payment as failed: async function validateresponse(response) { try { if (await checkallvalues(response)) { await response.complete("success"); } else { await response.complete("fail"); } } catch(err) { await response.complete("fail"); } } here,...
... examples in the fol
lowing example, a paymentrequest object is instantiated before the show() method is called.
... // paymentresponse.methodname contains the selected payment method // paymentresponse.details contains a payment method specific response await response.complete("success"); } catch (err) { console.error("uh oh, something bad happened", err.message); } } the fol
lowing example shows how to update the payment sheet as it's being presented to the end-user.
PaymentResponse.complete() - Web APIs
it must be one of the fol
lowing: success the payment was successfully processed.
...see the browser compatibility section be
low for details.
...if an error occurs, the promise instead rejects, returning one of the exceptions listed be
low.
... examples the fol
lowing example sends payment information to a secure server using the fetch api.
Using the Payment Request API - Web APIs
in the fol
lowing snippet, a merchant page performs this check, and if it returns true updates the checkout button to use paymentrequest instead of legacy web forms.
... in the fol
lowing snippet we do just this — depending on whether the user can make a fast payment or needs to add payment credentials first, the title of the checkout button changes between "fast checkout with w3c" and "setup w3c checkout".
... checking before all prices are known if the checkout f
low needs to know whether paymentrequest.canmakepayment() will return true even before all line items and their prices are known, you can instantiate paymentrequest with dummy data and pre-query .canmakepayment().
... }); the payment handler would include the fol
lowing code: self.addeventlistener('canmakepayment', function(evt) { // pre-authorize here.
PerformanceNavigationTiming - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overf
low: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/performanceentry" target="_top"><rect x="1" y="1" width="160" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="81" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53"...
...="201" y="1" width="270" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="336" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">performancenavigationtiming</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties this interface extends the fol
lowing performanceentry properties for navigation performance entry types by qualifying and constraining them as fol
lows: performanceentry.entrytype read only returns "navigation".
... this interface also extends fol
lowing performanceresourcetiming properties for navigation performance entry types by qualifying and constraining them as fol
lows: performanceresourcetiming.initiatortyperead only returns "navigation".
... the interface also supports the fol
lowing properties: performancenavigationtiming.domcomplete read only a domhighrestimestamp representing a time value equal to the time immediately before the browser sets the current document readiness of the current document to complete.
Performance Timeline - Web APIs
the standard also includes interfaces that al
low an application to define performance observer callbacks that are notified when specific performance events are added to the browser's performance timeline.
...this interface has the fol
lowing four properties, and these properties are extended (with additional constraints) by other interfaces (such as performancemark): name the name of the performance entry when the metric was created.
... performance observers the performance observer interfaces al
low an application to register an observer for specific performance event types, and when one of those event types is recorded, the application is notified of the event via the observer's callback function that was specified when the observer was created.
... implementation status a summary of the interfaces' implementation status is provided be
low, including a link to more detailed information.
RTCPeerConnection.setRemoteDescription() - Web APIs
this lets you simplify code such as the fol
lowing: mypeerconnection.setremotedescription(new rtcsessiondescription(description)) .then(function () { return createmystream(); }) to simply be: mypeerconnection.setremotedescription(description) .then(function () { return createmystream(); }) using async/await syntax, you can further simplify this to: await mypeerconnection.setremotedescription(description); createmystream(); since it'...
... exceptions the fol
lowing exceptions are reported to the rejection handler for the promise returned by setremotedescription(): invalidaccesserror the content of the description is invalid.
...the parameters for the older form of setremotedescription() are described be
low, to aid in updating existing code.
... exceptions when using the deprecated callback-based version of setremotedescription(), the fol
lowing exceptions may occur: invalidstateerror the connection's signalingstate is "closed", indicating that the connection is not currently open, so negotiation cannot take place.
RTCRtpSender.setParameters() - Web APIs
the default value is
low.
... exceptions if an error occurs, the returned promise is rejected with the appropriate exception from the list be
low.
... invalidmodificationerror one of the fol
lowing problems was detected: the number of encodings specified in the parameters object's encodings property does not match the number of encodings currently listed for the rtcrtpsender.
... rangeerror the value specified for scaleresolutiondownby is less than 1.0, which would result in scaling up rather than down, which is not al
lowed; or one or more of the specified encodings' maxframerate values is less than 0.0.
Reporting API - Web APIs
there are a few ways to use it, which are detailed in the sections be
low.
...the callback runs when observation starts an options dictionary that al
lows you to specify the type of reports to collect, and whether the reports that were generated before the observer was able to be created should be observable (buffered: true).
... reporting api dictionaries reportingobserveroptions al
lows options to be set in the constructor when creating a reporting observer.
... available report types the spec defines the fol
lowing report types: deprecation report indicates that a webapi or other browser feature being used in the website is expected to stop working in a future release.
Response.redirected - Web APIs
see the example disal
lowing redirects, which shows this being done.
...in the code be
low, a textual message is inserted into an element when a redirect occurred during the fetch operation.
... note, however, that this isn't as safe as outright rejecting redirects if they're unexpected, as described under disal
lowing redirects be
low.
...e-picture.jpg").then(function(response) { let elem = document.getelementbyid("warning-message-box"); if (response.redirected) { elem.innerhtml = "unexpected redirect"; } else { elem.innerhtml = ""; } return response.blob(); }).then(function(imageblob) { let imgobjecturl = url.createobjecturl(imageblob); document.getelementbyid("img-element-id").src = imgobjecturl; }); disal
lowing redirects because using redirected to manually filter out redirects can al
low forgery of redirects, you should instead set the redirect mode to "error" in the init parameter when calling fetch(), like this: fetch("awesome-picture.jpg", { redirect: "error" }).then(function(response) { return response.blob(); }).then(function(imageblob) { let imgobjecturl = url.createobjecturl(imageblob); ...
SVGAngle - Web APIs
exceptions on setting: a domexception with code no_modification_al
lowed_err is raised when the length corresponds to a read-only attribute, or when the object itself is read-only.
... exceptions on setting: a domexception with code no_modification_al
lowed_err is raised when the length corresponds to a read-only attribute, or when the object itself is read-only.
... a domexception with code no_modification_al
lowed_err is raised when the length corresponds to a read-only attribute, or when the object itself is read-only.
... a domexception with code no_modification_al
lowed_err is raised when the length corresponds to a read only attribute or when the object itself is read only.
SVGLength - Web APIs
exceptions on setting: a domexception with code no_modification_al
lowed_err is raised when the length corresponds to a read only attribute or when the object itself is read only.
... exceptions on setting: a domexception with code no_modification_al
lowed_err is raised when the length corresponds to a read only attribute or when the object itself is read only.
... a domexception with code no_modification_al
lowed_err is raised when the length corresponds to a read only attribute or when the object itself is read only.
... a domexception with code no_modification_al
lowed_err is raised when the length corresponds to a read only attribute or when the object itself is read only.
SVGStyleElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 23.333333333333332%; vertical-align: middle; overf
low: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/eventtarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">eventtarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#d4dde4" fill="none"/...
... svg 1.1 defined that a domexception is raised with code no_modification_al
lowed_err on an attempt to change the value of a read-only attribute.
... svg 1.1 defined that a domexception is raised with code no_modification_al
lowed_err on an attempt to change the value of a read-only attribute.
... svg 1.1 defined that a domexception is raised with code no_modification_al
lowed_err on an attempt to change the value of a read-only attribute.
ServiceWorkerContainer.register() - Web APIs
the fol
lowing example uses the default value of scope (by omitting it).
... navigator.serviceworker.register('/sw.js').then(function(registration) { console.log('service worker registration succeeded:', registration); }, /*catch*/ function(error) { console.log('service worker registration failed:', error); }); } else { console.log('service workers are not supported.'); } the fol
lowing code, if included in example.com/index.html, at the root of a site, would apply to exactly the same pages as the example above.
... the fol
lowing code, if included in example.com/index.html, at the root of a site, would only apply to resources under example.com/product.
...serviceworker.register('/sw.js', {scope: '/product/'}).then(function(registration) { console.log('service worker registration succeeded:', registration); }, /*catch*/ function(error) { console.log('service worker registration failed:', error); }); } else { console.log('service workers are not supported.'); } however, servers can remove this restriction by setting a service-worker-al
lowed header on the service worker script, and then you can specify a max scope for that service worker above the service worker's location.
ServiceWorkerGlobalScope - Web APIs
additionally, synchronous requests are not al
lowed from within a service worker — only asynchronous requests, like those initiated via the fetch() method, can be used.
... <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 12.142857142857142%; vertical-align: middle; overf
low: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-20 0 700 85" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/eventtarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">eventtar...
... methods serviceworkerglobalscope.skipwaiting() al
lows the current service worker registration to progress from waiting to active state while service worker clients are using it.
...therefore it also has the fol
lowing property available to it: globalfetch.fetch() starts the process of fetching a resource.
ServiceWorkerRegistration.showNotification() - Web APIs
syntax serviceworkerregistration.shownotification(title, [options]); parameters title the title that must be shown within the notification options optional an object that al
lows configuring the notification.
... it can have the fol
lowing properties: actions: an array of actions to display in the notification.
...it may contain the fol
lowing values: action: a domstring identifying a user action to be displayed on the notification.
... tag: an id for a given notification that al
lows you to find, replace, or remove the notification using a script if necessary.
Service Worker API - Web APIs
they will also al
low access to push notifications and background sync apis.
...if successful, your service worker will be downloaded to the client and attempt installation/activation (see be
low) for urls accessed by the user inside the whole origin, or inside a subset specified by you.
... download, install and activate at this point, your service worker will observe the fol
lowing lifecycle: download install activate the service worker is immediately downloaded when a user first accesses a service worker–controlled site/page.
...it contains information about the request and resulting response, and provides the fetchevent.respondwith() method, which al
lows us to provide an arbitrary response back to the controlled page.
Storage API - Web APIs
the diagram be
low shows a site storage pool with three storage units within, showing how storage units can have different data types stored within and may have different quotas (maximum storage limits).
...this origin, however, has a
lower quota than the other two do.
... it may be a less-visited site, or one known to have
lower data storage requirements.
...there are two modes: "best-effort" the user agent will try to retain the data contained in the box for as long as it can, but will not warn users if storage space runs
low and it becomes necessary to clear the box in order to relieve the storage pressure.
SubtleCrypto.deriveKey() - Web APIs
note that the key usages must be al
lowed by the algorithm set in derivedkeyalgorithm.
... exceptions the promise is rejected when one of the fol
lowing exceptions are encountered: invalidaccesserror raised when the master key is not a key for the requested derivation algorithm or if the cryptokey.usages value of that key doesn't contain derivekey.
... it's not designed to derive keys from relatively
low-entropy inputs such as passwords.
...it's designed to derive key material from some relatively
low-entropy input, such as a password.
SubtleCrypto - Web APIs
the subtlecrypto interface of the web crypto api provides a number of
low-level cryptographic functions.
... warning: this api provides a number of
low-level cryptographic primitives.
...the subtlecrypto api provides the fol
lowing cryptography functions: * sign() and verify(): create and verify digital signatures.
... the table be
low summarises which algorithms are suitable for which cryptographic operations: sign() verify() encrypt() decrypt() digest() derivebits() derivekey() wrapkey() unwrapkey() rsassa-pkcs1-v1_5 ✓ rsa-pss ✓ ecdsa ✓ hmac ...
Using Touch Events - Web APIs
interfaces touch events consist of three interfaces (touch, touchevent and touchlist) and the fol
lowing event types: touchstart - fired when a touch point is placed on the touch surface.
...this interface's attributes include the state of several modifier keys (for example the shift key) and the fol
lowing touch lists: touches - a list of all of the touch points currently on the screen.
... together, these interfaces define a relatively
low-level set of features, yet they support many kinds of touch-based interaction, including the familiar multi-touch gestures such as multi-finger swipe, rotation, pinch and zoom.
... examples and demos the fol
lowing documents describe how to use touch events and include example code: touch events overview implement custom gestures introduction to touch events in javascript add touch screen support to your website (the easy way) touch event demonstrations: paint program (by rick byers) touch/pointer tests and demos (by patrick h.
USB.requestDevice() - Web APIs
calling this function triggers the user agent's pairing f
low.
...each filter object can have the fol
lowing properties: vendorid productid classcode subclasscode protocolcode serialnumber return value a promise that resolves with an instance of usbdevice.
... example the fol
lowing example looks for one of two usb devices.
...this triggers a user-agent f
low that prompts the user to select a device for pairing.
WebGLRenderingContext.getParameter() - Web APIs
see be
low for possible values.
... parameter names webgl 1 you can query the fol
lowing pname parameters when using a webglrenderingcontext.
...ltexture or null gl.unpack_alignment glint gl.unpack_colorspace_conversion_webgl glenum gl.unpack_flip_y_webgl glboolean gl.unpack_premultiply_alpha_webgl glboolean gl.vendor domstring gl.version domstring gl.viewport int32array (with 4 elements) webgl 2 you can query the fol
lowing pname parameters when using a webgl2renderingcontext.
... webgl extensions you can query the fol
lowing pname parameters when using webgl extensions: constant returned type extension description ext.max_texture_max_anisotropy_ext glfloat ext_texture_filter_anisotropic maximum available anisotropy.
WebGLRenderingContext.pixelStorei() - Web APIs
see be
low for possible values.
...see be
low for possible values.
... pixel storage parameters parameter name (for pname) description type default value al
lowed values (for param) specified in gl.pack_alignment packing of pixel data into memory glint 4 1, 2, 4, 8 opengl es 2.0 gl.unpack_alignment unpacking of pixel data from memory.
... glenum gl.browser_default_webgl gl.browser_default_webgl, gl.none webgl when using a webgl 2 context, the fol
lowing values are available additionally: constant description type default value al
lowed values (for param) specified in gl.pack_row_length number of pixels in a row.
WebGLRenderingContext.texSubImage2D() - Web APIs
xoffset a glint specifying the
lower left texel x coordinate of a width-wide by height-wide rectangular subregion of the texture array.
... yoffset a glint specifying the
lower left texel y coordinate of a width-wide by height-wide rectangular subregion of the texture array..
... when using the ext_srgb extension: ext.srgb_ext ext.srgb_alpha_ext when using a webgl 2 context, the fol
lowing values are available additionally: gl.red gl.rg gl.red_integer gl.rg_integer gl.rgb_integer gl.rgba_integer type a glenum specifying the data type of the texel data.
... when using the oes_texture_float extension: gl.float when using the oes_texture_half_float extension: gl.half_float_oes when using a webgl 2 context, the fol
lowing values are available additionally: gl.byte gl.unsigned_short gl.short gl.unsigned_int gl.int gl.half_float gl.float gl.unsigned_int_2_10_10_10_rev gl.unsigned_int_10f_11f_11f_rev gl.unsigned_int_5_9_9_9_rev gl.unsigned_int_24_8 gl.float_32_unsigned_int_24_8_rev (pixels must be null) pixels one of the fol
lowing objects can be used...
Color masking - Web APIs
so, by masking off the blue and green channels, you are only al
lowing the red component of pixels to be updated, and therefore it is as if you were looking through a red tinted glass.
... color masking al
lows us to demonstrate some basics of color theory.
...masking only the blue channel would give us shades of yel
low (including shades of orange, brown, olive and yel
low-green), the complementary of blue.
...it al
lows us to setup webgl in a single initialization phase, and then just execute drawing commands for each frame.
Using shaders to apply color in WebGL - Web APIs
we'll do that by adding the fol
lowing code to our initbuffers() function: function initbuffers(){ ...
... to use these colors, the vertex shader needs to be updated to pull the appropriate color from the color buffer: const vssource = ` attribute vec4 avertexposition; attribute vec4 avertexcolor; uniform mat4 umodelviewmatrix; uniform mat4 uprojectionmatrix; varying
lowp vec4 vcolor; void main(void) { gl_position = uprojectionmatrix * umodelviewmatrix * avertexposition; vcolor = avertexcolor; } `; the key difference here is that for each vertex, we pass its color using a varying to the fragment shader.
... coloring the fragments as a refresher, here's what our fragment shader looked like previously: const fssource = ` void main() { gl_fragcolor = vec4(1.0, 1.0, 1.0, 1.0); } `; in order to pick up the interpolated color for each pixel, we need to change this to fetch the value from the vcolor varying: const fssource = ` varying
lowp vec4 vcolor; void main(void) { gl_fragcolor = vcolor; } `; each fragment receives the interpolated color based on its position relative to the vertex positions instead of a fixed value.
... then, drawscene() can have the fol
lowing added to it so it actually uses these colors when drawing the square: // tell webgl how to pull out the colors from the color buffer // into the vertexcolor attribute.
Using textures in WebGL - Web APIs
note: it's important to note that the loading of textures fol
lows cross-domain rules; that is, you can only load textures from sites for which your content has cors approval.
... see cross-domain textures be
low for details.
...this will al
low non-power-of-two (npot) textures at the expense of mipmapping, uv wrapping, uv tiling, and your control over how the device will handle your texture.
... // gl.nearest is also al
lowed, instead of gl.linear, as neither mipmap.
Taking still photos with WebRTC - Web APIs
listen for the video to start playing after calling htmlmediaelement.play() on the <video>, there's a (hopefully brief) period of time that elapses before the stream of video begins to f
low.
... handle clicks on the button to capture a still photo each time the user clicks the startbutton, we need to add an event listener to the button, to be called when the click event is issued: startbutton.addeventlistener('click', function(ev){ takepicture(); ev.preventdefault(); }, false); this method is simple enough: it just calls our takepicture() function, defined be
low in the section capturing a frame from the stream, then calls event.preventdefault() on the received event to prevent the click from being handled more than once.
... wrapping up the startup() method there are only two more lines of code in the startup() method: clearphoto(); } this is where we call the clearphoto() method we'll describe be
low in the section clearing the photo box.
...when the promise is fulfilled with an array of mediadeviceinfo objects describing the available devices, find the ones that you want to al
low and specify the corresponding deviceid or deviceids in the mediatrackconstraints object passed into getusermedia().
Using DTMF with WebRTC - Web APIs
these will be initialized when the call starts up, in our connectanddial() function, as shown in starting the connection process be
low.
...see initialization be
low.
...as previously mentioned, our example is simplified somewhat because we control both the caller and the receiver, so handlecallernegotiationneeded() is able to quickly construct the connection by chaining the required calls together for both the caller and receiver, as shown be
low.
...the handlereceivertrackevent() and handlereceiveraddstreamevent() methods, shown be
low, handle these.
Using WebRTC data channels - Web APIs
see security be
low for more information.
... automatic negotiation often, you can al
low the peer connection to handle negotiating the rtcdatachannel connection for you.
...while there's no way to control the size of the buffer, you can learn how much data is currently buffered, and you can choose to be notified by an event when the buffer starts to run
low on queued data.
... <<<write more about using bufferedamount, bufferedamount
lowthreshold, onbufferedamount
low, and bufferedamount
low here>>> ...
Writing a WebSocket server in C# - Web APIs
it al
lows usage of a namespace's classes without typing the full namespace every time.
...if it is 126, the fol
lowing 2 bytes (16-bit unsigned integer) are the length.
... if it is 127, the fol
lowing 8 bytes (64-bit unsigned integer) are the length.
...offset + i] ^ masks[i % 4]); string text = encoding.utf8.getstring(decoded); console.writeline("{0}", text); } else console.writeline("mask bit not set"); console.writeline(); } } } } client.html <!doctype html> <style> textarea { vertical-align: bottom; } #output { overf
low: auto; } #output > p { overf
low-wrap: break-word; } #output span { color: blue; } #output span.error { color: red; } </style> <h2>websocket test</h2> <textarea cols=60 rows=6></textarea> <button>send</button> <div id=output></div> <script> // http://www.websocket.org/echo.html var button = document.queryselector("button"), output = document.queryselector("#output"), ...
Using bounded reference spaces - Web APIs
if it does, it likely has a system in place to al
low the user to specify or select the boundaries to apply if a bounded space is to be used.
...this is demonstrated in the diagram be
low.
...by their very nature, bounded reference spaces have special hardware requirements, since they need to al
low for the user to physically move around in space while their movements are tracked.
...you can create a session that supports a bounded-floor reference space if available by using code such as the fol
lowing: async function onactivatexrbutton(event) { if (!xrsession) { navgator.xr.requestsession("immersive-vr"), { requiredfeatures: ["local-floor"], optionalfeatures: ["bounded-floor"] }).then((session) => { xrsession = session; startsessionanimation(); }); } } this function, called when the user clicks on a button to start the xr experience, works as usual...
WebXR permissions and security - Web APIs
once that check is passed, the request to enter immersive-vr mode is al
lowed if all of the fol
lowing are true: the requestsession() call was issued by code executing within the handler for a user event, or the from the startup code for a user-launched web application.
... the user's intent to enter immersive vr mode is well understood; see user intent be
low for details.
... inline presentation when you request an xrsession with the mode set to inline, and any features are required or requested, the browser will only al
low the session to be created if the call to requestsession() was made by code which is executing expressly due to user intent.
... implicit user intent (implicit user consent) is assumed if either of the fol
lowing scenarios is the case: the user has interacted with the document in some way which has in turn caused your request to occur.
Window.openDialog() - Web APIs
if the features parameter is a zero-length string, or contains only one or more of the behavior features (chrome, dependent, dialog and modal) the chrome features are assumed "os' choice." that is, window creation code is not given specific instructions, but is instead al
lowed to select the chrome that best fits a dialog on that operating system.
... to access these extra parameters from within dialog code, use the fol
lowing scheme: var food = window.arguments[0]; var price = window.arguments[1]; note that you can access this property from within anywhere in the dialog code.
... var retvals = { address: null, delivery: null }; opendialog("http://example.tld/zzz.xul", "dlg", "modal", "pizza", 6.98, retvals); if you set the properties of the retvals object in the dialog code as described be
low, you can now access them via the retvals array after the opendialog() call returns.
... inside the dialog code, you can set the properties as fol
lows: var retvals = window.arguments[2]; retvals.address = enteredaddress; retvals.delivery = "immediate"; specification this is not part of any specification.
XRInputSourceArray - Web APIs
in addition to being able to access the input sources in the list using standard array notation (that is, with index numbers insize square brackets), methods are available to al
low the use of iterators and the foreach() method is also available.
... properties the fol
lowing properties are available on xrinputsourcearray objects.
... methods the fol
lowing methods are available on xrinputsourcearray objects.
... in addition to these methods, you may use array notation to access items in the list by index for example, the snippet of code be
low calls a function handleinput(), passing into it the first item in the input source list, if the list isn't empty.
XRSession.requestAnimationFrame() - Web APIs
the specified callback is executed once before the next repaint; if you wish for it to be executed for the fol
lowing repaint, you must call requestanimationframe() again.
... syntax requestid = xrsession.requestanimationframe(animationframecallback); parameters animationframecallback a function which is called before the next repaint in order to al
low you to update and render the xr scene based on elapsed time, animation, user input changes, and so forth.
... example the fol
lowing example requests xrsession with "inline" mode so that it can be displayed in an html element (without the need for a separate ar or vr device).
... } }) }) the fol
lowing example was taken directly from the spec draft.
XRSession.requestReferenceSpace() - Web APIs
the "interface" column in the table be
low indicates which of the two types is returned for each reference space type constant..
... reference space descriptors the types of reference space are listed in the table be
low, with brief information about their use cases and which interface is used to implement them.
... xrreferencespace unbounded a tracking space which al
lows the user total freedom of movement, possibly over extremely long distances from their origin point.
... exceptions rather than throwing true exceptions, requestreferencespace() rejects the returned promise with a domexception whose name is found in the list be
low: notsupportederror the requested reference space is not supported.
XRSession: selectend event - Web APIs
examples the fol
lowing example uses addeventlistener() to establish handlers for the selection events: selectstart, selectend, and select.
... this snippet is the core of an event handler to al
low the user to grab objects in the scene and move them around.
... in this case, a single function is used to handle all three events, al
lowing them to share certain code that's the same regardless of which of the three events is received.
... only after completing those tasks does the onselectionevent() function be
low dispatch the action out to a specialized function to handle things.
XRSession: selectstart event - Web APIs
examples the fol
lowing example uses addeventlistener() to establish handlers for the selection events: selectstart, selectend, and select.
... this snippet is the core of an event handler to al
low the user to grab objects in the scene and move them around.
... in this case, a single function is used to handle all three events, al
lowing them to share certain code that's the same regardless of which of the three events is received.
... only after completing those tasks does the onselectionevent() function be
low dispatch the action out to a specialized function to handle things.
XRSession: squeezeend event - Web APIs
examples the fol
lowing example uses addeventlistener() to establish handlers for the squeezeion events: squeezestart, squeezeend, and squeeze.
... this snippet is the core of an event handler to al
low the user to grab objects in the scene and move them around.
... in this case, a single function is used to handle all three events, al
lowing them to share certain code that's the same regardless of which of the three events is received.
... only after completing those tasks does the onsqueezeevent() function be
low dispatch the action out to a specialized function to handle things.
XRSession: squeezestart event - Web APIs
examples the fol
lowing example uses addeventlistener() to establish handlers for the squeezeion events: squeezestart, squeezeend, and squeeze.
... this snippet is the core of an event handler to al
low the user to grab objects in the scene and move them around.
... in this case, a single function is used to handle all three events, al
lowing them to share certain code that's the same regardless of which of the three events is received.
... only after completing those tasks does the onsqueezeevent() function be
low dispatch the action out to a specialized function to handle things.
XRSession.updateRenderState() - Web APIs
the specified object may have any combination of the fol
lowing fields.
... exceptions this method may throw any of the fol
lowing exceptions.
... invalidstateerror this may occur for one of the fol
lowing reasons: the xrsession has already ended, so you cannot change its render state.
... the inlineverticalfieldofview property was set, but the session is immersive and therefore does not al
low this property to be used.
Using the group role - Accessibility
possible effects on user agents and assistive technology when the group role is added to an element, or such an element becomes visible, the user agent should do the fol
lowing: expose the element as having a group role in the operating system's accessibility api.
...fol
lowing this the focused control may be announced.
... examples example 1: using the group role with a html tree view the snippet be
low shows how the group role is added directly into the html source code.
...if" /> <span role="treeitem" tabindex="0">cats</span> </div> <div id="catgroup" role="group"> <div id="siamese" role="treeitem"> <span tabindex="-1">siamese</span> </div> <div id="tabby" role="treeitem"> <span tabindex="-1">tabby</span> </div> </div> </div> </div> example 2: using the group role with a html drop-down menu the snippet be
low shows how the group role is added directly into the html source code.
ARIA: feed role - Accessibility
implementing the feed pattern al
lows a screen reader to reliably read and trigger the loading of feed content while in reading mode.
...see keyboard interactions be
low.
... the feed pattern enables reliable assistive technology reading mode interaction by establishing the fol
lowing interoperability agreement between the web page and assistive technologies: in the context of a feed, the web page code is responsible for: appropriate visual scrolling of the content based on which article contains dom focus.
... keyboard interaction supporting the fol
lowing, or a similar, interface is recommended when focus is inside the feed: page down: move focus to next article.
ARIA: Main role - Accessibility
skip navigation skip navigation, also known as "skipnav", is a technique that al
lows an assistive technology user to quickly bypass large sections of repeated content (main navigation, info banners, etc.).
... this al
lows the user to access the main content of the page faster.
... adding an id attribute to the element with a declaration of role="main" al
lows it to be a target of a skip navigation link.
... <body> <a href="#main-content">skip to main content</a> <!-- navigation and header content --> <div id="main-content" role="main"> <!-- main page content --> </div> </body> webaim: "skip navigation" links added benefits certain technologies such as browser extensions can generate lists of all landmark roles present on a page, al
lowing non-screen reader users to also quickly identify and navigate to large sections of the document.
ARIA: dialog role - Accessibility
additionally, the fol
lowing needs to be done: the dialog must be properly labeled keyboard focus must be managed correctly the sections be
low describe how these two requirements can be met.
...this approach is shown in the code snippet be
low: <div role="dialog" aria-labelledby="dialog1title" aria-describedby="dialog1desc"> <h2 id="dialog1title">your personal details were successfully updated</h2> <p id="dialog1desc">you can change your details at any time in the user account section.</p> <button>close</button> </div> keep in mind that a dialog's title and description text do not have to be focusable in order to be perceived b...
...note that for non-modal dialogs there will have to be a global keyboard shortcut that al
lows focus to be moved between opened dialogs and the main page.
... possible effects on user agents and assistive technology when the dialog role is used, the user agent should do the fol
lowing: expose the element as a dialog in the operating system's accessibility api.
ARIA: listbox role - Accessibility
if an option or item is focused within the list, it gets announced next, fol
lowed by an indication of the item's position with the list if the screen reader supports this.
... required javascript features selecting an option in a single select listbox when the user selects an option, the fol
lowing must occur: deselect the previously selected option, setting the aria-selected to false, or removing the attribute altogether, changing the appearance of the newly unselected option to appear not selected.
... update the aria-activedescendant value on the listbox to the id of the newly selected option visually handle the blur, focus, and selected states of the option toggling the state of an option in a multi select listbox when the user clicks on an option, hits space when focused on an option, or otherwise toggles the state of an option, the fol
lowing must occur: toggle the aria-selected state of the currently focused option, changing the state of the aria-selected to true if it was false or false if it was true.
... examples example 1: a single select listbox that uses aria-activedescendant the snippet be
low shows how the listbox role is added directly into the html source code.
Basic form hints - Accessibility
the example be
low shows a simple form with labels.
... the example be
low shows a radio button group implemented using an unordered list.
... the example be
low shows a <button> element that is described by a sentence in a separate <div> element.
... the example be
low shows a simple form with three fields.
Alerts - Accessibility
this notifies the user of the error, but al
lows for them continue modifying the form without losing focus (caused by the “onblur” handler in javascript's default ‘alert’ function).
... be
low is example javascript code which could be inserted above the closing “head” tag: <script type="application/javascript"> function removeoldalert() { var oldalert = document.getelementbyid("alert"); if (oldalert){ document.body.removechild(oldalert); } } function addalert(amsg) { removeoldalert(); var newalert = document.createelement("div"); newalert.setattribute("role", "alert"); newalert.setattribute("id", "alert"); var msg = document.createtextnode(amsg); newalert.appendchild(msg); document.body.appendchild(newalert); } function checkvalidity(aid, asearchterm, amsg) { var elem = document.getelementbyid(aid); var invalid = (elem.value.indexof(asearchterm) < 0); if (invalid) { elem.setattribute("aria-invalid", "true"); ...
...the two inputs for e-mail and name for this: <input name="name" id="name" aria-required="true" onblur="checkvalidity('name', ' ', 'invalid name entered!');"/> <br /> <input name="email" id="email" aria-required="true" onblur="checkvalidity('email', '@', 'invalid e-mail address');"/> testing the example if you use firefox 3 and a currently-supported screen reader, try the fol
lowing: enter only your first name as the name.
...because this is not al
lowed by the windows api specs, and possibly others.
Keyboard-navigable JavaScript widgets - Accessibility
the fol
lowing table describes tabindex behavior in modern browsers: tabindex attribute focusable with mouse or javascript via element.focus() tab navigable not present fol
lows the platform convention of the element (yes for form controls, links, etc.).
... fol
lows the platform convention of the element.
...(for a full description of the keyboard support that is normally expected for typical widgets, see the wai-aria authoring practices.) the example be
low shows this technique used with a nested menu control.
...for techniques for managing focus within widgets, see "managing focus inside groups" be
low.
-webkit-line-clamp - CSS: Cascading Style Sheets
the -webkit-line-clamp css property al
lows limiting of the contents of a block container to the specified number of lines.
... in most cases you will also want to set overf
low to hidden, otherwise the contents won't be clipped but an ellipsis will still be shown after the specified number of lines.
...the css overf
low module level 3 specification also defines a line-clamp property, which is meant to replace this property and avoid its issues.
...</p> css p { width: 300px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overf
low: hidden; } result specifications specification status comment css overf
low module level 3the definition of '-webkit-line-clamp' in that specification.
:placeholder-shown - CSS: Cascading Style Sheets
html <input placeholder="type something here!"> css input { border: 1px solid black; padding: 3px; } input:placeholder-shown { border-color: teal; color: purple; font-style: italic; } result overf
lowing text when form fields are too small, placeholder text can get cropped in an undesirable way.
... you can use the text-overf
low property to alter the way overf
lowing text is displayed.
... html <input id="input1" placeholder="name, rank, and serial number"> <br><br> <input id="input2" placeholder="name, rank, and serial number"> css #input2:placeholder-shown { text-overf
low: ellipsis; } result customized input field the fol
lowing example highlights the branch and id code fields with a custom style.
.../label> <input id="branch" placeholder="student branch"/> </p> <p> <label for="sid">enter student id:</label> <input type="number" pattern="[0-9]{8}" title="8 digit id" id="sid" class="studentid" placeholder="8 digit id"/> </p> <input type="submit"/> </form> css input { background-color: #e8e8e8; color: black; } input.studentid:placeholder-shown { background-color: yel
low; color: red; font-style: italic; } result specifications specification status comment selectors level 4the definition of ':placeholder-shown' in that specification.
font-style - CSS: Cascading Style Sheets
the font-style css descriptor al
lows authors to specify font styles for the fonts specified in the @font-face rule.
... oblique with angle range selects a font classified as oblique, and additionally specifies a range of al
lowable angle for the slant of the text.
... note that a range is only supported when the font-style is oblique; for font-style: normal or italic, no second value is al
lowed.
... formal definition related at-rule@font-faceinitial valuenormalcomputed valueas specified formal syntax normal | italic | oblique <angle>{0,2} examples specifying an italic font style as an example, consider the garamond font family, in its normal form, we get the fol
lowing result: @font-face { font-family: garamond; src: url('garamond.ttf'); } the italicized version of this text uses the same glyphs present in the unstyled version, but they are artificially sloped by a few degrees.
@font-face - CSS: Cascading Style Sheets
font-feature-settings al
lows control over advanced typographic features in opentype fonts.
... font-variation-settings al
lows
low-level control over opentype or truetype font variations, by specifying the four letter axis names of the features to vary, along with their variation values.
... by al
lowing authors to provide their own fonts, @font-face makes it possible to design content without being limited to the so-called "web-safe" fonts (that is, the fonts which are so common that they're considered to be universally available).
...for example, the fol
lowing will not work: .classname { @font-face { font-family: myhelvetica; src: local("helvetica neue bold"), local("helveticaneue-bold"), url(mgopenmodernabold.ttf); font-weight: bold; } } formal syntax @font-face { [ font-family: <family-name>; ] | [ src: <src>; ] | [ unicode-range: <unicode-range>; ] | [ font-variant: <font-variant>; ] | [ font-fea...
prefers-contrast - CSS: Cascading Style Sheets
the prefers-contrast css media feature is used to detect if the user has requested that the web content is presented with a higher (or
lower) contrast.
... less indicates that user has notified the system that they prefer an interface that has a
lower level of contrast.
... examples this example has an annoying
low contrast by default.
... html <div class="contrast">
low contrast box</div> css .contrast { width: 100px; height: 100px; outline: 2px dashed black; } @media (prefers-contrast: high) { .contrast { outline: 2px solid black; } } result specifications specification status comment media queries level 5the definition of 'prefers-contrast' in that specification.
Border-radius generator - CSS: Cascading Style Sheets
roup:before, .group:after { content: ""; display: table; } .group:after { clear:both; } .group { zoom: 1; /* for ie 6/7 (trigger haslayout) */ } /* grid column setup * ========================================================================== */ .col { display: block; float:left; margin: 1% 0 1% 1.6%; } .col:first-child { margin-left: 0; } /* all browsers except ie6 and
lower */ /* * ui component */ .ui-input-slider-container { height: 20px; margin: 10px 0; font-family: "segoe ui", arial, helvetica, sans-serif; -moz-user-select: none; user-select: none; } .ui-input-slider-container * { float: left; height: 100%; line-height: 100%; } /* input slider */ .ui-input-slider > input { margin: 0; padding: 0; width: 50px; text-align: center; -moz-box-si...
...zing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } .ui-input-slider-info { width: 90px; padding: 0px 10px 0px 0px; text-align: right; text-transform:
lowercase; } .ui-input-slider-left, .ui-input-slider-right { width: 16px; cursor: pointer; background: url("https://mdn.mozillademos.org/files/5679/arrows.png") center left no-repeat; } .ui-input-slider-right { background: url("https://mdn.mozillademos.org/files/5679/arrows.png") center right no-repeat; } .ui-input-slider-name { width: 90px; padding: 0 10px 0 0; text-align: right; text-transform:
lowercase; } .ui-input-slider-btn-set { width: 25px; background-color: #2c9fc9; border-radius: 5px; color: #fff; font-weight: bold; line-height: 14px; text-align: center; } .ui-input-slider-btn-set:hov...
...ainer { width: 100%; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } /******************************************************************************/ /******************************************************************************/ /* * preview area */ #preview { height: 500px; border: 1px solid #ccc; border-radius: 3px; text-align: center; overf
low: hidden; position: relative; } #preview .content { width: 100%; height: 100%; display: block; } #preview input { color: #333; border: 1px solid #ccc; border-radius: 3px; } #subject { width: 400px; height: 150px; margin: 0 auto; border: 3px solid #c60; background: #fff; position: relative; } .radius { width: 50%; height: 50%; border: 1px solid #ccc; display: none; position: a...
...gin: 30px 30px 0 0; padding: 30px; border: 3px solid #555; border-radius: 10px; position: relative; float: right; } #unit-selection .info { height: 20%; width: 100%; line-height: 20%; font-size: 20px; text-align: center; position: relative; top: 40%; } #unit-selection .dropdown { width: 50px; height: 20px; margin: 10px; padding: 0; border-radius: 3px; position: absolute; overf
low: hidden; } #unit-selection select { width: 50px; height: 20px; marign: 0; padding: 0 0 0 10px; background: #555; border: 1px solid #555; border: none; color: #fff; float: left; } #unit-selection select option { background: #fff; color: #333; } #unit-selection select:hover { cursor: pointer; } #unit-selection .dropdown:before { content: ""; width: 18px; height: 20px; display: b...
Resizing background images with background-size - CSS: Cascading Style Sheets
try resizing the example be
low to see this in action.
... html <div class="bgsizecontain"> <p>try resizing this element!</p> </div> css .bgsizecontain { background-image: url(https://www.mozilla.org/media/img/logos/firefox/logo-quantum.9c5e96634f92.png); background-size: contain; width: 160px; height: 160px; border: 2px solid; color: pink; resize: both; overf
low: scroll; } result cover the cover value specifies that the background image should be sized so that it is as small as possible while ensuring that both dimensions are greater than or equal to the corresponding size of the container.
... try resizing the example be
low to see this in action.
... html <div class="bgsizecover"> <p>try resizing this element!</p> </div> css .bgsizecover { background-image: url(https://www.mozilla.org/media/img/logos/firefox/logo-quantum.9c5e96634f92.png); background-size: cover; width: 160px; height: 160px; border: 2px solid; color: pink; resize: both; overf
low: scroll; } result see also background-size background scaling of svg backgrounds ...
Using URL values for the cursor property - CSS: Cascading Style Sheets
this al
lows specifying arbitrary images as mouse cursors — any image format supported by gecko can be used.
... syntax the basic (css 2.1) syntax for this property is: cursor: [ <url> , ]* <keyword> this means that zero or more urls may be specified (comma-separated), which must be fol
lowed by one of the keywords defined in the css specification, such as auto or pointer.
... for example, the fol
lowing value would be al
lowed: cursor: url(foo.cur), url(http://www.example.com/bar.gif), auto; this will first try loading foo.cur.
..., ]* <keyword> it al
lows specifying the coordinates of the cursor's hotspot, which will be clamped to the boundaries of the cursor image.
Realizing common layouts using CSS Grid Layout - CSS: Cascading Style Sheets
the ad panel is be
low the sidebar, so starts at grid row line 4.
... i can cause a grid to backfill those gaps by setting grid-auto-f
low: dense on the grid container.
...you should only do this if your items do not have a set order – and be aware of the issues of the tab order fol
lowing the source and not your reordered display.
...; margin: 0; padding: 20px; } .listing li { border: 1px solid #ffe066; border-radius: 5px; display: flex; flex-direction: column; } .listing .cta { margin-top: auto; border-top: 1px solid #ffe066; padding: 10px; text-align: center; } .listing .body { padding: 10px; } .listing { list-style: none; margin: 2em; display: grid; grid-gap: 20px; grid-auto-f
low: dense; grid-template-columns: repeat(auto-fill,minmax(200px, 1fr)); } .listing .wide { grid-column-end: span 2; } this technique of using auto-placement with some rules applied to certain items is very useful, and can help you to deal with content that is being output by a cms for example, where you have repeated items and can perhaps add a class to certain ones as they are rendered into...
CSS Logical Properties and Values - CSS: Cascading Style Sheets
inline logical properties and values use the abstract terms block and inline to describe the direction in which they f
low.
... block dimension the dimension perpendicular to the f
low of text within a line, i.e., the vertical dimension in horizontal writing modes, and the horizontal dimension in vertical writing modes.
... inline dimension the dimension parallel to the f
low of text within a line, i.e., the horizontal dimension in horizontal writing modes, and the vertical dimension in vertical writing modes.
...g-block-start padding-inline padding-inline-end padding-inline-start properties for floating and positioning clear (inline-end and inline-start keywords) float (inline-end and inline-start keywords) inset inset-block inset-block-end inset-block-start inset-inline inset-inline-end inset-inline-start other properties caption-side (inline-end and inline-start keywords) overf
low-block overf
low-inline overscroll-behavior-block overscroll-behavior-inline resize (block and inline keywords) text-align (end and start keywords) deprecated properties offset-block-end (now inset-block-end ) offset-block-start (now inset-block-start ) offset-inline-end (now inset-inline-end ) offset-inline-start (now inset-inline-start ) guides basic conce...
Shapes From Images - CSS: Cascading Style Sheets
in the example be
low i am using a similar image to the initial example, however in this image the background of the star is not fully transparent, it has a 20% opacity as created in my graphics programme.
...many demos do this as it helps to show the shape we are fol
lowing, however the shape-outside property is not related to the image that is displayed on the page and so you do not need to display an image to use an image to create a shape.
... you do need something to float, but that could be some generated content as in the be
low example.
...you can play with that value in the example be
low to see how the diagonal line will move across the shape depending on that value.
Using Media Queries for Accessibility - CSS: Cascading Style Sheets
also, this method of switching animation off according to the user's preference can also benefit users with
low battery or
low-end phones or computers.
... this will help not only users with
low vision and contrast sensitivity issues but also users that are working on a computer or phone with direct sunlight.
... syntax the -ms-high-contrast media feature is specified as one of the fol
lowing values.
... example the fol
lowing declarations will match applications that are being displayed in high contrast mode with any color variation, a black-on-white color variation, and a white-on-black color variation, respectively.
Privacy and the :visited selector - CSS: Cascading Style Sheets
before about 2010, the css :visited selector al
lowed websites to uncover a user's browsing history and figure out what sites the user had visited.
...only the fol
lowing styles can be applied to visited links: color background-color border-color (and its sub-properties) column-rule-color outline-color the color parts of the fill and stroke attributes in addition, even for the above styles, you won't be able to change the transparency between unvisited and visited links, as you otherwise would be able to using rgba(), hsla(), or the transparent keywor...
...*/ } :visited { outline-color: orange; /* visited links have an orange outline */ background-color: green; /* visited links have a green background */ color: yel
low; /* visited links have yel
low colored text */ } impact on web developers overall, these restrictions shouldn't affect web developers too significantly.
... they may, however, require the fol
lowing changes to existing sites: using background images to style links based on whether they've been visited will no longer work, since only colors can be used to style visited links.
appearance (-moz-appearance, -webkit-appearance) - CSS: Cascading Style Sheets
textfield div { color: black; -moz-appearance: textfield; -webkit-appearance: textfield; } <div>lorem</div> firefox chrome safari edge the fol
lowing values are treated as equivalent to auto: button div { color: black; -moz-appearance: button; -webkit-appearance: button; } <div>lorem</div> firefox chrome safari edge the element is drawn like a button.
... chrome safari edge square-button div{ color: black; -moz-appearance: square-button; -webkit-appearance: square-button; } <div>lorem</div> chrome safari edge textarea div{ color: black; -webkit-appearance: textarea; } <div>lorem</div> firefox chrome safari edge non-standard keywords the fol
lowing values are implemented only for one or both of the prefixed properties, but not on the standard appearance property.
...available on the web starting in ios 10.1 and macos 10.12.1 obsolete values the fol
lowing values were at some point implemented for a prefixed property, but are no longer supported.
... formal definition initial valueautoapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax none | auto | button | textfield | menulist-button | <compat-auto>where <compat-auto> = searchfield | textarea | push-button | slider-horizontal | checkbox | radio | square-button | menulist | listbox | meter | progress-bar examples the fol
lowing would make an element look like a menulist button: .exampleone { appearance: menulist-button; } see also this jsfiddle for an example showing how you might use appearance: none to apply custom styling to radio buttons and checkboxes.
border-style - CSS: Cascading Style Sheets
constituent properties this property is a shorthand for the fol
lowing css properties: border-bottom-style border-left-style border-right-style border-top-style syntax /* keyword values */ border-style: none; border-style: hidden; border-style: dotted; border-style: dashed; border-style: solid; border-style: double; border-style: groove; border-style: ridge; border-style: inset; border-style: outset; /* vertical | horizontal */ border-style: dotted solid; ...
... each value is a keyword chosen from the list be
low.
...it can have the fol
lowing values: none like the hidden keyword, displays no border.
...in the case of table cell and border collapsing, the none value has the
lowest priority: if any other conflicting border is set, it will be displayed.
box-shadow - CSS: Cascading Style Sheets
box-shadow generator is an interactive tool al
lowing you to generate a box-shadow.
...inset shadows are drawn inside the border (even transparent ones), above the background, but be
low content.
...negative values are not al
lowed.
...the specification does not include an exact algorithm for how the blur radius should be calculated, however, it does elaborate as fol
lows: …for a long, straight shadow edge, this should create a color transition the length of the blur distance that is perpendicular to and centered on the shadow’s edge, and that ranges from the full shadow color at the radius endpoint inside the shadow to fully transparent at the endpoint outside it.
box-sizing - CSS: Cascading Style Sheets
this means that when you set width and height, you have to adjust the value you give to al
low for any border or padding that may be added.
... on the other hand, when using position: relative or position: absolute, use of box-sizing: content-box al
lows the positioning values to be relative to the content, and independent of changes to border and padding sizes, which is sometimes desirable.
... syntax the box-sizing property is specified as a single keyword chosen from the list of values be
low.
... html <div class="content-box">content box</div> <br> <div class="border-box">border box</div> css div { width: 160px; height: 80px; padding: 20px; border: 8px solid red; background: yel
low; } .content-box { box-sizing: content-box; /* total width: 160px + (2 * 20px) + (2 * 8px) = 216px total height: 80px + (2 * 20px) + (2 * 8px) = 136px content box width: 160px content box height: 80px */ } .border-box { box-sizing: border-box; /* total width: 160px total height: 80px content box width: 160px - (2 * 20px) - (2 * 8px) = 104px content box heigh...
caption-side - CSS: Cascading Style Sheets
syntax /* directional values */ caption-side: top; caption-side: bottom; /* warning: non-standard values */ caption-side: left; caption-side: right; caption-side: top-outside; caption-side: bottom-outside; /* global values */ caption-side: inherit; caption-side: initial; caption-side: unset; the caption-side property is specified as one of the keyword values listed be
low.
... bottom the caption box should be positioned be
low the table.
... bottom-outside the caption box should be positioned be
low the table, while the width and horizontal alignment behavior are not bound to the table's horizontal layout.
... formal definition initial valuetopapplies totable-caption elementsinheritedyescomputed valueas specifiedanimation typediscrete formal syntax top | bottom | block-start | block-end | inline-start | inline-end examples setting captions above and be
low html <table class="top"> <caption>caption above the table</caption> <tr> <td>some data</td> <td>some more data</td> </tr> </table> <br> <table class="bottom"> <caption>caption be
low the table</caption> <tr> <td>some data</td> <td>some more data</td> </tr> </table> css .top caption { caption-side: top; } .bottom caption { caption-side: bottom; } table { b...
clear - CSS: Cascading Style Sheets
the clear css property sets whether an element must be moved be
low (cleared) floating elements that precede it.
... when applied to non-floating blocks, it moves the border edge of the element down until it is be
low the margin edge of all relevant floats.
...when applied to floating elements, the margin edge of the bottom element is moved be
low the margin edge of all relevant floats.
... 1chrome android full support 18firefox android full support 4opera android full support 10.1safari ios full support 1samsung internet android full support 1.0f
low-relative values inline-start and inline-endchrome no support noedge no support nofirefox full support 55ie no support noopera no support nosafari no support ...
clip-path - CSS: Cascading Style Sheets
0% 0%, 100% 50%, 50% 100%, 0% 50%); clip-path: path('m0.5,1 c0.5,1,0,0.7,0,0.3 a0.25,0.25,1,1,1,0.5,0.3 a0.25,0.25,1,1,1,1,0.3 c1,0.7,0.5,1,0.5,1 z'); /* box and shape values combined */ clip-path: padding-box circle(50px at 0 100px); /* global values */ clip-path: inherit; clip-path: initial; clip-path: unset; the clip-path property is specified as one or a combination of the values listed be
low.
...the geometry box can be one of the fol
lowing values: margin-box uses the margin box as the reference box.
... viewbox"> <svg viewbox="0 0 192 192"> <g class="none"> <rect x="24" y="24" width="144" height="144" /> <text x="96" y="91">i love</text> <text x="96" y="109" class="em">clipping</text> </g> </svg> </div> </div> </div> <div class="note">clip-path: url(#mypath)<br><br> assuming the fol
lowing clippath definition: <pre> <svg> <clippath id="mypath" clippathunits="objectboundingbox"> <path d="m0.5,1 c 0.5,1,0,0.7,0,0.3 a 0.25,0.25,1,1,1,0.5,0.3 a 0.25,0.25,1,1,1,1,0.3 c 1,0.7,0.5,1,0.5,1 z" /> </clippath> </svg></pre> </div> <div class="row"> <div class="cell"> <span>html</span> <div class="conta...
... </div> </div> </div> </div> </div> html,body { height: 100%; box-sizing: border-box; background: #eee; } .grid { width: 100%; height: 100%; display: flex; font: 1em monospace; } .row { display: flex; flex: 1 auto; flex-direction: row; flex-wrap: wrap; } .col { flex: 1 auto; } .cell { margin: .5em; padding: .5em; background-color: #fff; overf
low: hidden; text-align: center; flex: 1; } .note { background: #fff3d4; padding: 1em; margin: .5em .5em 0; font: .8em sans-serif; text-align: left; white-space: nowrap; } .note + .row .cell { margin-top: 0; } .container { display: inline-block; border: 1px dotted grey; position:relative; } .container:before { content: 'margin'; position: absolute; top: 2px; left: ...
cross-fade() - CSS: Cascading Style Sheets
the two fol
lowing are lines (almost) identical: cross-fade( url(red.png), url(yel
low.png), url(blue.png)); /* all three will be 33.3333% opaque */ cross-fade( url(red.png) 33.33%, url(yel
low.png) 33.33%, url(blue.png) 33.33%); older, implemented syntax cross-fade( <image, <image>, <percentage> ) the specification for the cross-fade() function al
lows for multiple images and for each image to have transparenc...
...the original syntax, which has been implemented in some browsers, only al
lowed for two images, with the sum of the transparency of those two images being exactly 100%.
.../* fully black */ cross-fade(url(white.png), url(black.png), 25%); /* 25% white, 75% black */ cross-fade(url(white.png), url(black.png), 50%); /* 50% white, 50% black */ cross-fade(url(white.png), url(black.png), 75%); /* 75% white, 25% black */ cross-fade(url(white.png), url(black.png), 100%); /* fully white */ in the implemented syntax, the two comma-separated images are declared first, fol
lowed by a comma and required percent value.
... the green/red example (with the percentages totalling 150%) and the yel
low/red/blue example (with three images) from the specification syntax section, are not possible in this implementation.
flex-wrap - CSS: Cascading Style Sheets
if wrapping is al
lowed, it sets the direction that lines are stacked.
... syntax flex-wrap: nowrap; /* default value */ flex-wrap: wrap; flex-wrap: wrap-reverse; /* global values */ flex-wrap: inherit; flex-wrap: initial; flex-wrap: unset; the flex-wrap property is specified as a single keyword chosen from the list of values be
low.
... values the fol
lowing values are accepted: nowrap the flex items are laid out in a single line which may cause the flex container to overf
low.
..."> <div class="red">1</div> <div class="green">2</div> <div class="blue">3</div> </div> css /* common styles */ .content, .content1, .content2 { color: #fff; font: 100 24px/100px sans-serif; height: 150px; text-align: center; } .content div, .content1 div, .content2 div { height: 50%; width: 300px; } .red { background: orangered; } .green { background: yel
lowgreen; } .blue { background: steelblue; } /* flexbox styles */ .content { display: flex; flex-wrap: wrap; } .content1 { display: flex; flex-wrap: nowrap; } .content2 { display: flex; flex-wrap: wrap-reverse; } results specifications specification status comment css flexible box layout modulethe definition of 'flex-wrap' in that speci...
font-family - CSS: Cascading Style Sheets
the font-family property specifies a list of fonts, from highest priority to
lowest.
... the example be
low lists two font families, the first with a <family-name> and the second with a <generic-name>: font-family: gill sans extrabold, sans-serif; values <family-name> the name of a font family.
...the fol
lowing keywords are defined: serif glyphs have finishing strokes, flared or tapering ends, or have actual serifed endings.
... for example, the fol
lowing declarations are valid: font-family: gill sans extrabold, sans-serif; font-family: "goudy bookletter 1911", sans-serif; the fol
lowing declarations are invalid: font-family: goudy bookletter 1911, sans-serif; font-family: red/black, sans-serif; font-family: "lucida" grande, sans-serif; font-family: ahem!, sans-serif; font-family: test@foo, sans-serif; font-family: #pound, sans-serif; font-fa...
font-style - CSS: Cascading Style Sheets
syntax font-style: normal; font-style: italic; font-style: oblique; font-style: oblique 10deg; /* global values */ font-style: inherit; font-style: initial; font-style: unset; the font-style property is specified as a single keyword chosen from the list of values be
low, which can optionally include an angle if the keyword is oblique.
... for the example be
low to work, you'll need a browser that supports the css fonts level 4 syntax in which font-style: oblique can accept an <angle>.
... html <header> <input type="range" id="slant" name="slant" min="-90" max="90" /> <label for="slant">slant</label> </header> <div class="container"> <p class="sample">...it would not be wonderful to meet a megalosaurus, forty feet long or so, waddling like an elephantine lizard up holborn hill.</p> </div> css /* amstelvaralpha-vf is created by david ber
low (https://github.com/typenetwork/amstelvar) and is used here under the terms of its license: https://github.com/typenetwork/amstelvar/blob/master/ofl.txt */ @font-face { src: url('https://mdn.mozillademos.org/files/16044/amstelvaralpha-vf.ttf'); font-family:'amstelvaralpha'; font-style: normal; } label { font: 1rem monospace; } .container { max-height: 150px; overf
low: scroll; } .sample { font: 2rem 'amst...
...elvaralpha', sans-serif; } html, body { max-height: 100vh; max-width: 100vw; overf
low: hidden; } body { display: flex; flex-direction: column; } header { margin-bottom: 1.5rem; } .container { flex-grow: 1; } .container > p { margin-top: 0; margin-bottom: 0; } javascript let slantlabel = document.queryselector('label[for="slant"]'); let slantinput = document.queryselector('#slant'); let sampletext = document.queryselector('.sample'); function update() { let slant = `oblique ${slantinput.value}deg`; slantlabel.textcontent = `font-style: ${slant};`; sampletext.style.fontstyle = slant; } slantinput.addeventlistener('input', update); update(); accessibility concerns large sections of text set with a font-style value of italic may be difficult for people w...
font - CSS: Cascading Style Sheets
constituent properties this property is a shorthand for the fol
lowing css properties: font-family font-size font-stretch font-style font-variant font-weight line-height syntax the font property may be specified as either a single keyword, which will select a system font, or as a shorthand for various font-related properties.
... line-height must immediately fol
low font-size, preceded by "/", like this: "16px/3" font-family must be the last value specified.
...*/ p { font: bold italic large serif } /* use the same font as the status bar of the window */ p { font: status-bar } live sample html <p> change the radio buttons be
low to see the generated shorthand and it's effect.
...</div> <br/><br/><br/><br/><br/><br/> css body, input { font: 14px arial; overf
low: hidden; } .propinputcont { float: left; text-align: center; margin-right: 5px; width: 80px; } .setpropcont { float: left; margin-right: 5px; width: 120px; } .propinputs, .setpropcont { margin-bottom: 1em; } .curcss { border: none; border-bottom: 1px solid black; text-align: center; width: 80px; } .mandatory { border-bottom-color: red; } .cf:before, .cf:after { c...
<frequency-percentage> - CSS: Cascading Style Sheets
description use in calc() where a <frequency-percentage> is specified as an al
lowable type, this means that the percentage resolves to a frequency and therefore can be used in a calc() expression.
... examples valid percentage values 90% positive percentage +90% positive percentage with leading + -90% negative percentage — not valid for all properties that use percentages invalid percentage values 90 % no space is al
lowed between the number and the unit valid frequency values 12hz positive integer 4.3hz non-integer 14khz the unit is case-insensitive, though non-si capitalization is not recommended.
...7 hz no space is al
lowed between the number and the unit.
... 0 although unitless zero is an al
lowable <length>, it's an invalid <frequency>.
grid-template - CSS: Cascading Style Sheets
constituent properties this property is a shorthand for the fol
lowing css properties: grid-template-areas grid-template-columns grid-template-rows syntax /* keyword value */ grid-template: none; /* grid-template-rows / grid-template-columns values */ grid-template: 100px 1fr / 50px 1fr; grid-template: auto 1fr / auto 1fr auto; grid-template: [linename] 100px / [columnname1] 30% [columnname2] 70%; grid-template: fit-content(100px) / fit-content(40%); /* ...
... sets grid-template-areas to the strings listed, grid-template-rows to the track sizes fol
lowing each string (filling in auto for any missing sizes), and splicing in the named lines defined before/after each size, and grid-template-columns to the track listing specified after the slash (or none, if not specified).
... note: the repeat() function isn’t al
lowed in these track listings, as the tracks are intended to visually line up one-to-one with the rows/columns in the “ascii art”.
...d; width: 100%; height: 200px; grid-template: [header-left] "head head" 30px [header-right] [main-left] "nav main" 1fr [main-right] [footer-left] "nav foot" 30px [footer-right] / 120px 1fr; } header { background-color: lime; grid-area: head; } nav { background-color: lightblue; grid-area: nav; } main { background-color: yel
low; grid-area: main; } footer { background-color: red; grid-area: foot; } html <section id="page"> <header>header</header> <nav>navigation</nav> <main>main area</main> <footer>footer</footer> </section> result specifications specification status comment css grid layoutthe definition of 'grid-template' in that specification.
justify-self - CSS: Cascading Style Sheets
*/ justify-self: self-start; justify-self: self-end; justify-self: left; /* pack item from the left */ justify-self: right; /* pack item from the right */ /* baseline alignment */ justify-self: baseline; justify-self: first baseline; justify-self: last baseline; /* overf
low alignment (for positional alignment only) */ justify-self: safe center; justify-self: unsafe center; /* global values */ justify-self: inherit; justify-self: initial; justify-self: unset; this property can take one of three different forms: basic keywords: one of the keyword values normal, auto, or stretch.
... safe if the size of the item overf
lows the alignment container, the item is instead aligned as if the alignment mode were start.
... formal definition initial valueautoapplies toblock-level boxes, absolutely-positioned boxes, and grid itemsinheritednocomputed valueas specifiedanimation typediscrete formal syntax auto | normal | stretch | <baseline-position> | <overf
low-position>?
...baseline<overf
low-position> = unsafe | safe<self-position> = center | start | end | self-start | self-end | flex-start | flex-end examples simple demonstration in the fol
lowing example we have a simple 2 x 2 grid layout.
<length-percentage> - CSS: Cascading Style Sheets
syntax refer to the documentation for <length> and <percentage> for details of the individual syntaxes al
lowed by this type.
... examples length-percentage examples the fol
lowing simple example demonstrates several properties that use <length-percentage> values.
... /* length-percentage examples */ width: 75%; height: 200px; margin: 3rem; padding: 1%; border-radius: 10px 10%; font-size: 250%; line-height: 1.5em; /* length examples */ text-shadow: 1px 1px 1px red; border: 5px solid red; letter-spacing: 3px; /* percentage example */ text-size-adjust: 20%; } result use in calc() where a <length-percentage> is specified as an al
lowable type, this means that the percentage resolves to a length and therefore can be used in a calc() expression.
... therefore, all of the fol
lowing values are acceptable for width: width: 200px; width: 20%; width: calc(100% - 200px); specifications specification status comment css values and units module level 4the definition of '<length-percentage>' in that specification.
<number> - CSS: Cascading Style Sheets
fol
lowed by one or more decimal digits, and may be appended to an integer.
... decimal points must be fol
lowed by at least one digit.
... +-12.2 only one leading +/- is al
lowed.
... 12.1.1 only one decimal point is al
lowed.
offset-path - CSS: Cascading Style Sheets
the offset-path css property specifies a motion path for an element to fol
low and defines the element's positioning within the parent container or svg coordinate system.
... description this property defines a path an animated element can fol
low.
... <svg xmlns="http://www.w3.org/2000/svg" width="700" height="450" viewbox="350 0 1400 900"> <title>house and scissors</title> <rect x="595" y="423" width="610" height="377" fill="blue" /> <polygon points="506,423 900,190 1294,423" fill="yel
low" /> <polygon points="993,245 993,190 1086,190 1086,300" fill="red" /> <path id="house" d="m900,190 l993,245 v201 a11,11 0 0,1 1004,190 h1075 a11,11 0 0,1 1086,201 v300 l1294,423 h1216 a11,11 0 0,0 1205,434 v789 a11,11 0 0,1 1194,800 h606 a11,11 0 0,1 595,789 v434 a11,11 0 0,0 584,423 h506 l900,190" fill="none" stroke="black" stroke-width="13" stroke-...
...oke-width="5" stroke-linejoin="round" stroke-linecap="round" fill-rule="evenodd" /> </svg> css .scissorhalf { offset-path: path('m900,190 l993,245 v201 a11,11 0 0,1 1004,190 h1075 a11,11 0 0,1 1086,201 v300 l1294,423 h1216 a11,11 0 0,0 1205,434 v789 a11,11 0 0,1 1194,800 h606 a11,11 0 0,1 595,789 v434 a11,11 0 0,0 584,423 h506 l900,190'); animation: fol
lowpath 4s linear infinite; } @keyframes fol
lowpath { to { motion-offset: 100%; offset-distance: 100%; } } result specifications <body> specification status comment motion path module level 1the definition of 'offset-path' in that specification.
place-self - CSS: Cascading Style Sheets
the place-self css shorthand property al
lows you to align an individual item in both the block and inline directions at once (i.e.
... constituent properties this property is a shorthand for the fol
lowing css properties: align-self justify-self syntax /* keyword values */ place-self: auto center; place-self: normal start; /* positional alignment */ place-self: center normal; place-self: start auto; place-self: end normal; place-self: self-start auto; place-self: self-end normal; place-self: flex-start auto; place-self: flex-end normal; place-self: left auto; place-self: right normal; /...
...if the cross-size of the item is larger than the flex container, it will overf
low equally in both directions.
... examples simple demonstration in the fol
lowing example we have a simple 2 x 2 grid layout.
repeat() - CSS: Cascading Style Sheets
the repeat() css function represents a repeated fragment of the track list, al
lowing a large number of columns or rows that exhibit a recurring pattern to be written in a more compact form.
... auto-fill if the grid container has a definite or maximal size in the relevant axis, then the number of repetitions is the largest possible positive integer that does not cause the grid to overf
low its grid container.
...if any number of repetitions would overf
low, then the repetition is 1.
...an empty track is one with no in-f
low grid items placed into or spanning across it.
scroll-behavior - CSS: Cascading Style Sheets
user agents are al
lowed to ignore this property.
... syntax /* keyword values */ scroll-behavior: auto; scroll-behavior: smooth; /* global values */ scroll-behavior: inherit; scroll-behavior: initial; scroll-behavior: unset; the scroll-behavior property is specified as one of the keyword values listed be
low.
...user agents should fol
low platform conventions, if any.
...age id="page-2">2</scroll-page> <scroll-page id="page-3">3</scroll-page> </scroll-container> css a { display: inline-block; width: 50px; text-decoration: none; } nav, scroll-container { display: block; margin: 0 auto; text-align: center; } nav { width: 339px; padding: 5px; border: 1px solid black; } scroll-container { display: block; width: 350px; height: 200px; overf
low-y: scroll; scroll-behavior: smooth; } scroll-page { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 5em; } result specifications specification status comment css object model (cssom) view modulethe definition of 'scroll-behavior' in that specification.
table-layout - CSS: Cascading Style Sheets
cells use the overf
low property to determine whether to clip any overf
lowing content, but only if the table has a known width; otherwise, they won't overf
low the cells.
... formal definition initial valueautoapplies totable and inline-table elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax auto | fixed examples fixed-width tables with text-overf
low this example uses a fixed table layout, combined with the width property, to restrict the table's width.
... the text-overf
low property is used to apply an ellipsis to words that are too long to fit.
... html <table> <tr><td>ed</td><td>wood</td></tr> <tr><td>albert</td><td>schweitzer</td></tr> <tr><td>jane</td><td>fonda</td></tr> <tr><td>william</td><td>shakespeare</td></tr> </table> css table { table-layout: fixed; width: 120px; border: 1px solid red; } td { border: 1px solid blue; overf
low: hidden; white-space: nowrap; text-overf
low: ellipsis; } result specifications specification status comment css level 2 (revision 1)the definition of 'table-layout' in that specification.
<time> - CSS: Cascading Style Sheets
syntax the <time> data type consists of a <number> fol
lowed by one of the units listed be
low.
... note: conversion between s and ms fol
lows the logical 1s = 1000ms.
...+0s zero with a leading + and a unit -0ms zero with a leading - and a unit invalid times 0 although unitless zero is al
lowed for <length>s, it's invalid for <time>s.
...7 ms no space is al
lowed between the number and the unit.
transition-delay - CSS: Cascading Style Sheets
ze left top color; -webkit-transition-duration:2s; -webkit-transition-delay:0.5s; -webkit-transition-timing-function: linear; transition-property: width height background-color font-size left top color; transition-duration:2s; transition-delay:0.5s; transition-timing-function: linear; } .box1{ width: 50px; height: 50px; background-color: blue; color: yel
low; font-size: 18px; left: 150px; top:25px; position:absolute; -webkit-transition-property: width height background-color font-size left top color; -webkit-transition-duration:2s; -webkit-transition-delay:0.5s; -webkit-transition-timing-function: linear; transition-property: width height background-color font-size left top color; transition-duration:2s; t...
...t-size left top color; -webkit-transition-duration:2s; -webkit-transition-delay:1s; -webkit-transition-timing-function: linear; transition-property: width height background-color font-size left top color; transition-duration:2s; transition-delay:1s; transition-timing-function: linear; } .box1{ width: 50px; height: 50px; background-color: blue; color: yel
low; font-size: 18px; left: 150px; top:25px; position:absolute; -webkit-transition-property: width height background-color font-size left top color; -webkit-transition-duration:2s; -webkit-transition-delay:1s; -webkit-transition-timing-function: linear; transition-property: width height background-color font-size left top color; transition-duration:2s; tran...
...t-size left top color; -webkit-transition-duration:2s; -webkit-transition-delay:2s; -webkit-transition-timing-function: linear; transition-property: width height background-color font-size left top color; transition-duration:2s; transition-delay:2s; transition-timing-function: linear; } .box1{ width: 50px; height: 50px; background-color: blue; color: yel
low; font-size: 18px; left: 150px; top:25px; position:absolute; -webkit-transition-property: width height background-color font-size left top color; -webkit-transition-duration:2s; -webkit-transition-delay:2s; -webkit-transition-timing-function: linear; transition-property: width height background-color font-size left top color; transition-duration:2s; tran...
...t top color; -webkit-transition-duration:2s; -webkit-transition-delay:4s; -webkit-transition-timing-function: ease-in-out; transition-property: width height background-color font-size left top color; transition-duration:2s; transition-delay:4s; transition-timing-function: ease-in-out; } .box1{ width: 50px; height: 50px; background-color: blue; color: yel
low; font-size: 18px; left: 150px; top:25px; position:absolute; -webkit-transition-property: width height background-color font-size left top color; -webkit-transition-duration:2s; -webkit-transition-delay:4s; -webkit-transition-timing-function: ease-in-out; transition-property: width height background-color font-size left top color; transition-duration:2s; ...
transition-duration - CSS: Cascading Style Sheets
:0.5s; -webkit-transition-timing-function: ease-in-out; transition-property: width height background-color font-size left top transform -webkit-transform color; transition-duration:0.5s; transition-timing-function: ease-in-out; } .box1{ transform: rotate(270deg); -webkit-transform: rotate(270deg); width: 50px; height: 50px; background-color: blue; color: yel
low; font-size: 18px; left: 150px; top:25px; position:absolute; -webkit-transition-property: width height background-color font-size left top transform -webkit-transform color; -webkit-transition-duration:0.5s; -webkit-transition-timing-function: ease-in-out; transition-property: width height background-color font-size left top transform -webkit-transformv color; t...
...it-transition-duration:1s; -webkit-transition-timing-function: ease-in-out; transition-property: width height background-color font-size left top transform color; transition-duration:1s; transition-timing-function: ease-in-out; } .box1{ transform: rotate(270deg); -webkit-transform: rotate(270deg); width: 50px; height: 50px; background-color: blue; color: yel
low; font-size: 18px; left: 150px; top:25px; position:absolute; -webkit-transition-property: width height background-color font-size left top -webkit-transform transform color; -webkit-transition-duration:1s; -webkit-transition-timing-function: ease-in-out; transition-property: width height background-color font-size left top transform -webkit-transform color; tran...
...tion:2s; -webkit-transition-timing-function: ease-in-out; transition-property: width height background-color font-size left top transform -webkit-transform color; transition-duration:2s; transition-timing-function: ease-in-out; } .box1{ transform: rotate(270deg); -webkit-transform: rotate(270deg); width: 50px; height: 50px; background-color: blue; color: yel
low; font-size: 18px; left: 150px; top:25px; position:absolute; -webkit-transition-property: width height background-color font-size left top transform -webkit-transform color; -webkit-transition-duration:2s; -webkit-transition-timing-function: ease-in-out; transition-property: width height background-color font-size left top transform -webkit-transform color; tran...
...tion:4s; -webkit-transition-timing-function: ease-in-out; transition-property: width height background-color font-size left top transform -webkit-transform color; transition-duration:4s; transition-timing-function: ease-in-out; } .box1{ transform: rotate(270deg); -webkit-transform: rotate(270deg); width: 50px; height: 50px; background-color: blue; color: yel
low; font-size: 18px; left: 150px; top:25px; position:absolute; -webkit-transition-property: width height background-color font-size left top transform -webkit-transform color; -webkit-transition-duration:4s; -webkit-transition-timing-function: ease-in-out; transition-property: width height background-color font-size left top transform -webkit-transform color; tran...
white-space - CSS: Cascading Style Sheets
note: to make words break within themselves, use overf
low-wrap, word-break, or hyphens instead.
... syntax /* keyword values */ white-space: normal; white-space: nowrap; white-space: pre; white-space: pre-wrap; white-space: pre-line; white-space: break-spaces; /* global values */ white-space: inherit; white-space: initial; white-space: unset; the white-space property is specified as a single keyword chosen from the list of values be
low.
... the fol
lowing table summarizes the behavior of the various white-space values: new lines spaces and tabs text wrapping end-of-line spaces normal collapse collapse wrap remove nowrap collapse collapse no wrap remove pre preserve preserve no wrap preserve pre-wrap preserve preserve wrap hang ...
... excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> </div> .box { width: 300px; padding: 16px; border-radius: 10px; } #css-code { background-color: rgb(220, 220, 220); font-size: 16px; font-family: monospace; } #css-code select { font-family: inherit; } #results { background-color: rgb(230, 230, 230); overf
low-x: scroll; height: 400px; white-space: normal; font-size: 14px; } var select = document.queryselector("#css-code select"); var results = document.queryselector("#results p"); select.addeventlistener("change", function(e) { results.setattribute("style", "white-space: "+e.target.value); }) <p> lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut l...
will-change - CSS: Cascading Style Sheets
some of the stronger optimizations that are likely to be tied to will-change end up using a lot of a machine’s resources, and when overused like this can cause the page to s
low down or consume a lot of resources.
... the <animateable-feature> can be one of the fol
lowing values: scroll-position indicates that the author expects to animate or change the scroll position of the element in the near future.
...it cannot be one of the fol
lowing values: unset, initial, inherit, will-change, auto, scroll-position, or contents.
...this will let browser prepare the transition ahead of time and al
low for snappy transitions between the pages as soon as the key is pressed.
WAI ARIA Live Regions/API Support - Developer guides
le object about to go away) object shown or inserted children_changed::add (fired on the parent, with event data pointing to the child index of the inserted accessible object) event_object_show* (fired on the actual new accessible object) object replaced with different object (this happens especially if an object's interfaces or role changes) children_changed::remove fol
lowed immediately by children_change::add event_object_hide fol
lowed immediately by event_object_show text removed text_changed::delete ia2_event_text_removed (use iaccessibletext::get_oldtext to retrieve the offsets and removed text) text inserted text_changed::insert ia2_event_text_inserted (use iaccessibletext::get_newtext to retrieve the offsets and inserted text)...
... text replaced text_changed::delete fol
lowed immediately by text_changed::insert ia2_event_text_removed fol
lowed immediately by ia2_event_text_inserted * we do not use msaa's create/destroy at the request of screen reader vendors, who avoid those events because they cause crashes on some important system -- show/hide are the equivalent of those events.
... retrieving author-supplied aria live region semantics from an event for any mutation event in a page, the author can get the fol
lowing object attributes from the event object, if they are defined on some ancestor element (closest ancestor wins): object attribute name possible values default value if not specified meaning aria markup if required container-live "off" | "polite" | "assertive" "off" interruption policy aria-live on ancestor element container-relevant "[additions] [removals] [text]" | "all" "additions text" what types of mutations are possibly relevant?
... aria-atomic on ancestor element event-from-input "true" | "false" (described more be
low) browser could not calculate this was the root cause of this event explicit user input?
Setting up adaptive streaming media sources - Developer guides
this article explains how, looking at two of the most common formats: mpeg-dash and hls (http live streaming.) choosing formats in terms of adaptive streaming formats, there are many to choose from; we decided to choose the fol
lowing two as between them we can support most modern browsers.
... other reasons to use live profile over ondemand for vod content may be: your client or server does not support range requests your server cannot cache range requests efficiently your server cannot prefetch range requests efficiently the sidx* is large and having to load it first s
lows down startup a little you want to use the original files for both dash and other forms of delivery (such as microsoft smooth streaming) as a transition strategy you can use the same media files for both live transmission and vod at a later stage *sidx or segmentindexbox is a structure describing a segment by giving its earliest presentation time and other meta-data and can often make up a la...
... ondemand profile this profile will al
low 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.
...apple uses the .m3u8 format (an extension of its .m3u playlist format) for index files — see be
low for an example: #ext-x-version:3 #extm3u #ext-x-targetduration:10 #ext-x-media-sequence:1 # old-style integer duration; avoid for newer clients.
Making content editable - Developer guides
these are object resizing on <img>, <table>, and absolutely-positioned elements; inline table editing to add or remove rows and columns; and the grabber that al
lows moving of absolutely-positioned elements.
... if you want to use a different paragraph separator, the above browsers all support document.execcommand, which provides a defaultparagraphseparator command to al
low you to change it.
...you can enable them by setting the preferences shown be
low using about:config: user_pref("capability.policy.policynames", "al
lowclipboard"); user_pref("capability.policy.al
lowclipboard.sites", "https://www.mozilla.org"); user_pref("capability.policy.al
lowclipboard.clipboard.cutcopy", "allaccess"); user_pref("capability.policy.al
lowclipboard.clipboard.paste", "allaccess"); example: a simple but complete rich text editor <!doctype html> <html> <head> <t...
...win.document.write("<!doctype html><html><head><title>print<\/title><\/head><body onload=\"print();\">" + odoc.innerhtml + "<\/body><\/html>"); oprntwin.document.close(); } </script> <style type="text/css"> .intlink { cursor: pointer; } img.intlink { border: 0; } #toolbar1 select { font-size:10px; } #textbox { width: 540px; height: 200px; border: 1px #000000 solid; padding: 12px; overf
low: scroll; } #textbox #sourcetext { padding: 0; margin: 0; min-width: 498px; min-height: 200px; } #editmode label { cursor: pointer; } </style> </head> <body onload="initdoc();"> <form name="compform" method="post" action="sample.php" onsubmit="if(validatemode()){this.mydoc.value=odoc.innerhtml;return true;}return false;"> <input type="hidden" name="mydoc"> <div id="toolbar1"> <select oncha...
HTML5 Parser - Developer guides
calling document.write() during parsing prior to html5, gecko and webkit al
lowed calls to document.write() during parsing to insert content into the source stream.
...this change has the fol
lowing consequences for web developers: if you omit the closing tag for <title>, <style>, <textarea>, or <xmp>, the page will fail to be parsed.
...(there are also some element whose end tags can be omitted in some cases, such as <p> in the example be
low, but it's simpler to always use end tags for those elements than to make sure that the end tags are only omitted when they aren't necessary.) for example, the fol
lowing code writes a balanced sub-tree: <script> document.write("<div>"); document.write("<p>some content goes here.</p>"); document.write("</div>"); </script> <!-- non-script html goes here.
... --> in contrast, the fol
lowing code contains two scripts with unbalanced sub-trees, which causes speculative parsing to fail and therefore the time to parse the document is longer.
A hybrid approach - Developer guides
this keeps the complexity of altering content on the server side, but still al
lows our layouts to benefit from the flexibility and future-readiness of responsive design.
... using user-agent detection specifically for content and not layout also al
lows you to have a single url for each piece of content, so that the content can adapt its layout to the user’s browser.
...web applications that want to heavily modify the content or user f
low for mobile users should probably go for a separate mobile site.
... approaches to mobile web development see the fol
lowing articles for background and other approaches to developing for mobile platforms.
Writing forward-compatible websites - Developer guides
it's not always possible to fol
low all of these, but fol
lowing as many of them as possible will help future-proof your website.
... ask the authors of any javascript libraries you use to also fol
low these guidelines suggest to the developers of your favorite libraries that they fol
low these guidelines too.
...if you are fol
lowing the advice given above so that you have a single code path for all current and unknown browsers, testing that this single code path works in all the major engines makes it extremely probable that your code won't break in the future.
...missing those can lead to unexpected situations due to a fol
lowing tag name being treated as an attribute on a previous tag.
HTML attribute: max - HTML: Hypertext Markup Language
if the max attribute is valid and a non-empty value is greater than the maximum al
lowed by the max attribute, constraint validation will prevent form submission.
... if the value exceeds the max value al
lowed, the validitystate.rangeoverf
low will be true, and the the control will be matched by the :out-of-range and :invalid pseudo-classes.
... number <number> <input type="number" min="0" step="5" max="100"> range <number> <input type="range" min="60" step="5" max="100"> note: when the data entered by the user doesn't adhere to the maximum value set, the value is considered invalid in contraint validation and will match the :invalid and :out-of-range pseudoclasses see client-side validation and rangeoverf
low for more information.
... syntax for max values for other elements input type syntax example <progress> <number> <progress id="file" max="100" value="70"> 70% </progress> <meter> <number> <meter id="fuel" min="0" max="100"
low="33" high="66" optimum="80" value="40"> at 40/100</meter> ...
<p>: The Paragraph element - HTML: Hypertext Markup Language
see “tag omission” be
low.
... content categories f
low content, palpable content.
...the end tag may be omitted if the <p> element is immediately fol
lowed by an <address>, <article>, <aside>, <blockquote>, <div>, <dl>, <fieldset>, <footer>, <form>, <h1>, <h2>, <h3>, <h4>, <h5>, <h6>, <header>, <hr>, <menu>, <nav>, <ol>, <pre>, <section>, <table>, <ul> or another <p> element, or if there is no more content in the parent element and the parent element is not an <a> element.
... permitted parents any element that accepts f
low content.
<picture>: The Picture element - HTML: Hypertext Markup Language
this lets browsers opt for
lower-density versions in data-saving modes, and you don't have to write explicit media conditions.
... content categories f
low content, phrasing content, embedded content permitted content zero or more <source> elements, fol
lowed by one <img> element, optionally intermixed with script-supporting elements.
... permitted parents any element that al
lows embedded content.
... a width descriptor, fol
lowed by a w (such as 300w); or a pixel density descriptor, fol
lowed by an x (such as 2x) to serve a high-res image for high-dpi screens.
<select>: The HTML Select element - HTML: Hypertext Markup Language
warning: the mechanism for selecting multiple non-contiguous items via the keyboard described be
low currently only seems to work in firefox.
... for more useful information on styling <select>, see: styling html forms advanced styling for html forms examples basic select the fol
lowing example creates a very simple dropdown menu, the second option of which is selected by default.
... <!-- the second value will be selected initially --> <select name="choice"> <option value="first">first value</option> <option value="second" selected>second value</option> <option value="third">third value</option> </select> advanced select with multiple features the fol
low example is more complex, showing off more features you can use on a <select> element: <label>please choose one or more pets: <select name="pets" multiple size="4"> <optgroup label="4-legged pets"> <option value="dog">dog</option> <option value="cat">cat</option> <option value="hamster" disabled>hamster</option> </optgroup> <optgroup label="flying pets"> <option value="parrot">parrot</option> <option value="macaw">macaw</option> <option value="albatross">albat...
... technical summary content categories f
low content, phrasing content, interactive content, listed, labelable, resettable, and submittable form-associated element permitted content zero or more <option> or <optgroup> elements.
<shadow>: The obsolete Shadow Root element - HTML: Hypertext Markup Language
content categories transparent content permitted content f
low content tag omission none, both the starting and ending tag are mandatory.
... permitted parents any element that accepts f
low content.
... // the previous markup will not be displayed unless // <shadow> is used be
low.
... shadowroot2.innerhtml = '<shadow></shadow> <p>younger shadow root, displayed because it is the youngest.</p>'; </script> </body> </html> if you display this in a web browser it should look like the fol
lowing.
<style>: The Style Information element - HTML: Hypertext Markup Language
in the same manner as <link> elements, <style> elements can include media attributes that contain media queries, al
lowing you to selectively apply internal stylesheets to your document depending on media features such as viewport width.
... examples a simple stylesheet in the fol
lowing example, we apply a very simple stylesheet to a document: <!doctype html> <html> <head> <style> p { color: red; } </style> </head> <body> <p>this is my paragraph.</p> </body> </html> multiple style elements in this example we've included two <style> elements — notice how the conflicting declarations in the later <style> element override those in the earlier one, if t...
... <!doctype html> <html> <head> <style> p { color: white; background-color: blue; padding: 5px; border: 1px solid black; } </style> <style> p { color: blue; background-color: yel
low; } </style> </head> <body> <p>this is my paragraph.</p> </body> </html> including a media query in this example we build on the previous one, including a media attribute on the second <style> element so it is only applied when the viewport is less than 500px in width.
... <!doctype html> <html> <head> <style> p { color: white; background-color: blue; padding: 5px; border: 1px solid black; } </style> <style media="all and (max-width: 500px)"> p { color: blue; background-color: yel
low; } </style> </head> <body> <p>this is my paragraph.</p> </body> </html> technical summary content categories metadata content, and if the scoped attribute is present: f
low content.
<template>: The Content Template element - HTML: Hypertext Markup Language
content categories metadata content, f
low content, phrasing content, script-supporting element permitted content no restrictions tag omission none, both the starting and ending tag are mandatory.
...also al
lowed as a child of a <colgroup> element that does not have a span attribute.
...note that directly using the value of the content could lead to unexpected behavior, see avoiding documentfragment pitfall section be
low.
... consider the fol
lowing html and javascript: html <div id="container"></div> <template id="template"> <div>click me</div> </template> javascript const container = document.getelementbyid("container"); const template = document.getelementbyid("template"); function clickhandler(event) { alert("clicked a div"); } const firstclone = template.content.clonenode(true); firstclone.addeventlistener("click", clickha...
Preloading content with rel="preload" - HTML: Hypertext Markup Language
using as to specify the type of content to be preloaded al
lows the browser to: prioritize resource loading more accurately.
...these can accept media types or full-b
lown media queries, al
lowing you to do responsive preloading!
...in addition, browsers will give prefetch resources a
lower priority than preload ones — the current page is more important than the next.
... <link rel="subresource"> was supported in chrome a while ago, and was intended to tackle the same issue as preload, but it had a problem: there was no way to work out a priority for the items (as didn't exist back then), so they all got fetched with fairly
low priority.
Choosing between www and non-www URLs - HTTP
in an http url, the first substring that fol
lows the initial http:// or https:// is called the domain name.
...but even so, you can still have the other domain working: http al
lows two techniques so that it is clear for your users, or search engines, which domain is the canonical one, while still al
lowing the non-canonical domain to work and provide the expected pages.
...there are two techniques be
low to al
low the non-canonical domain to work still.
...this way, search engines don't index the same page several times, potentially leading to it being considered as duplicate content or spam, and even removing or
lowering your page from the search engine result pages.
HTTP caching - HTTP
for more details see the information about the vary header be
low.
... for more details, see also the freshness section be
low.
...for more details, see the validation section be
low.
... the expiration time is computed as fol
lows: expirationtime = responsetime + freshnesslifetime - currentage where responsetime is the time at which the response was received according to the browser.
CSP: plugin-types - HTTP
not setting this al
lows anything.
... examples disal
lowing plugins to disal
low all plugins, the object-src directive should be set to 'none' which will disal
low plugins.
... the plugin-types directive is only used if you are al
lowing plugins with object-src at all.
... <meta http-equiv="content-security-policy" content="object-src 'none'"> al
lowing flash content the content security policy content-security-policy: plugin-types application/x-shockwave-flash will al
low to load flash objects: <object data="https://example.com/flash" type="application/x-shockwave-flash"></object> al
lowing java applets to load an <applet> you must specify application/x-java-applet: content-security-policy: plugin-types application/x-java-applet specifications specification status comment content security policy level 3the definition of 'plugin-types' in that specification.
Expect-CT - HTTP
ct requirements can be satisfied via any one of the fol
lowing mechanisms: x.509v3 certificate extension to al
low embedding of signed certificate timestamps issued by individual logs a tls extension of type signed_certificate_timestamp sent during the handshake supporting ocsp stapling (that is, the status_request tls extension) and providing a signedcertificatetimestamplist when a site enables the expect-ct header, they are requesting that the browser check that any certificate for that site appears in public ct logs.
...certificates before march 2018 were al
lowed to have a lifetime of 39 months, those will all be expired in june 2021.
... if a cache receives a value greater than it can represent, or if any of its subsequent calculations overf
lows, the cache will consider this value to be either 2,147,483,648 (231) or the greatest positive integer it can represent.
... example the fol
lowing example specifies enforcement of certificate transparency for 24 hours and reports violations to foo.example.
OPTIONS - HTTP
request has body no successful response has body yes safe yes idempotent yes cacheable no al
lowed in html forms no syntax options /index.html http/1.1 options * http/1.1 examples identifying al
lowed request methods to find out which request methods a server supports, one can use the curl command-line program to issue an options request: curl -x options https://example.org -i the response then contains an al
low header that holds the al
lowed methods: http/1.1 204 no content al
low: options, get, head, post cache-control: max...
...in this example, the server response says that: access-control-al
low-origin the https://foo.example origin is permitted to request the bar.example/resources/post-here/ url via the fol
lowing: access-control-al
low-methods post, get, and options are permitted methods for the url.
... (this header is similar to the al
low response header, but used only for cors.) access-control-al
low-headers any script inspecting the response is permitted to read the values of the x-pingother and content-type headers.
... http/1.1 204 no content date: mon, 01 dec 2008 01:15:39 gmt server: apache/2.0.61 (unix) access-control-al
low-origin: https://foo.example access-control-al
low-methods: post, get, options access-control-al
low-headers: x-pingother, content-type access-control-max-age: 86400 vary: accept-encoding, origin keep-alive: timeout=2, max=100 connection: keep-alive specifications specification title rfc 7231, section 4.3.7: options hypertext transfer protocol (http/1.1): semantics and content ...
PATCH - HTTP
to find out whether a server supports patch, a server can advertise its support by adding it to the list in the al
low or access-control-al
low-methods (for cors) response headers.
... another (implicit) indication that patch is al
lowed, is the presence of the accept-patch header, which specifies the patch document formats accepted by the server.
... request has body yes successful response has body yes safe no idempotent no cacheable no al
lowed in html forms no syntax patch /file.txt http/1.1 example request patch /file.txt http/1.1 host: www.example.com content-type: application/example if-match: "e0023aa4e" content-length: 100 [description of changes] response a successful response is indicated by any 2xx status code.
... in the example be
low a 204 response code is used, because the response does not carry a payload body.
Proxy servers and tunneling - HTTP
forward proxies can also be anonymous proxies and al
low users to hide their ip address while browsing the web or using other internet services.
...a common way to disclose this information is by using the fol
lowing http headers: the standardized header: forwarded contains information from the client-facing side of proxy servers that is altered or lost when a proxy is involved in the path of the request.
...http tunneling is using a protocol of higher level (http) to transport a
lower level protocol (tcp).
...the example be
low will work in an environment where the internal dns server is set up so that it can only resolve internal host names, and the goal is to use a proxy only for hosts that aren't resolvable: function findproxyforurl(url, host) { if (isresolvable(host)) return "direct"; else return "proxy proxy.mydomain.com:8080"; } see proxy auto-configuration (pac) for more examples.
HTTP range requests - HTTP
http range requests al
low to send only a portion of an http message from a server to a client.
... multipart ranges the range header also al
lows you to get multiple ranges at once in a multipart document.
... curl http://www.example.com -i -h "range: bytes=0-50, 100-150" the server responses with the 206 partial content status and a content-type: multipart/byteranges; boundary=3d6b6a416f9b5 header, indicating that a multipart byterange fol
lows.
... comparison to chunked transfer-encoding the transfer-encoding header al
lows chunked encoding, which is useful when larger amounts of data are sent to the client and the total size of the response is not known until the request has been fully processed.
Redirections in HTTP - HTTP
[1] the specification did not intend to al
low method changes, but there are existing user agents that do change their method.
... [2] the specification did not intend to al
low method changes, but there are existing user agents that do change their method.
...in this case, the response is a 303 (see other) redirect that links to a page indicating that the action has been scheduled, and eventually informs about its progress, or al
lows to cancel it.
... redirection loops redirection loops happen when additional redirections fol
low the one that has already been fol
lowed.
Meta programming - JavaScript
« previousnext » starting with ecmascript 2015, javascript gains support for the proxy and reflect objects al
lowing you to intercept and define custom behavior for fundamental language operations (e.g.
... proxies introduced in ecmascript 6, proxy objects al
low you to intercept certain operations and to implement custom behaviors.
... terminology the fol
lowing terms are used when talking about the functionality of proxies.
... handlers and traps the fol
lowing table summarizes the available traps available to proxy objects.
Quantifiers - JavaScript
types the fol
lowing table is also duplicated on this cheatsheet.
... note: in the fol
lowing, item refers not only to singular characters, but also includes character classes, unicode property escapes, groups and ranges.
...letterword)); // ["i"] console.table(sentence.match(notsolongword)); // [ "why", "do", "i", "have", "to", "learn", "table" ] console.table(sentence.match(loooongword)); // ["multiplication"] optional character var britishtext = "he asked his neighbour a favour."; var americantext = "he asked his neighbor a favor."; var regexpending = /\w+ou?r/g; // \w+ one or several letters // o fol
lowed by an "o", // u?
... optionally fol
lowed by a "u" // r fol
lowed by an "r" console.table(britishtext.match(regexpending)); // ["neighbour", "favour"] console.table(americantext.match(regexpending)); // ["neighbor", "favor"] greedy versus non-greedy var text = "i must be getting somewhere near the centre of the earth."; var greedyregexp = /[\w ]+/; // [\w ] a letter of the latin alphabet or a whitespace // + one or several times console.log(text.match(greedyregexp)[0]); // "i must be getting somewhere near the centre of the earth" // almost all of the text matches (leaves out the dot character) var nongreedyregexp = /[\w ]+?/; // notice the question mark console.log(text.match(nongreedyregexp)); // "i" // the match is the smallest one possible specifications specification ...
Unicode property escapes - JavaScript
unicode property escapes regular expressions al
lows for matching characters based on their unicode properties.
... syntax the fol
lowing section is also duplicated on this cheatsheet.
... unicodepropertyname the name of a non-binary property: unicodepropertyvalue one of the tokens listed in the values section, be
low.
...the script and script_extensions unicode properties al
low regular expression to match characters according to the script they are mainly used with (script) or according to the set of scripts they belong to (script_extensions).
Using Promises - JavaScript
read the fol
lowing example: new promise((resolve, reject) => { console.log('initial'); resolve(); }) .then(() => { throw new error('something failed'); console.log('do this'); }) .catch(() => { console.error('do that'); }) .then(() => { console.log('do this, no matter what happened before'); }); this will output the fol
lowing text: initial do that do this, no matter what happened be...
...best practice is to wrap problematic functions at the
lowest possible level, and then never call them directly again: const wait = ms => new promise(resolve => settimeout(resolve, ms)); wait(10*1000).then(() => saysomething("10 seconds")).catch(failurecallback); basically, the promise constructor takes an executor function that lets us resolve or reject a promise manually.
...specifically, a nested catch only catches failures in its scope and be
low, not errors higher up in the chain outside the nested scope.
...several of these mistakes manifest in the fol
lowing example: // bad example!
Warning: String.x is deprecated; use String.prototype.x instead - JavaScript
string.split is deprecated; use string.prototype.split instead warning: string.startswith is deprecated; use string.prototype.startswith instead warning: string.substr is deprecated; use string.prototype.substr instead warning: string.substring is deprecated; use string.prototype.substring instead warning: string.tolocale
lowercase is deprecated; use string.prototype.tolocale
lowercase instead warning: string.tolocaleuppercase is deprecated; use string.prototype.tolocaleuppercase instead warning: string.to
lowercase is deprecated; use string.prototype.to
lowercase instead warning: string.touppercase is deprecated; use string.prototype.touppercase instead warning: string.trim is deprec...
...string generics provide string instance methods on the string object al
lowing string methods to be applied to any object.
... examples deprecated syntax var num = 15; string.replace(num, /5/, '2'); standard syntax var num = 15; string(num).replace(/5/, '2'); shim the fol
lowing is a shim to provide support to non-supporting browsers: /*globals define*/ // assumes all supplied string instance methods already present // (one may use shims for these if not available) (function() { 'use strict'; var i, // we could also build the array of methods with the fol
lowing, but the // getownpropertynames() method is non-shimable: // object.getownpropertynames(string).filter(function(methodname) { // return typeof string[methodname] === 'function'; // }); methods = [ 'contains', 'substring', 'to
lowercase', 'touppercase', 'charat', 'charcodeat', 'indexof', 'lastindexof', 'start...
...swith', 'endswith', 'trim', 'trimleft', 'trimright', 'tolocale
lowercase', 'normalize', 'tolocaleuppercase', 'localecompare', 'match', 'search', 'slice', 'replace', 'split', 'substr', 'concat', 'localecompare' ], methodcount = methods.length, assignstringgeneric = function(methodname) { var method = string.prototype[methodname]; string[methodname] = function(arg1) { return method.apply(arg1, array.prototype.slice.call(arguments, 1)); }; }; for (i = 0; i < methodcount; i++) { assignstringgeneric(methods[i]); } }()); ...
getter - JavaScript
description sometimes it is desirable to al
low access to a property that returns a dynamically computed value, or you may want to reflect the status of an internal variable without requiring the use of explicit method calls.
... note the fol
lowing when working with the get syntax: it can have an identifier which is either a number or a string; it must have exactly zero parameters (see incompatible es5 change: literal getter and setter functions must now have exactly zero or one arguments for more information); it must not appear in an object literal with another get or with a data entry for the same property ({ get x() { }, get x() { } } and { x: ..., get x() { } } are forbidden).
...this is useful in the fol
lowing situations: if the calculation of a property value is expensive (takes much ram or cpu time, spawns worker threads, retrieves remote file, etc).
... in the fol
lowing example, the object has a getter as its own property.
Array.prototype.reduce() - JavaScript
it is the accumulated value previously returned in the last invocation of the callback—or initialvalue, if it was supplied (see be
low).
... it is almost always safer to provide an initialvalue, because there can be up to four possible output types without initialvalue, as shown in the fol
lowing example: let maxcallback = ( acc, cur ) => math.max( acc.x, cur.x ); let maxcallback2 = ( max, cur ) => math.max( max, cur ); // reduce without initialvalue [ { x: 2 }, { x: 22 }, { x: 42 } ].reduce( maxcallback ); // nan [ { x: 2 }, { x: 22 } ].reduce( maxcallback ); // 22 [ { x: 2 } ].reduce( maxcallback ); // { x: 2 } [ ].red...
...uce( maxcallback ); // typeerror // map & reduce with initialvalue; better solution, also works for empty or larger arrays [ { x: 22 }, { x: 42 } ].map( el => el.x ) .reduce( maxcallback2, -infinity ); how reduce() works suppose the fol
lowing use of reduce() occurred: [0, 1, 2, 3, 4].reduce(function(accumulator, currentvalue, currentindex, array) { return accumulator + currentvalue }) the callback would be invoked four times, with the arguments and return values in each call being as fol
lows: callback iteration accumulator currentvalue currentindex array return value first call 0 1 1 [0, 1, 2, 3, 4] 1 second call 1 2 2 [0, 1, 2, 3, 4] 3 third call 3 3 3 [0, 1, 2, ...
...the code be
low will produce the same output as the code in the block above: [0, 1, 2, 3, 4].reduce( (accumulator, currentvalue, currentindex, array) => accumulator + currentvalue ) if you were to provide an initialvalue as the second argument to reduce(), the result would look like this: [0, 1, 2, 3, 4].reduce((accumulator, currentvalue, currentindex, array) => { return accumulator + currentvalue }, 10) callback iteration accumulator currentvalue currentindex array return value first call 10 0 0 [0, 1, 2, 3, ...
Array.prototype.reduceRight() - JavaScript
(see be
low.) currentvalue the current element being processed in the array.
... some example run-throughs of the function would look like this: [0, 1, 2, 3, 4].reduceright(function(accumulator, currentvalue, index, array) { return accumulator + currentvalue; }); the callback would be invoked four times, with the arguments and return values in each call being as fol
lows: callback accumulator currentvalue index array return value first call 4 3 3 [0, 1, 2, 3, 4] 7 second call 7 2 2 [0, 1, 2, 3, 4] 9 third call 9 1 1 [0, 1, 2, 3, 4] 10 fourth call 10 0 0 [0, 1, 2, 3, 4] 10 the value returned by reduceright would be that of the last c...
...you can work around this by inserting the fol
lowing code at the beginning of your scripts, al
lowing use of reduceright in implementations which do not natively support it.
...it’s a f
lowing right-to-left, calling each function with the output of the last one.
Array.prototype.slice() - JavaScript
the slice() method returns a shal
low copy of a portion of an array into a new array object selected from start to end (end not included) where start and end represent the index of items in that array.
...it returns a shal
low copy of elements from the original array.
... elements of the original array are copied into the returned array as fol
lows: for object references (and not the actual object), slice copies object references into the new array.
... examples return a portion of an existing array let fruits = ['banana', 'orange', 'lemon', 'apple', 'mango'] let citrus = fruits.slice(1, 3) // fruits contains ['banana', 'orange', 'lemon', 'apple', 'mango'] // citrus contains ['orange','lemon'] using slice> in the fol
lowing example, slice creates a new array, newcar, from mycar.
Array.prototype.splice() - JavaScript
in this case, you should specify at least one new element (see be
low).
... examples remove 0 (zero) elements before index 2, and insert "drum" let myfish = ['angel', 'c
lown', 'mandarin', 'sturgeon'] let removed = myfish.splice(2, 0, 'drum') // myfish is ["angel", "c
lown", "drum", "mandarin", "sturgeon"] // removed is [], no elements removed remove 0 (zero) elements before index 2, and insert "drum" and "guitar" let myfish = ['angel', 'c
lown', 'mandarin', 'sturgeon'] let removed = myfish.splice(2, 0, 'drum', 'guitar') // myfish is ["angel", "c
lown", "drum", "gui...
...tar", "mandarin", "sturgeon"] // removed is [], no elements removed remove 1 element at index 3 let myfish = ['angel', 'c
lown', 'drum', 'mandarin', 'sturgeon'] let removed = myfish.splice(3, 1) // myfish is ["angel", "c
lown", "drum", "sturgeon"] // removed is ["mandarin"] remove 1 element at index 2, and insert "trumpet" let myfish = ['angel', 'c
lown', 'drum', 'sturgeon'] let removed = myfish.splice(2, 1, 'trumpet') // myfish is ["angel", "c
lown", "trumpet", "sturgeon"] // removed is ["drum"] remove 2 elements from index 0, and insert "parrot", "anemone" and "blue" let myfish = ['angel', 'c
lown', 'trumpet', 'sturgeon'] let removed = myfish.splice(0, 2, 'parrot', 'anemone', 'blue') // myfish is ["parrot", "anemone", "blue", "trumpet", "sturgeon"] // removed is ["angel", "c
lown"] re...
...move 2 elements from index 2 let myfish = ['parrot', 'anemone', 'blue', 'trumpet', 'sturgeon'] let removed = myfish.splice(2, 2) // myfish is ["parrot", "anemone", "sturgeon"] // removed is ["blue", "trumpet"] remove 1 element from index -2 let myfish = ['angel', 'c
lown', 'mandarin', 'sturgeon'] let removed = myfish.splice(-2, 1) // myfish is ["angel", "c
lown", "sturgeon"] // removed is ["mandarin"] remove all elements from index 2 let myfish = ['angel', 'c
lown', 'mandarin', 'sturgeon'] let removed = myfish.splice(2) // myfish is ["angel", "c
lown"] // removed is ["mandarin", "sturgeon"] specifications specification ecmascript (ecma-262)the definition of 'array.prototype.splice' in that specification.
Date() constructor - JavaScript
individual date and time component values given at least a year and month, this form of date() returns a date object whose component values (year, month, day, hour, minute, second, and millisecond) all come from the fol
lowing parameters.
... any missing fields are given the
lowest possible value (1 for day and 0 for every other component).
...see the example be
low.
... examples several ways to create a date object the fol
lowing examples show several ways to create javascript dates: note: parsing of date strings with the date constructor (and date.parse, they are equivalent) is strongly discouraged due to browser differences and inconsistencies.
Date.prototype.toLocaleString() - JavaScript
in order to get the format of the language used in the user interface of your application, make sure to specify that language (and possibly some fallback languages) using the locales argument: let date = new date(date.utc(2012, 11, 20, 3, 0, 0)); // formats be
low assume the local time zone of the locale; // america/los_angeles for the us // us english uses month-day-year order and 12-hour time with am/pm console.log(date.tolocalestring('en-us')); // → "12/19/2012, 7:00:00 pm" // british english uses day-month-year order and 24-hour time without am/pm console.log(date.tolocalestring('en-gb')); // → "20/12/2012 03:00:00" // korean uses year-month-day...
...however, this might change in the future, and isn't guaranteed for all languages; output variations are by design, and al
lowed by the specification.
... most notably, the ie and edge browsers insert bidirectional control characters around dates, so the output text will f
low properly when concatenated with other text.
... for this reason, you cannot expect to be able to compare the results of tolocalestring() to a static value: "1/1/2019, 01:00:00" === new date("2019-01-01t01:00:00z").tolocalestring("en-us"); // true in firefox and others // false in ie and edge note: see also this stackoverf
low thread for more details and examples.
Error.prototype.stack - JavaScript
argument values in the stack: prior to firefox 14, the function name would be fol
lowed by the argument values converted to string in parentheses immediately before the at (@) sign.
... examples using the stack property the fol
lowing html markup demonstrates the use of stack property.
...-8"> <title>stack trace example</title> <body> <script> function trace() { try { throw new error('myerror'); } catch(e) { alert(e.stack); } } function b() { trace(); } function a() { b(3, 4, '\n\n', undefined, {}); } a('first call, firstarg'); </script> assuming the above markup is saved as c:\example.html on a windows file system it produces an alert message box with the fol
lowing text: starting with firefox 30 and later containing the column number: trace@file:///c:/example.html:9:17 b@file:///c:/example.html:16:13 a@file:///c:/example.html:19:13 @file:///c:/example.html:21:9 firefox 14 to firefox 29: trace@file:///c:/example.html:9 b@file:///c:/example.html:16 a@file:///c:/example.html:19 @file:///c:/example.html:21 firefox 13 and earlier would instead produce th...
...e fol
lowing text: error("myerror")@:0 trace()@file:///c:/example.html:9 b(3,4,"\n\n",(void 0),[object object])@file:///c:/example.html:16 a("first call, firstarg")@file:///c:/example.html:19 @file:///c:/example.html:21 stack of eval'ed code starting with firefox 30, the error stack of code in function() and eval() calls, now produces stacks with more detailed information about the line and column numbers inside these calls.
Intl.Locale.prototype.numberingSystem - JavaScript
a table of the standard unicode numeral systems can be seen be
low.
... value description adlm adlam digits ahom ahom digits arab arabic-indic digits arabext extended arabic-indic digits armn armenian upper case numerals — algorithmic armn
low armenian
lower case numerals — algorithmic bali balinese digits beng bengali digits bhks bhaiksuki digits brah brahmi digits cakm chakma digits cham cham digits cyrl cyrillic numerals — algorithmic deva devanagari digits ethi ethiopic numerals — algorithmic finance financial numerals — may be algorithmic fullwide full width digits geor georgian numerals — algorithmic gong gun...
...jala gondi digits gonm masaram gondi digits grek greek upper case numerals — algorithmic grek
low greek
lower case numerals — algorithmic gujr gujarati digits guru gurmukhi digits hanidays han-character day-of-month numbering for lunar/other traditional calendars hanidec positional decimal system using chinese number ideographs as digits hans simplified chinese numerals — algorithmic hansfin simplified chinese financial numerals — algorithmic hant traditional chinese numerals — algorithmic hantfin traditional chinese financial numerals — algorithmic hebr hebrew numerals — algorithmic hmng pahawh hmong digits hmnp n...
...anmar digits mymrshan myanmar shan digits mymrtlng myanmar tai laing digits native native digits newa newa digits nkoo n'ko digits olck ol chiki digits orya oriya digits osma osmanya digits rohg hanifi rohingya digits roman roman upper case numerals — algorithmic roman
low roman
lowercase numerals — algorithmic saur saurashtra digits shrd sharada digits sind khudawadi digits sinh sinhala lith digits sora sora_sompeng digits sund sundanese digits takr takri digits talu new tai lue digits taml tamil numerals — algorithmic tamldec modern tamil...
Intl.RelativeTimeFormat() constructor - JavaScript
an object with some or all of the fol
lowing properties: localematcher the locale matching algorithm to use.
...the "auto" value al
lows to not always have to use numeric values in the output.
... examples basic format usage the fol
lowing example shows how to create a relative time formatter using the english language.
...this al
lows to not always have to use numeric values in the output.
JSON.stringify() - JavaScript
replacer optional a function that alters the behavior of the stringification process, or an array of string and number that serve as an al
lowlist for selecting/filtering the properties of the value object to be included in the json string.
... it should return the value that should be added to the json string, as fol
lows: if you return a number, string, boolean, or null, the stringified version of that value is used as the property's value.
... therefore, if compatibility with older javascript engines is required, it is perilous to directly substitute the string returned by json.stringify into a javascript string to be passed to eval or new function or as part of a jsonp url, and the fol
lowing utility can be used: function jsfriendlyjsonstringify (s) { return json.stringify(s).
...":"quux"}' var b = json.stringify({ baz: "quux", foo: "bar" }) //'{"baz":"quux","foo":"bar"}' console.log(a !== b) // true // some memoization functions use json.stringify to serialize arguments, // which may cause a cache miss when encountering the same object like above example of using json.stringify() with localstorage in a case where you want to store an object created by your user and al
lowing it to be restored even after the browser has been closed, the fol
lowing example is a model for the applicability of json.stringify(): // creating an example of json var session = { 'screens': [], 'state': true }; session.screens.push({ 'name': 'screena', 'width': 450, 'height': 250 }); session.screens.push({ 'name': 'screenb', 'width': 650, 'height': 350 }); session.screens.push({ 'name':...
Object.defineProperties() - JavaScript
data descriptors and accessor descriptors may optionally contain the fol
lowing keys: configurable true if and only if the type of this property descriptor may be changed and if the property may be deleted from the corresponding object.
... a data descriptor also has the fol
lowing optional keys: value the value associated with the property.
... an accessor descriptor also has the fol
lowing optional keys: get a function which serves as a getter for the property, or undefined if there is no getter.
... polyfill assuming a pristine execution environment with all names and properties referring to their initial values, object.defineproperties is almost completely equivalent (note the comment in iscallable) to the fol
lowing reimplementation in javascript: function defineproperties(obj, properties) { function converttodescriptor(desc) { function hasproperty(obj, prop) { return object.prototype.hasownproperty.call(obj, prop); } function iscallable(v) { // nb: modify as necessary if other values than functions are callable.
Object.freeze() - JavaScript
he friendly duck'; // in strict mode such attempts will throw typeerrors function fail(){ 'use strict'; obj.foo = 'sparky'; // throws a typeerror delete obj.foo; // throws a typeerror delete obj.quaxxor; // returns true since attribute 'quaxxor' was never added obj.sparky = 'arf'; // throws a typeerror } fail(); // attempted changes through object.defineproperty; // both statements be
low throw a typeerror.
... object.defineproperty(obj, 'ohai', { value: 17 }); object.defineproperty(obj, 'foo', { value: 'eit' }); // it's also impossible to change the prototype // both statements be
low will throw a typeerror.
...the fol
lowing example shows that a frozen object is not constant (freeze is shal
low).
... what is "shal
low freeze"?
Object.prototype.toString() - JavaScript
the fol
lowing code illustrates this: const o = new object(); o.tostring(); // returns [object object] note: starting in javascript 1.8.5, tostring() called on null returns [object null], and undefined returns [object undefined], as defined in the 5th edition of ecmascript and subsequent errata.
... by using radix you can also convert base 10 numbers (like 1,2,3,4,5,.........) to another base numbers, in example be
low we are converting base 10 number to a base 2 (binary) number let basetenint = 10; console.log(basetenint.tostring(2)); // expected output is "1010" and same for big integers let bignum = bigint(20); console.log(bignum.tostring(2)); // expected output is "10100" some common radix are 2 for binary numbers, 8 for octal numbers, 10 for decimal numbers, 16 for hexadecimal numbers.
... the fol
lowing code defines the dog object type and creates thedog, an object of type dog: function dog(name, breed, color, sex) { this.name = name; this.breed = breed; this.color = color; this.sex = sex; } thedog = new dog('gabby', 'lab', 'chocolate', 'female'); if you call the tostring() method on this custom object, it returns the default value inherited from object: thedog.tostring(); // returns [object object] the fol
lowing code creates and ass...
... + ' is a ' + this.sex + ' ' + this.color + ' ' + this.breed; return ret; } or, using es6 template strings: dog.prototype.tostring = function dogtostring() { return `dog ${this.name} is a ${this.sex} ${this.color} ${this.breed}`; } with the preceding code in place, any time thedog is used in a string context, javascript automatically calls the dogtostring() function, which returns the fol
lowing string: "dog gabby is a female chocolate lab" using tostring() to detect object class tostring() can be used with every object and (by default) al
lows you to get its class.
handler.defineProperty() - JavaScript
syntax const p = new proxy(target, { defineproperty: function(target, property, descriptor) { } }); parameters the fol
lowing parameters are passed to the defineproperty() method.
... interceptions this trap can intercept these operations: object.defineproperty() reflect.defineproperty() invariants if the fol
lowing invariants are violated, the proxy will throw a typeerror: a property cannot be added, if the target object is not extensible.
... examples trapping of defineproperty the fol
lowing code traps object.defineproperty().
...p = new proxy({}, { defineproperty: function(target, prop, descriptor) { console.log('called: ' + prop); return true; } }); const desc = { configurable: true, enumerable: true, value: 10 }; object.defineproperty(p, 'a', desc); // "called: a" when calling object.defineproperty() or reflect.defineproperty(), the descriptor passed to defineproperty() trap has one restriction—only fol
lowing properties are usable (non-standard properties will be ignored): enumerable configurable writable value get set const p = new proxy({}, { defineproperty(target, prop, descriptor) { console.log(descriptor); return reflect.defineproperty(target, prop, descriptor); } }); object.defineproperty(p, 'name', { value: 'proxy', type: 'custom' }); // { value: 'proxy' } speci...
handler.get() - JavaScript
syntax const p = new proxy(target, { get: function(target, property, receiver) { } }); parameters the fol
lowing parameters are passed to the get() method.
... interceptions this trap can intercept these operations: property access: proxy[foo]and proxy.bar inherited property access: object.create(proxy)[foo] reflect.get() invariants if the fol
lowing invariants are violated, the proxy will throw a typeerror: the value reported for a property must be the same as the value of the corresponding target object property if the target object property is a non-writable, non-configurable own data property.
... examples trap for getting a property value the fol
lowing code traps getting a property value.
... const p = new proxy({}, { get: function(target, property, receiver) { console.log('called: ' + property); return 10; } }); console.log(p.a); // "called: a" // 10 the fol
lowing code violates an invariant.
handler.getOwnPropertyDescriptor() - JavaScript
syntax const p = new proxy(target, { getownpropertydescriptor: function(target, prop) { } }); parameters the fol
lowing parameters are passed to the getownpropertydescriptor() method.
... interceptions this trap can intercept these operations: object.getownpropertydescriptor() reflect.getownpropertydescriptor() invariants if the fol
lowing invariants are violated, the proxy will throw a typeerror: getownpropertydescriptor() must return an object or undefined.
... examples trapping of getownpropertydescriptor the fol
lowing code traps object.getownpropertydescriptor().
... const p = new proxy({ a: 20}, { getownpropertydescriptor: function(target, prop) { console.log('called: ' + prop); return { configurable: true, enumerable: true, value: 10 }; } }); console.log(object.getownpropertydescriptor(p, 'a').value); // "called: a" // 10 the fol
lowing code violates an invariant.
handler.has() - JavaScript
syntax const p = new proxy(target, { has: function(target, prop) { } }); parameters the fol
lowing parameters are passed to has() method.
... interceptions this trap can intercept these operations: property query: foo in proxy inherited property query: foo in object.create(proxy) with check: with(proxy) { (foo); } reflect.has() invariants if the fol
lowing invariants are violated, the proxy will throw a typeerror: a property cannot be reported as non-existent, if it exists as a non-configurable own property of the target object.
... examples trapping the in operator the fol
lowing code traps the in operator.
... const p = new proxy({}, { has: function(target, prop) { console.log('called: ' + prop); return true; } }); console.log('a' in p); // "called: a" // true the fol
lowing code violates an invariant.
handler.isExtensible() - JavaScript
syntax const p = new proxy(target, { isextensible: function(target) { } }); parameters the fol
lowing parameter is passed to the isextensible() method.
... interceptions this trap can intercept these operations: object.isextensible() reflect.isextensible() invariants if the fol
lowing invariants are violated, the proxy will throw a typeerror: object.isextensible(proxy) must return the same value as object.isextensible(target).
... examples trapping of isextensible the fol
lowing code traps object.isextensible().
... const p = new proxy({}, { isextensible: function(target) { console.log('called'); return true; } }); console.log(object.isextensible(p)); // "called" // true the fol
lowing code violates the invariant.
handler.ownKeys() - JavaScript
syntax const p = new proxy(target, { ownkeys: function(target) { } }); parameters the fol
lowing parameter is passed to the ownkeys() method.
... interceptions this trap can intercept these operations: object.getownpropertynames() object.getownpropertysymbols() object.keys() reflect.ownkeys() invariants if the fol
lowing invariants are violated, the proxy will throw a typeerror: the result of ownkeys() must be an array.
... examples trapping of getownpropertynames the fol
lowing code traps object.getownpropertynames().
... const p = new proxy({}, { ownkeys: function(target) { console.log('called'); return ['a', 'b', 'c']; } }); console.log(object.getownpropertynames(p)); // "called" // [ 'a', 'b', 'c' ] the fol
lowing code violates an invariant.
handler.preventExtensions() - JavaScript
syntax const p = new proxy(target, { preventextensions: function(target) { } }); parameters the fol
lowing parameter is passed to the preventextensions() method.
... interceptions this trap can intercept these operations: object.preventextensions() reflect.preventextensions() invariants if the fol
lowing invariants are violated, the proxy will throw a typeerror: object.preventextensions(proxy) only returns true if object.isextensible(proxy) is false.
... examples trapping of preventextensions the fol
lowing code traps object.preventextensions().
... const p = new proxy({}, { preventextensions: function(target) { console.log('called'); object.preventextensions(target); return true; } }); console.log(object.preventextensions(p)); // "called" // false the fol
lowing code violates the invariant.
RegExp - JavaScript
the fol
lowing three expressions create the same regular expression: /ab+c/i new regexp(/ab+c/, 'i') // literal notation new regexp('ab+c', 'i') // constructor the literal notation results in compilation of the regular expression when the expression is evaluated.
... for example, the fol
lowing are equivalent: let re = /\w+/ let re = new regexp('\\w+') perl-like regexp properties note that several of the regexp properties have both long and short (perl-like) names.
... examples using a regular expression to change data format the fol
lowing script uses the replace() method of the string instance to match a name in the format first last and output it in the format last, first.
...�сском языке' let regex = /[\u0400-\u04ff]+/g let match = regex.exec(text) console.log(match[0]) // logs 'Образец' console.log(regex.lastindex) // logs '7' let match2 = regex.exec(text) console.log(match2[0]) // logs 'на' [did not log 'text'] console.log(regex.lastindex) // logs '15' // and so on the unicode property escapes feature introduces a solution, by al
lowing for a statement as simple as \p{scx=cyrl}.
String.prototype.repeat() - JavaScript
rangeerror: repeat count must be less than infinity and not overf
low maximum string size.
...however, you can polyfill string.prototype.repeat() with the fol
lowing snippet: if (!string.prototype.repeat) { string.prototype.repeat = function(count) { 'use strict'; if (this == null) throw new typeerror('can\'t convert ' + this + ' to object'); var str = '' + this; // to convert string to integer.
... count = +count; // check nan if (count != count) count = 0; if (count < 0) throw new rangeerror('repeat count must be non-negative'); if (count == infinity) throw new rangeerror('repeat count must be less than infinity'); count = math.floor(count); if (str.length == 0 || count == 0) return ''; // ensuring count is a 31-bit integer al
lows us to heavily optimize the // main part.
... but anyway, most current (august 2014) browsers can't handle // strings 1 << 28 chars or longer, so: if (str.length * count >= 1 << 28) throw new rangeerror('repeat count must not overf
low maximum string size'); var maxcount = str.length * count; count = math.floor(math.log(count) / math.log(2)); while (count) { str += str; count--; } str += str.substring(0, maxcount - str.length); return str; } } examples using repeat 'abc'.repeat(-1) // rangeerror 'abc'.repeat(0) // '' 'abc'.repeat(1) // 'abc' 'abc'.repeat(2) // 'abcabc' 'abc'.repeat(3.5) // 'abcabcabc' (count will be converted to integer) 'abc'.repeat(1/0) // rangeerror ({ tostring: () => 'abc', repeat: string.prototype.repeat }).repeat(2) // 'abcabc' (repeat() ...
String.prototype.substring() - JavaScript
if indexstart is greater than indexend, then the effect of substring() is as if the two arguments were swapped; see example be
low.
... examples using substring() the fol
lowing example uses substring() to display characters from the string 'mozilla': let anystring = 'mozilla' // displays 'm' console.log(anystring.substring(0, 1)) console.log(anystring.substring(1, 0)) // displays 'mozill' console.log(anystring.substring(0, 6)) // displays 'lla' console.log(anystring.substring(4)) console.log(anystring.substring(4, 7)) console.log(anystring.substring(7, 4)) // displays 'mozilla' console.log(anystring.substring(0, 7)) console.log(anystring.substring(0, 10)) using substring() with length property the fol
lowing example use...
... replacing a substring within a string the fol
lowing example replaces a substring within a string.
... a better method for replacing strings is as fol
lows: function replacestring(olds, news, fulls) { return fulls.split(olds).join(news) } the code above serves as an example for substring operations.
WebAssembly.Memory() constructor - JavaScript
syntax new webassembly.memory(memorydescriptor); parameters memorydescriptor an object that can contain the fol
lowing members: initial the initial size of the webassembly memory, in units of webassembly pages.
... maximum optional the maximum size the webassembly memory is al
lowed to grow to, in units of webassembly pages.
...the fol
lowing example creates a new webassembly memory instance with an initial size of 10 pages (640kib), and a maximum size of 100 pages (6.4mib).
...the fol
lowing example (see memory.html on github, and view it live also) fetches and instantiates the loaded memory.wasm byte code using the webassembly.instantiatestreaming() method, while importing the memory created in the line above.
Destructuring assignment - JavaScript
examples array destructuring basic variable assignment const foo = ['one', 'two', 'three']; const [red, yel
low, green] = foo; console.log(red); // "one" console.log(yel
low); // "two" console.log(green); // "three" assignment separate from declaration a variable can be assigned its value via destructuring separate from the variable's declaration.
... without destructuring assignment, swapping two values requires a temporary variable (or, in some
low-level languages, the xor-swap trick).
...destructuring assignment al
lows you to unpack the parts out of this array easily, ignoring the full match if it is not needed.
...say you want the third element in the array props be
low, and then you want the name property in the object, you can do the fol
lowing: const props = [ { id: 1, name: 'fizz'}, { id: 2, name: 'buzz'}, { id: 3, name: 'fizzbuzz'} ]; const [,, { name }] = props; console.log(name); // "fizzbuzz" the prototype chain is looked up when the object is deconstructed when deconstructing an object, if a property is not accessed in itself, it will contin...
Object initializer - JavaScript
the fol
lowing code creates an object with three properties and the keys are "foo", "age" and "baz".
... function havees2015duplicatepropertysemantics() { 'use strict'; try { ({prop: 1, prop: 2}); // no error thrown, duplicate property names al
lowed in strict mode return true; } catch(e) { // error thrown, duplicates prohibited in strict mode return false; } } method definitions a property of an object can also refer to a function or a getter or setter method.
...that al
lows you to put an expression in brackets [], that will be computed and used as the property name.
... shal
low-cloning (excluding prototype) or merging objects is now possible using a shorter syntax than object.assign().
yield - JavaScript
description the yield keyword pauses generator function execution and the value of the expression fol
lowing the yield keyword is returned to the generator's caller.
...each time the generator's next() method is called, the generator resumes execution, and runs until it reaches one of the fol
lowing: a yield, which causes the generator to once again pause and return the generator's new value.
... unfortunately, next() is asymmetric, but that can’t be helped: it always sends a value to the currently suspended yield, but returns the operand of the fol
lowing yield.
... examples using yield the fol
lowing code is the declaration of an example generator function.
let - JavaScript
description let al
lows you to declare variables that are limited to the scope of a block statement, or expression on which it is used, unlike the var keyword, which defines a variable globally, or locally to an entire function regardless of block scope.
... the other difference between var and let is that the latter is initialized to a value only when a parser evaluates it (see be
low).
... function test(){ var foo = 33; if(foo) { let foo = (foo + 55); // referenceerror } } test(); this phenomenon may confuse you in a situation like the fol
lowing.
... var a = 1; var b = 2; if (a === 1) { var a = 11; // the scope is global let b = 22; // the scope is inside the if-block console.log(a); // 11 console.log(b); // 22 } console.log(a); // 11 console.log(b); // 2 however, this combination of var and let declaration be
low is a syntaxerror due to var being hoisted to the top of the block.
with - JavaScript
see the "ambiguity contra" paragraph in the "description" section be
low for details.
...therefore all identifiers that aren't members of the specified object will be found more s
lowly in a 'with' block.
... examples using with the fol
lowing with statement specifies that the math object is the default object.
... the statements fol
lowing the with statement refer to the pi property and the cos and sin methods, without specifying an object.
MathML attribute reference - MathML
the values block and inline are al
lowed.
... unimplemented overf
low <math> if an expression is too long to fit in the al
lowed width, this attribute sets the preferred handling.
... scriptminsize <mstyle> specifies a minimum font size al
lowed due to changes in scriptlevel.
... subscriptshift <mmultiscripts>, <msub>, <msubsup> the minimum space by which to shift the subscript be
low the baseline of the expression.
Digital video concepts - Web media technologies
doing so al
lows color data to be represented using fewer total bits of space in a video stream.
... as our eyes capture a scene, they essentially take two photos at once: a finely-detailed greyscale image and a somewhat fuzzy,
lower-resolution map of the colors of light received across the retina at the same time.
... since the color data is being encoded at a
lower resolution than the luma, when decoding the video to draw it to the screen each pixel's color is computed by calculating an appropriate color given the u and v values for the 4x2 block of 8 pixels in which the pixel resides.
... the table be
low shows examples of three chroma subsampling models.
CSS and JavaScript animation performance - Web Performance
css animations, on the other hand, al
low developers to make animations between a set of starting property values and a final set rather than between two states.
... running the performance test initially in the test seen be
low, a total of 1000 <div> elements are transformed by css animation.
...the key is that as long as the properties we want to animate do not trigger ref
low/repaint (read css triggers for more information), we can move those sampling operations out of the main thread.
... note: in nightly/developer edition, you should see that omta is enabled by default, so you might have to do the tests the other way around (test with it enabled first, then disable to test without omta.) summary browsers are able to optimize rendering f
lows.
Critical rendering path - Web Performance
understanding and optimizing the critical rendering path is important to ensure ref
lows and repaints can happen at 60 frames per second, to ensure performant user interactions and avoid jank.
... the greater the number of nodes, the longer the fol
lowing events in the critical rendering path will take.
...specificity is likely not your
low hanging fruit.
...while painting is a very fast process, and therefore likely not the most impactful place to focus on in improving performance, it is important to remember to al
low for both layout and re-paint times when measuring how long an animation frame may take.
How to make PWAs installable - Progressive web apps (PWAs)
previous overview: progressive next in the last article, we read about how the example application, js13kpwa, works offline thanks to its service worker, but we can go even further and al
low users to install the web app on mobile and desktop browers that support doing so.
... these technologies al
low the app to be launched directly from the device's home screen, rather than the user having to open the browser and then navigate to the site by using a bookmark or typing the url.
... requirements to make the web site installable, it needs the fol
lowing things in place: a web manifest, with the correct fields filled in the web site to be served from a secure (https) domain an icon to represent the app on the device a service worker registered, to al
low the app to work offline (this is required only by chrome for android currently) currently, only the chromium-based browsers such as chrome, edge, and samsung internet require the servi...
... the js13kpwa.webmanifest file of the js13kpwa web app is included in the <head> block of the index.html file using the fol
lowing line of code: <link rel="manifest" href="js13kpwa.webmanifest"> there are a few common kinds of manifest file that have been used in the past: manifest.webapp was popular in firefox os app manifests, and many use manifest.json for web manifests as the contents are organized in a json structure.
Media - Progressive web apps (PWAs)
to specify rules that are specific to a type of media, use @media fol
lowed by the media type, fol
lowed by curly braces that enclose the rules.
...this css (be
low) removes the navigation area when printing the document: @media print { #nav-area {display: none;} } some common media types are: screen color device display print printed paged media projection projected display all all media (the default) more details there are other ways to specify the media type for a set of rules.
... the document's markup language might al
low the media type to be specified when the stylesheet is linked to the document.
... the cursor property specifies the shape of the pointer: some of the common shapes are as fol
lows.
baseline-shift - SVG: Scalable Vector Graphics
the baseline-shift attribute al
lows repositioning of the dominant-baseline relative to the dominant-baseline of the parent text content element.
... as a presentation attribute, it can be applied to any element but it has effect only on the fol
lowing four elements: <altglyph>, <textpath>, <tref>, and <tspan> usage notes value <length-percentage> | sub | super default value 0 animatable yes sub the dominant-baseline is shifted to the default position for subscripts.
... <length-percentage> a length value raises (positive value) or
lowers (negative value) the dominant-baseline of the parent text content element by the specified length.
... a percentage value raises (positive value) or
lowers (negative value) the dominant-baseline of the parent text content element by the specified percentage of the line-height.
end - SVG: Scalable Vector Graphics
each value can be one of the fol
lowing: <offset-value> this value defines a clock-value that represents a point in time relative to the beginning of the svg document (usually the load or domcontentloaded event).
... a valid syncbase-value consists of an id reference to another animation element fol
lowed by a dot and either begin or end to identify whether to synchronize with the beginning or active end of the referenced animation element.
... a valid event-value consists of an element id fol
lowed by a dot and one of the supported events for that element.
... a valid repeat value consists of an element id fol
lowed by a dot and the function repeat() with an integer value specifying the number of repetitions as parameter.
font-size-adjust - SVG: Scalable Vector Graphics
« svg attribute reference home the font-size-adjust attribute al
lows authors to specify an aspect value for an element that will preserve the x-height of the first choice font in a substitute font.
... as a presentation attribute, it can be applied to any element but it has effect only on the fol
lowing eight elements: <altglyph>, <text>, <textpath>, <tref>, and <tspan> html, body, svg { height: 100%; } <svg width="600" height="80" viewbox="0 0 500 80" xmlns="http://www.w3.org/2000/svg"> <text y="20" font-family="times, serif" font-size="10px"> this text uses the times font (10px), which is hard to read in small sizes.
... </text> <text y="40" font-family="verdana, sans-serif" font-size="10px"> this text uses the verdana font (10px), which has relatively large
lowercase letters.
... <number> choose the size of the font so that its
lowercase letters (as determined by the x-height of the font) are the specified number times the font-size.
preserveAspectRatio - SVG: Scalable Vector Graphics
because the aspect ratio of an svg image is defined by the viewbox attribute, if this attribute isn't set, the preserveaspectratio attribute has no effect (with one exception, the <image> element, as described be
low).
...viewbox="0 0 100 100" width="10" height="25" preserveaspectratio="xmaxymid slice" x="150" y="0"> <use href="#smiley" /> </svg> <!-- none --> <rect x="0" y="30" width="160" height="60"> <title>none</title> </rect> <svg viewbox="0 0 100 100" width="160" height="60" preserveaspectratio="none" x="0" y="30"> <use href="#smiley" /> </svg> </svg> path { fill: yel
low; stroke: black; stroke-width: 8px; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; } rect:hover, rect:active { outline: 1px solid red; } syntax preserveaspectratio="<align> [<meetorslice>]" its value is made of one or two keywords: a required alignment value and an optional "meet or slice" reference as described be
low: alignment value the alignment valu...
...the alignment value must be one of the fol
lowing keywords: none do not force uniform scaling.
... meet or slice reference the meet or slice reference is optional and, if provided, must be one of the fol
lowing keywords: meet (the default) - scale the graphic such that: aspect ratio is preserved the entire viewbox is visible within the viewport the viewbox is scaled up as much as possible, while still meeting the other criteria in this case, if the aspect ratio of the graphic does not match the viewport, some of the viewport will extend beyond the bounds of the viewbox (i.e...
SVG Attribute reference - SVG: Scalable Vector Graphics
be
low is a list of all of the attributes available in svg along with links to reference documentation to help you learn which elements support them and how they work.
... svg attributes a to z a accent-height accumulate additive alignment-baseline al
lowreorder alphabetic amplitude arabic-form ascent attributename attributetype autoreverse azimuth b basefrequency baseline-shift baseprofile bbox begin bias by c calcmode cap-height class clip clippathunits clip-path clip-rule color color-interpolation color-interpolation-filters color-profile color-rendering contentscripttype contentstyletype cursor cx cy d d decelerate descent diffuseconstant direction display divisor dominant-baseline dur dx dy e edgemode elevation enable-background end exponent externalresourcesrequired f fill fill-opacity fill-rule filter filterres filterunits flood-color flood-opacity font-family font-s...
...unitlength kerning keypoints keysplines keytimes l lang lengthadjust letter-spacing lighting-color limitingconeangle local m marker-end marker-mid marker-start markerheight markerunits markerwidth mask maskcontentunits maskunits mathematical max media method min mode n name numoctaves o offset opacity operator order orient orientation origin overf
low overline-position overline-thickness p panose-1 paint-order path pathlength patterncontentunits patterntransform patternunits ping pointer-events points pointsatx pointsaty pointsatz preservealpha preserveaspectratio primitiveunits r r radius referrerpolicy refx refy rel rendering-intent repeatcount repeatdur requiredextensions requiredfeatures restart resul...
...rsor, direction, display, dominant-baseline, enable-background, fill, fill-opacity, fill-rule, filter, flood-color, flood-opacity, font-family, font-size, font-size-adjust, font-stretch, font-style, font-variant, font-weight, glyph-orientation-horizontal, glyph-orientation-vertical, image-rendering, kerning, letter-spacing, lighting-color, marker-end, marker-mid, marker-start, mask, opacity, overf
low, pointer-events, shape-rendering, stop-color, stop-opacity, stroke, stroke-dasharray, stroke-dashoffset, stroke-linecap, stroke-linejoin, stroke-miterlimit, stroke-opacity, stroke-width, text-anchor, text-decoration, text-rendering, transform, transform-origin, unicode-bidi, vector-effect, visibility, word-spacing, writing-mode filters attributes filter primitive attributes height, result, wid...
<a> - SVG: Scalable Vector Graphics
see warning be
low */ svg|a:link, svg|a:visited { cursor: pointer; } svg|a text, text svg|a { fill: blue; /* even for text, svg uses fill over color */ text-decoration: underline; } svg|a:hover, svg|a:active { outline: dotted 1px blue; } since this element shares its tag name with html's <a> element, selecting a with css or queryselector may apply to the wrong kind of element.
... value type: <string> ; default value: none; animatable: yes ping a space-separated list of urls to which, when the hyperlink is fol
lowed, post requests with the body ping will be sent by the browser (in the background).
...-miterlimit, stroke-opacity, stroke-width, transform, vector-effect, visibility xlink attributes most notably: xlink:title aria attributes aria-activedescendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-f
lowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, ari...
...a-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriescontainer elementpermitted contentany number of the fol
lowing 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.
SVG In HTML Introduction - SVG: Scalable Vector Graphics
source here is the source to the example: <html> <head> <title>xtech svg demo</title> <style> stop.begin { stop-color:yel
low; } stop.end { stop-color:green; } body.invalid stop.end { stop-color:red; } #err { display:none; } body.invalid #err { display:inline; } </style> <script> function signalerror() { document.getelementbyid('body').setattribute("class", "invalid"); } </script> </head> <body id="body" style="position:absolute; z-index:0; border:1px solid black; left:5%; top:5%; width:90%; height:90%;"> <form> <fieldset> ...
...(another style rule makes an error message appear.) this approach has the fol
lowing points in its favor: we have taken a regular html form that could have been part of an existing web site, and added an attractive, interactive background the approach is backwards compatible to browsers that do not support svg; simply, no background appears in them it's very simple and performs very well the picture dynamically sizes itself to the required size in an intelligent way we ...
...like in the fol
lowing example: var img = document.createelementns("http://www.w3.org/2000/svg", "image"); img.setattributens("http://www.w3.org/1999/xlink", "xlink:href", "move.png"); details the viewbox attribute establishes a logical coordinate system which the svg picture's coordinates are relative to.
... the preserveaspectratio attribute specifies that the aspect ratio must be preserved by centering the picture in the available size, sizing to the maximum of the height or width and then cutting off any overf
low.
Texts - SVG: Scalable Vector Graphics
the attribute text-anchor, which can have the values "start", "middle", "end" or "inherit", decides in which direction the text f
lows from this point.
...each of the fol
lowing properties can be set as an attribute or via a css declaration: font-family, font-style, font-weight, font-variant, font-stretch, font-size, font-size-adjust, kerning, letter-spacing, word-spacing and text-decoration.
...tspan font-weight="bold" fill="red">bold and red</tspan> </text> playable code <svg width="350" height="60" xmlns="http://www.w3.org/2000/svg"> <text> this is <tspan font-weight="bold" fill="red">bold and red</tspan> </text> <style><![cdata[ text{ dominant-baseline: hanging; font: 28px verdana, helvetica, arial, sans-serif; } ]]></style> </svg> the tspan element has the fol
lowing custom attributes: x set a new absolute x coordinate for the containing text.
...it is meant to al
low the rendering engine to fine-tune the positions of the glyphs when its own measured text length doesn't meet the one provided here.
Using templates and slots - Web Components
let's look at a trivial quick example: <template id="my-paragraph"> <p>my paragraph</p> </template> this won't appear in your page until you grab a reference to it with javascript and then append it to the dom, using something like the fol
lowing: let template = document.getelementbyid('my-paragraph'); let templatecontent = template.content; document.body.appendchild(templatecontent); although trivial, you can already start to see how this could be useful.
... slots are identified by their name attribute, and al
low you to define placeholders in your template that can be filled with any markup fragment you want when the element is used in the markup.
... the fol
lowing set of code snippets show how to use <slot> together with <template> and some javascript to: create a <element-details> element with named slots in its shadow root design the <element-details> element in such a way that, when used in documents, it is rendered from composing the element’s content together with content from its shadow root—that is, pieces of the element’s content are u...
... screenshotlive sample notice the fol
lowing points about this rendered result: even though the instances of the <element-details> element in the document do not directly use the <details> element, they get rendered using <details> because the shadow root causes them to get populated with that.
<xsl:sort> - XSLT: Extensible Stylesheet Language Transformations
syntax <xsl:sort select=expression order="ascending" | "descending" case-order="upper-first" | "
lower-first" lang=xml:lang-code data-type="text" | "number" /> required attributes none.
... case-order indicates whether upper- or
lowercase letters are to be ordered first.
... the al
lowable values are "upper-first" and "
lower-first".
...the al
lowable values are "text" and "number" with "text" being the default.
An Overview - XSLT: Extensible Stylesheet Language Transformations
« transforming xml with xslt the extensible stylesheet language/transform is a very powerful language, and a complete discussion of it is well beyond the scope of this article, but a brief discussion of some basic concepts will be helpful in understanding the description of netscape's capabilities that fol
lows.
... <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/xsl/transform" version="1.0"> the xmlns pseudo-attribute maps the shorthand name xsl onto the full namespace for use throughout the document that fol
lows.
...be
low the root node are its children, which can be elements, comments, processing instructions and so on.
...a fuller description of the parts of xpath most commonly used in xslt fol
lows in the reference section.
Converting WebAssembly text format to wasm - WebAssembly
a first look at the text format let’s look at a simple example of this — the fol
lowing program imports a function called imported_func from a module called imports, and exports a function called exported_func: (module (func $i (import "imports" "imported_func") (param i32)) (func (export "exported_func") i32.const 42 call $i ) ) the webassembly function exported_func is exported for use in our environment (e.g.
...go to https://github.com/webassembly/wabt — fol
low the instructions on this page to set up the tool.
... next, execute the wat2wasm program, passing it the path to the input file, fol
lowed by an -o parameter, fol
lowed by the path to the output file: wat2wasm simple.wat -o simple.wasm this will convert the wasm into a file called simple.wasm, which contains the .wasm assembly code.
...try this: wat2wasm simple.wat -v this will give you an output in your terminal in the fol
lowing way: ...
Interacting with page scripts - Archive of obsolete content
clicking "i will not work" fails, and the fol
lowing message is logged: permission denied to access property 'greeting' expose functions to page scripts the structured clone algorithm is a bit more powerful than simple json serialization, but not much: in particular, functions aren't cloned.
...see the section be
low on using postmessage() before firefox 31.
...require("sdk/self").data; var pagemod = require("sdk/page-mod"); pagemod.pagemod({ include: "http://my-domain.org/listen.html", contentscriptfile: data.url("talk.js") }); the "talk.js" content script uses window.postmessage() to send the message to the page: // talk.js window.postmessage("message from content script", "http://my-domain.org/"); the second argument may be '*' which will al
low communication with any domain.
Working with Events - Archive of obsolete content
for example, the fol
lowing add-on registers a listener with the tabs module to listen for the ready event, and logs a string to the console reporting the event: var tabs = require("sdk/tabs"); tabs.on("ready", function () { console.log("tab loaded"); }); it is not possible to enumerate the set of listeners for a given event.
... the fol
lowing add-on creates a button and assigns a listener to the onclick property of the options object supplied to the button's constructor.
... in the fol
lowing add-on, we add two listeners to the tabs module's ready event.
context-menu - Archive of obsolete content
if the total number of menu items in the main context menu from all add-ons exceeds a certain number (normally 10 but configurable with the extensions.addon-sdk.context-menu.overf
lowthreshold preference) all of the menu items will instead appear in an overf
low menu to avoid making the context menu too large.
...the example above works because <img> elements can't contain other elements, but in the example be
low, node.nodename is not guaranteed to be "p" - for example, it won't be "p" if the user context-clicked a link inside a paragraph: var cm = require("sdk/context-menu"); cm.item({ label: "a paragraph", context: cm.selectorcontext("p"), contentscript: 'self.on("context", function (node) {' + ' console.log(node.nodename);' + ' return true;' + ...
... targetname the name of the dom element that the menu was invoked on, in
lower-case.
url - Archive of obsolete content
for example: var url = require("sdk/url").url("https://developer.mozilla.org/add-ons?example=true&visible=yes#top"); console.log(url.hostname); // developer.mozilla.org pathname an initial '/' fol
lowed by the path of the url, as a string.
...for example: var url = require("sdk/url").url("https://developer.mozilla.org/add-ons?example=true&visible=yes#top"); console.log(url.pathname); // /add-ons hash a '#' fol
lowed by the fragment identifier of the url, as a string.
...for example: var url = require("sdk/url").url("https://developer.mozilla.org/add-ons?example=true&visible=yes#top"); console.log(url.protocol); // https: search if any parameters are present, a '?' fol
lowed by the parameters of the url, as a string.
util/match-pattern - Archive of obsolete content
for other schemes like file, resource, or data, use a scheme fol
lowed by an asterisk, as be
low.
... example pattern example matching urls example non-matching urls "*.example.com" http://example.com/ http://foo.example.com/ https://example.com/ http://example.com/foo ftp://foo.example.com/ ldap://example.com http://example.foo.com/ a url fol
lowed by an asterisk matches that url and any url prefixed with the pattern.
... example pattern example matching urls example non-matching urls "https://foo.com/*" https://foo.com/ https://foo.com/bar http://foo.com/ https://foo.com https://bar.foo.com/ a scheme fol
lowed by an asterisk matches all urls with that scheme.
window/utils - Archive of obsolete content
options : object options for the function, with the fol
lowing properties: name type parent nsidomwindow parent for the new window.
... parameters options : object options for the function, with the fol
lowing properties: name type url string uri of the document to be loaded into the window.
... options : object options object containing the fol
lowing property: name type includeprivate boolean whether to include private windows.
More Menu Features - Archive of obsolete content
the example be
low creates a simple submenu inside the file menu example 1 : source view <toolbox flex="1"> <menubar id="sample-menubar"> <menu id="file-menu" label="file"> <menupopup id="file-popup"> <menu id="new-menu" label="new"> <menupopup id="new-popup"> <menuitem label="window"/> <menuitem label="message"/> </menupopup> </menu> ...
...the example be
low creates a menu with a checked item.
...the example be
low demonstrates this: example 3 : source view <toolbox> <menubar id="planets-menubar"> <menu id="planet-menu" label="planet"> <menupopup> <menuitem id="jupiter" label="jupiter" type="radio" name="ringed"/> <menuitem id="saturn" label="saturn" type="radio" name="ringed" checked="true"/> <menuitem id="uranus" label="uranus" type="radio" name="ringed"/> <menu...
Persistent Data - Archive of obsolete content
xul al
lows you to save the state of any element.
...persist attribute to al
low the saving of state, you simply add a persist attribute to the element which holds a value you want to save.
...for example, to save the size of a window, you would do the fol
lowing: <window id="somewindow" width="200" height="300" persist="width height" .
Stacks and Decks - Archive of obsolete content
they are all special types of boxes and al
low all of the attributes of boxes on them.
...the first child of the stack is drawn underneath, the second child is drawn next, fol
lowed by the third and so on.
...for example, you could create an effect similar to the text-shadow property with the fol
lowing: example 1 : source view <stack> <description value="shadowed" style="padding-left: 1px; padding-top: 1px; font-size: 15pt"/> <description value="shadowed" style="color: red; font-size: 15pt;"/> </stack> both description elements create text with a size of 15 points.
Tree Box Objects - Archive of obsolete content
this makes it easy to pass event coordinates directly to these functions, as in the fol
lowing example of the getcellat() function.
... the fol
lowing line is used so that the example above will work in all versions.
...it takes seven arguments, as described be
low.
Tree Selection - Archive of obsolete content
the syntax of the onselect() event handler is shown be
low.
...multiple selection for trees that al
low multiple selection, getting the list of selected rows is a bit more complicated.
...for example, the fol
lowing code will select the row at index 5: tree.view.selection.select(5); note that you should not just change the tree's currentindex property to change the selection.
Tree View Details - Archive of obsolete content
the getparentindex method is expected to return the parent row of a given row, that is, the row before it with a
lower nesting value.
...the code above uses a brute force method which simply iterates over the rows looking for one, returning true if a row exists with the same level and false once it finds a row that has a
lower level.
... the fol
lowing code is used to delete rows when a row is closed.
XUL Changes for Firefox 1.5 - Archive of obsolete content
a set of icons will appear across the top of the dialog al
lowing the user to switch panels.
... <menulist> items in a <menulist> support the description attribute to al
low for extra descriptive text to appear beside an item's label.
... draggable tabs the tabbrowser now al
lows the user to rearrange tabs by dragging them.
XUL Template Primer - Bindings - Archive of obsolete content
we'll use a the fol
lowing data model to illustrate how bindings work.
... see the rdf/xml file friends.rdf, be
low, a simple database with name and address information for some of my good friends.
...ource="#doghouse"/> </rdf:description> </rdf:li> <rdf:li> <rdf:description nc:name="lumpy"/> </rdf:li> </rdf:seq> </nc:friends> </rdf:description> <rdf:description id="home" nc:street="437 hoffman"/> <rdf:description id="doghouse" nc:street="435 hoffman"/> </rdf:rdf> the rdf model that this file creates can be represented with the fol
lowing graph.
action - Archive of obsolete content
variables are a question mark fol
lowed by a name.
... examples example needed attributes inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltipte...
...xt, top, uri, wait-cursor, width properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelement...
arrowscrollbox - Archive of obsolete content
attributes clicktoscroll, disabled, smoothscroll, tabindex properties disabled, scrollboxobject, scrollincrement, smoothscroll, tabindex methods ensureelementisvisible, scrollbyindex, scrollbypixels examples <arrowscrollbox orient="vertical" flex="1"> <button label="red"/> <button label="blue"/> <button label="green"/> <button label="yel
low"/> <button label="orange"/> <button label="silver"/> <button label="lavender"/> <button label="gold"/> <button label="turquoise"/> <button label="peach"/> <button label="maroon"/> <button label="black"/> </arrowscrollbox> attributes inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, contex...
... the disabled attribute is al
lowed only for form controls.
... properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width disabled type: boolean ...
checkbox - Archive of obsolete content
crop type: one of the values be
low if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute.
...for example, for a menuitem in a menu you can add the fol
lowing css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled type: boolean indicates whether the element is disabled or not.
... the disabled attribute is al
lowed only for form controls.
colorpicker - Archive of obsolete content
the disabled attribute is al
lowed only for form controls.
...a change event is fired in different ways for different xul input elements as listed be
low: onchange type: script code textbox when enter key is pressed radio/check box when the state is changed select list when the selected item is changed what is accessible the script context at this point can only access the fol
lowing things: global values/functions i.e.
... the window object event object example <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="findfile-window" title="find files" orient="horizontal" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script type="text/javascript"> function myfunction(e){ /* do something cool here or just say the be
low */ alert(e.target.nodename); } </script> <textbox id="find-text" onchange="return myfunction(event);"/> </window> preference type: id connects the element to a corresponding preference.
command - Archive of obsolete content
see also: command attribute, commandset element attributes disabled, label, oncommand,reserved examples the fol
lowing code will send a paste command (cmd_paste) to the currently focused element: // first include chrome://global/content/globaloverlay.js godocommand("cmd_paste"); example with two buttons <commandset><command id="cmd_openhelp" oncommand="alert('help');"/></commandset> <button label="help" command="cmd_openhelp"/> <button label="more help" command="cmd_openhelp"/> attributes disabled ...
... the disabled attribute is al
lowed only for form controls.
... properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlist...
datepicker - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] a datepicker al
lows the user to enter a date.
... the disabled attribute is al
lowed only for form controls.
... type type: one of the values be
low you can set the type attribute to one of the values be
low to specify the type of datepicker to use normal a datepicker with three fields for entering the year, month and date.
dialogheader - Archive of obsolete content
examples <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?> <dialog id="donothing" title="dialog example" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <dialogheader title="my dialog" description="example dialog"/> <!-- other widgets --> </dialog> attributes crop type: one of the values be
low if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute.
...for example, for a menuitem in a menu you can add the fol
lowing css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } description type: string descriptive text to appear in addition to the dialog title.
... properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattr...
editor - Archive of obsolete content
to enable editing on an editor, do either of the fol
lowing: set the src attribute on the editor after the outer window has loaded, for example, in the onload handler.
... attributes editortype type: one of the values be
low the type of editor to use.
... editortype type: one of the values be
low the type of editor to use.
image - Archive of obsolete content
validate type: one of the values be
low this attribute indicates whether to load the image from the cache or not.
...the fol
lowing values are accepted, or leave out the attribute entirely for default handling: always the image is always checked to see whether it should be reloaded.
... inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(),...
keyset - Archive of obsolete content
attributes disabled examples <keyset> <key id="sample-key" modifiers="shift" key="r"/> </keyset> attributes inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
... the disabled attribute is al
lowed only for form controls.
... properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlist...
listhead - Archive of obsolete content
the disabled attribute is al
lowed only for form controls.
... inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
... inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener...
listheader - Archive of obsolete content
the disabled attribute is al
lowed only for form controls.
... inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
... inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, f...
preferences - Archive of obsolete content
note: it's not clear which of the fol
lowing methods and properties are public.
... inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods void firechangedevent(in domelement preference); creates and dispatches a changed (non-bubbling) event to the specified preference element.
progressmeter - Archive of obsolete content
mode type: one of the values be
low a determinedprogressmeter is used in cases where you know how long an operation will take.
... inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
... inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlist...
radiogroup - Archive of obsolete content
tes disabled, focused, preference, tabindex, value properties accessibletype, disabled, focuseditem, itemcount, selectedindex, selecteditem, tabindex, value methods appenditem, checkadjacentelement, getindexofitem, getitematindex, insertitemat, removeitemat examples <radiogroup> <radio id="orange" label="red"/> <radio id="violet" label="green" selected="true"/> <radio id="yel
low" label="blue"/> </radiogroup> attributes disabled type: boolean indicates whether the element is disabled or not.
... the disabled attribute is al
lowed only for form controls.
... value type: string the string attribute al
lows you to associate a data value with an element.
rows - Archive of obsolete content
however, nesting rows elements al
lows groups of rows to have a separate appearance such as a different border, or separate scrolling may be defined for these rows.
... attributes inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait...
...-cursor, width properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), ge...
toolbar - Archive of obsolete content
the value of this attribute should be a comma-separated list of item ids from the toolbarpalette or, additionally, any of the fol
lowing strings: "separator", "spring", "spacer".
... mode not in seamonkey 1.x type: one of the values be
low how the toolbarbuttons on the toolbar are displayed.
...for spacers, separators, and flexible spacers the fol
lowing strings are used instead of ids: "spacer", "separator", "spring".
where - Archive of obsolete content
rel type: one of the values be
low the type of comparison to perform.
... inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
wizard - Archive of obsolete content
set to false to disal
low moving to the next page.
...set to false to disal
low moving to the previous page.
...the pageid argument al
lows you to specify the index of the page to which to jump.
XUL Explorer - Archive of obsolete content
double-click or drag-and-drop to insert a snippet file > new al
lows user to pick any “template” snippet, as well as blank.
...it checks for legal element and attribute names, including al
lowed attributes for a given element.
...e” checks such as: using of commands and keys, strings in dtds and so on - xul checker multi-tabbed editor support support wizards to generate common projects - extensions support extension testing using firefox extension test mode venkman support dom inspector support future: support more “best practice” checks such as: more a11y checks, strings in dtds and so on - xul checker al
low users to add snippets on the fly add sidebars for more functionality - property sidebar and project sidebar support wizards to generate common projects - xul files, js xpcom, and xulrunner applications for more detailed information, see the xul_explorer:planning#feature_planning_for_xul_explorer.
application/http-index-format specification - Archive of obsolete content
syntax every line in the file must conform to the fol
lowing generic syntax: number: data where number is at least a three digit number (note that more digits are possible in the future) and data is separated from number by a colon and a space.
...all lines must be terminated by a carriage return fol
lowed by a line feed.
... file-type one of the fol
lowing keywords to represent a special status for a file: file directory symbolic-link sym-file (a symbolic link to a file) sym-directory (a symbolic link to a directory) permissions unix type file permission syntax.
2006-11-10 - Archive of obsolete content
this feature consists of creating buttons using a small program, that al
lows you to create shortcuts to a particular address.
... ref
low branch build failed with vc 7.1 sp1 november 8th: roy received an error when he tried to ref
low a branch build using vc 7.1 sp1.
... build problem firefox 2.0 on fc3 november 10th: vin downloaded the latest firefox 2 rc3 and tried to build it on fc3 with the fol
lowing options: ./configure --enable-application=browser --prefix=$prefix --enable-extensions=default,spatialnavigation then he tried running "make" and received the fol
lowing error: /usr/bin/ld: testtarray.o(.text+0x2237): unresolvable relocation against symbol `nstarray_base::semptyhdr' /usr/bin/ld: final link failed: nonrepresentable section on output collect2: ld returned 1 exit status gma...
NS_ConvertUTF8toUTF16
ubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char
lowercaseequalsascii
lowercaseequalsliteral(const char
lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity setlength truncate getdata getmutabledata set...
...parameters char* data equalsliteral(const char prbool equalsliteral(const char (&)[n]) const - source equalsliteral(char prbool equalsliteral(char (&)[n]) const - source
lowercaseequalsascii prbool
lowercaseequalsascii(const char*, pruint32) const - source parameters char* data pruint32 len prbool
lowercaseequalsascii(const char*) const - source parameters char* data
lowercaseequalsliteral(const char prbool
lowercaseequalsliteral(const char (&)[n]) const - source
lowercaseequalsliteral(char prbool
lowercaseequalsliteral(char (&)[n]) const - s...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to
low-memory conditions.
NS_LossyConvertUTF16toASCII
ubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char
lowercaseequalsascii
lowercaseequalsliteral(const char
lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity setlength truncate getdata getmutabledata set...
...parameters char* data equalsliteral(const char prbool equalsliteral(const char (&)[n]) const - source equalsliteral(char prbool equalsliteral(char (&)[n]) const - source
lowercaseequalsascii prbool
lowercaseequalsascii(const char*, pruint32) const - source parameters char* data pruint32 len prbool
lowercaseequalsascii(const char*) const - source parameters char* data
lowercaseequalsliteral(const char prbool
lowercaseequalsliteral(const char (&)[n]) const - source
lowercaseequalsliteral(char prbool
lowercaseequalsliteral(char (&)[n]) const - s...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to
low-memory conditions.
operator=
return values this operator returns a reference back to the object being modified to al
low operator chaining.
... return values this operator returns a reference back to the object being modified to al
low operator chaining.
... return values this operator returns a reference back to the object being modified to al
low operator chaining.
operator+=
return values this operator returns a reference back to the object being modified to al
low operator chaining.
... return values this operator returns a reference back to the object being modified to al
low operator chaining.
... return values this operator returns a reference back to the object being modified to al
low operator chaining.
nsACString_internal
eloper.mozilla.org/en/nsadoptingcstring" shape="rect" title="nsadoptingcstring"> </map> method overview constructors beginreading endreading beginwriting endwriting data length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char
lowercaseequalsascii
lowercaseequalsliteral(const char
lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char operator= adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity setlength truncate getdata getmutab...
...parameters char* data equalsliteral(const char prbool equalsliteral(const char (&)[n]) const - source equalsliteral(char prbool equalsliteral(char (&)[n]) const - source
lowercaseequalsascii prbool
lowercaseequalsascii(const char*, pruint32) const - source parameters char* data pruint32 len prbool
lowercaseequalsascii(const char*) const - source parameters char* data
lowercaseequalsliteral(const char prbool
lowercaseequalsliteral(const char (&)[n]) const - source
lowercaseequalsliteral(char prbool
lowercaseequalsliteral(char (&)[n]) const - s...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to
low-memory conditions.
operator=
return values this operator returns a reference back to the object being modified to al
low operator chaining.
... return values this operator returns a reference back to the object being modified to al
low operator chaining.
... return values this operator returns a reference back to the object being modified to al
low operator chaining.
nsAString_internal
eveloper.mozilla.org/en/nsadoptingstring" shape="rect" title="nsadoptingstring"> </map> method overview constructors beginreading endreading beginwriting endwriting data length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char
lowercaseequalsascii
lowercaseequalsliteral(const char
lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char operator= adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity setlength truncate getdata getmutab...
...parameters char* data equalsliteral(const char prbool equalsliteral(const char (&)[n]) const - source equalsliteral(char prbool equalsliteral(char (&)[n]) const - source
lowercaseequalsascii prbool
lowercaseequalsascii(const char*, pruint32) const - source parameters char* data pruint32 len prbool
lowercaseequalsascii(const char*) const - source parameters char* data
lowercaseequalsliteral(const char prbool
lowercaseequalsliteral(const char (&)[n]) const - source
lowercaseequalsliteral(char prbool
lowercaseequalsliteral(char (&)[n]) const - s...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to
low-memory conditions.
nsAdoptingCString
ar replacesubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data length isempty isvoid isterminated charat first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char
lowercaseequalsascii
lowercaseequalsliteral(const char
lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity setlength truncate getdata getmutabledata set...
...parameters char* data equalsliteral(const char prbool equalsliteral(const char (&)[n]) const - source equalsliteral(char prbool equalsliteral(char (&)[n]) const - source
lowercaseequalsascii prbool
lowercaseequalsascii(const char*, pruint32) const - source parameters char* data pruint32 len prbool
lowercaseequalsascii(const char*) const - source parameters char* data
lowercaseequalsliteral(const char prbool
lowercaseequalsliteral(const char (&)[n]) const - source
lowercaseequalsliteral(char prbool
lowercaseequalsliteral(char (&)[n]) const - s...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to
low-memory conditions.
nsAdoptingString
ar replacesubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data length isempty isvoid isterminated charat first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char
lowercaseequalsascii
lowercaseequalsliteral(const char
lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity setlength truncate getdata getmutabledata set...
...parameters char* data equalsliteral(const char prbool equalsliteral(const char (&)[n]) const - source equalsliteral(char prbool equalsliteral(char (&)[n]) const - source
lowercaseequalsascii prbool
lowercaseequalsascii(const char*, pruint32) const - source parameters char* data pruint32 len prbool
lowercaseequalsascii(const char*) const - source parameters char* data
lowercaseequalsliteral(const char prbool
lowercaseequalsliteral(const char (&)[n]) const - source
lowercaseequalsliteral(char prbool
lowercaseequalsliteral(char (&)[n]) const - s...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to
low-memory conditions.
nsAutoString
ubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char
lowercaseequalsascii
lowercaseequalsliteral(const char
lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity setlength truncate getdata getmutabledata set...
...parameters char* data equalsliteral(const char prbool equalsliteral(const char (&)[n]) const - source equalsliteral(char prbool equalsliteral(char (&)[n]) const - source
lowercaseequalsascii prbool
lowercaseequalsascii(const char*, pruint32) const - source parameters char* data pruint32 len prbool
lowercaseequalsascii(const char*) const - source parameters char* data
lowercaseequalsliteral(const char prbool
lowercaseequalsliteral(const char (&)[n]) const - source
lowercaseequalsliteral(char prbool
lowercaseequalsliteral(char (&)[n]) const - s...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to
low-memory conditions.
nsCAutoString
appendfloat beginreading endreading beginwriting endwriting data length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char
lowercaseequalsascii
lowercaseequalsliteral(const char
lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut ...
... parameters char* data equalsliteral(const char prbool equalsliteral(const char (&)[n]) const - source equalsliteral(char prbool equalsliteral(char (&)[n]) const - source
lowercaseequalsascii prbool
lowercaseequalsascii(const char*, pruint32) const - source parameters char* data pruint32 len prbool
lowercaseequalsascii(const char*) const - source parameters char* data
lowercaseequalsliteral(const char prbool
lowercaseequalsliteral(const char (&)[n]) const - source
lowercaseequalsliteral(char prbool
lowercaseequalsliteral(...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to
low-memory conditions.
nsCString
ubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char
lowercaseequalsascii
lowercaseequalsliteral(const char
lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity setlength truncate getdata getmutabledata set...
...parameters char* data equalsliteral(const char prbool equalsliteral(const char (&)[n]) const - source equalsliteral(char prbool equalsliteral(char (&)[n]) const - source
lowercaseequalsascii prbool
lowercaseequalsascii(const char*, pruint32) const - source parameters char* data pruint32 len prbool
lowercaseequalsascii(const char*) const - source parameters char* data
lowercaseequalsliteral(const char prbool
lowercaseequalsliteral(const char (&)[n]) const - source
lowercaseequalsliteral(char prbool
lowercaseequalsliteral(char (&)[n]) const - s...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to
low-memory conditions.
nsDependentCSubstring
entsubstring for wide characters nsdependentcsubstring for narrow characters method overview constructors rebind beginreading endreading beginwriting endwriting data length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char
lowercaseequalsascii
lowercaseequalsliteral(const char
lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char operator= adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity setlength truncate getdata getmutab...
...parameters char* data equalsliteral(const char prbool equalsliteral(const char (&)[n]) const - source equalsliteral(char prbool equalsliteral(char (&)[n]) const - source
lowercaseequalsascii prbool
lowercaseequalsascii(const char*, pruint32) const - source parameters char* data pruint32 len prbool
lowercaseequalsascii(const char*) const - source parameters char* data
lowercaseequalsliteral(const char prbool
lowercaseequalsliteral(const char (&)[n]) const - source
lowercaseequalsliteral(char prbool
lowercaseequalsliteral(char (&)[n]) const - s...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to
low-memory conditions.
nsDependentSubstring
entsubstring for wide characters nsdependentcsubstring for narrow characters method overview constructors rebind beginreading endreading beginwriting endwriting data length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char
lowercaseequalsascii
lowercaseequalsliteral(const char
lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char operator= adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity setlength truncate getdata getmutab...
...parameters char* data equalsliteral(const char prbool equalsliteral(const char (&)[n]) const - source equalsliteral(char prbool equalsliteral(char (&)[n]) const - source
lowercaseequalsascii prbool
lowercaseequalsascii(const char*, pruint32) const - source parameters char* data pruint32 len prbool
lowercaseequalsascii(const char*) const - source parameters char* data
lowercaseequalsliteral(const char prbool
lowercaseequalsliteral(const char (&)[n]) const - source
lowercaseequalsliteral(char prbool
lowercaseequalsliteral(char (&)[n]) const - s...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to
low-memory conditions.
nsFixedCString
ubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char
lowercaseequalsascii
lowercaseequalsliteral(const char
lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity setlength truncate getdata getmutabledata set...
...parameters char* data equalsliteral(const char prbool equalsliteral(const char (&)[n]) const - source equalsliteral(char prbool equalsliteral(char (&)[n]) const - source
lowercaseequalsascii prbool
lowercaseequalsascii(const char*, pruint32) const - source parameters char* data pruint32 len prbool
lowercaseequalsascii(const char*) const - source parameters char* data
lowercaseequalsliteral(const char prbool
lowercaseequalsliteral(const char (&)[n]) const - source
lowercaseequalsliteral(char prbool
lowercaseequalsliteral(char (&)[n]) const - s...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to
low-memory conditions.
ident - CSS: Cascading Style Sheets
it consists of one or more characters, where characters can be any of the fol
lowing: any alphabetical character (a to z, or a to z), any decimal digit (0 to 9), a hyphen (-), an underscore (_), an escaped character (preceded by a backslash, \), a unicode character (in the format of a backslash, \, fol
lowed by one to six hexadecimal digits, representing its unicode code point) note that id1, id1, id1 and id1 are all different identifiers as they are case-sensitive.
... examples valid identifiers nono79 a mix of alphanumeric characters and numbers ground-level a mix of alphanumeric characters and a dash -test a dash fol
lowed by alphanumeric characters --toto a custom-property like identifier _internal an underscore fol
lowed by alphanumeric characters \22 toto a unicode character fol
lowed by a sequence of alphanumeric characters bili\.bob a correctly escaped period invalid identifiers 34rem it must not start with a decimal digit.
... -12rad it must not start with a dash fol
lowed by a decimal digit.
<image> - CSS: Cascading Style Sheets
syntax the <image> data type can be represented with any of the fol
lowing: an image denoted by the <url> data type a <gradient> data type a part of the webpage, defined by the element() function an image, image fragment or solid patch of color, defined by the image() function a blending of two or more images defined by the cross-fade() function.
... description css can handle the fol
lowing kinds of images: images with intrinsic dimensions (a natural size), like a jpeg, png, or other raster format.
...if supported, the browser-defined size matching the usual cursor size on the client's system content for a pseudo-element (::after/::before) a 300px × 150px rectangle the concrete object size is calculated using the fol
lowing algorithm: if the specified size defines both the width and the height, these values are used as the concrete object size.
ime-mode - CSS: Cascading Style Sheets
syntax the ime-mode property is specified using one of the keyword values listed be
low.
... description unlike internet explorer, firefox's implementation of ime-mode al
lows this property on <input type="password">.
...users may correct the inappropriate behavior of sites that don't fol
low this recommendation by placing the fol
lowing css into their user stylesheet: input[type=password] { ime-mode: auto !important; } the mac version of gecko 1.9 (firefox 3) can't recover the previous state of the ime when a field for which it is disabled loses focus, so mac users may get grumpy when you use the disabled value.
line-height-step - CSS: Cascading Style Sheets
/* point values */ line-height-step: 18pt; syntax the line-height-step property is specified as any one of the fol
lowing: a <length>.
... formal definition initial value0applies toblock containersinheritedyescomputed valueabsolute <length>animation typediscrete formal syntax <length> examples setting step unit for line box height in the fol
lowing example, the height of line box in each paragraph is rounded up to the step unit.
... :root { font-size: 12pt; --my-grid: 18pt; line-height-step: var(--my-grid); } h1 { font-size: 20pt; margin-top: calc(2 * var(--my-grid)); } the result of these rules is shown be
low in the fol
lowing screenshot: specifications specification status comment css rhythmic sizingthe definition of 'line-height-step' in that specification.
mask-composite - CSS: Cascading Style Sheets
the mask-composite css property represents a compositing operation used on the current mask layer with the mask layers be
low it.
... /* keyword values */ mask-composite: add; mask-composite: subtract; mask-composite: intersect; mask-composite: exclude; /* global values */ mask-composite: inherit; mask-composite: initial; mask-composite: unset; syntax one or more of the keyword values listed be
low, separated by commas.
... values for the composition the current mask layer is referred to as source, while all layers be
low it are referred to as destination.
mask-size - CSS: Cascading Style Sheets
negative lengths are not al
lowed.
...negative percentages are not al
lowed.
... the rendered size of the mask image is then computed as fol
lows: if both components of mask-size are specified and are not auto: the mask image renders at the specified size.
mask - CSS: Cascading Style Sheets
as well as the properties listed be
low, the mask shorthand also resets mask-border to its initial value.
...this will ensure that mask-border has also been reset to al
low the new styles to take effect.
... constituent properties this property is a shorthand for the fol
lowing css properties: mask-clip mask-composite mask-image mask-mode mask-origin mask-position mask-repeat mask-size syntax /* keyword values */ mask: none; /* image values */ mask: url(mask.png); /* pixel image used as mask */ mask: url(masks.svg#star); /* element within svg graphic used as mask */ /* combined values */ mask: url(masks.svg#star) luminance; /* element within svg graphic used as luminance mask */ mask: url(masks.svg#star) 40px 20px; /* element within svg graphic used as mask positioned 40px from the top and 20px from the left */ mask: url(masks.svg#star) 0 0/50px 50px; /* element within svg graphic used as mask with a width and height of 50px */...
max() - CSS: Cascading Style Sheets
the max() function can be used anywhere a <length>, <frequency>, <angle>, <time>, <percentage>, <number>, or <integer> is al
lowed.
... formal syntax max( <calc-sum># )where <calc-sum> = <calc-product> [ [ '+' | '-' ] <calc-product> ]*where <calc-product> = <calc-value> [ '*' <calc-value> | '/' <number> ]*where <calc-value> = <number> | <dimension> | <percentage> | ( <calc-sum> ) examples setting a minimum size for a font another use case for css functions is al
low a font size to grow while ensuring it is at least a mimum size, enabling responsive font sizes while ensuring legibility.
...this ensure it is legible and ensures accessibility <h1>this text is always legible, but doesn't change size</h1> <h1 class="responsive">this text is always legible, and is responsive, to a point</h1> think of the max() function as finding the minimum value al
lowed for a property.
opacity - CSS: Cascading Style Sheets
for example: background: rgba(0, 0, 0, 0.4); accessibility concerns if text opacity is adjusted, it is important to ensure that the contrast ratio between the color of the text and the background the text is placed over is high enough that people experiencing
low vision conditions will be able to read the content of the page.
...tsinheritednocomputed valuethe specified value, clipped in the range [0,1]animation typea number formal syntax <alpha-value>where <alpha-value> = <number> | <percentage> examples setting background opacity html <div class="light">you can barely see this.</div> <div class="medium">this is easier to see.</div> <div class="heavy">this is very easy to see.</div> css div { background-color: yel
low; } .light { opacity: 0.2; /* barely see the text over the background */ } .medium { opacity: 0.5; /* see the text more clearly over the background */ } .heavy { opacity: 0.9; /* see the text very clearly over the background */ } result setting opacity on hover html <img src="//developer.mozilla.org/static/img/opengraph-logo.png" alt="mdn logo" width="128" height="146" class="opac...
...ity"> css img.opacity { opacity: 1; filter: alpha(opacity=100); /* ie8 and
lower */ zoom: 1; /* triggers "haslayout" in ie 7 and
lower */ } img.opacity:hover { opacity: 0.5; filter: alpha(opacity=50); zoom: 1; } result specifications specification status comment css color module level 4the definition of 'opacity' in that specification.
perspective-origin - CSS: Cascading Style Sheets
syntax /* one-value syntax */ perspective-origin: x-position; /* two-value syntax */ perspective-origin: x-position y-position; /* when both x-position and y-position are keywords, the fol
lowing is also valid */ perspective-origin: y-position x-position; /* global values */ perspective-origin: inherit; perspective-origin: initial; perspective-origin: unset; values x-position indicates the position of the abscissa of the vanishing point.
... it can have one of the fol
lowing values: <length-percentage> indicating the position as an absolute length value or relative to the width of the element.
...it can have one of the fol
lowing values: <length-percentage> indicating the position as an absolute length value or relative to the height of the element.
<ratio> - CSS: Cascading Style Sheets
syntax in media queries level 3, the <ratio> data type consisted of a strictly positive <integer> fol
lowed by a forward slash ('/', unicode u+002f solidus) and a second strictly positive <integer>.
... in media queries level 4, the <ratio> date type is updated to consist of a strictly positive <number> fol
lowed by a forward slash ('/', unicode u+002f solidus) and a second strictly positive <number>.
... in addition a single <number> as a value is al
lowable.
scroll-margin-inline - CSS: Cascading Style Sheets
constituent properties this property is a shorthand for the fol
lowing css properties: scroll-margin-inline-end scroll-margin-inline-start syntax /* <length> values */ scroll-margin-inline: 10px; scroll-margin-inline: 1em .5em ; /* global values */ scroll-margin-inline: inherit; scroll-margin-inline: initial; scroll-margin-inline: unset; values <length> an outset from the corresponding edge of the scroll container.
...the outer container is styled like this: .scroller { text-align: left; width: 250px; height: 250px; overf
low-x: scroll; display: flex; box-sizing: border-box; border: 1px solid #000; scroll-snap-type: x mandatory; } the main parts relevant to the scroll snapping are overf
low-x: scroll, which makes sure the contents will scroll and not be hidden, and scroll-snap-type: x mandatory, which dictates that scroll snapping must occur along the horizontal axis, and the scrolling will always come to rest...
... the child elements are styled as fol
lows: .scroller > div { flex: 0 0 250px; width: 250px; background-color: #663399; color: #fff; font-size: 30px; display: flex; align-items: center; justify-content: center; scroll-snap-align: end; } .scroller > div:nth-child(2n) { background-color: #fff; color: #663399; } the most relevant part here is scroll-snap-align: end, which specifies that the right-hand edges (the "ends" along the x axis, in our case) are the designated snap points.
scroll-margin - CSS: Cascading Style Sheets
constituent properties this property is a shorthand for the fol
lowing css properties: scroll-margin-bottom scroll-margin-left scroll-margin-right scroll-margin-top syntax /* <length> values */ scroll-margin: 10px; scroll-margin: 1em .5em 1em 1em; /* global values */ scroll-margin: inherit; scroll-margin: initial; scroll-margin: unset; values <length> an outset from the corresponding edge of the scroll container.
...the outer container is styled like this: .scroller { text-align: left; width: 250px; height: 250px; overf
low-x: scroll; display: flex; box-sizing: border-box; border: 1px solid #000; scroll-snap-type: x mandatory; } the main parts relevant to the scroll snapping are overf
low-x: scroll, which makes sure the contents will scroll and not be hidden, and scroll-snap-type: x mandatory, which dictates that scroll snapping must occur along the horizontal axis, and the scrolling will always come to rest...
... the child elements are styled as fol
lows: .scroller > div { flex: 0 0 250px; width: 250px; background-color: #663399; color: #fff; font-size: 30px; display: flex; align-items: center; justify-content: center; scroll-snap-align: start; } .scroller > div:nth-child(2n) { background-color: #fff; color: #663399; } the most relevant part here is scroll-snap-align: start, which specifies that the left-hand edges (the "starts" along the x axis, in our case) are the designated snap points.
scrollbar-width - CSS: Cascading Style Sheets
the scrollbar-width property al
lows the author to set the maximum thickness of an element’s scrollbars when they are shown.
...it must be one of the fol
lowing values: auto the default scrollbar width for the platform.
...ag, guideline 2.1 explanations mdn understanding wcag, guideline 2.5 explanations understanding success criterion 2.1.1 | w3c understanding wcag 2.1 understanding success criterion 2.5.5 | w3c understanding wcag 2.1 formal definition initial valueautoapplies toscrolling boxesinheritednocomputed valueas specifiedanimation typediscrete formal syntax auto | thin | none examples sizing overf
low scrollbars css .scroller { width: 300px; height: 100px; overf
low-y: scroll; scrollbar-width: thin; } html <div class="scroller">veggies es bonus vobis, proinde vos postulo essum magis kohlrabi welsh onion daikon amaranth tatsoi tomatillo melon azuki bean garlic.
text-emphasis-position - CSS: Cascading Style Sheets
the informative table be
low summarizes the preferred emphasis mark positions for chinese, mongolian and japanese: preferred emphasis mark and ruby position language preferred position illustration horizontal vertical japanese over right korean mongolian chinese under right note: the text-emphasis-position cannot be set, and ...
...in html, this can be done with the fol
lowing style rule: ruby { text-emphasis: none; } preferring emphasis marks over ruby some other editors prefer to hide ruby when they conflict with emphasis marks.
... in html, this can be done with the fol
lowing pattern: em { text-emphasis: dot; /* set text-emphasis for <em> elements */ } em rt { display: none; /* hide ruby inside <em> elements */ } specifications specification status comment css text decoration module level 3the definition of 'text-emphasis' in that specification.
text-underline-position - CSS: Cascading Style Sheets
under forces the line to be set be
low the alphabetic baseline, at a position where it won't cross any descenders.
... be
low forces the line to be be
low the text.
...in the horizontal text we use text-underline-position: under; to put the underline be
low all the descenders.
matrix3d() - CSS: Cascading Style Sheets
a1a2a3a4b1b2b3b4c1c2c3c4d1d2d3d4 examples cube squashing example the fol
lowing example shows a 3d cube created from dom elements and transforms, which can be hovered/focused to apply a matrix3d() transform to it.
...</div> css html { width: 100%; } body { height: 100vh; /* centering content */ display: flex; flex-f
low: row wrap; justify-content: center; align-content: center; } .foo { width: 50%; padding: 1em; color: white; background: #ff8c66; border: 2px dashed black; text-align: center; font-family: system-ui, sans-serif; font-size: 14px; /* setting up animation for better demonstration */ animation: motionscale 2s alternate linear infinite; } @keyframes motionscale { from { ...
... the matrix be
low describes the fol
lowing transformations: translates every x point by -50px translates every y point by -100px translates every z point by 0 scales down by 10% */ transform: matrix3d( 1,0,0,0, 0,1,0,0, 0,0,1,0, -50,-100,0,1.1 ); } 50% { transform: matrix3d( 1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,0.9 ); } to { transform: matrix3d( 1,0,0,0, 0,1,0,0, 0,0,1,0, 50,100,0,1.1 ) } } result specifications specification status comment css transforms level 2the definition of 'matrix3d()' in that specification.
<transform-function> - CSS: Cascading Style Sheets
syntax the <transform-function> data type is specified using one of the transformation functions listed be
low.
... examples transform function comparison the fol
lowing example provides a 3d cube created from dom elements and transforms, and a select menu al
lowing you to choose different transform functions to transform the cube with, so you can compare the effects of the different types.
...the cube's starting state is slightly rotated using transform3d(), to al
low you to see the effect of all the transforms.
EXSLT
there are a number of modules; those that are supported by firefox are listed be
low: common (exsl)the exslt common package provides basic functions that expand upon the capabilities of xslt.math (math)the exslt math package provides functions for working with numeric values and comparing nodes.regular expressions (regexp)the exslt regular expressions package provides functions that al
low testing, matching, and replacing text using javascript style regular expressions.sets (set)the exslt sets package offers functions that let you perform set manipulation.strings (str)the exslt strings package provides functions that al
low the manipulation of strings.
... functions math:highest() math:
lowest() math:max() math:min() regular expressions the exslt regular expressions package provides functions that al
low testing, matching, and replacing text using javascript style regular expressions.
... functions set:difference() set:distinct() set:intersection() set:has-same-node() set:leading() set:trailing() strings the exslt strings package provides functions that al
low the manipulation of strings.
Web Audio playbackRate explained - Developer guides
the playbackrate property of the <audio> and <video> elements al
lows us to change the speed, or rate, at which a piece of web audio or video is playing.
... </form> and apply some javascript to it: window.onload = function () { var v = document.getelementbyid("myvideo"); var p = document.getelementbyid("pbr"); var c = document.getelementbyid("currentpbr"); p.addeventlistener('input',function(){ c.innerhtml = p.value; v.playbackrate = p.value; },false); }; finally, we listen for the input event firing on the <input> element, al
lowing us to react to the playback rate control being changed.
... so defaultplaybackrate al
lows us to set the playback rate before playing the media, while playbackrate al
lows us to change it during media playback.
DOM onevent handlers - Developer guides
in order to al
low multiple handlers to be installed for the same event on a given object, you can call its addeventlistener() method, which manages a list of handlers for the given event on the object.
... when an event occurs that applies to an element, each of its event handlers is called to al
low them to handle the event, one after another.
...(the html specification names these: onblur, onerror, onfocus, onload, and onscroll.) event handler's parameters, this binding, and the return value when the event handler is specified as an html attribute, the specified code is wrapped into a function with the fol
lowing parameters: event — for all event handlers except onerror.
Mutation events - Developer guides
performance adding dom mutation listeners to a document profoundly degrades the performance of further dom modifications to that document (making them 1.5 - 7 times s
lower!).
... mutation events list the fol
lowing is a list of all mutation events, as defined in dom level 3 events specification: domattrmodified domattributenamechanged domcharacterdatamodified domelementnamechanged domnodeinserted domnodeinsertedintodocument domnoderemoved domnoderemovedfromdocument domsubtreemodified mutation observers alternatives examples domnoderemovedfromdocument var isdescendant = function (desc, root...
...& (desc === root || isdescendant(desc.parentnode, root)); }; var onremove = function (element, callback) { var observer = new mutationobserver(function (mutations) { _.foreach(mutations, function (mutation) { _.foreach(mutation.removednodes, function (removed) { if (isdescendant(element, removed)) { callback(); // al
low garbage collection observer.disconnect(); observer = undefined; } }); }); }); observer.observe(document, { childlist: true, subtree: true }); }; usage you can register a listener for mutation events using element.addeventlistener as fol
lows: element.addeventlistener("domnodeinserted", functi...
Orientation and motion data explained - Developer guides
the x axis fol
lows along the ground plane, perpendicular to the y axis and positive toward the east (and therefore negative toward the west).
... the y axis fol
lows along the ground plane, and is positive toward true north (that is, the north pole, not magnetic north) and negative toward true south.
...we use
lower-case letters ("x", "y", and "z") to describe the axes of the device coordinate frame.
Localizations and character encodings - Developer guides
to specify that a page is using, for example, the utf-8 character encoding (as per the recommendation), simply place the fol
lowing line in the <head> block: <meta charset="utf-8"> details and browser internals when the encoding is declared by web content like the html specification requires, firefox will use that encoding for turning the bytes into the internal representation.
... finding canonical encoding names the text be
low refers to canonical names of encodings.
...(be sure to use a browser installation that has its settings left to the defaults when investigating!) for locales where firefox has more market share than internet explorer, it's probably best not to change the fallback encoding even if it doesn't fol
low the guidance given above.
Separate sites for mobile and desktop - Developer guides
finally, it also al
lows for completely different user experiences on desktop and mobile — they’re two different sites, after all!
...when it is right to choose this option firstly, if your target audience includes users on older or
low-end feature phones, it is worth noting that you may need to employ this strategy to some degree no matter what.
...approaches to mobile web development see the fol
lowing articles for background and other approaches to developing for mobile platforms.
Printing - Developer guides
using a print style sheet add the fol
lowing to your <head> tag.
...=150'); my_window.document.write('<html><head><title>print me</title></head>'); my_window.document.write('<body onafterprint="self.close()">'); my_window.document.write('<p>when you print this window, it will close afterward.</p>'); my_window.document.write('</body></html>'); } </script> </head> <body> <p>to try out the <code>afterprint</code> event, click the link be
low to open the window to print.
...the fol
lowing is a possible example which will print a file named externalpage.html: <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>mdn example</title> <script type="text/javascript"> function closeprint () { document.body.removechild(this.__container__); } function setprint () { this.contentwindow.__container__ = this; this.contentwindow.o...
HTML attribute: min - HTML: Hypertext Markup Language
-12-25t19:30"> number <number> <input type="number" min="0" step="5" max="100"> range <number> <input type="range" min="60" step="5" max="100"> note: when the data entered by the user doesn't adhere to the min value set, the value is considered invalid in contraint validation and will match the :invalid pseudoclass see client-side validation and rangeunderf
low for more information.
... for the <meter> element, the min attribute defines the
lower numeric bound of the measured range.
... syntax for min values for other elements input type syntax example <meter> <number> <meter id="fuel" min="0" max="100"
low="33" high="66" optimum="80" value="40"> at 40/100</meter> impact on step the value of min and step define what are valid values, even if the step attribute is not included, as step defaults to 0.
HTML attribute: pattern - HTML: Hypertext Markup Language
examples given the fol
lowing: <p> <label>enter your phone number in the format (123)456-7890 (<input name="tel1" type="tel" pattern="[0-9]{3}" placeholder="###" aria-label="3-digit area code" size="2"/>)- <input name="tel2" type="tel" pattern="[0-9]{3}" placeholder="###" aria-label="3-digit prefix" size="2"/> - <input name="tel3" type="tel" pattern="[0-9]{4}" placeholder="####" aria-label="4-digit number" size=...
... the example be
low restricts the value to 4-8 characters and requires that it contain only
lower-case letters.
... <form> <div> <label for="uname">choose a username: </label> <input type="text" id="uname" name="name" required size="45" pattern="[a-z]{4,8}" title="4 to 8
lowercase letters"> <span class="validity"></span> <p>usernames must be
lowercase and 4-8 characters in length.</p> </div> <div> <button>submit</button> </div> </form> div { margin-bottom: 10px; position: relative; } p { font-size: 80%; color: #999; } input + span { padding-right: 30px; } input:invalid+span:after { position: absolute; content: '✖'; padding-left: 5px; } input:valid+span:after { position: absolute; content: '✓'; padding-left: 5px; } this renders like so: accessibility concerns when a control has a pattern attribute, the title attribute, if used, m...
HTML attribute: step - HTML: Hypertext Markup Language
the value can must be a positive number - integer or float -- or the special value any, which means no stepping is implied, and any value is al
lowed (barring other constraints, such as min and max).
... the default stepping value for number inputs is 1, al
lowing only integers to be entered, unless the stepping base is not an integer.
...if providing instructions outside of labels, which al
lows more flexible positioning and design, consider using aria-labelledby or aria-describedby.
<abbr>: The Abbreviation element - HTML: Hypertext Markup Language
content categories f
low content, phrasing content, palpable content permitted content phrasing content tag omission none, both the starting and ending tag are mandatory.
...there are, though, a few cases where it's helpful to do so: when an abbreviation is used and you want to provide an expansion or definition outside the f
low of the document's content, use <abbr> with an appropriate title.
...see the example defining an abbreviation be
low.
Array.prototype.find() - JavaScript
however, you can polyfill array.prototype.find with the fol
lowing snippet: // https://tc39.github.io/ecma262/#sec-array.prototype.find if (!array.prototype.find) { object.defineproperty(array.prototype, 'find', { value: function(predicate) { // 1.
...(inventory.find(ischerries)); // { name: 'cherries', quantity: 5 } using arrow function and destructuring const inventory = [ {name: 'apples', quantity: 2}, {name: 'bananas', quantity: 0}, {name: 'cherries', quantity: 5} ]; const result = inventory.find( ({ name }) => name === 'cherries' ); console.log(result) // { name: 'cherries', quantity: 5 } find a prime number in an array the fol
lowing example finds an element in the array that is a prime number (or returns undefined if there is no prime number): function isprime(element, index, array) { let start = 2; while (start <= math.sqrt(element)) { if (element % start++ < 1) { return false; } } return element > 1; } console.log([4, 6, 8, 12].find(isprime)); // undefined, not found console.log([4, 5, 8, 12].fin...
...d(isprime)); // 5 the fol
lowing examples show that nonexistent and deleted elements are visited, and that the value passed to the callback is their value when visited: // declare array with no elements at indexes 2, 3, and 4 const array = [0,1,,,,5,6]; // shows all indexes, not just those with assigned values array.find(function(value, index) { console.log('visited index ', index, ' with value ', value); }); // shows all indexes, including deleted array.find(function(value, index) { // delete element 5 on first iteration if (index === 0) { console.log('deleting array[5] with value ', array[5]); delete array[5]; } // element 5 is still visited even though deleted console.log('visited index ', index, ' with value ', value); }); // expected output: // deleting array[5] w...
Array.prototype.flatMap() - JavaScript
it is identical to a map() fol
lowed by a flat() of depth 1, but flatmap() is often quite useful, as merging both into one method is slightly more efficient.
...the flatmap method is identical to a map fol
lowed by a call to flat of depth 1.
...in other words, it al
lows you to map many items to many items (by handling each input item separately), rather than always one-to-one.
Array.prototype.indexOf() - JavaScript
you can work around this by utilizing the fol
lowing code at the beginning of your scripts.
... this will al
low you to use indexof() when there is still no native support.
... if (k in o && o[k] === searchelement) return k; } return -1; }; } examples using indexof() the fol
lowing example uses indexof() to locate values in an array.
Array.prototype.lastIndexOf() - JavaScript
you can work around this by inserting the fol
lowing code at the beginning of your scripts, al
lowing use of lastindexof in implementations which do not natively support it.
... examples using lastindexof the fol
lowing example uses lastindexof to locate values in an array.
... var numbers = [2, 5, 9, 2]; numbers.lastindexof(2); // 3 numbers.lastindexof(7); // -1 numbers.lastindexof(2, 3); // 3 numbers.lastindexof(2, 2); // 0 numbers.lastindexof(2, -2); // 0 numbers.lastindexof(2, -1); // 3 finding all the occurrences of an element the fol
lowing example uses lastindexof to find all the indices of an element in a given array, using push to add them to another array as they are found.
Array.prototype.pop() - JavaScript
examples removing the last element of an array the fol
lowing code creates the myfish array containing four elements, then removes its last element.
... var myfish = ['angel', 'c
lown', 'mandarin', 'sturgeon']; var popped = myfish.pop(); console.log(myfish); // ['angel', 'c
lown', 'mandarin' ] console.log(popped); // 'sturgeon' using apply( ) or call ( ) on array-like objects the fol
lowing code creates the myfish array-like object containing four elements and a length parameter, then removes its last element and decrements the length parameter.
... var myfish = {0:'angel', 1:'c
lown', 2:'mandarin', 3:'sturgeon', length: 4}; var popped = array.prototype.pop.call(myfish); //same syntax for using apply( ) console.log(myfish); // {0:'angel', 1:'c
lown', 2:'mandarin', length: 3} console.log(popped); // 'sturgeon' specifications specification ecmascript (ecma-262)the definition of 'array.prototype.pop' in that specification.
Array.prototype.shift() - JavaScript
examples removing an element from an array the fol
lowing code displays the myfish array before and after removing its first element.
... it also displays the removed element: var myfish = ['angel', 'c
lown', 'mandarin', 'surgeon']; console.log('myfish before:', json.stringify(myfish)); // myfish before: ['angel', 'c
lown', 'mandarin', 'surgeon'] var shifted = myfish.shift(); console.log('myfish after:', myfish); // myfish after: ['c
lown', 'mandarin', 'surgeon'] console.log('removed this element:', shifted); // removed this element: angel using shift() method in while loop the shift() method is often used in condition inside while loop.
... in the fol
lowing example every iteration will remove the next element from an array, until it is empty: var names = ["andrew", "edward", "paul", "chris" ,"john"]; while( (i = names.shift()) !== undefined ) { console.log(i); } // andrew, edward, paul, chris, john specifications specification ecmascript (ecma-262)the definition of 'array.prototype.shift' in that specification.
Array.prototype.some() - JavaScript
you can work around this by inserting the fol
lowing code at the beginning of your scripts, al
lowing use of some() in implementations which do not natively support it.
...peerror('array.prototype.some called on null or undefined'); } if (typeof fun !== 'function') { throw new typeerror(); } var t = object(this); var len = t.length >>> 0; for (var i = 0; i < len; i++) { if (i in t && fun.call(thisarg, t[i], i, t)) { return true; } } return false; }; } examples testing value of array elements the fol
lowing example tests whether any element in the array is bigger than 10.
...ts = ['apple', 'banana', 'mango', 'guava']; function checkavailability(arr, val) { return arr.some(arrval => val === arrval); } checkavailability(fruits, 'kela'); // false checkavailability(fruits, 'banana'); // true converting any value to boolean const truthy_values = [true, 'true', 1]; function getboolean(value) { 'use strict'; if (typeof value === 'string') { value = value.to
lowercase().trim(); } return truthy_values.some(function(t) { return t === value; }); } getboolean(false); // false getboolean('false'); // false getboolean(1); // true getboolean('true'); // true specifications specification ecmascript (ecma-262)the definition of 'array.prototype.some' in that specification.
Date.parse() - JavaScript
examples using date.parse() the fol
lowing calls all return 1546300800000.
... the first according to es5 will imply utc time, and the others are specifying utc timezone via the iso date specification (z and +00:00) date.parse("2019-01-01") date.parse("2019-01-01t00:00:00.000z") date.parse("2019-01-01t00:00:00.000+00:00") the fol
lowing call, which does not specify a time zone will be set to 2019-01-01 at 00:00:00 in the local timezone of the system.
... if ipodate is an existing date object, it can be set to august 9, 1995 (local time) as fol
lows: ipodate.settime(date.parse('aug 9, 1995')); some other examples of parsing non-standard date strings: date.parse('aug 9, 1995'); returns 807937200000 in time zone gmt-0300, and other values in other time zones, since the string does not specify a time zone and is not iso format, therefore the time zone defaults to local.
Date - JavaScript
date.prototype.toisostring() converts a date to a string fol
lowing the iso 8601 extended format.
... examples several ways to create a date object the fol
lowing examples show several ways to create javascript dates: note: parsing of date strings with the date constructor (and date.parse, they are equivalent) is strongly discouraged due to browser differences and inconsistencies.
... let date = new date(98, 1) // sun feb 01 1998 00:00:00 gmt+0000 (gmt) // deprecated method; 98 maps to 1998 here as well date.setyear(98) // sun feb 01 1998 00:00:00 gmt+0000 (gmt) date.setfullyear(98) // sat feb 01 0098 00:00:00 gmt+0000 (bst) calculating elapsed time the fol
lowing examples show how to determine the elapsed time between two javascript dates in milliseconds.
Error - JavaScript
see be
low for standard built-in error types.
... see "what's a good way to extend error in javascript?" on stackoverf
low for an in-depth discussion.
...otherwise, old versions of babel and other transpilers will not correctly handle the fol
lowing code without additional configuration.
Function.caller - JavaScript
the special property __caller__, which returned the activation object of the caller thus al
lowing to reconstruct the stack, was removed for security reasons.
...consider: function f(n) { g(n - 1); } function g(n) { if (n > 0) { f(n); } else { stop(); } } f(2); at the moment stop() is called the call stack will be: f(2) -> g(1) -> f(1) -> g(0) -> stop() the fol
lowing is true: stop.caller === g && f.caller === g && g.caller === f so if you tried to get the stack trace in the stop() function like this: var f = stop; var stack = 'stack trace:'; while (f) { stack += '\n' + f.name; f = f.caller; } the loop would never stop.
... examples checking the value of a function's caller property the fol
lowing code checks the value a function's caller property.
Function.name - JavaScript
" you can define a function with a name in a function expression: let object = { somemethod: function object_somemethod() {} }; console.log(object.somemethod.name); // logs "object_somemethod" try { object_somemethod } catch(e) { console.log(e); } // referenceerror: object_somemethod is not defined the name property is read-only and cannot be changed by the assigment operator: example be
low contradicts with what is said at the beginning of this section and doesn't work as described.
... let o = { get foo(){}, set foo(x){} }; var descriptor = object.getownpropertydescriptor(o, "foo"); descriptor.get.name; // "get foo" descriptor.set.name; // "set foo"; function names in classes you can use obj.constructor.name to check the "class" of an object (but be sure to read the warnings be
low): function foo() {} // es2015 syntax: class foo {} var fooinstance = new foo(); console.log(fooinstance.constructor.name); // logs "foo" warning: the script interpreter will set the built-in function.name property only if a function does not have an own property called name (see section 9.2.11 of the ecmascript2015 language specification).
...above class definition in es2015 syntax will behave in chrome or firefox similar to the fol
lowing snippet in es5 syntax: function foo() {} object.defineproperty(foo, 'name', { writable: true }); foo.name = function() {}; trying to obtain the class of fooinstance via fooinstance.constructor.name won't give us the class name at all but a reference to the static class method.
Intl.DateTimeFormat.prototype.format() - JavaScript
however, this might change in the future and isn't guaranteed for all the languages — output variations are by design and al
lowed by the specification.
... most notably, the ie and edge browsers insert bidirectional control characters around dates, so the output text will f
low properly when concatenated with other text.
...esults of format() to a static value: let d = new date("2019-01-01t00:00:00.000000z"); let formatteddate = intl.datetimeformat(undefined, { year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric' }).format(d); "1.1.2019, 01:00:00" === formatteddate; // true in firefox and others // false in ie and edge note: see also this stackoverf
low thread for more details and examples.
Intl.ListFormat() constructor - JavaScript
an object with some or all of the fol
lowing properties: localematcher the locale matching algorithm to use.
...when style is short or narrow, unit is the only al
lowed value for the type option.
... examples using format the fol
lowing example shows how to create a list formatter using the english language.
Intl.NumberFormat() constructor - JavaScript
the fol
lowing unicode extension key is al
lowed: nu the numbering system to be used.
... options optional an object with some or all of the fol
lowing properties: compactdisplay only used when notation is "compact".
... the fol
lowing properties fall into two groups: minimumintegerdigits, minimumfractiondigits, and maximumfractiondigits in one group, minimumsignificantdigits and maximumsignificantdigits in the other.
How to make PWAs re-engageable using Notifications and Push - Progressive web apps (PWAs)
al
lowing the user to install the web app on their home screen is even better.
... from the server-side, the whole process has to be encrypted with public and private keys for security reasons — al
lowing everyone to send push messages unsecured using your app would be a terrible idea.
...you can use the fol
lowing ones:"); console.log(webpush.generatevapidkeys()); return; } webpush.setvapiddetails( 'https://serviceworke.rs/', process.env.vapid_public_key, process.env.vapid_private_key ); next, a module defines and exports all the routes an app needs to handle: getting the vapid public key, registering, and then sending notifications.
Graphic design for responsive sites - Progressive web apps (PWAs)
css media queries al
low us to serve different css rules dependant on viewport dimensions, and you should consider using mobile first media queries where possible.
... high res and
low res image copies one option here is to create a hi res and a
low res set of images, then use resolution media queries to serve the hi res images only to hi res devices.
... css as well as adding programmatic graphical effects to links (and anywhere else you might want them), css3 also al
lows you to write declarative animations and transitions.
Web API reference - Web technology reference
document object model the dom is an api that al
lows access to and modification of the current document.
... it al
lows manipulation of document node and element.
... device apis this set of apis al
lows access to various hardware features available to web pages and applications.
Applying SVG effects to HTML content - SVG: Scalable Vector Graphics
example: masking for example, you can make a gradient mask for html content using svg and css code similar to the fol
lowing, inside your html document: <svg height="0"> <mask id="mask-1"> <lineargradient id="gradient-1" y2="1"> <stop stop-color="white" offset="0"/> <stop stop-opacity="0" offset="1"/> </lineargradient> <circle cx="0.25" cy="0.25" r="0.25" id="circle" fill="white"/> <rect x="0.5" y="0.2" width="300" height="100" fill="url(#gradient-1)"/> </mask> </svg> .target { m...
...ask: url(#mask-1); } p { width: 300px; border: 1px solid #000; display: inline-block; } note that in the css, the mask is specified using a url to the id #mask-1, which is the id of the svg mask specified be
low it.
...ponent="10" lighting-color="white"> <fepointlight x="-5000" y="-10000" z="20000"/> </fespecularlighting> </filter> <filter id="f5"> <fecolormatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 1 0 0 0" style="color-interpolation-filters:srgb"/> </filter> </svg> the five filters are applied using the fol
lowing css: p.target { filter:url(#f3); } p.target:hover { filter:url(#f5); } b.target { filter:url(#f1); } b.target:hover { filter:url(#f4); } pre.target { filter:url(#f2); } pre.target:hover { filter:url(#f3); } view this example live example: blurred text in order to blur text, webkit based browsers have a (prefixed) css filter called blur (see also css filter).
SVG Core Attributes - SVG: Scalable Vector Graphics
value: any valid language id; animatable: no tabindex the tabindex svg attribute al
lows you to control whether an element is focusable and to define the relative order of the element for the purposes of sequential focus navigation.
... value type: <iri>; animatable: no xml:lang it is a universal attribute al
lowed in all xml dialects to mark up the natural human language that an element contains.
... it's almost identical in usage to html's lang, but in conforming xml 1.0 documents, it does not al
low the use of a null attribute value (xml:lang="") to indicate an unknown language.
class - SVG: Scalable Vector Graphics
white space in lists is defined as one or more of the fol
lowing consecutive characters: "space" (u+0020), "tab" (u+0009), "line feed" (u+000a), "carriage return" (u+000d), and "form-feed" (u+000c).
... the fol
lowing is a template for an ebnf grammar describing the <list-of-ts> syntax: list-of-ts ::= t | t, list-of-ts within the svg dom, values of a <list-of-ts> type are represented by an interface specific for the particular type t.
... } circle.circleclass { stroke: #006600; fill: #cc0000; } ]]> </style> <rect class="rectclass" x="10" y="10" width="100" height="100"/> <circle class="circleclass" cx="40" cy="50" r="26"/> </svg> </body> </html> elements the fol
lowing elements can use the class attribute: <a> <altglyph> <circle> <clippath> <defs> <desc> <ellipse> <feblend> <fecolormatrix> <fecomponenttransfer> <fecomposite> <feconvolvematrix> <fediffuselighting> <fedisplacementmap> <feflood> <fegaussianblur> <feimage> <femerge> <femorphology> <feoffset> <fespecularlighting> <fetile> <feturbulence> <filter> <font> <foreignobject>...
clip-rule - SVG: Scalable Vector Graphics
the fol
lowing fragment of code will cause an evenodd clipping rule to be applied to the clipping path because clip-rule is specified on the <path> element that defines the clipping shape: <g> <clippath id="myclip"> <path d="..." clip-rule="evenodd" /> </clippath> <rect clip-path="url(#myclip)" ...
... /> </g> whereas the fol
lowing fragment of code will not cause an evenodd clipping rule to be applied because the clip-rule is specified on the referencing element, not on the object defining the clipping shape: <g> <clippath id="myclip"> <path d="..." /> </clippath> <rect clip-path="url(#myclip)" clip-rule="evenodd" ...
...-> <clippath id="emptystar"> <use xlink:href="#star" clip-rule="evenodd" /> </clippath> <rect clip-path="url(#emptystar)" width="50" height="90" fill="blue" /> <!-- right: nonzero --> <clippath id="filledstar"> <use xlink:href="#star" clip-rule="nonzero" /> </clippath> <rect clip-path="url(#filledstar)" width="50" height="90" x="50" fill="red" /> </svg> elements the fol
lowing elements can use the clip-rule attribute, but only if they are inside a <clippath> element.
display - SVG: Scalable Vector Graphics
html, body, svg { height: 100%; } <svg viewbox="0 0 220 100" xmlns="http://www.w3.org/2000/svg"> <!-- here the yel
low rectangle is displayed --> <rect x="0" y="0" width="100" height="100" fill="skyblue"></rect> <rect x="20" y="20" width="60" height="60" fill="yel
low"></rect> <!-- here the yel
low rectangle is not displayed --> <rect x="120" y="0" width="100" height="100" fill="skyblue"></rect> <rect x="140" y="20" width="60" height="60" fill="yel
low" display="none"></rect> </svg> usage notes ...
... default value inline value [ <display-outside> | <display-inside> ] | <display-listitem> | <display-internal> | <display-box> | <display-legacy>where <display-outside> = block | inline | run-in<display-inside> = f
low | f
low-root | table | flex | grid | ruby<display-listitem> = <display-outside>?
... && [ f
low | f
low-root ]?
pointer-events - SVG: Scalable Vector Graphics
the pointer-events attribute is a presentation attribute that al
lows defining whether or when an element may be the target of a mouse event.
... to change the color of the rect underneath you have to click outside the circle --> <rect x="0" y="0" height="10" width="10" fill="black" /> <circle cx="5" cy="5" r="4" fill="white" pointer-events="visiblepoint" /> <!-- the circle be
low will never catch a mouse event.
...between #000000 and #ffffff const color = math.round(math.random() * 0xffffff) // let's format the color to fit css requirements const fill = '#' + color.tostring(16).padstart(6,'0') // 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 fol
lowing 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 ...
writing-mode - SVG: Scalable Vector Graphics
as a presentation attribute, it can be applied to any element but it has effect only on the fol
lowing five elements: <altglyph>, <text>, <textpath>, <tref>, and <tspan> usage notes default value horizontal-tb value horizontal-tb | vertical-rl | vertical-lr animatable yes horizontal-tb this value defines a top-to-bottom block f
low direction.
... vertical-rl this value defines a right-to-left block f
low direction.
... vertical-lr this value defines a left-to-right block f
low direction.
<circle> - SVG: Scalable Vector Graphics
a value
lower or equal to zero disables rendering of the circle.
...fset, stroke-linecap, stroke-linejoin, stroke-miterlimit, stroke-opacity, stroke-width, transform, vector-effect, visibility aria attributes aria-activedescendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-f
lowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, ari...
...a-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the fol
lowing elements, in any order:animation elementsdescriptive elements specifications specification status comment scalable vector graphics (svg) 2the definition of '<circle>' in that specification.
<symbol> - SVG: Scalable Vector Graphics
fset, stroke-linecap, stroke-linejoin, stroke-miterlimit, stroke-opacity, stroke-width, transform, vector-effect, visibility aria attributes aria-activedescendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-f
lowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, ari...
...a-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriescontainer element, structural elementpermitted contentany number of the fol
lowing 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.
... candidate recommendation al
lowed geometry properties to be specified on a symbol scalable vector graphics (svg) 1.1 (second edition)the definition of '<symbol>' in that specification.
<tspan> - SVG: Scalable Vector Graphics
it al
lows for adjustment of the style and/or position of that subtext as needed.
...linecap, stroke-linejoin, stroke-miterlimit, stroke-opacity, stroke-width, text-anchor, transform, vector-effect, visibility aria attributes aria-activedescendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-f
lowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, ari...
...a-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriestext content element, text content child elementpermitted contentcharacter data and any number of the fol
lowing elements, in any order:descriptive elements<a>, <altglyph>, <animate>, <animatecolor>, <set>, <tref>, <tspan> specifications specification status comment scalable vector graphics (svg) 2the definition of '<tspan>' in that specification.
<use> - SVG: Scalable Vector Graphics
however, xlink:href can still be required in practice for cross-browser compatibility (see the compatibility table be
low).
...fset, stroke-linecap, stroke-linejoin, stroke-miterlimit, stroke-opacity, stroke-width, transform, vector-effect, visibility aria attributes aria-activedescendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-f
lowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, ari...
...a-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role xlink attributes xlink:href, xlink:title usage notes categoriesgraphics element, graphics referencing element, structural elementpermitted contentany number of the fol
lowing elements, in any order:animation elementsdescriptive elements specifications specification status comment scalable vector graphics (svg) 2the definition of '<use>' in that specification.
Basic Transformations - SVG: Scalable Vector Graphics
an example: <svg width="30" height="10"> <g fill="red"> <rect x="0" y="0" width="10" height="10" /> <rect x="20" y="0" width="10" height="10" /> </g> </svg> all fol
lowing transformations are summed up in an element's transform attribute.
...that means, the units you specify for the element and its children might not fol
low the 1:1 pixel mapping, but are also distorted, skewed, translated and scaled according to the transformation.
... embedding svg in svg in contrast to html, svg al
lows you to embed other svg elements seamlessly.
Creating Dialogs - Archive of obsolete content
the fol
lowing values may be used, seperated by commas: accept - an ok button cancel - a cancel button help - a help button disclosure - a disclosure button, which is used for showing more information you can set code to execute when the buttons are pressed using the ondialogaccept, ondialogcancel, ondialoghelp and ondialogdisclosure attributes.
...<script> function dosave(){ //dosomething() return true; } function docancel(){ return true; } </script> <dialogheader title="my dialog" description="example dialog"/> <groupbox flex="1"> <caption label="select favourite fruit"/> <radio id="orange" label="oranges because they are fruity"/> <radio id="violet" selected="true" label="strawberries because of their colour"/> <radio id="yel
low" label="bananas because they are pre-packaged"/> </groupbox> </dialog> the buttons elements can be accessed with the fol
lowing javascript // the accept button var acceptbutt = document.documentelement.getbutton("accept") more examples more examples in dialogs and prompts (code snippets).
Creating an Installer - Archive of obsolete content
these are described step by step be
low.
... our find files example for the find files dialog, we'll create a structure in the archive much like the fol
lowing: install.js findfile content contents.rdf findfile.xul findfile.js skin contents.rdf findfile.css locale contents.rdf findfile.dtd a directory has been added for each part of the package, the content, the skin and the locale.
Grids - Archive of obsolete content
however, the grid al
lows either row or column based organization so you may put content in either rows or in columns.
...the fol
lowing example demonstrates this: example 4 : source view <grid flex="1"> <columns> <column flex="5"/> <column/> <column/> </columns> <rows> <row flex="10"> <button label="cherry"/> <button label="lemon"/> <button label="grape"/> </row> <row flex="1"> <button label="strawberry"/> <button label="raspberry"/> <button label="peach"/> </row> </rows> </grid> t...
Introduction to XBL - Archive of obsolete content
the fol
lowing example shows the basic skeleton of an xbl file: <?xml version="1.0"?> <bindings xmlns="http://www.mozilla.org/xbl"> <binding id="binding1"> <!-- content, property, method and event descriptions go here --> </binding> <binding id="binding2"> <!-- content, property, method and event descriptions go here --> </binding> </bindings> the bindings element is the root element of an x...
...the fol
lowing example demonstrates this.
Progress Meters - Archive of obsolete content
determinate progress meter: indeterminate progress meter: the progress meter has the fol
lowing syntax: <html:progress id="identifier" mode="determined" value="50" max="100"/> the attributes are as fol
lows: id the unique identifer of the progress meter mode the type of the progress meter.
...do this by adding the be
low line to your opening window tag in the findfile.xul.
Property Files - Archive of obsolete content
an example is shown be
low: notfoundalert=no files were found matching the criteria.
...var dir = "/usr/local/document"; var count = 10; var strbundle = document.getelementbyid("strings"); var result = strbundle.getformattedstring("resultmessage", [ dir, count ]); alert(result); this example will display fol
lowing message in an alert box.
Scrolling Menus - Archive of obsolete content
mozilla will provide a scrolling mechanism that will al
low you to scroll through the items.
...example - scrolling list of buttons the fol
lowing example shows how to create a scrolling list of buttons (you will need to resize the window to see the arrow buttons): example 1 : source view <arrowscrollbox orient="vertical" flex="1"> <button label="red"/> <button label="blue"/> <button label="green"/> <button label="yel
low"/> <button label="orange"/> <button label="silver"/> <button label="lavender"/> <button label="gold"/>...
assign - Archive of obsolete content
inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
bbox - Archive of obsolete content
examples (example needed) attributes inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, to...
...p, uri, wait-cursor, width properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbyt...
binding - Archive of obsolete content
properties object, predicate, subject examples fixme: (example needed) attributes inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
... inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlisten...
bindings - Archive of obsolete content
examples (example needed) attributes inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
... properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlist...
box - Archive of obsolete content
examples <box orient="horizontal"> <label value="zero"/> <box orient="vertical"> <label value="one"/> <label value="two"/> </box> <box orient="horizontal"> <label value="three"/> <label value="four"/> </box> </box> attributes inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
broadcaster - Archive of obsolete content
examples (example needed) attributes inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
broadcasterset - Archive of obsolete content
examples (example needed) attributes inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, temp...
...late, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelement...
caption - Archive of obsolete content
crop type: one of the values be
low if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute.
...for example, for a menuitem in a menu you can add the fol
lowing css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } image type: uri the uri of the image to appear on the element.
column - Archive of obsolete content
attributes inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
columns - Archive of obsolete content
attributes inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
commandset - Archive of obsolete content
valid events are listed be
low, or you can use your own events.
... properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlist...
conditions - Archive of obsolete content
examples (example needed) attributes inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
deck - Archive of obsolete content
inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
... inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlist...
dropmarker - Archive of obsolete content
examples properties accessibletype attributes inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
... inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, f...
grid - Archive of obsolete content
<textbox id="user"/> </row> <row> <label value="group"/> <menulist> <menupopup> <menuitem label="accounts"/> <menuitem label="sales" selected="true"/> <menuitem label="support"/> </menupopup> </menulist> </row> </rows> </grid> </groupbox> attributes inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
grippy - Archive of obsolete content
examples (example needed) attributes inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, styl...
...e, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, get...
groupbox - Archive of obsolete content
properties accessibletype examples <groupbox> <caption label="settings"/> <radiogroup> <radio label="black and white"/> <radio label="colour"/> </radiogroup> <checkbox label="enabled"/> </groupbox> attributes inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
... inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, f...
hbox - Archive of obsolete content
example <!-- two button on the right --> <hbox> <spacer flex="1"/> <button label="connect"/> <button label="ping"/> </hbox> attributes inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
listcol - Archive of obsolete content
ox> <listhead> <listheader label="first"/> <listheader label="last"/> </listhead> <listcols> <listcol flex="1"/> <listcol/> </listcols> <listitem> <listcell label="buck"/> <listcell label="rogers"/> </listitem> <listitem> <listcell label="john"/> <listcell label="painter"/> </listitem> </listbox> attributes inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
listcols - Archive of obsolete content
example <!-- creates a two column listbox --> <listbox> <listcols> <listcol flex="1"/> <listcol flex="1"/> </listcols> <listitem> <listcell label="buck"/> <listcell label="rogers"/> </listitem> <listitem> <listcell label="john"/> <listcell label="painter"/> </listitem> </listbox> attributes inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
member - Archive of obsolete content
properties child, container examples (example needed) attributes inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
... inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlist...
notification - Archive of obsolete content
type type: one of the values be
low indicates the type of notification, determined from the priority.
... value type: string the string attribute al
lows you to associate a data value with an element.
observes - Archive of obsolete content
inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
page - Archive of obsolete content
examples (example needed) attributes inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width ...
... properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagna...
popupset - Archive of obsolete content
examples <popupset> <menupopup id="clipmenu"> <menuitem label="cut"/> <menuitem label="copy"/> <menuitem label="paste"/> </menupopup> </popupset> <label value="right click for popup" context="clipmenu"/> attributes inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
prefpane - Archive of obsolete content
using multiple prefpanes note that when using multiple prefpanes in the same prefwindow, you must not put the <script> elements above the prefpane elements, but instead be
low them.
...place the <script> tags as in the fol
lowing example for preference dialogs to work correctly: <prefwindow> <prefpane id="panegeneral" label="general"> ...
query - Archive of obsolete content
inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
queryset - Archive of obsolete content
attributes inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties in...
...herited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, get...
row - Archive of obsolete content
attributes inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
script - Archive of obsolete content
inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
scrollbar - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] when a container's contents which are larger that the size of the container, scroll bars may be placed at the side of the container to al
low the user to scroll around in the container.
... properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlist...
scrollcorner - Archive of obsolete content
examples (example needed) attributes inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width pro...
...perties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), ...
spacer - Archive of obsolete content
examples <box> <button label="left"/> <spacer flex="1"/> <button label="right"/> </box> attributes inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
spinbuttons - Archive of obsolete content
attributes inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
stack - Archive of obsolete content
--> </hbox> </stack> attributes inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
statusbar - Archive of obsolete content
properties accessibletype examples <statusbar> <statusbarpanel label="left panel"/> <spacer flex="1"/> <progressmeter mode="determined" value="82"/> <statusbarpanel label="right panel"/> </statusbar> attributes inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
... inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus...
stringbundle - Archive of obsolete content
for example, the fol
lowing defines two properties: message.displayerror=an error occured trying to display this message message.namealreadyused=the name %s is already being used by another account.
... inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
tabpanel - Archive of obsolete content
examples (example needed) attributes inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, st...
...atustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyat...
template - Archive of obsolete content
inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
textnode - Archive of obsolete content
inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
toolbargrippy - Archive of obsolete content
properties accessible examples (example needed) attributes inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
... inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute...
toolbaritem - Archive of obsolete content
s" selected="true"/> <menuitem label="train"/> </menupopup> </menulist> </toolbaritem> <toolbaritem id="sample-toolbutton-unified"> <toolbarbutton id="myext-button1" class="toolbarbutton-1" label="label1" /> <toolbarbutton id="myext-button2" class="toolbarbutton-1" label="labe2l" /> </toolbaritem> attributes inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
toolbarpalette - Archive of obsolete content
examples <toolbarpalette id="browsertoolbarpalette"> <toolbarbutton id="toolbarpalette-button" class="toolbarbutton-class" label="&mylabel;" tooltiptext="&mytiptext;" oncommand="somefunction()"/> </toolbarpalette> attributes inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
toolbarseparator - Archive of obsolete content
properties accessibletype examples <toolbox> <toolbar> <toolbarbutton label="button 1"/> <toolbarseparator /> <toolbarbutton label="button 2"/> </toolbar> </toolbox> attributes inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
... inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus,...
toolbarset - Archive of obsolete content
examples (example needed) attributes inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait...
...-cursor, width properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getele...
toolbarspacer - Archive of obsolete content
properties accessibletype examples (example needed) attributes inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties ...
... inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattr...
toolbarspring - Archive of obsolete content
properties accessibletype examples (example needed) attributes inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width p...
... inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), gete...
treechildren - Archive of obsolete content
inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
treecols - Archive of obsolete content
inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
... inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, f...
treerow - Archive of obsolete content
inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
treeseparator - Archive of obsolete content
inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
triple - Archive of obsolete content
inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
vbox - Archive of obsolete content
example <!-- two labels at bottom --> <vbox> <spacer flex="1"/> <label value="one"/> <label value="two"/> </vbox> attributes inherited from xul element align, al
lowevents, al
lownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , al
lowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
Building XULRunner - Archive of obsolete content
please read and fol
low the general build documentation for instructions on how to get sources and set up build prerequisites.
... a basic minimal mozconfig which will build a release configuration of xulrunner is: mk_add_options moz_co_project=xulrunner mk_add_options moz_objdir=@topsrcdir@/obj-xulrunner ac_add_options --enable-application=xulrunner #uncomment the fol
lowing line if you don't want to build javaxpcom: #ac_add_options --disable-javaxpcom cvs tags and xulrunner versions older xulrunner releases where tagged in cvs with (for instance xulrunner_1_8_0_5_release ) up to version 1.8.0.5 the cvs repository does not have specific tags for xulrunner anymore.
Using SOAP in XULRunner 1.9 - Archive of obsolete content
after some experimentation, the fol
lowing seems to be the best way to speak soap in xulrunner.
...(there is a diff be
low.) you'll need: sasoapclient.js saxmlutils.js making a soap call var url = 'http://example.com/soap/'; var ns = 'http://example.com/soap/namespace'; var method = 'foo'; var params = { 'foo': 'bar', 'baz': 'bang' }; var callback = function(obj) { components.utils.reporterror(obj.tosource()); }; soapclient.proxy = url; var body = new soapobject(method); body.ns = ns; for (var k in par...
What XULRunner Provides - Archive of obsolete content
the fol
lowing features are either already implemented or planned: gecko features xpcom networking gecko rendering engine dom editing and transaction support (no ui) cryptography xbl (xbl2 planned) xul svg xslt xml extras (xmlhttprequest, domparser, etc.) web services (soap) auto-update support (not yet complete) type ahead find toolbar history implementation (the places implementation in the 1.9 cycle) accessibility support ipc services for communication between gecko-based apps (not yet complete) storage/sqlite interfaces user interface features the fol
lowing user interface is supplied by xu...
... extension manager file picker (uses native os filepicker as appropriate) find toolbar helper app dialog/ui security ui (maintenance of ssl keychains, etc) embedding apis the fol
lowing embedding apis are provided by xulrunner: cross-platform embedding (xre_initembedding) javaxpcom embedding gtkmozembed (linux only) activex control (windows only) (not yet complete) obsolete since gecko 7.0 nsview-based-widget (mac os x only) (not yet complete) the "maybe" list the fol
lowing features have been discussed and may be included if developer time permits and code size is controlled...
calICalendarViewController - Archive of obsolete content
implementing a calicalendarviewcontroller al
lows for these actions to be performed in a manner consistent with the rest of the application in which the calicalendarview is included.
...otherwise, a dialog should be display al
lowing the user to modify the fields.
2006-10-27 - Archive of obsolete content
these were the fol
lowing choices stated: search the filesystem for unneeded files delete or archive them, add a hard disk, move all or part of the concerned filesystem there move that tinderbox to a different machine with more empty disk space on october 23rd: nick responded to gavin and tony's posting.
...the fol
lowing is his configuration script that he used to build firefox 2 on solaris.
2006-11-24 - Archive of obsolete content
he is using make 3.80, working with the source tarball for xulrunner 1.8.4,running "make -f client.mk distclean" fol
lowed by "make -f client.mk build_all".
...he is receiving the fol
lowing error: error: uncaught exception: [exception...
2006-10-06 - Archive of obsolete content
preed fol
lowed up and said that the checker was run and "build is go for launch".
...dbaron then fol
lows up that bug 354835 is solved so there is no need to close the tree waiting for it.
2006-11-10 - Archive of obsolete content
william vanderpol asks, regarding remote xul applications, if is it possible (or does it exist?) to have an extension that will al
low chrome access to certain specified url's?
...benjamin smedberg has been "working on some xptcall refactoring which will al
low us to expose xptcall via a frozen api (and c linkage)".
JS-Engine FAQ - Archive of obsolete content
to write wrappers in pure javascript to interface with any c library on the system there are mechanisms such as xpcshell, wxjs, jsdb, jsni coding spidermonkey in c check out this tutorial how to compile tamarin on linux/x86 there is a patch that al
lows you to compile it.
... rhino what is the performance between rhino js and native java rhino js is significantly s
lower in run-time than native java.
Monitoring plugins - Archive of obsolete content
be
low are a number of javascript snippets that would be useful to developers trying to use this feature: registration to register for runtime notifications with the observer service you must create a class with an observe method which receives 3 parameters (subject, topic and data) as well as a register method that contains the fol
lowing code: var observerservice = components.classes["@mozilla.org...
... clean up to unregister your class with the observer service - when you no longer want to be listening to runtime notifications - your class must include an unregister method that contains the fol
lowing code: var observerservice = components.classes["@mozilla.org/observer-service;1"] .getservice(components.interfaces.nsiobserverservice); observerservice.removeobserver(this, "experimental-notify-plugin-call"); skeleton observer class be
low is a skeleton class that you may use to listen to runtime notifications: function pluginobserver() { this.registered...
NPN_GetAuthenticationInfo - Archive of obsolete content
st, int32_t port, const char *scheme, const char *realm, char **username, uint32_t *ulen, char **password, uint32_t *plen); parameters this function has the fol
lowing parameters: instance pointer to the current plug-in instance protocol protocol name (uri scheme) host host name port port number scheme http authentication scheme name realm http authentication realm username out parameter.
...this function al
lows the plugin to ask the browser for http authentication information for a domain.
stop-opacity - SVG: Scalable Vector Graphics
as a presentation attribute, it can be applied to any element but it has effect only on the fol
lowing element: <stop> usage notes value <opacity-value> default value 1 animatable yes <opacity-value> this value is either a <number> between 0 and 1 or a <percentage> value specifying the opacity of the color gradient stop.
... candidate recommendation refers to the definition in css colors 3, but al
lows percentage values.
stroke-dashoffset - SVG: Scalable Vector Graphics
as a presentation attribute, it can be applied to any element but it has effect only on the fol
lowing twelve elements: <altglyph>, <circle>, <ellipse>, <path>, <line>, <polygon>, <polyline>, <rect>, <text>, <textpath>, <tref>, and <tspan> html,body,svg { height:100% } <svg viewbox="-3 0 33 10" xmlns="http://www.w3.org/2000/svg"> <!-- no dash array --> <line x1="0" y1="1" x2="30" y2="1" stroke="black" /> <!-- no dash offset --> <line x1="0" y1="3" x2="30" y2="3" stroke="black" stroke-dasharray="3 1" /> <!-- the start of the dash array computation is pulle...
...> <line x1="0" y1="7" x2="30" y2="7" stroke="black" stroke-dasharray="3 1" stroke-dashoffset="-3" /> <!-- the start of the dash array computation is pulled by 1 user units which ends up in the same rendering as the previous example --> <line x1="0" y1="9" x2="30" y2="9" stroke="black" stroke-dasharray="3 1" stroke-dashoffset="1" /> <!-- the fol
lowing red lines highlight the offset of the dash array for each line --> <path d="m0,5 h-3 m0,7 h3 m0,9 h-1" stroke="rgba(255,0,0,.5)" /> </svg> usage notes value <percentage> | <length> default value 0 animatable yes the offset is usually expressed in user units resolved against the pathlength but if a <percentage> is used, the value is resolve...
stroke-miterlimit - SVG: Scalable Vector Graphics
as a presentation attribute, it can be applied to any element but it has effect only on the fol
lowing nine elements: <altglyph>, <path>, <polygon>, <polyline>, <rect>, <text>, <textpath>, <tref>, and <tspan> html,body,svg { height:100% } <svg viewbox="0 0 38 30" xmlns="http://www.w3.org/2000/svg"> <!-- impact of the default miter limit --> <path stroke="black" fill="none" stroke-linejoin="miter" id="p1" d="m1,9 l7 ,-3 l7 ,3 m2,0 l3.5 ,-3 l3.5 ,3 m2,0 ...
... m2, 0 l0.75,-3 l0.75,3 m2, 0 l0.5 ,-3 l0.5 ,3" /> <!-- impact of a large miter limit (8) --> <path stroke="black" fill="none" stroke-linejoin="miter" stroke-miterlimit="8" id="p3" d="m1,29 l7 ,-3 l7 ,3 m2, 0 l3.5 ,-3 l3.5 ,3 m2, 0 l2 ,-3 l2 ,3 m2, 0 l0.75,-3 l0.75,3 m2, 0 l0.5 ,-3 l0.5 ,3" /> <!-- the fol
lowing pink lines highlight the position of the path for each stroke --> <path stroke="pink" fill="none" stroke-width="0.05" d="m1, 9 l7,-3 l7,3 m2,0 l3.5,-3 l3.5,3 m2,0 l2,-3 l2,3 m2,0 l0.75,-3 l0.75,3 m2,0 l0.5,-3 l0.5,3 m1,19 l7,-3 l7,3 m2,0 l3.5,-3 l3.5,3 m2,0 l2,-3 l2,3 m2,0 l0.75,-3 l0.75,3 m2,0 l0.5,-3 l0.5,3 m1,29 l7,-3 l7,3 m2,0 l3.5,-3 l3.5,3 m2,0 l2,-3 l2,3 ...
stroke-opacity - SVG: Scalable Vector Graphics
as a presentation attribute, it can be applied to any element but it has effect only on the fol
lowing twelve elements: <altglyph>, <circle>, <ellipse>, <path>, <line>, <polygon>, <polyline>, <rect>, <text>, <textpath>, <tref>, and <tspan> html,body,svg { height:100% } <svg viewbox="0 0 40 10" xmlns="http://www.w3.org/2000/svg"> <!-- default stroke opacity: 1 --> <circle cx="5" cy="5" r="4" stroke="green" /> <!-- stroke opacity as a number --> <circle cx="15" cy="5" r="4" stroke="green" stroke-opacity="0.7" /> <!-- stroke op...
...city="50%" /> <!-- stroke opacity as a css property --> <circle cx="35" cy="5" r="4" stroke="green" style="stroke-opacity: .3;" /> </svg> usage notes value [0-1] | <percentage> default value 1 animatable yes note: svg2 introduces percentage values for stroke-opacity, however, it is not widely supported yet (see browser compatibility be
low) as a consequence, it is best practices to set opacity with a value in the range [0-1].
systemLanguage - SVG: Scalable Vector Graphics
the attribute evaluates to "true" if one of the language tags indicated by user preferences is a case-insensitive match or prefix (fol
lowed by a "-") of one of the language tags given in the value of this parameter.
... the prefix rule simply al
lows the use of prefix tags if this is the case.
type - SVG: Scalable Vector Graphics
the other keywords represent convenience shortcuts to al
low commonly used color operations to be performed without specifying a complete matrix.
...ories none value fractalnoise | turbulence animatable yes normative document svg 1.1 (2nd edition) for the <style> and <script> elements categories none value <content-type> animatable no normative document svg 1.1 (2nd edition) : script svg 1.1 (2nd edition) : style example elements the fol
lowing elements can use the values attribute <animatetransform> <fecolormatrix> <fefunca> <fefuncb> <fefuncg> <fefuncr> <feturbulence> <script> <style> ...
visibility - SVG: Scalable Vector Graphics
as a presentation attribute, it can be applied to any element but it has effect only on the fol
lowing nineteen elements: <a>, <altglyph>, <audio>, <canvas>, <circle>, <ellipse>, <foreignobject>, <iframe>, <image>, <line>, <path>, <polygon>, <polyline>, <rect>, <text>, <textpath>, <tref>, <tspan>, <video> html, body, svg { height: 100%; } <svg viewbox="0 0 220 120" xmlns="http://www.w3.org/2000/svg"> <rect x="10" y="10" width="200" height="100" stroke="black" stroke-width="5" fil...
... example the fol
lowing example toggles the css visibility of the svg image path.
widths - SVG: Scalable Vector Graphics
the widths attribute indicates a list of range values, each fol
lowed by one or more glyph widths.
... only one element is using this attribute: <font-face> usage notes value <number> default value none animatable no <number> this value is a comma-separated list of ucs range values as defined in iso 10646, each fol
lowed by one or more glyph widths.
x-height - SVG: Scalable Vector Graphics
the x-height attribute indicates the height of
lowercase glyphs in the font within the font coordinate system.
... only one element is using this attribute: <font-face> usage notes value <number> default value none animatable no <number> this value indicates the height of
lowercase glyphs.
xml:lang - SVG: Scalable Vector Graphics
it is a universal attribute al
lowed in all xml dialects to mark up the natural human language that an element contains.
... the most common syntax is a value formed by a
lowercase two-character part for the language and an uppercase two-character part for the region or country, separated by a minus sign, e.g.
<animateTransform> - SVG: Scalable Vector Graphics
the animatetransform element animates a transformation attribute on its target element, thereby al
lowing animations to control translation, scaling, rotation, and/or skewing.
... usage context categoriesanimation elementpermitted contentany number of the fol
lowing elements, in any order:descriptive elements example <svg width="120" height="120" viewbox="0 0 120 120" xmlns="http://www.w3.org/2000/svg"> <polygon points="60,30 90,90 30,90"> <animatetransform attributename="transform" attributetype="xml" type="rotate" from="0 60 70" to="360 60 70" dur="10s" repeatcount="indefinite"/> </polygon> </svg> live sample attributes global attributes conditional processing attributes » core attributes » animation event attributes » xlink attributes » animation attribute target attribut...
<color-profile> - SVG: Scalable Vector Graphics
the <color-profile> element al
lows describing the color profile used for the image.
... usage context categoriesnonepermitted contentany number of the fol
lowing elements, in any order:descriptive elements attributes global attributes core attributes » xlink attributes » specific attributes local name rendering-intent xlink:href dom interface this element implements the svgcolorprofileelement interface.
<discard> - SVG: Scalable Vector Graphics
the <discard> svg element al
lows authors to specify the time at which particular elements are to be discarded, thereby reducing the resources required by an svg user agent.
... usage context categoriesanimation elementpermitted contentany number of the fol
lowing elements, in any order:descriptive elements<script> attributes global attributes conditional processing attributes core attributes aria attributes specific attributes begin href (but note that <discard> has never supported xlink:href) specifications specification status comment svg animations level 2the definition of '<discard>' in that specification.
<ellipse> - SVG: Scalable Vector Graphics
fset, stroke-linecap, stroke-linejoin, stroke-miterlimit, stroke-opacity, stroke-width, transform, vector-effect, visibility aria attributes aria-activedescendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-f
lowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, ari...
...a-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the fol
lowing elements, in any order:animation elementsdescriptive elements specifications specification status comment scalable vector graphics (svg) 2the definition of '<ellipse>' in that specification.
<feColorMatrix> - SVG: Scalable Vector Graphics
| r' | | r1 r2 r3 r4 r5 | | r | | g' | | g1 g2 g3 g4 g5 | | g | | b' | = | b1 b2 b3 b4 b5 | * | b | | a' | | a1 a2 a3 a4 a5 | | a | | 1 | | 0 0 0 0 1 | | 1 | in simplified terms, be
low is how each color channel in the new pixel is calculated.
... usage context categoriesfilter primitive elementpermitted contentany number of the fol
lowing elements, in any order:<animate>, <set> attributes global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in type values dom interface this element implements the svgfecolormatrixelement interface.
<feComponentTransfer> - SVG: Scalable Vector Graphics
it al
lows operations like brightness adjustment, contrast adjustment, color balance or thresholding.
... usage context categoriesfilter primitive elementpermitted contentany number of the fol
lowing elements, in any order:<fefunca>, <fefuncr>, <fefuncb>, <fefuncg> attributes global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in dom interface this element implements the svgfecomponenttransferelement interface.
<feConvolveMatrix> - SVG: Scalable Vector Graphics
to illustrate, suppose you have a input image which is 5 pixels by 5 pixels, whose color values for one of the color channels are as fol
lows: 0 20 40 235 235 100 120 140 235 235 200 220 240 235 235 225 225 255 255 255 225 225 255 255 255 and you define a 3-by-3 convolution kernel as fol
lows: 1 2 3 4 5 6 7 8 9 let's focus on the color value at the second row and second column of the image (source pixel value is 120).
...case (where the input image's pixel grid aligns perfectly with the kernel's pixel grid) and assuming default values for attributes ‘divisor’, ‘targetx’ and ‘targety’, then resulting color value will be: (9* 0 + 8* 20 + 7* 40 + 6*100 + 5*120 + 4*140 + 3*200 + 2*220 + 1*240) / (9+8+7+6+5+4+3+2+1) usage context categoriesfilter primitive elementpermitted contentany number of the fol
lowing elements, in any order:<animate>, <set> attributes global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in order kernelmatrix divisor bias targetx targety edgemode kernelunitlength preservealpha dom interface this element implements the svgfeconvolvematrixelement interface.
<feMerge> - SVG: Scalable Vector Graphics
the <femerge> svg element al
lows filter effects to be applied concurrently instead of sequentially.
... usage context categoriesfilter primitive elementpermitted contentany number of the fol
lowing elements, in any order:<femergenode> example svg <svg width="200" height="200" xmlns="http://www.w3.org/2000/svg"> <filter id="feoffset" x="-40" y="-20" width="100" height="200"> <feoffset in="sourcegraphic" dx="60" dy="60" /> <fegaussianblur stddeviation="5" result="blur2" /> <femerge> <femergenode in="blur2" /> <femergenode in="sourcegraphic" /> </femerge> </filter> <rect x="40" y="40" width="100" height="100" style="stroke: #000000; fill: green; filter: url(#feoffset);" /> </svg> result attributes global attributes ...
<feOffset> - SVG: Scalable Vector Graphics
the <feoffset> svg filter primitive al
lows to offset the input image.
... usage context categoriesfilter primitive elementpermitted contentany number of the fol
lowing elements, in any order:<animate>, <set> attributes global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in dx dy dom interface this element implements the svgfeoffsetelement interface.
<fePointLight> - SVG: Scalable Vector Graphics
the <fepointlight> filter primitive defines a light source which al
lows to create a point light effect.
... usage context categorieslight source elementpermitted contentany number of the fol
lowing elements, in any order:<animate>, <set> attributes global attributes core attributes specific attributes x y z dom interface this element implements the svgfepointlightelement interface.
<feSpotLight> - SVG: Scalable Vector Graphics
the <fespotlight> svg filter primitive defines a light source which al
lows to create a spotlight effect.
... usage context categorieslight source elementpermitted contentany number of the fol
lowing elements, in any order:<animate>, <set> attributes global attributes core attributes specific attributes x y z pointsatx pointsaty pointsatz specularexponent limitingconeangle dom interface this element implements the svgfespotlightelement interface.
<feTile> - SVG: Scalable Vector Graphics
the <fetile> svg filter primitive al
lows to fill a target rectangle with a repeated, tiled pattern of an input image.
... usage context categoriesfilter primitive elementpermitted contentany number of the fol
lowing elements, in any order:<animate>, <set> attributes global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in dom interface this element implements the svgfetileelement interface.
<feTurbulence> - SVG: Scalable Vector Graphics
it al
lows the synthesis of artificial textures like clouds or marble.
... usage context categoriesfilter primitive elementpermitted contentany number of the fol
lowing elements, in any order:<animate>, <set> attributes global attributes core attributes presentation attributes filter primitive attributes class style specific attributes basefrequency numoctaves seed stitchtiles type dom interface this element implements the svgfeturbulenceelement interface.
<foreignObject> - SVG: Scalable Vector Graphics
html,body,svg { height:100% } <svg viewbox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"> <style> div { color: white; font: 18px serif; height: 100%; overf
low: auto; } </style> <polygon points="5,5 195,10 185,185 10,195" /> <!-- common use case: embed html text into svg --> <foreignobject x="20" y="20" width="160" height="160"> <!-- in the context of svg embedded in an html document, the xhtml namespace could be omitted, but it is mandatory in the context of an svg document --> <div xmlns="http://www.w3.org/1999/xhtml"> lorem ipsum dolor sit amet, consectetur adipiscin...
...fset, stroke-linecap, stroke-linejoin, stroke-miterlimit, stroke-opacity, stroke-width, transform, vector-effect, visibility aria attributes aria-activedescendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-f
lowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, ari...
<g> - SVG: Scalable Vector Graphics
fset, stroke-linecap, stroke-linejoin, stroke-miterlimit, stroke-opacity, stroke-width, transform, vector-effect, visibility aria attributes aria-activedescendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-f
lowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, ari...
...a-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriescontainer element, structural elementpermitted contentany number of the fol
lowing 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.
<image> - SVG: Scalable Vector Graphics
usage context categoriesgraphics element, graphics referencing elementpermitted contentany number of the fol
lowing elements, in any order:animation elementsdescriptive elements attributes global attributes conditional processing attributes core attributes graphical event attributes presentation attributes xlink attributes class style externalresourcesrequired transform specific attributes x: positions the image horizontally from the origin.
... candidate recommendation al
lows omitting height and width scalable vector graphics (svg) 1.1 (second edition)the definition of '<image>' in that specification.
<line> - SVG: Scalable Vector Graphics
fset, stroke-linecap, stroke-linejoin, stroke-miterlimit, stroke-opacity, stroke-width, transform, vector-effect, visibility aria attributes aria-activedescendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-f
lowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, ari...
...a-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the fol
lowing elements, in any order:animation elementsdescriptive elements specifications specification status comment scalable vector graphics (svg) 2the definition of '<line>' in that specification.
<marker> - SVG: Scalable Vector Graphics
fset, stroke-linecap, stroke-linejoin, stroke-miterlimit, stroke-opacity, stroke-width, transform, vector-effect, visibility aria attributes aria-activedescendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-f
lowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, ari...
...a-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriescontainer elementpermitted contentany number of the fol
lowing 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.
<mpath> - SVG: Scalable Vector Graphics
usage context categoriesanimation elementpermitted contentany number of the fol
lowing elements, in any order:descriptive elements attributes global attributes core attributes » xlink attributes » externalresourcesrequired specific attributes xlink:href dom interface this element implements the svgmpathelement interface.
...--> <path d="m-25,-12.5 l25,-12.5 l 0,-87.5 z" fill="yel
low" stroke="red" stroke-width="7.06" > <!-- define the motion path animation --> <animatemotion dur="6s" repeatcount="indefinite" rotate="auto" > <mpath xlink:href="#path1"/> </animatemotion> </path> </svg> result specifications specification status comment svg animations level 2the definition of '<mpath>' in that specification.
<path> - SVG: Scalable Vector Graphics
fset, stroke-linecap, stroke-linejoin, stroke-miterlimit, stroke-opacity, stroke-width, transform, vector-effect, visibility aria attributes aria-activedescendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-f
lowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, ari...
...a-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesgraphics element, shape elementpermitted contentany number of the fol
lowing elements, in any order:animation elementsdescriptive elements specifications specification status comment svg pathsthe definition of '<path>' in that specification.
<polygon> - SVG: Scalable Vector Graphics
fset, stroke-linecap, stroke-linejoin, stroke-miterlimit, stroke-opacity, stroke-width, transform, vector-effect, visibility aria attributes aria-activedescendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-f
lowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, ari...
...a-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the fol
lowing elements, in any order:animation elementsdescriptive elements specifications specification status comment scalable vector graphics (svg) 2the definition of '<polygon>' in that specification.
<polyline> - SVG: Scalable Vector Graphics
fset, stroke-linecap, stroke-linejoin, stroke-miterlimit, stroke-opacity, stroke-width, transform, vector-effect, visibility aria attributes aria-activedescendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-f
lowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, ari...
...a-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the fol
lowing elements, in any order:animation elementsdescriptive elements specifications specification status comment scalable vector graphics (svg) 2the definition of '<polyline>' in that specification.
<rect> - SVG: Scalable Vector Graphics
fset, stroke-linecap, stroke-linejoin, stroke-miterlimit, stroke-opacity, stroke-width, transform, vector-effect, visibility aria attributes aria-activedescendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-f
lowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, ari...
...a-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the fol
lowing elements, in any order:animation elementsdescriptive elements specifications specification status comment scalable vector graphics (svg) 2the definition of '<rect>' in that specification.
<script> - SVG: Scalable Vector Graphics
the svg script element al
lows to add scripts to an svg document.
... while svg's script element is equivalent to the html <script> element, it has some discrepancies, like it uses the href attribute instead of src and it doesn't support ecmascript modules so far (see browser compatibility be
low for details) html,body,svg { height:100% } <svg viewbox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"> <script> // <![cdata[ window.addeventlistener('domcontentloaded', () => { function getcolor () { const r = math.round(math.random() * 255).tostring(16).padstart(2,'0') const g = math.round(math.random() * 255).tostring(16).padstart(2,'0') const b = math.round(math.random() * 255).tostring(16).padstart(2,'0') return `#${r}${g}${b}` } document.queryselector('circle').addeventlistener('click', (e) => { e.target.styl...
<set> - SVG: Scalable Vector Graphics
the additive and accumulate attributes are not al
lowed, and will be ignored if specified.
...eatcount, repeatdur, fill other animation attributes most notably: attributename animation event attributes most notably: onbegin, onend, onrepeat global attributes core attributes most notably: id styling attributes class, style event attributes global event attributes, document element event attributes usage notes categoriesanimation elementpermitted contentany number of the fol
lowing elements, in any order:descriptive elements specifications specification status comment svg animations level 2the definition of '<set>' in that specification.
<svg> - SVG: Scalable Vector Graphics
fset, stroke-linecap, stroke-linejoin, stroke-miterlimit, stroke-opacity, stroke-width, transform, vector-effect, visibility aria attributes aria-activedescendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-f
lowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, ari...
...a-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriescontainer element, structural elementpermitted contentany number of the fol
lowing 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.
<text> - SVG: Scalable Vector Graphics
linecap, stroke-linejoin, stroke-miterlimit, stroke-opacity, stroke-width, text-anchor, transform, vector-effect, visibility aria attributes aria-activedescendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-f
lowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, ari...
...a-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesgraphics element, text content elementpermitted contentcharacter data and any number of the fol
lowing elements, in any order:animation elementsdescriptive elementstext content elements<a> specifications specification status comment scalable vector graphics (svg) 2the definition of '<text>' in that specification.
<textPath> - SVG: Scalable Vector Graphics
fset, stroke-linecap, stroke-linejoin, stroke-miterlimit, stroke-opacity, stroke-width, transform, vector-effect, visibility aria attributes aria-activedescendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-f
lowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, ari...
...a-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role xlink attributes xlink:title usage notes categoriestext content element, text content child elementpermitted contentcharacter data and any number of the fol
lowing elements, in any order:descriptive elements<a>, <altglyph>, <animate>, <animatecolor>, <set>, <tref>, <tspan> specifications specification status comment scalable vector graphics (svg) 2the definition of '<textpath>' in that specification.
Specification Deviations - SVG: Scalable Vector Graphics
nevertheless, to al
low mozilla to more cleanly share internal 'class' and 'style' related code, we will implement these attributes on all svg elements as of firefox 3.
...extending the 'class' attribute to apply to all svg elements will al
low svg authors to use the selectors api to select any svg element based on class.
Gradients in SVG - SVG: Scalable Vector Graphics
<stop offset="100%" stop-color="yel
low" stop-opacity="0.5"/> to use a gradient, we have to reference it from an object's fill or stroke attributes.
...setting these three attributes will al
low you to move the gradient around and change its size, as shown in the second rect above.
Patterns - SVG: Scalable Vector Graphics
the reason they've been used here is described be
low.
...all three of the preceding examples are shown be
low on a rectangle that has been slightly elongated to a height of 300px, but i should note that it's not an exhaustive picture, and there are other options available depending on your application.
Referer header: privacy and security concerns - Web security
the referrer problem the referer (sic) header contains the address of the previous web page from which a link to the currently requested page was fol
lowed, which has lots of fairly innocent uses including analytics, logging, or optimized caching.
...if the link was fol
lowed, depending on how information was shared the social media site may receive the reset password url and may still be able to use the shared information, potentially compromising a user's security.
Securing your site - Web security
note: this article is a work in progress, and is neither complete nor does fol
lowing its suggestions guarantee your site will be fully secure.
... the x-frame-options response header the x-frame-options: http response header can be used to indicate whether or not a browser should be al
lowed to render a page in a <frame>.
Types of attacks - Web security
(click-jacking is sometimes called "user interface redressing", though this is a misuse of the term "redress".) cross-site request forgery (csrf) cross-site scripting (xss) cross-site scripting (xss) is a security exploit which al
lows an attacker to inject into a website malicious client-side code.
...this could al
low an attacker to bypass csrf protection or hijack a session after the user logs in.