Search completed in 1.31 seconds.
Introduction to progressive web apps - Progressive web apps (PWAs)
overview: pro
gressive web apps next this article provides an introduction to pro
gressive web apps (pwas), discussing what they are and the advantages they offer over regular web apps.
... what is a pro
gressive web app?
... the term "pro
gressive web app" isn't a formal or official name.
...And 13 more matches
Progressive web app structure - Progressive web apps (PWAs)
previous overview: pro
gressive web apps next now that we know the theory behind pwas, let's look at the recommended structure of an actual app.
...they both have their advantages and disadvantages, and you can mix the two approaches to some de
gree.
...it works
great across browsers, but it suffers in terms of time navigating between pages and therefore general perceived performance — loading a page requires a new round trip to the server.
...And 9 more matches
<progress>: The Progress Indicator element - HTML: Hypertext Markup Language
the html <pro
gress> element displays an indicator showing the completion pro
gress of a task, typically displayed as a pro
gress bar.
... permitted content phrasing content, but there must be no <pro
gress> element among its descendants.
... implicit aria role pro
gressbar permitted aria roles no role permitted dom interface htmlpro
gresselement attributes this element includes the global attributes.
...And 8 more matches
Progressive loading - Progressive web apps (PWAs)
previous overview: pro
gressive web apps in previous articles we covered apis that help us make our js13kpwa example a pro
gressive web app: service workers, web manifests, notifications and push.
... in this article we will go even further and improve the performance of the app by pro
gressively loading its resources.
... this could be achieved by pro
gressive loading — also known as lazy loading.
...And 7 more matches
Structural overview of progressive web apps - Progressive web apps (PWAs)
while pro
gressive web apps (pwas) can do anything any web content can do, they need to have a particular structure and include specific components in order to be recognized as a web app that can be used both on the web and installed and run as a local application.
...they both have their advantages and disadvantages, and you can mix the two approaches to some de
gree.
...it works
great across browsers, but it suffers in terms of time navigating between pages and therefore general perceived performance — loading a page requires a new round trip to the server.
...And 7 more matches
ProgressEvent.initProgressEvent() - Web APIs
the pro
gressevent.initpro
gressevent() method initializes an animation event created using the deprecated document.createevent("pro
gressevent") method.
... pro
gressevent created that way are untrusted.
...do not use it anymore, use the standard constructor, pro
gressevent(), to create a synthetic pro
gressevent syntax pro
gress.initpro
gressevent(typearg, canbubblearg, cancelablearg, lengthcomputable, loaded, total); parameters typearg is a domstring identifying the specific type of animation event that occurred.
...And 4 more matches
nsIWebProgressListener
uriloader/base/nsiwebpro
gresslistener.idlscriptable this interface is implemented by clients wishing to listen in on the pro
gress associated with the loading of asynchronous requests in the context of a nsiwebpro
gress instance as well as any child nsiwebpro
gress instances.
... inherits from: nsisupports last changed in gecko 15 (firefox 15 / thunderbird 15 / seamonkey 2.12) nsiwebpro
gress describes the parent-child relationship of nsiwebpro
gress instances.
... method overview void onlocationchange(in nsiwebpro
gress awebpro
gress, in nsirequest arequest, in nsiuri alocation, [optional] in unsigned long aflags); void onpro
gresschange(in nsiwebpro
gress awebpro
gress, in nsirequest arequest, in long acurselfpro
gress, in long amaxselfpro
gress, in long acurtotalpro
gress, in long amaxtotalpro
gress); void onsecuritychange(in nsiwebpro
gress awebpro
gress, in nsirequest arequest, in unsigned long astate); void onstatechange(in nsiwebpro
gress awebpro
gress, in nsirequest arequest, in unsigned long astateflags, in nsresult astatus); void onstatuschange(in nsiwebpro
gress awebpro
gress, in nsirequest arequest, in nsresult astatus, in wstring amessage); constants state transition flags these flags indicate the v...
...And 37 more matches
nsIWebProgress
the nsiwebpro
gress interface is used to add or remove nsiwebpro
gresslistener instances to observe the loading of asynchronous requests (usually in the context of a dom window).
... nsiwebpro
gress instances may be arranged in a parent-child configuration, corresponding to the parent-child configuration of their respective dom windows.
... however, in some cases a nsiwebpro
gress instance may not have an associated dom window.
...And 24 more matches
nsIDownloadProgressListener
/toolkit/components/downloads/nsidownloadpro
gresslistener.idlscriptable this interface gives applications and extensions a way to monitor the status of downloads being processed by the download manager.
... this interface works very similarly to the nsiwebpro
gress interface.
... method overview void ondownloadstatechange(in short astate, in nsidownload adownload); void onlocationchange(in nsiwebpro
gress awebpro
gress, in nsirequest arequest, in nsiuri alocation, in nsidownload adownload); obsolete since gecko 1.9.1 void onpro
gresschange(in nsiwebpro
gress awebpro
gress, in nsirequest arequest, in long long acurselfpro
gress, in long long amaxselfpro
gress, in long long acurtotalpro
gress, in long long amaxtotalpro
gress, in nsidownload adownload); void onsecuritychange(in nsiwebpro
gress awebpro
gress, in nsirequest arequest, in unsigned long astate, in nsidownload adownload); ...
...And 18 more matches
Progress Meters - Archive of obsolete content
« previousnext » in this section, we'll look at creating pro
gress meters.
... adding a pro
gress meter a pro
gress meter is a bar that indicates how much of a task has been completed.
...xul has a pro
gressmeter element which can be used to create these.
...And 16 more matches
Progressive web apps (PWAs)
pro
gressive web apps are web apps that use emerging web browser apis and features along with traditional pro
gressive enhancement strategy to bring a native app-like user experience to cross-platform web applications.
... pro
gressive web apps are a useful design pattern, though they aren't a formalized standard.
... manifest file a json file that controls how your app appears to the user and ensures that pro
gressive web apps are discoverable.
...And 16 more matches
GRE - Archive of obsolete content
the framework for embedding mozilla technologies was at one point called the
gre (gecko runtime environment).
...this document describes how embedders should dynamically link to a
gre.
... to understand how
gres are registered, see
gre registration.
...And 14 more matches
nsIWebProgressListener2
an extended version of nsiwebpro
gresslistener.
... uriloader/base/nsiwebpro
gresslistener2.idlscriptable please add a summary to this article.
... last changed in gecko 1.9 (firefox 3) inherits from: nsiwebpro
gresslistener method overview void onpro
gresschange64(in nsiwebpro
gress awebpro
gress, in nsirequest arequest, in long long acurselfpro
gress, in long long amaxselfpro
gress, in long long acurtotalpro
gress, in long long amaxtotalpro
gress); boolean onrefreshattempted(in nsiwebpro
gress awebpro
gress, in nsiuri arefreshuri, in long amillis, in boolean asameuri); methods onpro
gresschange64() notification that the pro
gress has changed for one of the requests associated with awebpro
gress.
...And 14 more matches
Table Layout Regression Tests - Archive of obsolete content
subject overview changes in layout, parser and content code can have unintended side effects, also known as re
gressions.
... it is good style to check for these unwanted re
gressions and fixing them before checkin rather than causing bugzilla avalanches.
... select from the re
gression-test menu the add new list...entry.
...And 13 more matches
Using the progressbar role - Accessibility
this technique demonstrates how to use the pro
gressbar role and describes the effect it has on browsers and assistive technology.
... the pro
gressbar role should be used for an element that displays the pro
gress status for a task that take a long time or consists of several steps.
... a pro
gressbar indicates that the user's request has been received and the application is making pro
gress toward completing the requested action.
...And 10 more matches
nsITaskbarProgress
widget/public/nsitaskbarpro
gress.idlscriptable starting in windows 7, applications can display a pro
gress notification in the taskbar.
... 1.0 66 introduced gecko 1.9.2 inherits from: nsisupports last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) method overview void setpro
gressstate(in nstaskbarpro
gressstate state, in unsigned long long currentvalue optional, in unsigned long long maxvalue optional); constants constant value description state_no_pro
gress 0 stop displaying pro
gress on the taskbar button.
... state_indeterminate 1 display a cycling, indeterminate pro
gress bar.
...And 9 more matches
Progress Listeners - Archive of obsolete content
pro
gress listeners pro
gress listeners allow extensions to be notified of events associated with documents loading in the browser and with tab switching events.
... pro
gress listeners implement the nsiwebpro
gresslistener interface.
... in the examples below the pro
gress listener is attached to the tabbrowser, which means you don't get any notifications for inactive tabs.
...And 8 more matches
ProgressEvent - Web APIs
the pro
gressevent interface represents events measuring pro
gress of an underlying process, like an http request (for an xmlhttprequest, or the loading of the underlying resource of an <img>, <audio>, <video>, <style> or <link>).
... 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/pro
gressevent" target="_top"><rect x="116" y="1" width="130" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="181" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">pro
gressevent</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} constructor pro
gresseve...
...nt() creates a pro
gressevent event with the given parameters.
...And 8 more matches
SVGRectElement - Web APIs
the sv
grectelement interface provides access to the properties of <rect> elements, as well as methods to manipulate them.
...0" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="171" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svggeometryelement</text></a><polyline points="81,89 71,84 71,94 81,89" stroke="#d4dde4" fill="none"/><line x1="71" y1="89" x2="41" y2="89" stroke="#d4dde4"/><a xlink:href="/docs/web/api/sv
grectelement" target="_top"><rect x="-99" y="65" width="140" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="-29" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">sv
grectelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties this inter...
... sv
grectelement.x read only returns an svganimatedlength corresponding to the x attribute of the given <rect> element.
...And 7 more matches
progressmeter - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] a meter which can be used to display the pro
gress of a lengthy operation.
...in addition, an indeterminate pro
gressmeter may be created by setting the mode attribute to undetermined.
... attributes max, mode, value properties accessibletype, max, mode, value examples <pro
gressmeter mode="determined" value="82"/> <pro
gressmeter mode="undetermined"/> <!-- switching modes while the mouse is over a button --> <pro
gressmeter mode="determined" id="mypro
gress"/> <button label="example" onmouseover="setloading(true)" onmouseout="setloading(false)"/> function setloading(state){ document.getelementbyid('mypro
gress').mode = (state) ?
...And 6 more matches
nsIDOMProgressEvent
dom/interfaces/events/nsidompro
gressevent.idlscriptable this interface represents the events sent with pro
gress information while uploading data using the xmlhttprequest object.
... 1.0 66 introduced gecko 1.9.1 deprecated gecko 22 inherits from: nsidomevent last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) the nsidompro
gressevent is used in the media elements (<video> and <audio>) to inform interested code of the pro
gress of the media download.
... this implementation is a placeholder until the specification is complete, and is compatible with the webkit pro
gressevent.
...And 6 more matches
HTMLProgressElement - Web APIs
the htmlpro
gresselement interface provides special properties and methods (beyond the regular htmlelement interface it also has available to it by inheritance) for manipulating the layout and presentation of <pro
gress> elements.
...,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlelement</text></a><polyline points="491,25 501,20 501,30 491,25" stroke="#d4dde4" fill="none"/><line x1="501" y1="25" x2="509" y2="25" stroke="#d4dde4"/><line x1="509" y1="25" x2="509" y2="90" stroke="#d4dde4"/><line x1="509" y1="90" x2="492" y2="90" stroke="#d4dde4"/><a xlink:href="/docs/web/api/htmlpro
gresselement" target="_top"><rect x="301" y="65" width="190" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="396" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlpro
gresselement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inher...
... htmlpro
gresselement.max is a double value reflecting the content attribute of the same name, limited to numbers
greater than zero.
...And 6 more matches
Customizing the download progress bar - Archive of obsolete content
this example illustrates how to customize the pro
gress bar displayed for a given download in the downloads window.
... the myextension.css file will look something like this: richlistitem pro
gressmeter { %ifdef xp_win min-height: 17px !important; %else %ifdef xp_macosx -moz-appearance: none !important; background-image: url(chrome://myextension/skin/pro
gress_bg_osx.png) !important; %endif %endif } richlistitem .pro
gress-bar { %ifdef xp_win -moz-appearance: none !important; background-image: url(chrome://myextension/skin/pro
gress_fd_win.png) !important; %else %i...
...fdef xp_macosx background-image: url(chrome://myextension/skin/pro
gress_fd_osx.gif) !important; %endif %endif } note: this file only supports windows and mac, but it would be straightforward to add support for linux.
...And 5 more matches
GRE Registration - Archive of obsolete content
successfully embedding the
gre requires that information about installed
gres be stored on the system.
... windows on windows,
gre registration information is kept in the win32 registry under the hkey_local_machine/software/mozilla.org/
gre and hkey_current_user/software/mozilla.org/
gre keys.
... each subkey is searched for
gre registration information: hklm/software/mozilla.org/
gre/1.8_1 version=1.8
grehome=c:\path\to\installed-dir feature=value feature2=value2 hklm/software/mozilla.org/
gre/1.8_2 version=1.8
grehome=c:\path\to\second-installation when installing a
gre via the mozilla suite
gre installer, the installer will blindly overwrite any previous
gre information in hklm/software/mozilla.org/
gre/<version>.
...And 5 more matches
mozIStorageAggregateFunction
it allows consumers to add ag
gregate functions that are available to sql queries and triggers.
... an ag
gregate function is a function that returns one value from a series of values.
... there are a number of already defined ag
gregate functions provided by sqlite.
...And 5 more matches
SVGRect - Web APIs
the sv
grect represents a rectangle.
... an sv
grect object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown.
... <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 23.333333333333332%; vertical-align: middle; overflow: 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/sv
grect" target="_top"><rect x="1" y="1" width="75" height="50" fill="#f4f7f8" 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">sv
grect</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties sv
grect.x the exact effect of this coordinate depends on each element.
...And 5 more matches
nsIProgressEventSink
netwerk/base/public/nsipro
gresseventsink.idlscriptable this interface is used to asynchronously convey channel status and pro
gress information that is generally not critical to the processing of the channel.
... inherits from: nsisupports last changed in gecko 1.7 this interface is used to asynchronously convey channel status and pro
gress information that is generally not critical to the processing of the channel.
...the channel will begin passing notifications to the pro
gress event sink after its asyncopen method has been called.
...And 4 more matches
ProgressEvent() - Web APIs
the pro
gressevent() constructor returns a newly created pro
gressevent, representing the current completion of a long process.
... syntax pro
gressevent = new pro
gressevent(type, {lengthcomputable: abooleanvalue, loaded: anumber, total: anumber}); arguments the pro
gressevent() constructor also inherits arguments from event().
... type is a domstring representing the name of the type of the pro
gressevent.
...And 4 more matches
mozIStorageProgressHandler
the mozistoragepro
gresshandler interface lets storage consumers receive callbacks during the execution of sqlite requests.
... storage/public/mozistoragepro
gresshandler.idlscriptable please add a summary to this article.
... last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) inherits from: nsisupports method overview boolean onpro
gress(in mozistorageconnection aconnection); methods onpro
gress() the onpro
gress() method is called periodically while an sqlite operation is ongoing.
...And 3 more matches
::-webkit-progress-inner-element - CSS: Cascading Style Sheets
the ::-webkit-pro
gress-inner-element css pseudo-element represents the outermost container of the <pro
gress> element.
... it is the parent of the ::-webkit-pro
gress-bar pseudo-element.
... note: in order to let ::-webkit-pro
gress-value take effect, -webkit-appearance needs to be set to none on the <pro
gress> element.
...And 3 more matches
AggregateError - JavaScript
the ag
gregateerror object represents an error when several errors need to be wrapped in a single error.
... constructor ag
gregateerror() creates a new ag
gregateerror object.
... instance properties ag
gregateerror.prototype.message error message, defaults to "".
...And 3 more matches
Aggregating the In-Memory Datasource
introduction you can use xpcom ag
gregation1 with the in-memory datasource.
...ag
gregation to the rescue!
...that is, you want to reflect the contents of something as an rdf graph (presumably so that it can be ag
gregated with other information or displayed as styled content).
...And 2 more matches
HTMLMediaElement: progress event - Web APIs
the pro
gress event is fired periodically as the browser loads a resource.
... bubbles no cancelable no interface event event handler property onpro
gress examples live example html <div class="example"> <button type="button">load video</button> <video controls width="250"></video> <div class="event-log"> <label>event log:</label> <textarea readonly class="event-log-contents"></textarea> </div> </div> css .event-log-contents { width: 18rem; height: 5rem; border: 1px solid black; margin: .2rem; padding: .2rem; } .example { display: grid; grid-template-areas: "button log" "video log"; } button { grid-area: button; width: 10rem; margin: .5rem 0; } video { grid-area: video; } .event-log { grid-area: log; } .event-log>labe...
... { display: block; } javascript const loadvideo = document.queryselector('button'); const video = document.queryselector('video'); const eventlog = document.queryselector('.event-log-contents'); let source = null; function handleevent(event) { eventlog.textcontent = eventlog.textcontent + `${event.type}\n`; } video.addeventlistener('loadstart', handleevent); video.addeventlistener('pro
gress', handleevent); video.addeventlistener('canplay', handleevent); video.addeventlistener('canplaythrough', handleevent); loadvideo.addeventlistener('click', () => { if (source) { document.location.reload(); } else { loadvideo.textcontent = "reset example"; source = document.createelement('source'); source.setattribute('src', 'https://interactive-examples.
...And 2 more matches
RTCPeerConnection.pendingRemoteDescription - Web APIs
the read-only property rtcpeerconnection.pendin
gremotedescription returns an rtcsessiondescription object describing a pending configuration change for the remote end of the connection.
... syntax sessiondescription = rtcpeerconnection.pendin
gremotedescription; return value if a remote description change is in pro
gress, this is an rtcsessiondescription describing the proposed configuration.
... example this example looks at the pendin
gremotedescription to determine whether or not there's a description change being processed.
...And 2 more matches
::-webkit-progress-bar - CSS: Cascading Style Sheets
the ::-webkit-pro
gress-bar css pseudo-element represents the entire bar of a <pro
gress> element.
... normally it's only visible as the unfilled portion of the bar, since by default it's rendered below the ::-webkit-pro
gress-value pseudo-element.
... it is a child of the ::-webkit-pro
gress-inner-element pseudo-element and the parent of the ::-webkit-pro
gress-value pseudo-element.
...And 2 more matches
::-webkit-progress-value - CSS: Cascading Style Sheets
the ::-webkit-pro
gress-value css pseudo-element represents the filled-in portion of the bar of a <pro
gress> element.
... it is a child of the ::-webkit-pro
gress-bar pseudo-element.
... note: in order to let ::-webkit-pro
gress-value take effect, -webkit-appearance needs to be set to none on the <pro
gress> element.
...And 2 more matches
progressmeter.mode - Archive of obsolete content
« xul reference home mode type: one of the values below a determinedpro
gressmeter is used in cases where you know how long an operation will take.
... an undeterminedpro
gressmeter can be used when you don't and will typically be drawn as a spinning barber pole.
... determined the pro
gress meter uses its value attribute to determine the amount of the bar that is filled in.
... undetermined the pro
gressmeter is indeterminate.
Progressive Enhancement - MDN Web Docs Glossary: Definitions of Web-related terms
pro
gressive enhancement is a design philosophy that provides a baseline of essential content and functionality to as many users as possible, while delivering the best possible experience only to users of the most modern browsers that can run all the required code.
... pro
gressive enhancement is a useful technique that allows web developers to focus on developing the best possible websites while making those websites work on multiple unknown user agents.
... graceful degradation is related but is not the same thing and is often seen as going in the opposite direction to pro
gressive enhancement.
... learn more general knowledge pro
gressive enhancement on wikipedia ...
AggregateError() constructor - JavaScript
the ag
gregateerror() constructor creates an error for several errors that need to be wrapped in a single error.
... syntax new ag
gregateerror(errors[, message]) parameters errors an iterable of errors, may not actually be error instances.
... messageoptional an optional human-readable description of the ag
gregate error.
... examples creating an ag
gregateerror try { throw new ag
gregateerror([ new error("some error"), ], 'hello'); } catch (e) { console.log(e instanceof ag
gregateerror); // true console.log(e.message); // "hello" console.log(e.name); // "ag
gregateerror" console.log(e.errors); // [ error: "some error" ] } specifications specification promise.anythe definition of 'ag
gregateerror()' in that specification.
progress - Archive of obsolete content
the pro
gress event is fired when the user agent is downloading resources listed by the manifest.
... general info specification offline interface pro
gressevent bubbles no cancelable no target applicationcache default action none properties property type description target eventtarget (dom element) the event target (the topmost target in the dom tree).
... related events checking noupdate downloading pro
gress cached updateready obsolete error ...
-ms-block-progression - Archive of obsolete content
the -ms-block-pro
gression css property is a microsoft extension that specifies the block pro
gression and layout orientation.
... only one block pro
gression is active at a time; these values cannot be combined.
... this property is based on the block-pro
gression property of the css3 text layout module.
FileReader: progress event - Web APIs
the pro
gress event is fired periodically as the filereader reads data.
... bubbles no cancelable no interface pro
gressevent event handler property filereader.onpro
gress examples live example html <div class="example"> <div class="file-select"> <label for="avatar">choose a profile picture:</label> <input type="file" id="avatar" name="avatar" accept="image/png, image/jpeg"> </div> <img src="" class="preview" height="200" alt="image preview..."> <div class="event-log"> <label>event log:</label> <textarea readonly class="event-log-contents"></textarea> </div> </div> css img.preview { margin: 1rem 0; } .event-log-contents { width: 18rem; height: 5rem; border: 1px solid black; margin: .2rem; padding: .2rem; } ...
...entlog.textcontent = eventlog.textcontent + `${event.type}: ${event.loaded} bytes transferred\n`; if (event.type === "load") { preview.src = reader.result; } } function addlisteners(reader) { reader.addeventlistener('loadstart', handleevent); reader.addeventlistener('load', handleevent); reader.addeventlistener('loadend', handleevent); reader.addeventlistener('pro
gress', handleevent); reader.addeventlistener('error', handleevent); reader.addeventlistener('abort', handleevent); } function handleselected(e) { eventlog.textcontent = ''; const selectedfile = fileinput.files[0]; if (selectedfile) { addlisteners(reader); reader.readasdataurl(selectedfile); } } fileinput.addeventlistener('change', handleselected); result ...
FileRequest.onprogress - Web APIs
summary this property specifies a callback function to be run repeatedly while the operation represented by a filerequest object is in pro
gress.
... syntax instanceoffilerequest.onpro
gress = function; where instanceoffilerequest is a filerequest object and function is the javascript function to execute.
... example // assuming 'request' which is a filerequest object request.onpro
gress = function (status) { var pro
gress = document.queryselector('pro
gress'); pro
gress.value = status.loaded; pro
gress.max = status.total; } specification not part of any current specification.
HTMLProgressElement.labels - Web APIs
the htmlpro
gresselement.labels read-only property returns a nodelist of the <label> elements associated with the <pro
gress> element.
... syntax var labelelements = pro
gress.labels; return value a nodelist containing the <label> elements associated with the <pro
gress> element.
... example html <label id="label1" for="test">label 1</label> <pro
gress id="test" value="70" max="100">70%</pro
gress> <label id="label2" for="test">label 2</label> javascript window.addeventlistener("domcontentloaded", function() { const pro
gress = document.getelementbyid("test"); for(var i = 0; i < pro
gress.labels.length; i++) { console.log(pro
gress.labels[i].textcontent); // "label 1" and "label 2" } }); specifications specification status comment html living standardthe definition of 'labels' in that specification.
ProgressEvent.lengthComputable - Web APIs
the pro
gressevent.lengthcomputable read-only property is a boolean flag indicating if the resource concerned by the pro
gressevent has a length that can be calculated.
... if not, the pro
gressevent.total property has no significant value.
... syntax flag = pro
gressevent.lengthcomputable specifications specification status comment xmlhttprequestthe definition of 'pro
gressevent.lengthcomputable' in that specification.
ProgressEvent.loaded - Web APIs
the pro
gressevent.loaded read-only property is an integer representing the amount of work already performed by the underlying process.
... the ratio of work done can be calculated with the property and pro
gressevent.total.
... syntax value = pro
gressevent.loaded specifications specification status comment xmlhttprequestthe definition of 'pro
gressevent.loaded' in that specification.
SVGRenderingIntent - Web APIs
the sv
grenderingintent interface defines the enumerated list of possible values for rendering-intent attributes or descriptors.
... <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/sv
grenderingintent" target="_top"><rect x="1" y="1" width="180" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="91" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">sv
grenderingintent</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} warning: this interface was removed in the svg 2 specification.
... specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'sv
grenderingintent' in that specification.
XDomainRequest.onprogress - Web APIs
this method is called periodically as an event handler for pro
gress events on xdomainrequests, so that code can monitor pro
gress while loading content.
... syntax xdr.onpro
gress = funcref; parameters funcref a function to call when pro
gress events occur.
... example var xdr = new xdomainrequest(); xdr.open("post", "http://example.com/api/method"); xdr.onpro
gress = function(){ //handle partial response with xdr.responsetext } xdr.onload = function(){ //handle response with xdr.responsetext } xdr.send("param1=value1¶m2=value2"); specification not part of any specification.
XMLHttpRequest: progress event - Web APIs
the pro
gress event is fired periodically when a request receives more data.
... bubbles no cancelable no interface pro
gressevent event handler property onpro
gress examples live example html <div class="controls"> <input class="xhr success" type="button" name="xhr" value="click to start xhr (success)" /> <input class="xhr error" type="button" name="xhr" value="click to start xhr (error)" /> <input class="xhr abort" type="button" name="xhr" value="click to start xhr (abort)" /> </div> <textarea readonly class="event-log"></textarea> css .event-log { width: 25rem; height: 4rem; border: 1px solid black; margin: .5rem; padding: .2rem; } input { width: 11rem; margin: .5rem; } js const xhrbuttonsuccess = document.queryselector('.xhr.success'); const xhrbuttonerror = docu...
...eryselector('.xhr.abort'); const log = document.queryselector('.event-log'); function handleevent(e) { log.textcontent = log.textcontent + `${e.type}: ${e.loaded} bytes transferred\n`; } function addlisteners(xhr) { xhr.addeventlistener('loadstart', handleevent); xhr.addeventlistener('load', handleevent); xhr.addeventlistener('loadend', handleevent); xhr.addeventlistener('pro
gress', handleevent); xhr.addeventlistener('error', handleevent); xhr.addeventlistener('abort', handleevent); } function runxhr(url) { log.textcontent = ''; const xhr = new xmlhttprequest(); addlisteners(xhr); xhr.open("get", url); xhr.send(); return xhr; } xhrbuttonsuccess.addeventlistener('click', () => { runxhr('https://mdn.mozillademos.org/files/16553/dgszyj...
XMLHttpRequestEventTarget.onprogress - Web APIs
the xmlhttprequesteventtarget.onpro
gress is the function called periodically with information when an xmlhttprequest before success completely.
... syntax xmlhttprequest.onpro
gress = callback; values callback is the function to be called periodically before the request is completed.
... xmlhttprequest.onpro
gress = function (event) { event.loaded; event.total; }; example var xmlhttp = new xmlhttprequest(), method = 'get', url = 'https://developer.mozilla.org/'; xmlhttp.open(method, url, true); xmlhttp.onpro
gress = function () { //do something }; xmlhttp.send(); specifications specification status comment xmlhttprequest living standard whatwg living standard ...
::-moz-progress-bar - CSS: Cascading Style Sheets
the ::-moz-pro
gress-bar css pseudo-element is a mozilla extension that represents the pro
gress bar inside a <pro
gress> element.
... (the bar represents the amount of pro
gress that has been made.) if you want to select the unfinished part of <pro
gress> in mozilla, please select the <pro
gress> directly.
... syntax ::-moz-pro
gress-bar examples html <pro
gress value="30" max="100">30%</pro
gress> <pro
gress max="100">indeterminate</pro
gress> css ::-moz-pro
gress-bar { background-color: red; } /* force indeterminate bars to have zero width */ :indeterminate::-moz-pro
gress-bar { width: 0; } result specifications not part of any standard.
::-moz-range-progress - CSS: Cascading Style Sheets
the ::-moz-range-pro
gress css pseudo-element is a mozilla extension that represents the lower portion of the track (i.e., groove) in which the indicator slides in an <input> of type="range".
... note: using ::-moz-range-pro
gress with anything but an <input type="range"> doesn't match anything and has no effect.
... syntax ::-moz-range-pro
gress examples html <input type="range" min="0" max="100" step="5" value="50"/> css input[type=range]::-moz-range-pro
gress { background-color:
green; height: 1em; } result a pro
gress bar using this style might look something like this: specifications not part of any standard.
How to make PWAs installable - Progressive web apps (PWAs)
previous overview: pro
gressive 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 allow users to install the web app on mobile and desktop browers that support doing so.
... the content of the file looks like this: { "name": "js13kgames pro
gressive web app", "short_name": "js13kpwa", "description": "pro
gressive web app that lists games submitted to the a-frame category in the js13kgames 2017 competition.", "icons": [ { "src": "icons/icon-32.png", "sizes": "32x32", "type": "image/png" }, // ...
... previous overview: pro
gressive next ...
Making PWAs work offline with Service workers - Progressive web apps (PWAs)
previous overview: pro
gressive web apps next now that we’ve seen what the structure of js13kpwa looks like and have seen the basic shell up and running, let's look at how the offline capabilities using service worker are implemented.
... "pro
gressive" in pwa when implemented properly as a pro
gressive enhancement, service workers can benefit users who have modern browsers that support the api by providing offline support, but won't break anything for those using legacy browsers.
... previous overview: pro
gressive web apps next ...
Media - Progressive web apps (PWAs)
place your mouse over the items in this list to see the actual pointer shapes in your browser: selector selects pointer indicating a link wait indicating that the program cannot accept input pro
gress indicating that the program is working, but can still accept input default the default (usually an arrow) an outline property creates an outline that is often used to indicate keyboard focus.
... example these rules specify styles for a button that changes dynamically as the user interacts with it: .
green-button { background-color:#cec; color:#black; border:2px outset #cec; padding: 5px 10px; } .
green-button[disabled] { background-color:#cdc; color:#777; } .
green-button:active, .
green-button.active { border-style: inset; } <table> <tbody> <tr> <td><button class="
green-button" disabled>click me</button></td> <td><button class="
green-button">click me</button></td> ...
... <td><button class="
green-button active">click me</button></td> </tr> <tr style="line-height:25%;"> <td> </td> </tr> <tr style="font-style:italic;"> <td>disabled</td> <td>normal</td> <td>active</td> </tr> </tbody> </table> live sample a fully functional button also has a dark outline around the entire button when it is the default, and a dotted outline on the face of the button when it has keyboard focus.
Mobile first - Progressive web apps (PWAs)
if you are using mechanisms like feature detection and matchmedia to conditionally load scripting functionality depending on viewport size, feature support, etc., you should just load the very basics that pretty much all browsers will need first, then pro
gressively enhance browsers higher up the food chain.
...volo has a number of useful commands available, of which we will just use a couple: volo server: starts a local web server at localhost:8080 and runs your app through it:
great for easy testing.
... note: firefox's responsive design view is a
great way to get a quick idea of how your media queries are behaving themselves.
The building blocks of responsive design - Progressive web apps (PWAs)
if the content, layout, and functionality need to change
greatly for different devices, it may not be such a good approach.
...the video always resizes dynamically, but the screen captures taken from it do not, so upon resizing the screen it was possible to end up with a messy layout with different sized elements when using max-width: 100%, such as: media queries fluid grids are a
great start, but you'll notice that at certain points (known as breakpoints) the layout starts to break down.
... i'm sure you'll a
gree that this really isn't what we wanted — why is this happening?
addTabsProgressListener - Archive of obsolete content
« xul reference home addtabspro
gresslistener( listener ) return type: no return value add a pro
gress listener to the browser which will monitor loaded documents in all tabs in the tabbed browser.
... the pro
gress listener should be based on the nsiwebpro
gresslistener interface with an additional "browser" argument as the first argument of every method, which is the browser (not <tabbrowser> = gbrowser) where the event occurred.
removeTabsProgressListener - Archive of obsolete content
« xul reference home removetabspro
gresslistener( listener ) return type: no return value removes a pro
gress listener to the browser which has been monitoring all tabs.
... the pro
gress listener should implement the nsiwebpro
gresslistener interface.
addProgressListener - Archive of obsolete content
« xul reference home addpro
gresslistener( listener ) return type: no return value add a pro
gress listener to the browser which will monitor loaded documents.
... the pro
gress listener should implement the nsiwebpro
gresslistener interface.
Index - Web APIs
134 audiocontext.resume() api, audio, audiocontext, method, reference, web audio api, resume the resume() method of the audiocontext interface resumes the pro
gression of time in an audio context that has previously been suspended.
... 135 audiocontext.suspend() api, audio, audiocontext, method, reference, web audio api, suspend the suspend() method of the audiocontext interface suspends the pro
gression of time in the audio context, temporarily halting audio hardware access and reducing cpu/battery usage in the process — this is useful if you want an application to power down the audio hardware when it will not be using an audio context for a while.
...this value, specified in de
grees, indicates how far off from heading due north the device is.
...And 65 more matches
Index - Archive of obsolete content
perhaps your target audience is people that are using older hardware, for example, and can't upgrade to the latest and
greatest browsers.
...the use of modules
greatly improves the maintainability of code, by splitting it up into independent components, and enforcing logical boundaries between them.
... 178 customizing the download pro
gress bar no summary!
...And 40 more matches
Image file type and format guide - Web media technologies
for example, an rgb color depth of 8 indicates that each of the red,
green, and blue components are represented by an 8-bit value.
... apng is ideal for basic animations that do not need to synchronize to other activities or to a sound track, such as pro
gress indicators, activity throbbers, and other animated sequences.
... file extension(s) .apng specification wiki.mozilla.org/apng_specification browser compatibility chrome 59, edge 12, firefox 3, opera 46, safari 8 maximum dimensions 2,147,483,647×2,147,483,647 pixels supported color modes color mode bits per component (d) description
greyscale 1, 2, 4, 8, and 16 each pixel consists of a single d-bit value indicating the brightness of the
greyscale pixel.
...And 33 more matches
Listening to events on all tabs
firefox 3.5 adds support for listening to pro
gress events on all tabs.
... adding a listener to listen to pro
gress events on all tabs, call the browser's addtabspro
gresslistener() method: gbrowser.addtabspro
gresslistener(mypro
gresslistener); mypro
gresslistener is an object that implements the callbacks used to provide notifications of pro
gress events.
... removing a listener to remove a previously installed pro
gress listener, call removetabspro
gresslistener(): gbrowser.removetabspro
gresslistener(mypro
gresslistener); implementing a listener the listener object itself has five methods it can implement to handle various events: onlocationchange called when the uri of the document displayed in the tab changes.
...And 26 more matches
Index
3 ag
gregating the in-memory datasource rdf no summary!
...the xpcom interfaces and tools you've used have been general, cross-platform, and available in the gecko runtime environment or in any gecko-based application after mozilla 1.2 (when the
gre began to be used).
... 118 receiving startup notifications component manager, embedding mozilla, needsupdate, xpcom sometimes it's necessary for xpcom components to receive notifications as to the pro
gress of the application's startup process, so they can start new services at appropriate times, for example.
...And 25 more matches
Applying color to HTML elements using CSS - HTML: Hypertext Markup Language
color keywords include the standard primary and secondary colors (such as red, blue, or orange), shades of gray (from black to white, including colors like darkgray and light
grey), and a variety of other blended colors including lightsea
green, cornflowerblue, and rebeccapurple.
... hexadecimal string notation hexadecimal string notation represents a color using hexadecimal digits to represent each of the color components (red,
green, and blue).
... "#rrggbb" specifies a fully-opaque color whose red component is the hexadecimal number 0xrr,
green component is 0xgg, and blue component is 0xbb.
...And 20 more matches
<color> - CSS: Cascading Style Sheets
color keywords color keywords are case-insensitive identifiers that represent a specific color, such as red, blue, black, or lightsea
green.
... several keywords are aliases for each other: aqua / cyan fuchsia / magenta darkgray / dark
grey darkslategray / darkslate
grey dimgray / dim
grey lightgray / light
grey lightslategray / lightslate
grey gray /
grey slategray / slate
grey though many keywords have been adapted from x11, their rgb values may differ from the corresponding color on x11 systems since manufacturers sometimes tailor x11 colors to their specific hardware.
... specification keyword rgb hex value live keyword css level 1 black #000000 silver #c0c0c0 gray #808080 white #ffffff maroon #800000 red #ff0000 purple #800080 fuchsia #ff00ff
green #008000 lime #00ff00 olive #808000 yellow #ffff00 navy #000080 blue #0000ff teal #008080 aqua #00ffff css level 2 (revision 1) orange #ffa500 css color module level 3 aliceblue #f0f8ff antiquewhite #faebd7 aquamarin...
...And 17 more matches
Event reference
pro
gress events event name fired when abort pro
gression has been terminated (not due to an error).
... error pro
gression has failed.
... load pro
gression has been successful.
...And 16 more matches
In depth: Microtasks and the JavaScript runtime environment - Web APIs
consider the javascript program below: let outputelem = document.getelementbyid("output"); let userlanguages = { "mike": "en", "teresa": "es" }; function
greetuser(user) { function local
greeting(user) { let
greeting; let language = userlanguages[user]; switch(language) { case "es":
greeting = `¡hola, ${user}!`; break; case "en": default:
greeting = `hello, ${user}!`; break; } return
greeting; } outputelem.innerhtml += local
greeting(user) + "<br>\r"; }
greetuser("mike");
gre...
...etuser("teresa");
greetuser("veronica"); this short program contains three execution contexts, some of which are created and destroyed several times over the course of the program's execution.
... when
greetuser("mike") is reached, a context is created for the
greetuser() function; this execution context is pushed onto the execution context stack.
...And 14 more matches
Web applications and ARIA FAQ - Accessibility
you may want to consider implementing aria using pro
gressive enhancement techniques—such as adding aria using javascript, not directly to your markup—in order to more gracefully support older browsers and assistive technologies.
...here's the markup for a pro
gress bar widget: <div id="percent-loaded" role="pro
gressbar" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100" /> this pro
gress bar is built using a <div>, which is not very descriptive.
...in this example, the role="pro
gressbar" attribute informs the browser that this element is actually a javascript-powered pro
gress bar widget.
...And 14 more matches
Creating a cross-browser video player - Developer guides
the control set most browser's default video controls have the following functionality: play/pause mute volume control pro
gress bar skip ahead go fullscreen the custom control set will also support this functionality, with the addition of a stop button.
...for the pro
gress bar, the pro
gress element is taken advantage of, with a fallback provided for browsers that don't support it (e.g.
... <ul id="video-controls" class="controls"> <li><button id="playpause" type="button">play/pause</button></li> <li><button id="stop" type="button">stop</button></li> <li class="pro
gress"> <pro
gress id="pro
gress" value="0" min="0"> <span id="pro
gress-bar"></span> </pro
gress> </li> <li><button id="mute" type="button">mute/unmute</button></li> <li><button id="volinc" type="button">vol+</button></li> <li><button id="voldec" type="button">vol-</button></li> <li><button id="fs" type="button">fullscreen</button></li> </ul> each button is given an id so it can be easily accessed w...
...And 14 more matches
Drawing graphics - Learn web development
let's add another rectangle into the mix — a
green one this time.
...this converts de
gree values to radians, which is useful because whenever you need to provide an angle value in javascript, it will nearly always be in radians, but humans usually think in de
grees.
... function degtorad(de
grees) { return de
grees * math.pi / 180; }; next, start off your path by adding the following below your previous addition; here we set a color for our triangle, start drawing a path, and then move the pen to (50, 50) without drawing anything.
...And 13 more matches
mozIStorageConnection
method overview void asyncclose([optional] in mozistoragecompletioncallback acallback); void begintransaction(); void begintransactionas(in print32 transactiontype); mozistoragestatement clone([optional] in boolean areadonly); void close(); void committransaction(); void createag
gregatefunction(in autf8string afunctionname, in long anumarguments, in mozistorageag
gregatefunction afunction); mozistorageasyncstatement createasyncstatement(in autf8string asqlstatement); void createfunction(in autf8string afunctionname, in long anumarguments, in mozistoragefunction afunction); mozistoragestatement createstatement(in autf8string asqlstatement); ...
...numstatements)] in mozistoragebasestatement astatements, in unsigned long anumstatements, [optional] in mozistoragestatementcallback acallback ); void executesimplesql(in autf8string asqlstatement); boolean indexexists(in autf8string aindexname); void preload(); obsolete since gecko 1.9 void removefunction(in autf8string afunctionname); mozistoragepro
gresshandler removepro
gresshandler(); void rollbacktransaction(); void setgrowthincrement(in print32 aincrement, in autf8string adatabasename); mozistoragepro
gresshandler setpro
gresshandler(in print32 agranularity, in mozistoragepro
gresshandler ahandler); boolean tableexists(in autf8string atablename); attributes attribute type description...
... transactioninpro
gress boolean returns true if there is a transaction in pro
gress on the database.
...And 13 more matches
nsIDownloadManager
manager;1"] .getservice(components.interfaces.nsidownloadmanager); method overview nsidownload adddownload(in short adownloadtype, in nsiuri asource, in nsiuri atarget, in astring adisplayname, in nsimimeinfo amimeinfo, in prtime astarttime, in nsilocalfile atempfile, in nsicancelable acancelable, in boolean aisprivate); void addlistener(in nsidownloadpro
gresslistener alistener); void canceldownload(in unsigned long aid); void cleanup(); void endbatchupdate(); obsolete since gecko 1.9.1 void flush(); obsolete since gecko 1.8 nsidownload getdownload(in unsigned long aid); void onclose(); obsolete since gecko 1.9.1 void open(in nsidomwindow aparent, in nsidownload adownload); obsolete sin...
...ce gecko 1.9.1 void openpro
gressdialogfor(in nsidownload adownload, in nsidomwindow aparent, in boolean acanceldownloadonclose); obsolete since gecko 1.9.1 void pausedownload(in unsigned long aid); void removedownload(in unsigned long aid); void removedownloadsbytimeframe(in long long abegintime, in long long aendtime); void removelistener(in nsidownloadpro
gresslistener alistener); void resumedownload(in unsigned long aid); void retrydownload(in unsigned long aid); void savestate(); obsolete since gecko 1.8 void startbatchupdate(); obsolete since gecko 1.9.1 attributes attribute type description activedownloadcount long the number of files currently being downloaded.
... listener nsidownloadpro
gresslistener the download manager's pro
gress listener.
...And 13 more matches
Intercepting Page Loads - Archive of obsolete content
http observers are
great for load detection, and filtering by url.
... you won't be able to make dom modifications like with the load events, since these notifications are triggered before the response arrives and is parsed into dom tree, so this is not the best approach for the typical
greasemonkey-style extensions.
... webpro
gresslisteners when used in the chrome, this is a more sophisticated way of intercepting and modifying the various stages in page loads.
...And 12 more matches
MCD, Mission Control Desktop, AKA AutoConfig - Archive of obsolete content
the name of the file can be anything you want because it is named by a general.config preference that should be added at the end of file mozilla_home/default/pref/autoconf.js or mozilla_home/
greprefs/autoconf.js: pref("general.config.filename", "mozilla.cfg");.
... that prefcalls.js is now archive in omni.jar file located at the root of the mozilla apps installation, example of tb5: # jar -tvf /usr/lib/thunderbird/omni.jar |
grep prefcalls.js 7499 sat nov 05 09:21:34 cet 2011 defaults/autoconfig/prefcalls.js traditionally (previous apps versions) is was in mozilla_home/default/autoconfig/prefcalls.js.
...hunderbird-3.0/configure 2009-06-29 11:37:21.677372297 +0200 +++ thunderbird-3.0.autoldap/configure 2009-06-29 14:41:11.547435040 +0200 @@ -12855,7 +12855,7 @@ moz_feeds=1 moz_jsdebugger=1 moz_jsloader=1 -moz_ldap_xpcom= +moz_ldap_xpcom=1 moz_mail_news= moz_mork=1 moz_morkreader= and set --enable-extensions=pref in mozconfig file, in fedora source rpm it is: [root@b008-02 sources]#
grep enable-extensions /root/rpmbuild/sources/thunderbird-mozconfig ac_add_options --enable-extensions=pref it seems worse this time , as even after applying those compilation options mentioned above, i now get the following error message while stating thunderbird with autoconfig (autoconf.js having pref('general.config.filename','thunderbird.cfg'); ) and thunderbird.cfg calling getldap* functions...
...And 12 more matches
Index - Archive of obsolete content
the purpose of this article is not to describe these items in any
great detail but to define what they are in simple terms.
... 300 pro
gressmeter.max no summary!
... 301 pro
gressmeter.mode xul attributes, xul reference no summary!
...And 12 more matches
The Implementation of the Application Object Model - Archive of obsolete content
xul has language constructs for all of the typical dialog controls, as well as for widgets like toolbars, trees, pro
gress bars, and menus.
...this gives you a feature called ag
gregation, the ability to put completely different kinds of data into the same place.
...this same ability to ag
gregate data leads to another capability of rdf.
...And 12 more matches
Object-oriented JavaScript for beginners - Learn web development
for example, a student's
greeting might be of the form "yo, i'm [firstname]" (e.g yo, i'm sam), whereas a teacher might use something more formal, such as "hello, my name is [prefix] [lastname], and i teach [subject]." (e.g hello, my name is mr griffiths, and i teach chemistry).
...add this function within the script element: function createnewperson(name) { const obj = {}; obj.name = name; obj.
greeting = function() { alert('hi!
... i\'m ' + obj.name + '.'); }; return obj; } you can now create a new person by calling this function — try the following lines in your browser's javascript console: const salva = createnewperson('salva'); salva.name; salva.
greeting(); this works well enough, but it is a bit long-winded; if we know we want to create an object, why do we need to explicitly create a new empty object and return it?
...And 12 more matches
Background Tasks API - Web APIs
this establishes a box (id "container") that's used to present the pro
gress of an operation (because you never know how long decoding "quantum filament tachyon emissions" will take, after all) as well as a second main box (with the id "logbox"), which is used to display textual output.
...</p> <div class="container"> <div class="label">decoding quantum filament tachyon emissions...</div> <pro
gress id="pro
gress" value="0"></pro
gress> <div class="button" id="startbutton"> start </div> <div class="label counter"> task <span id="currenttasknumber">0</span> of <span id="totaltaskcount">0</span> </div> </div> <div class="logbox"> <div class="logheader"> log </div> <div id="log"> </div> </div> the pro
gress box uses a <pro
gress> element to show the pro
gress, along with a label with sections that are changed to present numeric information about the pro
gress.
...4px 4px 2px black; display: block; overflow: auto; } .label { display: inline-block; } .counter { text-align: right; padding-top: 4px; float: right; } .button { padding-top: 2px; padding-bottom: 4px; width: 100px; display: inline-block; float: left; border: 1px solid black; cursor: pointer; text-align: center; margin-top: 0; color: white; background-color: dark
green; } #pro
gress { width: 100%; padding-top: 6px; } javascript content now that the document structure is defined, construct the javascript code that will do the work.
...And 12 more matches
Using XMLHttpRequest - Web APIs
*/ } oreq.open("get", url); oreq.responsetype = "arraybuffer"; oreq.send(); for more examples check out the sending and receiving binary data page monitoring pro
gress xmlhttprequest provides the ability to listen to various events that can occur while the request is being processed.
... this includes periodic pro
gress notifications, error notifications, and so forth.
... support for dom pro
gress event monitoring of xmlhttprequest transfers follows the specification for pro
gress events: these events implement the pro
gressevent interface.
...And 12 more matches
Digital video concepts - Web media technologies
rgb most computer graphics models use the rgb color system, wherein some number of bits of data are used to represent each of the red,
green, and blue components of the color of an individual pixel, and an image is comprised of a two-dimensional array of these pixels.
...when using integer components, rgb color uses 8 bits each of red,
green, and blue, as well as potentially 8 bits of alpha (the amount of transparency).
... contemplating human vision we're able to represent an image this way because the human eye sees far more detail in
greyscale than in color, thanks to biology.
...And 12 more matches
Inheritance in JavaScript - Learn web development
for example: person.prototype.
greeting = function() { alert('hi!
... an updated
greeting() method, which sounds a bit more formal than the standard
greeting() method — more suitable for a teacher addressing some students at school.
...to see this, compare the outputs of person.prototype.
greeting and teacher.prototype.
greeting.
...And 11 more matches
nsIPrintingPrompt
this service enables embedders to implement their own print and pro
gress dialogs.
... defaults for platform service: showprintdialog - displays a native dialog showpagesetup() - displays a xul dialog showpro
gress() - displays a xul dialog summary for windows embedders: stated once again: there is no "fallback" native platform support in gfx for the displaying of the native print dialog.
... the current default implementation for windows display a native print dialog but a xul-based pro
gress dialog.
...And 11 more matches
Video player styling basics - Developer guides
the custom video controls and <pro
gress> element are now contained within <div> elements, rather than residing inside unordered list items.
... the markup for the custom controls now looks as follows: <div id="video-controls" class="controls" data-state="hidden"> <button id="playpause" type="button" data-state="play">play/pause</button> <button id="stop" type="button" data-state="stop">stop</button> <div class="pro
gress"> <pro
gress id="pro
gress" value="0" min="0"> <span id="pro
gress-bar"></span> </pro
gress> </div> <button id="mute" type="button" data-state="mute">mute/unmute</button> <button id="volinc" type="button" data-state="volup">vol+</button> <button id="voldec" type="button" data-state="voldown">vol-</button> <button id="fs" type="button" data-state="go-fullscreen">fullscreen</button> </div> related css alteration the previous article simply set the display property of the vid...
... the <div> container for the <pro
gress> element also requires some specific settings; it is set to be much wider than the other child elements and its cursor value is set to be pointer: .controls .pro
gress { cursor:pointer; width:75.390625%; } buttons the first major styling task to tackle is to make the video control's buttons actually look like and act like real buttons.
...And 11 more matches
Listening to events in Firefox extensions - Archive of obsolete content
web pro
gress listeners for more information about web loads a web pro
gress listener can be used; these provide more details about the pro
gress of loading data from the web.
... both browser and tabbrowser elements support the following: var pro
gresslistener = { // add nsiwebpro
gressimplementation here } b.addpro
gresslistener(pro
gresslistener); where b is the browser or tabbrowser you want to listen to events for.
... there are code snippets available that give more detail on using web pro
gress listeners.
...And 10 more matches
Client-side storage - Learn web development
use of cache and service workers is an advanced topic, and we won't be covering it in
great detail in this article, although we will show a simple example in the offline asset storage section below.
...our example will allow you enter a name, after which the page will update to give you a personalized
greeting.
... you can find the example html at personal-
greeting.html — this contains a simple website with a header, content, and footer, and a form for entering your name.
...And 10 more matches
Examples
components.utils.import("resource://
gre/modules/osfile.jsm") let path = os.path.join(os.constants.path.tmpdir, "file.txt"); let promise = os.file.exists(path); let newpromise = promise.then(function onfulfill(aexists) { if (aexists) { console.log("you have file.txt in your temporary directory."); } else { throw new error("you don't have file.txt in your temporary directory."); } }); // unexpected errors should always be reported at the end of a promise chain.
... components.utils.import("resource://
gre/modules/osfile.jsm") let path = os.path.join(os.constants.path.tmpdir, "file.txt"); let promise = os.file.exists(path); let newpromise = promise.then(function onfulfill(aexists) { if (aexists) { console.log("you have file.txt in your temporary directory."); } else { console.log("you don't have file.txt in your temporary directory."); } }); // unexpected errors should always be reported at the end of a promise chain.
... using a promise returned by a function (compact) the same code as the previous example is usually written with a more compact syntax: components.utils.import("resource://
gre/modules/osfile.jsm") let path = os.path.join(os.constants.path.tmpdir, "file.txt"); os.file.exists(path).then(exists => { console.log(exists ?
...And 9 more matches
Mail composition back end
ns_imethod addlistener(nsimsgsendlistener *alistener) = 0; ns_imethod removelistener(nsimsgsendlistener *alistener) = 0; sending listener interfaces the nsimsgsendlistener interface will let a caller keep track of the pro
gress and any status of a send operation.
...an important item to note is the fact that this interface should also implement the nsimsgcopyservicelistener interface if it wants to be notified of the pro
gress and completion of the copy operation.
... ns_imethod onstartsending(const char *amsgid, - the message id for the message being sent pruint32 amsgsize) = 0; - the total message size for the message being sent onpro
gress the onpro
gress interface is called with pro
gress notification on the send operation.
...And 9 more matches
Web Accessibility: Understanding Colors and Luminance - Accessibility
a
great example of a tool that converts colors for you is tom jewett's "mini color selector" with hsl, rgb, hex options for checking contrast in the browser.
... yellow has a
greater luminance than blue, for example.
... our eyes are tuned to perceive certain colors, red, blue, and
green, but we do not perceive these colors with equal strength.
...And 9 more matches
repeating-conic-gradient() - CSS: Cascading Style Sheets
syntax /* starburst: a a blue on blue starburst: the gradient is a starburst of lighter and darker blue, centered in the upper left quandrant, offset by 3de
grees so there is no up/down straight line */ background: repeating-conic-gradient( from 3deg at 25% 25%, hsl(200, 100%, 50%) 0deg 15deg, hsl(200, 100%, 60%) 10deg 30deg); ); values <angle> preceded by the from keyterm, and taking an angle as its value, defines the gradient rotation in clockwise direction.
... <color-hint> th color-hint is an interpolation hint defining how the gradient pro
gresses between adjacent color stops.
... if neither the first nor the last color stops include include a a color stop angle
greater than 0deg or less than 360 de
grees respectively, the conic-gradient will not repeat.
...And 9 more matches
Downloading Files - Archive of obsolete content
components.utils.import("resource://
gre/modules/privatebrowsingutils.jsm"); const webbrowserpersist = components.constructor("@mozilla.org/embedding/browser/nswebbrowserpersist;1", "nsiwebbrowserpersist"); var persist = webbrowserpersist(); var targetfile = services.dirsvc.get("desk", ci.nsifile); targetfile.append("file.bin"); // obtain the privacy context of the browser window that...
...var privacy = privatebrowsingutils.privacycontextfromwindow(urlsourcewindow); persist.persistflags = persist.persist_flags_from_cache | persist.persist_flags_replace_existing_files; persist.saveuri(uritosave, null, null, null, "", targetfile, privacy); if you don't need detailed pro
gress information, you might be happier with nsidownloader.
... downloading binary files with a pro
gress listener to download a binary file with custom pro
gress listener: components.utils.import("resource://
gre/modules/privatebrowsingutils.jsm"); const webbrowserpersist = components.constructor("@mozilla.org/embedding/browser/nswebbrowserpersist;1", "nsiwebbrowserpersist"); var persist = webbrowserpersist(); var targetfile = services.dirsvc.get("desk", ci.nsifile); targetfile.append("file.bin"); var obj_uri = services.io.newuri(aurltodownload, null, null); // obtain the privacy context of the browser window that the url // we are downloading comes from.
...And 8 more matches
Making decisions in your code — conditionals - Learn web development
best to stay in with a cup of hot chocolate, or go build a snowman.'; } else if (choice === 'overcast') { para.textcontent = 'it isn\'t raining, but the sky is
grey and gloomy; it could turn any minute, so take a rain coat just in case.'; } else { para.textcontent = ''; } } here we've got an html <select> element allowing us to make different weather choices, and a simple paragraph.
... < and > — test if one value is less than or
greater than another.
... <= and >= — test if one value is less than or equal to, or
greater than or equal to, another.
...And 8 more matches
Color picker tool - CSS: Cascading Style Sheets
tformat(format) { if (format === 'hsv') this.format = 'hsv'; if (format === 'hsl') this.format = 'hsl'; }; /*========== methods to set color properties ==========*/ color.prototype.isvalidrgbvalue = function isvalidrgbvalue(value) { return (typeof(value) === 'number' && isnan(value) === false && value >= 0 && value <= 255); }; color.prototype.setrgba = function setrgba(red,
green, blue, alpha) { if (this.isvalidrgbvalue(red) === false || this.isvalidrgbvalue(
green) === false || this.isvalidrgbvalue(blue) === false) return; this.r = red | 0; this.g =
green | 0; this.b = blue | 0; if (this.isvalidrgbvalue(alpha) === true) this.a = alpha | 0; }; color.prototype.setbyname = function setbyname(name, value) { if (name === 'r' || name === 'g' ||...
...a(c, x, m); return; } if (h >= 1 && h < 2) { this.setrgba(x, c, m); return; } if (h >= 2 && h < 3) { this.setrgba(m, c, x); return; } if (h >= 3 && h < 4) { this.setrgba(m, x, c); return; } if (h >= 4 && h < 5) { this.setrgba(x, m, c); return; } if (h >= 5 && h < 6) { this.setrgba(c, m, x); return; } }; color.prototype.rgbtohsv = function rgbtohsv() { var red = this.r / 255; var
green = this.g / 255; var blue = this.b / 255; var cmax = math.max(red,
green, blue); var cmin = math.min(red,
green, blue); var delta = cmax - cmin; var hue = 0; var saturation = 0; if (delta) { if (cmax === red ) { hue = ((
green - blue) / delta); } if (cmax ===
green ) { hue = 2 + (blue - red) / delta; } if (cmax === blue ) { hue = 4 + (red -
green) / delta; } if (cmax) ...
...saturation = delta / cmax; } this.hue = 60 * hue | 0; if (this.hue < 0) this.hue += 360; this.saturation = (saturation * 100) | 0; this.value = (cmax * 100) | 0; }; color.prototype.rgbtohsl = function rgbtohsl() { var red = this.r / 255; var
green = this.g / 255; var blue = this.b / 255; var cmax = math.max(red,
green, blue); var cmin = math.min(red,
green, blue); var delta = cmax - cmin; var hue = 0; var saturation = 0; var lightness = (cmax + cmin) / 2; var x = (1 - math.abs(2 * lightness - 1)); if (delta) { if (cmax === red ) { hue = ((
green - blue) / delta); } if (cmax ===
green ) { hue = 2 + (blue - red) / delta; } if (cmax === blue ) { hue = 4 + (red -
green) / delta; } if (cmax) saturation = delta / x; } this.hue = 60 * hue | 0; ...
...And 8 more matches
Web video codec guide - Web media technologies
in some situations, a
greater sacrifice of quality in order to bring down the data size is worth that lost quality; other times, the loss of quality is unacceptable and it's necessary to accept a codec configuration that results in a correspondingly larger file.
... effect of source video format on encoded output the de
gree to which the format of the source video will affect the output varies depending on the codec and how it works.
... the more variability—such as noise—there is in the image, the more complex the compression process and the less success the algorithm is likely to have compressing the image to the same de
gree.
...And 8 more matches
Interacting with page scripts - Archive of obsolete content
expose objects to page scripts until firefox 30, you could use unsafewindow to perform the reverse procedure, and make objects defined in content scripts available to page scripts: // content-script.js unsafewindow.contentscriptobject = {"
greeting" : "hello from add-on"}; // page-script.js var button = document.getelementbyid("show-content-script-var"); button.addeventlistener("click", function() { // access object defined by content script console.log(window.contentscriptobject.
greeting); // "hello from add-on" }, false); after firefox 30, you can still do this for primitive values, but can no longer do it for objects.
...k/self"); tabs.open({ url: self.data.url("page.html"), onready: attachscript }); function attachscript(tab) { tab.attach({ contentscriptfile: self.data.url("content-script.js") }); } the content script defines an object and assigns it to unsafewindow twice: the first time using cloneinto(), the second time using simple assignment: // content-script.js var contentscriptobject = {"
greeting" : "hello from add-on"}; unsafewindow.clonedcontentscriptobject = cloneinto(contentscriptobject, unsafewindow); unsafewindow.assignedcontentscriptobject = contentscriptobject; the "page.html" file adds two buttons and assigns an event listener to each: one listener displays a property of the cloned object, and the other listener displays a property of the assigned object: <html> <head> ...
... </head> <body> <input id="works" type="button" value="i will work"/> <input id="fails" type="button" value="i will not work"/> <script> var works = document.getelementbyid("works"); works.addeventlistener("click", function() { alert(clonedcontentscriptobject.
greeting); }, false); var fails = document.getelementbyid("fails"); fails.addeventlistener("click", function() { alert(assignedcontentscriptobject.
greeting); }, false); </script> </body> </html> if you run the example, clicking "i will work" displays the value of "
greeting" in an alert.
...And 7 more matches
tabbrowser - Archive of obsolete content
ctrlpageupdown, onbookmarkgroup, onnewtab, tabmodalpromptshowing properties browsers, cangoback, cangoforward, contentdocument, contenttitle, contentvieweredit, contentviewerfile, contentwindow, currenturi, docshell, documentcharsetinfo, homepage, markupdocumentviewer, securityui, selectedbrowser, selectedtab, sessionhistory, tabcontainer, tabs, visibletabs, webbrowserfind, webnavigation, webpro
gress methods addpro
gresslistener, addtab, addtabspro
gresslistener,appendgroup, getbrowseratindex, getbrowserindexfordocument, getbrowserfordocument, getbrowserfortab, geticon, getnotificationbox, gettabforbrowser, gettabmodalpromptbox, goback, gobackgroup, goforward, goforwardgroup, gohome, gotoindex, loadgroup, loadonetab, loadtabs, loaduri, loaduriwithflags, movetabto, pintab, reload, reloadallt...
...abs, reloadtab, reloadwithflags, removealltabsbut, removecurrenttab, removepro
gresslistener, removetab, removetabspro
gresslistener,replacegroup, selecttabatindex, seticon, showonlythesetabs, stop, unpintab attributes autocompleteenabled type: boolean set to true to enable autocomplete of fields.
... webpro
gress type: nsiwebpro
gress this read-only property contains an nsiwebpro
gress object which is used to monitor the pro
gress of a document loading.
...And 7 more matches
Index - MDN Web Docs Glossary: Definitions of Web-related terms
in a typical image file, the color channels describe how much red,
green, and blue are used to make up the final color.
...dhtml ag
gregates the combined functionality of html, css, the dom, and javascript.
... 273 mobile first design, glossary, layout, layout mobile mobile first, a form of pro
gressive enhancement, is a web-development and web-design approach that focuses on prioritizing design and development for mobile screen sizes over design and development for desktop screen sizes.
...And 7 more matches
HTML text fundamentals - Learn web development
so, for example, we expect a red traffic light to mean "stop," and a
green traffic light to mean "go." things can get tricky very quickly if the wrong semantics are applied.
... hummus is a delicious thick paste used heavily in
greek and middle eastern dishes.
... in
gredients 1 can (400g) of chick peas (garbanzo beans) 175g of tahini 6 sundried tomatoes half a red pepper a pinch of cayenne pepper 1 clove of garlic a dash of olive oil instructions remove the skin from the garlic, and chop coarsely remove all the seeds and stalk from the pepper, and chop coarsely add all the in
gredients into a food processor process all the in
gredients into a paste if you want a coarse "chunky" hummus, process it for a short time if you want a smooth hummus, process it for a longer time for a different flavour, you could try blending in a small measure of lemon and coriander, chili pepper, lime and chipotle, harissa and mint, or spinach and feta cheese.
...And 7 more matches
Download
this property may be populated or changed while the download is in pro
gress, using the mime type provided by the server.
...this value starts at zero, and may be updated regardless of the value of haspro
gress.
... this property is relevant while the download is in pro
gress, and also if it failed or has been canceled.
...And 7 more matches
nsIZipWriter
attempting to perform a synchronous operation on the interface while the background queue is in pro
gress will throw an ns_error_in_pro
gress exception.
... inqueue boolean true if operations are being performed in the background queue, or false if background operations are not in pro
gress.
... ns_error_in_pro
gress the zip writer is already performing another operation.
...And 7 more matches
Fundamentals of WebXR - Web APIs
the width of the field of view is measured as the angle defining the arc from the far left edge of your field of view to the far right edge, and is specified in either de
grees or radians.
... de
grees of freedom the term de
grees of freedom is an indication of how much freedom of movement the user has within the virtual world.
... diagram showing the movements possible with 3 de
gree of freedom hardware: yaw, roll, and pitch.
...And 7 more matches
Using CSS gradients - CSS: Cascading Style Sheets
css gradients are represented by the <gradient> data type, a special type of <image> made of a pro
gressive transition between two or more colors.
... we'll start by introducing linear gradients, then introduce features that are supported in all gradient types using linear gradients as the example, then move on to radial, conic and repeating gradients using linear gradients a linear gradient creates a band of colors that pro
gress in a straight line.
... controlling the pro
gression of a gradient by default, a gradient evenly pro
gresses between the colors of two adjacent color stops, with the midpoint between those two color stops being the midpoint color value.
...And 7 more matches
begin - SVG: Scalable Vector Graphics
begin="2s" dur="6s" fill="freeze" /> </rect> <rect x="60" y="85" height="15" width="0"> <animate attributetype="xml" attributename="width" to="50" begin="4s" dur="4s" fill="freeze" /> </rect> <!-- grid --> <text x="10" y="20" text-anchor="middle">0s</text> <line x1="10" y1="25" x2="10" y2="105" stroke="
grey" stroke-width=".5" /> <text x="35" y="20" text-anchor="middle">2s</text> <line x1="35" y1="25" x2="35" y2="105" stroke="
grey" stroke-width=".5" /> <text x="60" y="20" text-anchor="middle">4s</text> <line x1="60" y1="25" x2="60" y2="105" stroke="
grey" stroke-width=".5" /> <text x="85" y="20" text-anchor="middle">6s</text> <line x1="85" y1="25" x2="85" y2="105" stroke="
grey...
..." stroke-width=".5" /> <text x="110" y="20" text-anchor="middle">8s</text> <line x1="110" y1="25" x2="110" y2="105" stroke="
grey" stroke-width=".5" /> <line x1="10" y1="30" x2="110" y2="30" stroke="
grey" stroke-width=".5" /> <line x1="10" y1="105" x2="110" y2="105" stroke="
grey" stroke-width=".5" /> </svg> begin-1-offset.svg syncbase example <svg width="120" height="120" viewbox="0 0 120 120" xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink"> <!-- animated rectangles --> <rect x="10" y="35" height="15" width="0"> <animate attributetype="xml" attributename="width" to="50" id="first" begin="0s;third.end" dur="4s" /> </rect> <rect x="60" y="60" height="15" width="0"> <an...
...e="width" to="25" id="second" begin="first.end" dur="2s" /> </rect> <rect x="85" y="85" height="15" width="0"> <animate attributetype="xml" attributename="width" to="25" id="third" begin="second.end" dur="2s" /> </rect> <!-- grid --> <text x="10" y="20" text-anchor="middle">0s</text> <line x1="10" y1="25" x2="10" y2="105" stroke="
grey" stroke-width=".5" /> <text x="35" y="20" text-anchor="middle">2s</text> <line x1="35" y1="25" x2="35" y2="105" stroke="
grey" stroke-width=".5" /> <text x="60" y="20" text-anchor="middle">4s</text> <line x1="60" y1="25" x2="60" y2="105" stroke="
grey" stroke-width=".5" /> <text x="85" y="20" text-anchor="middle">6s</text> <line x1="85" y1="25" x2="85" y2="105" stroke="
grey...
...And 7 more matches
/loader - Archive of obsolete content
it can be loaded as a regular script tag in documents that have system principals (note: this does not appear to work as of 02.2016 due to "use strict" being added to the file): <script type='application/javascript' src='resource://
gre/modules/commonjs/toolkit/loader.js'></script> this will expose a single loader object containing all of the api functions described in this document.
... it can be loaded as a javascript code module: let { loader, require, unload } = components.utils.import('resource://
gre/modules/commonjs/toolkit/loader.js'); it can be required as a commonjs module from a module loaded in the loader itself: let { loader, require, unload } = require('toolkit/loader'); what is it good for ?
...there are lots of different possibilities, but the most common setup looks like this: let { loader } = require('toolkit/loader'); let loader = loader({ paths: { // resolve all modules starting with `toolkit/` as follows: // toolkit/foo -> resource://
gre/modules/commonjs/toolkit/foo.js // toolkit/foo/bar -> resource://
gre/modules/commonjs/toolkit/foo/bar.js 'toolkit/': 'resource://
gre/modules/commonjs/toolkit/', // resolve all other non-relative module requirements as follows: // devtools/gcli -> resource:///modules/devtools/gcli.js // panel -> resource:///modules/panel.js '': 'resource:///modules/', } ...
...And 6 more matches
File I/O - Archive of obsolete content
creating an nsifile object components.utils.import("resource://
gre/modules/fileutils.jsm"); var file = new fileutils.file("/home"); or the same without using fileutils.jsm: var file = components.classes["@mozilla.org/file/local;1"].
... getting files in special directories components.utils.import("resource://
gre/modules/fileutils.jsm"); // get the "data.txt" file in the profile directory var file = fileutils.getfile("profd", ["data.txt"]); or the same without using fileutils.jsm: // get profile directory.
...however, you can enumerate available drives using the following code: components.utils.import("resource://
gre/modules/fileutils.jsm"); var root = new fileutils.file("\\\\."); var drivesenum = root.directoryentries, drives = []; while (drivesenum.hasmoreelements()) { drives.push(drivesenum.getnext().
...And 6 more matches
Finding window handles - Archive of obsolete content
recall that nsibasewindow -> nativehandle returns the following 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 .queryinterface(ci.nsiinterfacerequestor) .getinterface(ci.nsibasewindow); var hwndstring = basewindow.nativehandle; components.utils.import('resource://
gre/modules/ctypes.jsm'); var user32 = ctypes.open('user32.dll'); /* http://msdn.microsoft.com/en-us/library/ms633539%28v=vs.85%29.aspx * bool winapi setforegroundwindow( * __in_ hwnd hwnd * ); */ var setforegroundwindow = user32.declare('setforegroundwindow', ctypes.winapi_abi, ctypes.bool, // return bool ctypes.voidptr_t // hwnd ); var hwnd = ctypes.voidptr_t(ctypes.uint64(hwndstring)); var rez_setforegroundwindow = setforegroundwindow(hwnd); console.log('rez_setforegroundwindow:', rez_setforegroundwindow, rez_setforegroundwindow.tostring());...
... user32.close(); mac os x objective-c 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 .queryinterface(ci.nsiinterfacerequestor) .getinterface(ci.nsibasewindow); var nswindowstring = basewindow.nativehandle; components.utils.import('resource://
gre/modules/ctypes.jsm'); var objc = ctypes.open(ctypes.libraryname('objc')); // ...
...And 6 more matches
Advanced form styling - Learn web development
<input type="color"> date-related controls such as <input type="datetime-local"> <input type="range"> <input type="file"> <pro
gress> and <meter> let's first talk about the appearance property, which is pretty useful for making all of the above more stylable.
...prefixed usually means "work in pro
gress", so in the future browser vendors may come to a consensus to drop the prefix.
...e; } we can use the :checked and :disabled pseudo-classes to change the appearance of our custom checkbox as its state changes: input[type="checkbox"] { position: relative; width: 1em; height: 1em; border: 1px solid gray; /* adjusts the position of the checkboxes on the text baseline */ vertical-align: -2px; /* set here so that windows' high-contrast mode can override */ color:
green; } input[type="checkbox"]::before { content: "✔"; position: absolute; font-size: 1.2em; right: -1px; top: -0.3em; visibility: hidden; } input[type="checkbox"]:checked::before { /* use `visibility` instead of `display` to avoid recalculating layout */ visibility: visible; } input[type="checkbox"]:disabled { border-color: black; background: #ddd; color: gray; } you'll ...
...And 6 more matches
Other form controls - Learn web development
previous overview: forms next we now look at the functionality of non-<input> form elements in detail, from other control types such as drop-down lists and multi-line text fields, to other useful form features such as the <output> element (which we saw in action in the previous article), and pro
gress bars.
... in this case, different browsers behave differently from case to case, so consider such uses as pro
gressive enhancement, and ensure they degrade gracefully.
... meters and pro
gress bars meters and pro
gress bars are visual representations of numeric values.
...And 6 more matches
Index - Learn web development
13 aprender y obtener ayuda beginner, learn, learning, web development, getting help it is
great that you are putting some time into learning a new set of skills, but there are good practices to employ that will make your learning more effective.
... there are also are times when you'll get stuck and feel frustrated — even professional web developers feel like this regularly — and it pays to know about the most effective ways to try and get help so you can pro
gress in your work.
... 44 the web and web standards beginner, front-end, learn, web, web standards this article provides some useful background on the web — how it came about, what web standard technologies are, how they work together, why "web developer" is a
great career to choose, and what kinds of best practices you'll learn about through the course.
...And 6 more matches
nsIMsgMessageService
amsgwindow nsimsgwindow for pro
gress and status feedback return values aurl the new nsiuri of the message.
... aurllistener an nsiurllistener amsgwindow nsimsgwindow for pro
gress and status feedback return values aurl the new nsiuri of the message.
... amsgwindow nsimsgwindow for pro
gress and status feedback aurllistener an nsiurllistener acharsetoverride (optional) character set over ride to force the message to use.
...And 6 more matches
WebGL constants - Web APIs
returns never, always, less, equal, lequal,
greater, gequal, or notequal.
...returns never, always, less, equal, lequal,
greater, gequal, or notequal.
... color_clear_value 0x0c22 color_writemask 0x0c23 unpack_alignment 0x0cf5 pack_alignment 0x0d05 max_texture_size 0x0d33 max_viewport_dims 0x0d3a subpixel_bits 0x0d50 red_bits 0x0d52
green_bits 0x0d53 blue_bits 0x0d54 alpha_bits 0x0d55 depth_bits 0x0d56 stencil_bits 0x0d57 polygon_offset_units 0x2a00 polygon_offset_factor 0x8038 texture_binding_2d 0x8069 sample_buffers 0x80a8 samples 0x80a9 sample_coverage_value ...
...And 6 more matches
Web audio spatialization basics - Web APIs
by default, both are 360 de
grees.
...make it project to the back when the boombox is rotated 180 de
grees and facing away from us.
... let's set up a rotation rate, which we'll convert into a radian range value for use in math.sin and math.cos later, when we want to figure out the new coordinates when we're rotating our boombox: // set up rotation constants const rotationrate = 60; // bigger number equals slower sound rotation const q = math.pi/rotationrate; //rotation increment in radians we can also use this to work out de
grees rotated, which will help with the css transforms we will have to create (note we need both an x and y-axis for the css transforms): // get de
grees for css const de
greesx = (q * 180)/math.pi; const de
greesy = (q * 180)/math.pi; let's take a look at our left rotation as an example.
...And 6 more matches
ARIA - Accessibility
here's the markup for a pro
gress bar widget: <div id="percent-loaded" role="pro
gressbar" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"> </div> this pro
gress bar is built using a <div>, which has no meaning.
...in this example, the role="pro
gressbar" attribute informs the browser that this element is actually a javascript-powered pro
gress bar widget.
... the aria-valuemin and aria-valuemax attributes specify the minimum and maximum values for the pro
gress bar, and the aria-valuenow describes the current state of it and therefore must be kept updated with javascript.
...And 6 more matches
Linear-gradient Generator - CSS: Cascading Style Sheets
tformat(format) { if (format === 'hsv') this.format = 'hsv'; if (format === 'hsl') this.format = 'hsl'; }; /*========== methods to set color properties ==========*/ color.prototype.isvalidrgbvalue = function isvalidrgbvalue(value) { return (typeof(value) === 'number' && isnan(value) === false && value >= 0 && value <= 255); }; color.prototype.setrgba = function setrgba(red,
green, blue, alpha) { if (this.isvalidrgbvalue(red) === false || this.isvalidrgbvalue(
green) === false || this.isvalidrgbvalue(blue) === false) return; this.r = red | 0; this.g =
green | 0; this.b = blue | 0; if (this.isvalidrgbvalue(alpha) === true) this.a = alpha | 0; }; color.prototype.setbyname = function setbyname(name, value) { if (name === 'r' || name === 'g' ||...
...a(c, x, m); return; } if (h >= 1 && h < 2) { this.setrgba(x, c, m); return; } if (h >= 2 && h < 3) { this.setrgba(m, c, x); return; } if (h >= 3 && h < 4) { this.setrgba(m, x, c); return; } if (h >= 4 && h < 5) { this.setrgba(x, m, c); return; } if (h >= 5 && h < 6) { this.setrgba(c, m, x); return; } }; color.prototype.rgbtohsv = function rgbtohsv() { var red = this.r / 255; var
green = this.g / 255; var blue = this.b / 255; var cmax = math.max(red,
green, blue); var cmin = math.min(red,
green, blue); var delta = cmax - cmin; var hue = 0; var saturation = 0; if (delta) { if (cmax === red ) { hue = ((
green - blue) / delta); } if (cmax ===
green ) { hue = 2 + (blue - red) / delta; } if (cmax === blue ) { hue = 4 + (red -
green) / delta; } if (cmax) ...
...saturation = delta / cmax; } this.hue = 60 * hue | 0; if (this.hue < 0) this.hue += 360; this.saturation = (saturation * 100) | 0; this.value = (cmax * 100) | 0; }; color.prototype.rgbtohsl = function rgbtohsl() { var red = this.r / 255; var
green = this.g / 255; var blue = this.b / 255; var cmax = math.max(red,
green, blue); var cmin = math.min(red,
green, blue); var delta = cmax - cmin; var hue = 0; var saturation = 0; var lightness = (cmax + cmin) / 2; var x = (1 - math.abs(2 * lightness - 1)); if (delta) { if (cmax === red ) { hue = ((
green - blue) / delta); } if (cmax ===
green ) { hue = 2 + (blue - red) / delta; } if (cmax === blue ) { hue = 4 + (red -
green) / delta; } if (cmax) saturation = delta / x; } this.hue = 60 * hue | 0; ...
...And 6 more matches
Cross-browser audio basics - Developer guides
ntbyid('play'); var pause = document.getelementbyid('pause'); // associate functions with the 'onclick' events play.onclick = playaudio; pause.onclick = pauseaudio; function playaudio() { myaudio.play(); } function pauseaudio() { myaudio.pause(); } } media loading events above we have shown how you can create a very simple audio player, but what if we want to show pro
gress, buffering and only activate the buttons when the media is ready to play?
... myaudio.addeventlistener("loadeddata", function() { //you could display the playhead now }); pro
gress the pro
gress event indicates that the download of media is still in pro
gress.
... myaudio.addeventlistener("pro
gress", function() { // you could let the user know the media is downloading }); canplay canplay is a useful event to detect should you want to determine whether the media is ready to play.
...And 6 more matches
Game promotion - Game development
there are many ways to promote your game — most of them being free, so even if you're struggling to make a living as an indie dev with zero budget you can still do a lot to let people know about your
great new game.
... many
great games get started as a quick, sloppy demo submitted to a competition.
...a further option is to publish monthly reports that summarize all your pro
gress — it helps you see what you've accomplished throughout the month and what's still left to do, and it keeps reminding people that your game is coming out soon — building buzz is always good.
...And 5 more matches
JavaScript object basics - Learn web development
he likes ' + this.interests[0] + ' and ' + this.interests[1] + '.'); },
greeting: function() { alert('hi!
... i\'m ' + this.name[0] + '.'); } }; after saving and refreshing, try entering some of the following into the javascript console on your browser devtools: person.name person.name[0] person.age person.interests[1] person.bio() person.
greeting() you have now got some data and functionality inside your object, and are now able to access them with some nice simple syntax!
...look at this one for example:
greeting: function() { alert('hi!
...And 5 more matches
Command line crash course - Learn web development
although there's a
great wealth of tools available from the command line, if you're using tools like visual studio code there's also a mass of extensions that can be used as a proxy to using terminal commands without needing to use the terminal directly.
...mputer’s file system along with base level tasks such as create, copy, rename and delete: move around your directory structure: cd create directories: mkdir create files (and modify their metadata): touch copy files: cp move files: mv delete files or directories: rm download files found at specific urls: curl search for fragments of text inside larger bodies of text:
grep view a file's contents page by page: less, cat manipulate and transform streams of text (for example changing all the instances of <div>s in an html file to <article>): awk, tr, sed note: there are a number of good tutorials on the web that go much deeper into the command line on the web — this is only a brief introduction!
...the man page lists all the options in
great detail, which may be a bit intimidating to begin with, but at least you know it’s there if you need it.
...And 5 more matches
Working with windows in chrome code
in this example, we're using window.opendialog to open a pro
gress dialog.
... we pass in the current status text as well as the maximum and current pro
gress values.
...todo: link to how to pass an xpcom object to a new window when it has a more useful example opener code: window.opendialog("chrome://test/content/pro
gress.xul", "mypro
gress", "chrome,centerscreen", {status: "reading remote data", maxpro
gress: 50, pro
gress: 10} ); pro
gress.xul: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window onload="onload();" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script><![cdata[ var gstatus, gpro
gressmeter; var maxpro
gress = 100; function onload() { gstatus = document.getelementbyid("status"); gpro
gressmeter = document.getelementbyid("pro
gressmeter"); if("arguments" in window && ...
...And 5 more matches
Web Video Text Tracks Format (WebVTT) - Web APIs
it is also recommended that you use the
greater-than escape sequence (>) instead of the
greater-than character (>) to avoid confusion with tags.
...in this case, you insert your css rules into the file with each rule preceded by the string "style" all by itelf on a line of text, as shown below: webvtt style ::cue { background-image: linear-gradient(to bottom, dimgray, lightgray); color: papayawhip; } /* style blocks cannot use blank lines nor "dash dash
greater than" */ note comment blocks can be used between style blocks.
...the end time must be
greater than the start time, and the start time must be
greater than or equal to all previous start times.
...And 5 more matches
conic-gradient() - CSS: Cascading Style Sheets
syntax /* a conic gradient rotated 45 de
grees, starting blue and finishing red */ conic-gradient(from 45deg, blue, red); /* a a bluish purple box: the gradient goes from blue to red, but as only the bottom right quadrant is visible, as the center of the conic gradient is in at the top left corner */ conic-gradient(from 90deg at 0 0, blue, red); /* colorwheel */ background: conic-gradient( hsl(360, 100%, 50%), hsl(315, 10...
... <color-hint> th color-hint is an interpolation hint defining how the gradient pro
gresses between adjacent color stops.
... to create a conic gradient that repeats so as to fill a 360 de
gree rotation, use the repeating-conic-gradient() function instead.
...And 5 more matches
linear-gradient() - CSS: Cascading Style Sheets
the linear-gradient() css function creates an image consisting of a pro
gressive transition between two or more colors along a straight line.
... syntax /* a gradient tilted 45 de
grees, starting blue and finishing red */ linear-gradient(45deg, blue, red); /* a gradient going from the bottom right to the top left corner, starting blue and finishing red */ linear-gradient(to left top, blue, red); /* color stop: a gradient going from the bottom to top, starting blue, turning
green at 40% of its length, and finishing red */ linear-gradient(0deg, blue,
green 40%, red); /* color hint: a gradient going from the lef...
...t to right, starting red, getting to the midpoint color 10% of the way across the length of the gradient, taking the rest of the 90% of the length to change to blue */ linear-gradient(.25turn, red, 10%, blue); /* multi-position color stop: a gradient tilted 45 de
grees, with a red bottom-left half and a blue top-right half, with a hard line where the gradient changes from red to blue */ linear-gradient(45deg, red 0 50%, blue 50% 100%); values <side-or-corner> the position of the gradient line's starting point.
...And 5 more matches
HTML attribute: max - HTML: Hypertext Markup Language
if the value of the element is
greater than this, the element fails constraint validation.
... this value must be
greater than or equal to the value of the min attribute.
...if the max attribute is valid and a non-empty value is
greater than the maximum allowed by the max attribute, constraint validation will prevent form submission.
...And 5 more matches
<input>: The Input (Form Input) element - HTML: Hypertext Markup Language
this table is followed by a list describing each attribute in
greater detail, along with which input types they are associated with.those that are common to most or all input types are defined in
greater detail below.
... max valid for date, month, week, time, datetime-local, number, and range, it defines the
greatest value in the range of permitted values.
...this value must also be
greater than or equal to the value of minlength.
...And 5 more matches
HTML documentation index - HTML: Hypertext Markup Language
if the value of the element is
greater than this, the element fails constraint validation.
... this value must be
greater than or equal to the value of the min attribute.
...if the max attribute is valid and a non-empty value is
greater than the maximum allowed by the max attribute, constraint validation will prevent form submission.
...And 5 more matches
How to convert an overlay extension to restartless - Archive of obsolete content
step 1: use services.jsm if you load one of mozilla's internal jsm files, for example services.jsm, you'll do so via privileged javascript code like this: components.utils.import("resource://
gre/modules/services.jsm"); from here on out, it is assumed you've imported services.jsm somewhere at the top of whatever file you're in and will be using it in all code examples.
...it's a
great way to modularize your code that's been available since firefox 3.
... how to get and load the data of of your add-on's files using the add-on manager api: // this is the old way of getting one of your files const myaddonid = ...; // just store a constant with your id components.utils.import("resource://
gre/modules/addonmanager.jsm"); addonmanager.getaddonbyid(myaddonid,function(addon) { var file = services.io.newuri("resource://myaddon/filename.ext",null,null) .queryinterface(components.interfaces.nsifileurl) .file; var stream = components.classes["@mozilla.org/network/file-input-stream;1"] .createinstance(compon...
...And 4 more matches
Promises - Archive of obsolete content
a task example like the following: components.utils.import("resource://
gre/modules/task.jsm"); task.spawn(function* () { var response = yield request("login", { username: user, password: password }); if (response.messages) { try { yield publish({ username: user, messages: response.messages }); } catch (e) { self.reporterror("publication failed", e); } } }); can be converted to a pure promise-based equ...
... representative example usage components.utils.import("resource://
gre/modules/osfile.jsm"); task.spawn(function* () { // retrieve file metadata to check modification time.
...the downloads object provides a promise-based api for downloading remote files, with full support for pro
gress tracking, pause and resume, and, optionally, integration with the download manager ui.
...And 4 more matches
Introduction to Public-Key Cryptography - Archive of obsolete content
similarly, a digital signature on an html form, combined with a certificate that identifies the signer, can provide evidence, after the fact, that the person identified by that certificate did a
gree to the contents of the form.
... in addition to authentication, the digital signature in both cases ensures a de
gree of nonrepudiation-that is, a digital signature makes it difficult for the signer to claim later not to have sent the email or the form.
... organizations have a
great deal of flexibility in terms of the way they set up their ca hierarchies.
...And 4 more matches
The Business Benefits of Web Standards - Archive of obsolete content
by using semantic markup we
greatly assist the search engines in their indexing process.
...a lot of other sites would
greatly increase their seo by simply using proper tags for the content.
...as style sheet technology gives designers good typographic control and permits effects such as roll-overs, it
greatly reduces the need for javascript programming and creation of graphics.
...And 4 more matches
Call stack - MDN Web Docs Glossary: Definitions of Web-related terms
example function
greeting() { // [1] some codes here sayhi(); // [2] some codes here } function sayhi() { return "hi!"; } // invoke the `
greeting` function
greeting(); // [3] some codes here the code above would be executed like this: ignore all functions, until it reaches the
greeting() function invocation.
... add the
greeting() function to the call stack list.
... call stack list: -
greeting execute all lines of code inside the
greeting() function.
...And 4 more matches
CSS values and units - Learn web development
so each successive level of nesting gets pro
gressively larger, as each has its font size set to 1.3em — 1.3 times its parent's font size.
...each <li> has a font-size of 80%, therefore the nested list items become pro
gressively smaller as they inherit their sizing from their parent.
... the standard color system available in modern computers is 24 bit, which allows the display of about 16.7 million distinct colors via a combination of different red,
green and blue channels with 256 different values per channel (256 x 256 x 256 = 16,777,216.) let's have a look at some of the ways in which we can specify colors in css.
...And 4 more matches
Cooperative asynchronous JavaScript: Timeouts and intervals - Learn web development
(in other words, when the stack is empty.) you will learn more on this matter as you pro
gress through this article.
... in the following example, the browser will wait two seconds before executing the anonymous function, then will display the alert message (see it running live, and see the source code): let my
greeting = settimeout(function() { alert('hello, mr.
...the following two versions of the code snippet are equivalent to the first one: // with a named function let my
greeting = settimeout(function sayhi() { alert('hello, mr.
...And 4 more matches
Aprender y obtener ayuda - Learn web development
it is
great that you are putting some time into learning a new set of skills, but there are good practices to employ that will make your learning more effective.
... there are also are times when you'll get stuck and feel frustrated — even professional web developers feel like this regularly — and it pays to know about the most effective ways to try and get help so you can pro
gress in your work.
... focused thinking is
great for concentrating hard on specific subjects, getting into deep problem solving, and improving your mastery of the techniques required — strengthening the neural pathways in your brain where that information is stored.
...And 4 more matches
Software accessibility: Where are we today?
this article reviews the pro
gress and technology as it has developed.
...one
great place to go and learn about this industry is the csun conference in los angeles, which takes place every year in mid-late march.
...screen magnifiers also have some built-in text-to-speech and the ability to filter text and images through various color palettes, such as black on yellow for high contrast, or
green on blue for low contrast.
...And 4 more matches
Embedding Tips
implement the nsiwebpro
gresslistener interface and register it with the appropriate web browser object via the nsiwebbrowser::addwebbrowserlistener() method.
...register your own nsiwebpro
gresslistener object to listen for pro
gress and state notifications.
... your web pro
gress listener must also implement nsiauthprompt if you want to be able to upload to a password protected location (e.g.
...And 4 more matches
WebRequest.jsm
usage to import webrequest, use code like: let {webrequest} = cu.import("resource://
gre/modules/webrequest.jsm", {}); the webrequest object has the following properties, each of which corresponds to a specific stage in executing a web request: onbeforerequest onbeforesendheaders onsendheaders onheadersreceived onresponsestarted oncompleted each of these objects defines two functions: addlistener(callback, filter, opt_extrainfospec) removelistener(callback) adding li...
...the matchpattern constructor accepts: either: a string defining a single pattern or: an array of such strings cu.import("resource://
gre/modules/matchpattern.jsm"); let pattern = new matchpattern("https:/developer.mozilla.org/*"); cu.import("resource://
gre/modules/matchpattern.jsm"); let pattern = new matchpattern(["https://mozorg.cdn.mozilla.net/*", "https://mdn.mozillademos.org/*", "https://developer.cdn.mozilla.net/*"]); see the match patterns article for det...
... examples basic examples this example just logs the url for every request initiated: let {webrequest} = cu.import("resource://
gre/modules/webrequest.jsm", {}); webrequest.onbeforerequest.addlistener(logurl); function logurl(e) { console.log("loading: " + e.url); } filtering this example logs urls for requests under "https://developer.mozilla.org/": let {webrequest} = cu.import("resource://
gre/modules/webrequest.jsm", {}); cu.import("resource://
gre/modules/matchpattern.jsm"); let pattern = new matchpattern("https:/de...
...And 4 more matches
Localization and Plurals
verything: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, … plural rule #1 (2 forms) families: germanic (danish, dutch, english, faroese, frisian, german, norwegian, swedish), finno-ugric (estonian, finnish, hungarian), language isolate (basque), latin/
greek (
greek), semitic (hebrew), romanic (italian, portuguese, spanish, catalan), vietnamese is 1: 1 everything else: 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, … plural rule #2 (2 forms) families: romanic (french, brazilian portuguese), lingala is...
... pluralrule=2 seconds=seconde;secondes minutes=minute;minutes hours=heure;heures days=jour;jours like many other times when localizing words, gender a
greement might force you to rearrange words in a way that the gender is always the same.
... components.utils.import("resource://
gre/modules/pluralform.jsm"); methods: get these methods make use of the browser's current locale specified by chrome://global/locale/intl.properties's pluralrule value.
...And 4 more matches
Index
because public key encryption is more expensive (more calculations required) than symmetric encryption (where both parties use the same key), a key a
greement protocol will be executed, where the public and private keys are used to proof and verify the exchanged initial information.
... once the key a
greement is done, a symmetric encryption will be used (until a potential re-handshake on an existing channel).
... therefore, you should take
great care to ensure that you can stand behind any file you sign and distribute.
...And 4 more matches
XPCOM Interface Reference
tallinfoamiwebinstalllisteneramiwebinstallpromptamiwebinstallerimgicacheimgicontainerimgicontainerobserverimgidecoderimgidecoderobserverimgiencoderimgiloaderimgirequestinidomutilsjsdistackframemoziasyncfaviconsmoziasynchistorymozicoloranalyzermozijssubscriptloadermozipersonaldictionarymoziplaceinfomoziplacesautocompletemoziregistrymozirepresentativecolorcallbackmozispellcheckingenginemozistorageag
gregatefunctionmozistorageasyncstatementmozistoragebindingparamsmozistoragebindingparamsarraymozistoragecompletioncallbackmozistorageconnectionmozistorageerrormozistoragefunctionmozistoragependingstatementmozistoragepro
gresshandlermozistorageresultsetmozistoragerowmozistorageservicemozistoragestatementmozistoragestatementcallbackmozistoragestatementparamsmozistoragestatementrowmozistoragestatementwra...
...nsidomglobalpropertyinitializernsidomhtmlaudioelementnsidomhtmlformelementnsidomhtmlmediaelementnsidomhtmlsourceelementnsidomhtmltimerangesnsidomjswindownsidommousescrolleventnsidommoznetworkstatsnsidommoznetworkstatsdatansidommoznetworkstatsmanagernsidommoztoucheventnsidomnshtmldocumentnsidomnavigatordesktopnotificationnsidomnodensidomofflineresourcelistnsidomorientationeventnsidomparsernsidompro
gresseventnsidomserializernsidomsimplegestureeventnsidomstoragensidomstorage2nsidomstorageeventobsoletensidomstorageitemnsidomstoragelistnsidomstoragemanagernsidomstoragewindownsidomuserdatahandlernsidomwindownsidomwindow2nsidomwindowinternalnsidomwindowutilsnsidomxpathevaluatornsidomxpathexceptionnsidomxpathexpressionnsidomxpathresultnsidomxulcontrolelementnsidomxulelementnsidomxullabeledcontrolelem...
...icemotionlistenernsidialogcreatornsidialogparamblocknsidictionarynsidirindexnsidirindexlistenernsidirindexparsernsidirectoryenumeratornsidirectoryiteratornsidirectoryservicensidirectoryserviceprovidernsidirectoryserviceprovider2nsidiskcachestreaminternalnsidispatchsupportnsidocshellnsidocumentloadernsidownloadnsidownloadhistorynsidownloadmanagernsidownloadmanageruinsidownloadobservernsidownloadpro
gresslistenernsidownloadernsidragdrophandlernsidragservicensidragsessionnsidroppedlinkhandlernsidroppedlinkitemnsidynamiccontainernsieditornsieditorboxobjectnsieditordocshellnsieditorimesupportnsieditorloggingnsieditormailsupportnsieditorobservernsieditorspellchecknsieffectivetldservicensienumeratornsienvironmentnsierrorservicensieventlistenerinfonsieventlistenerservicensieventsourcensieventtargetnsi...
...And 4 more matches
Using js-ctypes
this is as simple as including the following line of code in the desired javascript scope: components.utils.import("resource://
gre/modules/ctypes.jsm") loading a native library once you've imported the code module, you can call the ctypes.open() method to load each native library you wish to use.
... components.utils.import("resource://
gre/modules/ctypes.jsm"); var lib = ctypes.open("c:\\windows\\system32\\user32.dll"); /* declare the signature of the function we are going to call */ var msgbox = lib.declare("messageboxw", ctypes.winapi_abi, ctypes.int32_t, ctypes.int32_t, ctypes.jschar.ptr, ctypes.jschar.p...
... note: this example will not work on 64bit os x, see below for core foundation for 64bit os x /* build a str255 ("pascal style") string from the passed-in string */ function makestr(str) { return string.fromcharcode(str.length) + str; } components.utils.import("resource://
gre/modules/ctypes.jsm"); var carbon = ctypes.open("/system/library/frameworks/carbon.framework/carbon"); stdalert = carbon.declare("standardalert", /* function name */ ctypes.default_abi, /* abi type */ ctypes.int16_t, /* return type */ ctypes.int16_t, /* alert type */ cty...
...And 4 more matches
Detecting device orientation - Web APIs
in particular, hand-held devices such as mobile phones can use this information to automatically rotate the display to remain upright, presenting a wide-screen view of the web content when the device is rotated so that its width is
greater than its height.
...these are described in
greater detail in the orientation and motion data explained article which is summarized below.
... the deviceorientationevent.alpha value represents the motion of the device around the z axis, represented in de
grees with values ranging from 0 to 360.
...And 4 more matches
Text.wholeText - Web APIs
syntax str = textnode.wholetext; notes and example suppose you have the following simple paragraph within your webpage (with some whitespace added to aid formatting throughout the code samples here), whose dom node is stored in the variable para: <p>thru-hiking is
great!
... <strong>no insipid election coverage!</strong> however, <a href="http://en.wikipedia.org/wiki/absentee_ballot">casting a ballot</a> is tricky.</p> you decide you don’t like the middle sentence, so you remove it: para.removechild(para.childnodes[1]); later, you decide to rephrase things to, “thru-hiking is
great, but casting a ballot is tricky.” while preserving the hyperlink.
... so you try this: para.firstchild.data = "thru-hiking is
great, but "; all set, right?
...And 4 more matches
Color masking - Web APIs
so, by masking off the blue and
green channels, you are only allowing the red component of pixels to be updated, and therefore it is as if you were looking through a red tinted glass.
...so, clearly masking both blue and red, would give us shades of
green.
... masking only the blue channel would give us shades of yellow (including shades of orange, brown, olive and yellow-
green), the complementary of blue.
...And 4 more matches
Accessibility documentation index - Accessibility
26 using the aria-valuemax attribute aria, accessibility the aria-valuemax attribute is used to define the maximum value allowed for a range widget such as a slider, spinbutton or pro
gressbar.
... 27 using the aria-valuemin attribute aria, accessibility, needscontent the aria-valuemin attribute is used to define the minimum value allowed for a range widget such as a slider, spinbutton or pro
gressbar.
... 28 using the aria-valuenow attribute aria, accessibility, needscontent the aria-valuenow attribute is used to define the current value for a range widget such as a slider, spinbutton or pro
gressbar.
...And 4 more matches
appearance (-moz-appearance, -webkit-appearance) - CSS: Cascading Style Sheets
arance: auto; appearance: menulist-button; appearance: textfield; /* "compat-auto" values, which have the same effect as 'auto' */ appearance: button; appearance: searchfield; appearance: textarea; appearance: push-button; appearance: slider-horizontal; appearance: checkbox; appearance: radio; appearance: square-button; appearance: menulist; appearance: listbox; appearance: meter; appearance: pro
gress-bar; /* partial list of available values in gecko */ -moz-appearance: scrollbarbutton-up; -moz-appearance: button-bevel; /* partial list of available values in webkit/blink (as well as gecko and edge) */ -webkit-appearance: media-mute-button; -webkit-appearance: caret; values standard keywords value demo browser description none div{ color: black; ...
...; } <div>lorem</div> firefox chrome safari edge menulist div { color: black; -moz-appearance: menulist; -webkit-appearance: menulist; } <div>lorem</div> firefox chrome safari edge meter div{ color: black; -webkit-appearance: meter; } <div>lorem</div> chrome safari firefox pro
gress-bar div{ color: black; -webkit-appearance: pro
gress-bar; } <div>lorem</div> chrome safari firefox push-button div{ color: black; -webkit-appearance: push-button; } <div>lorem</div> chrome safari edge radio div { color: black; -moz-appearance: radio; -webkit-appearance: radio; } <div>l...
... number-input div { color: black; -moz-appearance: number-input; -webkit-appearance: number-input; } <div>lorem</div> firefox pro
gress-bar-value div{ color: black; -webkit-appearance: pro
gress-bar-value; } <div>lorem</div> chrome safari pro
gressbar div { color: black; -moz-appearance: pro
gressbar; -webkit-appearance: pro
gressbar; } <div>lorem</div> firefox the element is styled like a pro
gress bar.
...And 4 more matches
Media buffering, seeking, and time ranges - Developer guides
sometimes it's useful to know how much <audio> or <video> has downloaded or is playable without delay — a good example of this is the buffered pro
gress bar of an audio or video player.
... var startx = myaudio.buffered.start(i) * inc; var endx = myaudio.buffered.end(i) * inc; var width = endx - startx; context.fillrect(startx, 0, width, mycanvas.height); context.rect(startx, 0, width, mycanvas.height); context.stroke(); } }); } this works better with longer pieces of audio or video, but press play and click about the player pro
gress bar and you should get something like this.
...the html for our player looks like this: <audio id="my-audio" preload controls> <source src="music.mp3" type="audio/mpeg"> </audio> <div class="buffered"> <span id="buffered-amount"></span> </div> <div class="pro
gress"> <span id="pro
gress-amount"></span> </div> we'll use the following css to style the buffering display: .buffered { height: 20px; position: relative; background: #555; width: 300px; } #buffered-amount { display: block; height: 100%; background-color: #777; width: 0; } .pro
gress { margin-top: -20px; height: 20px; position: relative; width: 300px; } #pro
gress-amoun...
...And 4 more matches
<input type="range"> - HTML: Hypertext Markup Language
the value won't be
greater than max.
... see the range control with hash marks below for an example of how the options on a range are denoted in supported browsers max the
greatest value in the range of permitted values.
... this value must be
greater than or equal to the value of the min attribute.
...And 4 more matches
SVG documentation index - SVG: Scalable Vector Graphics
29 azimuth filters, svg, svg attribute the azimuth attribute specifies the direction angle for the light source on the xy plane (clockwise), in de
grees from the x axis.
... 66 elevation filters, svg, svg attribute the elevation attribute specifies the direction angle for the light source from the xy plane towards the z-axis, in de
grees.
... 126 limitingconeangle filters, svg, svg attribute the limitingconeangle attribute represents the angle in de
grees between the spot light axis (i.e.
...And 4 more matches
Compiling from Rust to WebAssembly - WebAssembly
let's write some rust let's put this code into src/lib.rs instead: use wasm_bindgen::prelude::*; #[wasm_bindgen] extern { pub fn alert(s: &str); } #[wasm_bindgen] pub fn
greet(name: &str) { alert(&format!("hello, {}!", name)); } this is the contents of our rust project.
... producing rust functions that javascript can call the final part is this one: #[wasm_bindgen] pub fn
greet(name: &str) { alert(&format!("hello, {}!", name)); } once again, we see the #[wasm_bindgen] attribute.
... this function is named
greet, and takes one argument, a string (written &str), name.
...And 4 more matches
Adding menus and submenus - Archive of obsolete content
the toolbox should be positioned near the top of the xul document, and the code should be similar to this: <toolbox> <menubar id="xulschoolhello-menubar"> <menu id="xulschoolhello-
greeting-menu" label="&xulschoolhello.
greeting.label;"> <menupopup> <menuitem label="&xulschoolhello.
greet.short.label;" oncommand="xulschoolchrome.
greetingdialog.
greetingshort(event);" /> <menuitem label="&xulschoolhello.
greet.medium.label;" oncommand="xulschoolchrome.
greetingdialog.
greetingmedium(event);" /> <menuitem label="&xulschoolhello.
greet.lo...
...ng.label;" oncommand="xulschoolchrome.
greetingdialog.
greetinglong(event);" /> <menuseparator /> <menuitem label="&xulschoolhello.
greet.custom.label;" oncommand="xulschoolchrome.
greetingdialog.
greetingcustom(event);" /> </menupopup> </menu> </menubar> </toolbox> this code displays a simple menu with options for 3 different types of
greetings, a menuseparator, and finally an option to show a custom
greeting.
...menus require a menupopup element as a container for its children, which are usually menuitem elements, but can also be menuseparator, or menu in order to have multiple nesting levels: <toolbox> <menubar id="xulschoolhello-menubar"> <menu id="xulschoolhello-
greeting-menu" label="&xulschoolhello.
greeting.label;"> <menupopup> <menu id="xulschoolhello-
greeting-sizes-menu" label="&xulschoolhello.
greetingsizes.label;"> <menupopup> <menuitem label="&xulschoolhello.
greet.short.label;" oncommand="xulschoolchrome.
greetingdialog.
greetingshort(event);" /> <menuitem label="&xulschoolhello.
greet.medium.la...
...And 3 more matches
The Essentials of an Extension - Archive of obsolete content
toolbars, menu bars, pro
gress bars, and window title bars are all examples of elements that are typically part of the chrome.
...this gives firefox extensions a
great deal of flexibility.
...event handlers are explained in
greater depth further ahead.
...And 3 more matches
Building Trees - Archive of obsolete content
the mode is used for pro
gress meter columns.
... it may be set to either “normal” for a normal pro
gress meter or “undetermined” for an undetermined pro
gress meter.
... the value attribute is used to set the current pro
gress value for normal pro
gress meters.
...And 3 more matches
Styling a Tree - Archive of obsolete content
::-moz-tree-pro
gressmeter: content for pro
gressmeter cells.
... you can create a pro
gressmeter column by setting the type attribute on the column to pro
gressmeter.
...the example below sets the background color to
grey for rows that have the 'readonly' and 'unread' properties.
...And 3 more matches
Archived Mozilla and build documentation - Archive of obsolete content
chromeless [this project may not be active — check github https://github.com/mozilla/chromeless] creating a firefox sidebar extension this article describes how to create a registered sidebar for firefox 2 or
greater.
... download manager improvements in firefox 3 firefox 3 offers improvements to the download manager that allow multiple pro
gress listeners, use of the storage api for data management, download resuming, and more.
...
gre hacking wiki to be able to hack the mdc wiki software, you'll need a local webserver install, which can run mediawiki.
...And 3 more matches
Common Firefox theme issues and solutions - Archive of obsolete content
"about" pages about:addons disabled add-on icons are not
grey scale in tools > add-ons, the icons of disabled icons need to be converted to
grey scale.
... to accomplish this copy the file chrome://mozapps/skin/extensions/extensions.svg from the default theme into the mozapps/extensions/ folder of your theme and add the following style rule to the css file extensions.css: .addon[active="false"] .icon { filter: url("chrome://mozapps/skin/extensions/extensions.svg#
greyscale"); opacity:0.3; } about:memory about:memory nodes do not collapse the styling of about:memory is a little messed up in that nodes do not collapse as they should when clicked on.
...this is document is a work in pro
gress so feedback and/or suggestions is appreciated.
...And 3 more matches
Supporting older browsers - Learn web development
in my experience, developers are often very worried about the experience of 1% of users in an old version of internet explorer, while not considering at all the far
greater number who have accessibility needs.
...supporting everyone means serving a version of your content that is designed defensively, so that it will look
great on modern browsers, but will still be usable at a basic level for users of older browsers.
... flexbox as a fallback for grid flexbox has
greater browser support than grid due to being supported by ie10 and 11, although do check out the information later in this lesson explaining the rather patchy and confusing support for flexbox in older browsers.
...And 3 more matches
Useful string methods - Learn web development
filtering
greeting messages in the first exercise we'll start you off simple — we have an array of
greeting card messages, but we want to sort them to list just the christmas messages.
... playable code <h2>live output</h2> <div class="output" style="min-height: 125px;"> <ul> </ul> </div> <h2>editable code</h2> <p class="a11y-label">press esc to move focus away from the code area (tab inserts a tab character).</p> <textarea id="code" class="playable-code" style="height: 290px; width: 95%"> const list = document.queryselector('.output ul'); list.innerhtml = ''; let
greetings = ['happy birthday!', 'merry christmas my love', 'a happy christmas to all the family', 'you\'re all i want for christmas', 'get well soon']; for (let i = 0; i <
greetings.length; i++) { let input =
greetings[i]; // your conditional test needs to go inside the parentheses // in the line below, replacing what's curren...
...tly there if (
greetings[i]) { let listitem = document.createelement('li'); listitem.textcontent = input; list.appendchild(listitem); } } </textarea> <div class="playable-buttons"> <input id="reset" type="button" value="reset"> <input id="solution" type="button" value="show solution"> </div> html { font-family: sans-serif; } h2 { font-size: 16px; } .a11y-label { margin: 0; text-align: right; font-size: 0.7rem; width: 98%; } body { margin: 10px; background: #f5f9fa; } const textarea = document.getelementbyid('code'); const reset = document.getelementbyid('reset'); const solution = document.getelementbyid('solution'); let code = textarea.value; let userentry = textarea.value; function updatecode() { eval(textarea.value); } reset.addeventlistener('cl...
...And 3 more matches
Introduction to cross browser testing - Learn web development
different devices with different capabilities, from the latest
greatest tablets and smartphones, through smart tvs, right down to cheap tablets and even older feature phones that may run browsers with limited capabilities.
...as a web developer, you need to a
gree on a range of browsers and devices that the code definitely needs to work on with the site owner, but beyond that, you need to code defensively to give other browsers the best chance possible of being able to use your content.
... this is one of the
great challenges of web development.
...And 3 more matches
CSUN Firefox Materials
firefox 1.5, beyond the status quo "...firefox is a
great little browser.
...firefox's "www for everyone" philosophy is also a
great accessibility story.
...many users are finding the true
greatness of firefox lies in support for third party extensions.
...And 3 more matches
Overview of Mozilla embedding APIs
contract-id: ns_pref_contractid implemented interfaces: nsiprefservice nsiprefbranch related interfaces: nsipreflistener profile manager service contract-id: implemented interfaces: document loader service (webpro
gress) eventually, this service will be replaced by thewebpro
gress service...
... contract-id: ns_document_loader_service_contractid implemented interfaces: nsiwebpro
gress nsidocumentloader related interfaces: nsiwebpro
gresslistener public components nswebbrowser the nswebbrowser is the main embedding component which gecko exposes.
...contract-id: ns_webbrowser_contractid implemented interfaces: nsiwebbrowser nsiwebnavigation nsiwebbrowsersetup nsiwebbrowserpersist nsiwebbrowserfind nsiwebbrowserprint nsiwebbrowserfocus nsibasewindow requestor interfaces: nsidomwindow nsidomdocument nsiwebpro
gress nsiclipboardcommands nsiprompt related interfaces: nsiprompt nsiwebbrowserchrome nsiwebbrowsersitewindow nsiwebpro
gresslistener nsicontextmenulistener nsiprintoptions overview: most of gecko's functionality is exposed through the nswebbrowser component.
...And 3 more matches
InstallListener
installlisteners are notified of an addoninstall's pro
gress.
... method overview void onnewinstall(in addoninstall install) void ondownloadstarted(in addoninstall install) void ondownloadpro
gress(in addoninstall install) void ondownloadended(in addoninstall install) void ondownloadcancelled(in addoninstall install) void ondownloadfailed(in addoninstall install) void oninstallstarted(in addoninstall install) void oninstallended(in addoninstall install, in addon addon) void oninstallcancelled(in addoninstall install) void oninstallfailed(in addoninstall install) void onexternalinstall(in addon install, in addon existingaddo...
...n, in boolean needsrestart) methods onnewinstall() called when a new instance of addoninstall is created, primarily so ui can display some kind of pro
gress for all installs.
...And 3 more matches
PromiseWorker.jsm
promiseworker.jsm path: resource://
gre/modules/promiseworker.jsm a javascript code module used by the main thread to create a worker thread and communicate with it.
... promiseworker.js path: resource://
gre/modules/workers/promiseworker.js a javascript file used by the worker thread, which is created by promiseworker.jsm in main thread, to communicate with the main thread.
...the code below is what should be copied and pasted: importscripts('resource://
gre/modules/workers/require.js'); let promiseworker = require('resource://
gre/modules/workers/promiseworker.js'); // instantiate abstractworker (see below).
...And 3 more matches
Localization sign-off reviews
this article presents an overview of why we do sign-off reviews of localizations, the details on the criteria used for the sign-off reviews, and the process for requesting a review and for following its pro
gress.
... search plugin changes this
greatly impacts productization.
... once you have made the formal request in bugzilla and you have pushed your work into your l10n repo, refer to the dashboards to follow your review's pro
gress.
...And 3 more matches
Rhino overview
rhino 1.3 and
greater conform to edition 3 of the standard.
... rhino 1.6 and
greater implement ecma-357 ecmascript for xml (e4x).
... version 1.3 and
greater are ecma conformant.
...And 3 more matches
nsITreeView
tcelltext(in long row, in nsitreecolumn col); astring getcellvalue(in long row, in nsitreecolumn col); astring getcolumnproperties(in nsitreecolumn col, in nsisupportsarray properties obsolete since gecko 22); astring getimagesrc(in long row, in nsitreecolumn col); long getlevel(in long index); long getparentindex(in long rowindex); long getpro
gressmode(in long row, in nsitreecolumn col); astring getrowproperties(in long index, in nsisupportsarray properties obsolete since gecko 22); boolean hasnextsibling(in long rowindex, in long afterindex); boolean iscontainer(in long index); boolean iscontainerempty(in long index); boolean iscontaineropen(in long index); boolean iseditable(in long ...
... constants constant value description pro
gress_normal 1 note: renamed from pro
gressnormal in gecko 1.8 pro
gress_undetermined 2 note: renamed from pro
gressundetermined in gecko 1.8 pro
gress_none 3 note: renamed from pro
gressnone in gecko 1.8 drop_before -1 drop_on 0 drop_after 1 indropbefore 0 obsolete since gecko 1.8...
... getpro
gressmode() the pro
gress mode for a given cell.
...And 3 more matches
nsIWinTaskbar
see bug 744992 for details and to track pro
gress on a fix.
...to create an instance, use: var wintaskbar = components.classes["@mozilla.org/windows-taskbar;1"] .getservice(components.interfaces.nsiwintaskbar); method overview nsijumplistbuilder createjumplistbuilder(); nsitaskbartabpreview createtaskbartabpreview(in nsidocshell shell, in nsitaskbarpreviewcontroller controller); nsitaskbarpro
gress gettaskbarpro
gress(in nsidocshell shell); nsitaskbarwindowpreview gettaskbarwindowpreview(in nsidocshell shell); void setgroupidforwindow(in nsidomwindow aparent, in astring aidentifier); attributes attribute type description available boolean returns true if the operating system supports windows 7 or later taskbar features; you can use this instead of in-place operating system ver...
...= navigator2.queryinterface(components.interfaces.nsidocshell); // get the parent docshell; this is the top-level docshell var docshelltreeitem = docshell.queryinterface(components.interfaces.nsidocshelltreeitem); var parent = docshelltreeitem.parent; var ds = parent.queryinterface(components.interfaces.nsidocshell); // create the preview taskbar.createtaskbartabpreview(ds, {}); gettaskbarpro
gress() gets the taskbar pro
gress for a window.
...And 3 more matches
Add to iPhoto
the first declaration to be done here is to actually declare the cfstrin
gref data type; this is an opaque pointer to a cfstring object.
... this.cfstrin
gref = new ctypes.pointertype("cfstrin
gref"); now that we've declared the core type, we can declare the methods we use that work with cfstring objects.
... this.cfstringcreatewithcharacters = this.lib.declare("cfstringcreatewithcharacters", ctypes.default_abi, this.cfstrin
gref, // returns a new cfstrin
gref ctypes.voidptr_t, // allocator ctypes.jschar.ptr, // pointer to the unicode string ctypes.int32_t); // length of the string cfstringcreatewithcharacters() is used to create a new cfstring object using a unicode string as the source string, which is copied into the new cfstring object.
...And 3 more matches
Standard OS Libraries
components.utils.import("resource://
gre/modules/ctypes.jsm"); var lib = ctypes.open("user32.dll"); /* note: if you go to getcursorpos page on msdn, it says first argument is of structure point, so lets create that structure, * the link here shows that that x and y are type long which is ctypes.long */ // https://msdn.microsoft.com/en-us/library/windows/desktop/dd162805%28v=vs.85%29.aspx var point = new ctypes.structtype("tagpoint", ...
... components.utils.import('resource://
gre/modules/ctypes.jsm'); var gdk = ctypes.open('libgdk-x11-2.0.so.0'); // types var gint = ctypes.int; var gdkdevice = ctypes.structtype('gdkdevice'); var gdkmodifiertype = ctypes.int; var gdkwindow = ctypes.structtype('gdkwindow'); var void = ctypes.void_t; // https://developer.gnome.org/gdk3/stable/gdk3-windows.html#gdk-get-default-root-window var gdk_get_default_root_window = gdk.declare('gdk_...
...x, x.tostring()); console.info('y:', y, y.tostring()); console.info('mask:', mask, mask.tostring()); gdk.close(); example: gdk_window_get_device_position this example works only for gdk3, as the function gdk_window_get_device_position was not available in gdk2, for gdk2 equivalent see above warning this example does not work yet it needs some bug fixing components.utils.import('resource://
gre/modules/ctypes.jsm'); var gdk = ctypes.open('libgdk-x11-2.0.so.0'); var gdk3 = ctypes.open('libgdk-3.so.0'); // types var gint = ctypes.int; var gdkdevice = ctypes.structtype('gdkdevice'); var gdkdevicemanager = ctypes.structtype('gdkdevicemanager'); var gdkdisplay = ctypes.structtype('gdkdisplay'); var gdkmodifiertype = ctypes.int; var gdkwindow = ctypes.structtype('gdkwindow'); // https://dev...
...And 3 more matches
Using files from web applications - Web APIs
example: showing thumbnails of user-selected images let's say you're developing the next
great photo-sharing website and want to use html to display thumbnail previews of images before the user actually uploads them.
... function fileupload(img, file) { const reader = new filereader(); this.ctrl = createthrobber(img); const xhr = new xmlhttprequest(); this.xhr = xhr; const self = this; this.xhr.upload.addeventlistener("pro
gress", function(e) { if (e.lengthcomputable) { const percentage = math.round((e.loaded * 100) / e.total); self.ctrl.update(percentage); } }, false); xhr.upload.addeventlistener("load", function(e){ self.ctrl.update(100); const canvas = self.ctrl.ctx.canvas; canvas.parentnode.removechild(canvas); }, false); xhr.open("p...
...ost", "http://demos.hacks.mozilla.org/paul/demos/resources/webservices/devnull.php"); xhr.overridemimetype('text/plain; charset=x-user-defined-binary'); reader.onload = function(evt) { xhr.send(evt.target.result); }; reader.readasbinarystring(file); } the fileupload() function shown above creates a throbber, which is used to display pro
gress information, and then creates an xmlhttprequest to handle uploading the data.
...And 3 more matches
WebGL2RenderingContext.texImage3D() - Web APIs
possible values: gl.alpha: discards the red,
green and blue components and reads the alpha component.
... gl.rgb: discards the alpha components and reads the red,
green and blue components.
... gl.rgba: red,
green, blue and alpha components are read from the color buffer.
...And 3 more matches
WebGL2RenderingContext.texSubImage3D() - Web APIs
possible values: gl.alpha: discards the red,
green and blue components and reads the alpha component.
... gl.rgb: discards the alpha components and reads the red,
green and blue components.
... gl.rgba: red,
green, blue and alpha components are read from the color buffer.
...And 3 more matches
WebGLRenderingContext.texImage2D() - Web APIs
gba ui16 ui16 ui16 ui16 ● rgba32i rgba i32 i32 i32 i32 ● rgba32ui rgba ui32 ui32 ui32 ui32 ● possible values in webgl2 for the versions of teximage2d that take a texture an htmlimageelement, htmlcanvaselement, htmlvideoelement, imagebitmap, or imagedata gl.alpha: discards the red,
green and blue components and reads the alpha component.
... gl.rgb: discards the alpha components and reads the red,
green and blue components.
... gl.rgba: red,
green, blue and alpha components are read from the color buffer.
...And 3 more matches
WebGLRenderingContext.texSubImage2D() - Web APIs
possible values: gl.alpha: discards the red,
green and blue components and reads the alpha component.
... gl.rgb: discards the alpha components and reads the red,
green and blue components.
... gl.rgba: red,
green, blue and alpha components are read from the color buffer.
...And 3 more matches
A basic 2D WebGL animation example - Web APIs
let uscalingfactor; let uglobalcolor; let urotationvector; let avertexposition; // animation timing let previoustime = 0.0; let de
greespersecond = 90.0; initializing the program is handled through a load event handler called startup(): window.addeventlistener("load", startup, false); function startup() { glcanvas = document.getelementbyid("glcanvas"); gl = glcanvas.getcontext("webgl"); const shaderset = [ { type: gl.vertex_shader, id: "vertex-shader" }, { type: gl.fragment_shader, ...
... then the current rotation angle (in de
grees) is set to 0.0, since we haven't performed any rotation yet, and the rotation speed (in de
grees per screen refresh period, typically 60 fps) is set to 6.
...ertexposition = gl.getattriblocation(shaderprogram, "avertexposition"); gl.enablevertexattribarray(avertexposition); gl.vertexattribpointer(avertexposition, vertexnumcomponents, gl.float, false, 0, 0); gl.drawarrays(gl.triangles, 0, vertexcount); window.requestanimationframe(function(currenttime) { let deltaangle = ((currenttime - previoustime) / 1000.0) * de
greespersecond; currentangle = (currentangle + deltaangle) % 360; previoustime = currenttime; animatescene(); }); } the first thing that needs to be done in order to draw a frame of the animation is to clear the background to the desired color.
...And 3 more matches
Clearing with colors - Web APIs
set up the rendering context and then just clear it solid
green.
... note that css sets the background color of the canvas to black, so when the canvas turns
green we know that webgl's magic has worked.
...first, we set the clear color to
green, using the method clearcolor().
...And 3 more matches
Signaling and video calling - Web APIs
this process is called signaling and involves both devices connecting to a third, mutually a
greed-upon server.
... once the two peers a
gree upon a mutually-compatible candidate, that candidate's sdp is used by each peer to construct and open a connection, through which media then begins to flow.
... if they later a
gree on a better (usually higher-performance) candidate, the stream may change formats as needed.
...And 3 more matches
Movement, orientation, and motion: A WebXR example - Web APIs
the code looks like this: const xrotationde
greespersecond = 25; const yrotationde
greespersecond = 15; const zrotationde
greespersecond = 35; const enablerotation = true; const allowmouserotation = true; const allowkeyboardmotion = true; const enableforcepolyfill = false; //const session_type = "immersive-vr"; const session_type = "inline"; const mouse_speed = 0.003; xrotationde
greespersecond the number of de
grees of rotation to apply arou...
... yrotationde
greespersecond the number of de
grees to rotate around the y axis each second.
... zrotationde
greespersecond the number of de
grees per second to rotate around the z axis.
...And 3 more matches
ARIA Test Cases - Accessibility
re
gression testers should test both tabbing forward and back, to make sure that the groupbox description and button description are both read when the button is the first item focused in the groupbox.
...ts: at firefox ie opera safari jaws 9 - - n/a n/a jaws 10 - - - - voiceover (leopard) n/a n/a - fail window-eyes - - - - nvda - n/a - - zoom (leopard) pass n/a pass pass zoomtext - - - - orca - - - - pro
gressbar dojo nightly build pro
gress bar in "off" live region pro
gressbar in "assertive" live region expected at behavior: the pro
gress updates should be treated as the screen reader treats any pro
gress updates.
... the live region markup should not affect how the pro
gress updates are presented.
...And 3 more matches
Web accessibility for seizures and physical reactions - Accessibility
for a
great introduction on the topic of musicogenic seizures, visit epilepsy ontario's web page on musicogenic seizures.
...section 508 prohibits flickering effects with a frequency
greater than 3 hz (flickers per second) and lower than 55 hz.
... @media screen and (prefers-reduced-motion: reduce) { } @media screen and (prefers-reduced-motion) { } to see a
great example of how to use the code prefers-reduced-motion, visit the mdn document, prefers-reduced-motion, or see the example below from the section on new in chrome 74.
...And 3 more matches
Specificity - CSS: Cascading Style Sheets
when two conflicting declarations with the !important rule are applied to the same element, the declaration with a
greater specificity will be applied.
...by indicating one or more elements before the element you're selecting, the rule becomes more specific and gets higher priority: <div id="test"> <span>text</span> </div> div#test span { color:
green; } div span { color: blue; } span { color: red; } no matter the order, text will be
green because that rule is most specific.
... *#foo { color:
green; } *[id="foo"] { color: purple; } ...
...And 3 more matches
cross-fade() - CSS: Cascading Style Sheets
cross-fade( url(white.png) 0%, url(black.png) 100%); /* fully black */ cross-fade( url(white.png) 25%, url(black.png) 75%); /* 25% white, 75% black */ cross-fade( url(white.png) 50%, url(black.png) 50%); /* 50% white, 50% black */ cross-fade( url(white.png) 75%, url(black.png) 25%); /* 75% white, 25% black */ cross-fade( url(white.png) 100%, url(black.png) 0%); /* fully white */ cross-fade( url(
green.png) 75%, url(red.png) 75%); /* both
green and red at 75% */ if any percentages are omitted, all the specified percentages are summed together and subtracted from 100%.
... if the result is
greater than 0%, the result is then divided equally between all images with omitted percentages.
...een written as: cross-fade( url(white.png) 0%, url(black.png)); /* fully black */ cross-fade( url(white.png) 25%, url(black.png)); /* 25% white, 75% black */ cross-fade( url(white.png), url(black.png)); /* 50% white, 50% black */ cross-fade( url(white.png) 75%, url(black.png)); /* 75% white, 25% black */ cross-fade( url(white.png) 100%, url(black.png)); /* fully white */ cross-fade( url(
green.png) 75%, url(red.png) 75%); /* both
green and red at 75% */ if no percentages are declared, both the images will be 50% opaque, with a cross-fade rendering as an even merge of both images.
...And 3 more matches
async function - JavaScript
await expressions suspend pro
gress through an async function, yielding control and subsequently resuming pro
gress only when an awaited promise-based asynchronous operation is either fulfilled or rejected.
...in this way a promise chain is pro
gressively constructed with each reentrant step through the function.
...pro
gress moves through function foo in three stages.
...And 3 more matches
Handling media support issues in web content - Web media technologies
one of the realities of working with audio and video presentation and manipulation on the web is that there are a number of media formats available, of varying de
grees of popularity and with a variety of capabilities.
... poster frames for video pro
gressive images images—whether embedded using <img> or <picture>—don't support a concept similar to poster frames.
...this requires creating your images using pro
gressive formats, such as pro
gressive jpeg or interlaced png.
...And 3 more matches
end - SVG: Scalable Vector Graphics
begin="0s" end="6s" fill="freeze" /> </rect> <rect x="10" y="85" height="15" width="0"> <animate attributetype="xml" attributename="width" to="50" begin="0s" end="4s" fill="freeze" /> </rect> <!-- grid --> <text x="10" y="20" text-anchor="middle">0s</text> <line x1="10" y1="25" x2="10" y2="105" stroke="
grey" stroke-width=".5" /> <text x="35" y="20" text-anchor="middle">2s</text> <line x1="35" y1="25" x2="35" y2="105" stroke="
grey" stroke-width=".5" /> <text x="60" y="20" text-anchor="middle">4s</text> <line x1="60" y1="25" x2="60" y2="105" stroke="
grey" stroke-width=".5" /> <text x="85" y="20" text-anchor="middle">6s</text> <line x1="85" y1="25" x2="85" y2="105" stroke="
grey...
..." stroke-width=".5" /> <text x="110" y="20" text-anchor="middle">8s</text> <line x1="110" y1="25" x2="110" y2="105" stroke="
grey" stroke-width=".5" /> <line x1="10" y1="30" x2="110" y2="30" stroke="
grey" stroke-width=".5" /> <line x1="10" y1="105" x2="110" y2="105" stroke="
grey" stroke-width=".5" /> </svg> event example <svg width="120" height="120" viewbox="0 0 120 120" xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink"> <!-- animated rectangle --> <rect x="10" y="35" height="15" width="0"> <animate attributetype="xml" attributename="width" from="0" to="100" begin="0s" end="endbutton.click" dur="8s" repeatcount="indefinite" fill="freeze" /> </rect> <!-- trigge...
...r --> <rect id="endbutton" style="cursor:pointer;" x="19.5" y="62.5" rx="5" height="25" width="80" fill="#efefef" stroke="black" stroke-width="1" /> <text x="60" y="80" text-anchor="middle" style="pointer-events:none;">click me.</text> <!-- grid --> <text x="10" y="20" text-anchor="middle">0s</text> <line x1="10" y1="25" x2="10" y2="55" stroke="
grey" stroke-width=".5" /> <text x="35" y="20" text-anchor="middle">2s</text> <line x1="35" y1="25" x2="35" y2="55" stroke="
grey" stroke-width=".5" /> <text x="60" y="20" text-anchor="middle">4s</text> <line x1="60" y1="25" x2="60" y2="55" stroke="
grey" stroke-width=".5" /> <text x="85" y="20" text-anchor="middle">6s</text> <line x1="85" y1="25" x2="85" y2="55" stroke="
grey" st...
...And 3 more matches
glyph-orientation-vertical - SVG: Scalable Vector Graphics
when the inline-pro
gression-direction is vertical and the glyph-orientation-vertical results in an orientation angle that is a multiple of 180 de
grees, then the current text position is incremented according to the vertical metrics of the glyph.
... otherwise, if the angle is not a multiple of 180 de
grees, then the current text position is incremented according to the horizontal metrics of the glyph.
... as a presentation attribute, it can be applied to any element but it has effect only on the following five elements: <altglyph>, <textpath>, <text>, <tref>, and <tspan> context notes value auto | <angle> default value auto animatable no auto fullwidth ideographic and fullwidth latin text will be set with a glyph orientation of 0 de
grees.
...And 3 more matches
transform - SVG: Scalable Vector Graphics
html,body,svg { height:100% } <svg viewbox="-40 0 150 100" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <g fill="
grey" transform="rotate(-10 50 100) translate(-36 45.5) skewx(40) scale(1 0.5)"> <path id="heart" d="m 10,30 a 20,20 0,0,1 50,30 a 20,20 0,0,1 90,30 q 90,60 50,90 q 10,60 10,30 z" /> </g> <use xlink:href="#heart" fill="none" stroke="red"/> </svg> note: as of svg2, transform is a presentation attribute, meaning it can be used as a css property.
...x} x_{\mathrm{prevcoordsys}} \\ y_{\mathrm{prevcoordsys}} \\ 1 \end{pmatrix} = \begin{pmatrix} a x_{\mathrm{prevcoordsys}} + c y_{\mathrm{prevcoordsys}} + e \\ b x_{\mathrm{prevcoordsys}} + d y_{\mathrm{prevcoordsys}} + f \\ 1 \end{pmatrix} example html,body,svg { height:100% } <svg viewbox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"> <rect x="10" y="10" width="30" height="20" fill="
green" /> <!-- in the following example we are applying the matrix: [a c e] [3 -1 30] [b d f] => [1 3 40] [0 0 1] [0 0 1] which transform the rectangle as such: top left corner: oldx=10 oldy=10 newx = a * oldx + c * oldy + e = 3 * 10 - 1 * 10 + 30 = 50 newy = b * oldx + d * oldy + f = 1 * 10 + 3 * 10 + 40 = 80 top right corner: oldx=40 oldy=10 newx = a * oldx + c * ...
... in other words: xnew = xold + <x> ynew = yold + <y> example html,body,svg { height:100% } <svg viewbox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <!-- no translation --> <rect x="5" y="5" width="40" height="40" fill="
green" /> <!-- horizontal translation --> <rect x="5" y="5" width="40" height="40" fill="blue" transform="translate(50)" /> <!-- vertical translation --> <rect x="5" y="5" width="40" height="40" fill="red" transform="translate(0 50)" /> <!-- both horizontal and vertical translation --> <rect x="5" y="5" width="40" height="40" fill="yellow" transform="translate(...
...And 3 more matches
Paths - SVG: Scalable Vector Graphics
<svg width="190" height="160" xmlns="http://www.w3.org/2000/svg"> <path d="m 10 80 q 52.5 10, 95 80 t 180 80" stroke="black" fill="transparent"/> </svg> both curves produce similar results, although the cubic one allows
greater freedom in exactly what the curve looks like.
...this is best explained with an example: <svg width="320" height="320" xmlns="http://www.w3.org/2000/svg"> <path d="m 10 315 l 110 215 a 30 50 0 0 1 162.55 162.45 l 172.55 152.45 a 30 50 -45 0 1 215.1 109.9 l 315 10" stroke="black" fill="
green" stroke-width="2" fill-opacity="0.5"/> </svg> the example shows a <path> element that goes diagonally across the page.
...for the second arc, though, the x-axis-rotation is set to -45 de
grees.
...And 3 more matches
Chapter 1: Introduction to Extensions - Archive of obsolete content
about extensions management using the add-ons manager firefox's add-ons manager is an excellent way to manage extensions, and is a
great step up in ease of use.
...this class of extension requires a
greater level of knowledge and programming ability.
...
greasemonkey userchrome.js both of these provide an environment for running user scripts (javascript) in firefox itself, where the scripts can target specific websites.
...And 2 more matches
Adding sidebars - Archive of obsolete content
keyboard shortcuts are an essential feature of firefox, and you can add your own into your extensions, which is also
great.
...trees are another strong option when you need to show a
great amount of information in a compact presentation.
...here's an example of a simple tree: <tree flex="1"> <treecols> <treecol label="&xulschoolhello.namecolumn.label;" flex="1" /> <treecol label="&xulschoolhello.
greetingcolumn.label;" flex="3" /> </treecols> <treechildren> <treeitem> <treerow> <treecell label="peter" /> <treecell label="hey, what's up?" /> </treerow> </treeitem> <treeitem> <treerow> <treecell label="john"/> <treecell label="good evening, how are you doing?" /> </treerow> </treeitem> </treechildren> </tree> the t...
...And 2 more matches
The Box Model - Archive of obsolete content
with xul you can define vertically oriented as well as horizontally oriented interfaces, providing
greater flexibility in interface design.
... any xul interface can be broken down into the following basic components: boxes text images alignment and flexibility widths and heights margins and paddings menus, toolbar buttons, and even the most complex elements in xul are composed of these simple in
gredients.
...once you grasp this simple idea, you'll be able to use the dom inspector and css to mold xul elements and layouts with
great precision and flexibility.
...And 2 more matches
browser - Archive of obsolete content
ry, disablesecurity, droppedlinkhandler, homepage, showcaret, src, type properties accessibletype, cangoback, cangoforward, contentdocument, contentprincipal, contenttitle, contentvieweredit, contentviewerfile, contentwindow, currenturi, docshell, documentcharsetinfo, homepage, markupdocumentviewer, messagemanager, preferences, securityui, sessionhistory, webbrowserfind, webnavigation, webpro
gress methods addpro
gresslistener, goback, goforward, gohome, gotoindex, loaduri, loaduriwithflags, reload, reloadwithflags, removepro
gresslistener, stop, swapdocshells examples <!-- shows mozilla homepage inside a groupbox --> <groupbox flex="1"> <caption label="mozilla homepage"/> <browser type="content" src="http://www.mozilla.org" flex="1"/> </groupbox> attributes autocomp...
... webpro
gress type: nsiwebpro
gress this read-only property contains an nsiwebpro
gress object which is used to monitor the pro
gress of a document loading.
...hildnodes(), insertbefore(), isdefaultnamespace(), isequalnode, issamenode, issupported(), lookupnamespaceuri, lookupprefix, normalize(), queryselector(), queryselectorall(), removeattribute(), removeattributenode(), removeattributens(), removechild(), removeeventlistener(), replacechild(), setattribute(), setattributenode(), setattributenodens(), setattributens(), setuserdata addpro
gresslistener( listener ) return type: no return value add a pro
gress listener to the browser which will monitor loaded documents.
...And 2 more matches
Browser Detection and Cross Browser Support - Archive of obsolete content
fortunately, other browsers such as opera (versions 7 & later) and to a lesser extent, internet explorer (versions 5.5 & later) also support the standards to a de
gree.
... we are still faced with the question of how to develop standards based content while supporting the differing implementations of modern browsers while at the same time supporting (to a lesser de
gree) older and less capable browsers.
...the abilities of browsers to support the latest and
greatest content changed on an almost daily basis.
...And 2 more matches
::-ms-fill - Archive of obsolete content
the ::-ms-fill css pseudo-element is a microsoft extension that represents a pro
gress bar displayed by <pro
gress>.
... all allowable properties except animation-name apply to a determinate pro
gress bar.
...(a pro
gress bar is determinate if it has a value attribute set; otherwise it is indeterminate.
...And 2 more matches
Unconventional controls - Game development
as well as being
great for virtual interfaces, it can also be used for a casual 2d gaming experiences.
... we will need a few helper variables for our code to work — one for the purpose of calculating the de
grees from radians, two for holding the horizontal and vertical amount of de
grees our hand is leaning above the controller, one for the threshold of that lean, and one for the state of our hand's grab status.
... we next add these lines after all the event listeners for keyboard and mouse, but before the draw method: var tode
grees = 1 / (math.pi / 180); var horizontalde
gree = 0; var verticalde
gree = 0; var de
greethreshold = 30; var grabstrength = 0; right after that we use the leap's loop method to get the information held in the hand variable on every frame: leap.loop({ hand: function(hand) { horizontalde
gree = math.round(hand.roll() * tode
grees); verticalde
gree = math.round(hand.pitch() * tode
grees); grabstrength = hand.grabstrength; output.innerhtml = 'leap motion: <br />' + ' roll: ' + horizontalde
gree + '° <br />' + ' pitch: ' + verticalde
gree + '° <br />' + ' strength: ' + grabstrength + ''; } }); the code above i...
...And 2 more matches
Test your skills: Selectors - Learn web development
give the element with a class of alert a 1px
grey border.
... if the element with a class of alert also has a class of go, make the background
green.
... style links, making the link-state orange, visited links
green, and remove the underline on hover.
...And 2 more matches
UI pseudo-classes - Learn web development
the above form isn't bad, but it isn't
great either.
... for a start, we are signalling required versus optional status using color alone, which isn't
great for colorblind people.
...e" name="fname" type="text" required> <span></span> </div> to provide these indicators, we use the following css: input + span { position: relative; } input + span::before { position: absolute; right: -20px; top: 5px; } input:invalid { border: 2px solid red; } input:invalid + span::before { content: '✖'; color: red; } input:valid + span::before { content: '✓'; color:
green; } as before, we set the <span>s to position: relative so that we can position the generated content relative to them.
...And 2 more matches
A first splash into JavaScript - Learn web development
you got it right!'; lastresult.style.backgroundcolor = '
green'; loworhi.textcontent = ''; setgameover(); } else if (guesscount === 10) { lastresult.textcontent = '!!!game over!!!'; loworhi.textcontent = ''; setgameover(); } else { lastresult.textcontent = 'wrong!'; lastresult.style.backgroundcolor = 'red'; if(userguess < randomnumber) { loworhi.textcontent = 'last guess ...
...try entering the following lines, one at a time: let name = 'bingo'; name; let hello = ' says hello!'; hello; let
greeting = name + hello;
greeting; there are also some shortcut operators available, called augmented assignment operators.
...it exactly the same?) 5 === 2 + 4 // false 'chris' === 'bob' // false 5 === 2 + 3 // true 2 === '2' // false; number versus string !== non-equality (is it not the same?) 5 !== 2 + 4 // true 'chris' !== 'bob' // true 5 !== 2 + 3 // false 2 !== '2' // true; number versus string < less than 6 < 10 // true 20 < 10 // false >
greater than 6 > 10 // false 20 > 10 // true conditionals returning to our checkguess() function, i think it's safe to say that we don't want it to just spit out a placeholder message.
...And 2 more matches
Basic math in JavaScript — numbers and operators - Learn web development
doubles are a specific type of floating point number that have
greater precision than standard floating point numbers (meaning that they are accurate to a
greater number of decimal places).
... 10 < 6 >
greater than tests whether the left value is
greater than the right one.
... 3 <= 2 >=
greater than or equal to tests whether the left value is
greater than or equal to the right one.
...And 2 more matches
Object building practice - Learn web development
the last two parameters specify the start and end number of de
grees around the circle that the arc is drawn between.
... here we specify 0 de
grees, and 2 * pi, which is the equivalent of 360 de
grees in radians (annoyingly, you have to specify this in radians).
...if you had specified only 1 * pi, you'd get a semi-circle (180 de
grees).
...And 2 more matches
Multimedia: Images - Learn web development
if you want to play it safe, then you would go for well compressed pro
gressive jpegs.
... pro
gressive jpegs, in contrast to normal jpegs, render pro
gressively (hence the name), meaning the user sees a low-resolution version that gains clarity as the image downloads, rather than the image loading at full resolution top-to-bottom or even only rendering once completely downloaded.
...supports transparency and also animation, but not pro
gressive display.
...And 2 more matches
Perceived performance - Learn web development
how fast a website feels like it's loading and rendering has a
greater impact on user experience than how fast the website actually loads and renders.
... there is no unicorn metric that can measure what the user feels, but metrics are useful in guaging improvements (and re
gressions).
...loading essential data in initial requests and pro
gressively loading features and data only as needed helps mitigate low bandwidth and lower spec hardware.
...And 2 more matches
Getting started with Vue - Learn web development
a clearer vue vue is a modern javascript framework that provides useful facilities for pro
gressive enhancement — unlike many other frameworks, you can use vue to enhance existing html.
... in addition to allowing you to pro
gressively integrate vue into your applications, vue also provides a pro
gressive approach to writing markup.
...this allows you to start using vue on existing sites, which is why vue prides itself on being a pro
gressive framework.
...And 2 more matches
Gecko info for Windows accessibility vendors
mfcembed testing client: this is a very simple package,
great for testing basic html accessibility with your products and the gecko rendering engine.
... event_valuechange is fired for sliders, pro
gress meters and other objects who's get_accvalue() may change.
...the exception is pro
gress meters, which are guaranteed to fire event_show and event_hide events when they are displayed or hidden.
...And 2 more matches
Testopia
this is not an trivial task, it takes time (it started in august 2014), and we decided that it was not a good idea to release half-baked code which still needs testing to make sure we didn't re
gress anything.
... the good news is that the current code in the git repository already works with bugzilla 5.0, and so if you upgraded to 5.0 already, and if you don't mind having a work-in-pro
gress extension on your machine, you can decide to pull the code from the git repository.
... this would also let us get some early feedback in case you find re
gressions.
...And 2 more matches
Creating reftest-based unit tests
if one has software that multiplies numbers, one wants a re
gression test to show that 2 * 2 continues to be calculated to be 4, not something similar to but not quite exactly 4.
...if a re
gression test harness has false failures, it makes the harness not trustworthy and the harness will not be used.
...g></body> </html> step 4 create a file named bar.html with the following: <html><head><title>reftest0001</title> <body><b>hello!</b></body> </html> step 5 create a file named reftest.list with the following: == foo.html bar.html you are now ready to run the test (but first you must go back to the root of firefox's source code tree): $ ./mach reftest path/to/reftest.list 2>&1 |
grep reftest reftest pass: file:///users/ray/mozilla-central/path/to/foo.html $ congratulations!
...And 2 more matches
Eclipse CDT Manual Setup
click on the little
green button beside this message to open the "pro
gress" tab, and keep an eye on the "refreshing workspace" item as you continue with the steps below.
... building the index once you see the end of the build output in the console tab and the build item has disappeared from the pro
gress tab, you can start indexing the source.
... if indexing started automatically (see the pro
gress tab), cancel it, since there seems to be a bug that makes it give bad results when it starts automatically at this stage.
...And 2 more matches
DownloadSummary
provides an ag
gregated view on the contents of a downloadlist.
... pro
gresstotalbytes read only number indicates the total number of bytes to be transferred before completing all the downloads that are currently in pro
gress.
... this is zero if no downloads are currently in pro
gress.
...And 2 more matches
Downloads.jsm
to use it, you first need to import the code module into your javascript scope: components.utils.import("resource://
gre/modules/downloads.jsm"); method overview promise<download> createdownload(object aproperties); promise<void> fetch(asource, atarget, [optional] object aoptions); promise<downloadlist> getlist(atype); promise<downloadsummary> getsummary(atype); constants constant description public work on downloads that were not started from a private browsing window.
... examples downloading to a local file this example downloads an html file without showing pro
gress, handling errors programmatically.
... components.utils.import("resource://
gre/modules/downloads.jsm"); components.utils.import("resource://
gre/modules/osfile.jsm") components.utils.import("resource://
gre/modules/task.jsm"); task.spawn(function () { yield downloads.fetch("http://www.mozilla.org/", os.path.join(os.constants.path.tmpdir, "example-download.html")); console.log("example-download.html has been downloaded."); }).then(null, components.utils.reporterror); observing downloads this example logs a message every time a change occurs in one of the global download lists.
...And 2 more matches
Sqlite.jsm
before you can use this module, you need to import it into your scope: components.utils.import("resource://
gre/modules/sqlite.jsm") obtaining a connection sqlite.jsm exports the sqlite symbol.
... here is an example: components.utils.import("resource://
gre/modules/sqlite.jsm"); try { const conn = await sqlite.openconnection({ path: "mydatabase.sqlite", sharedmemorycache: false }); // connection is the opened sqlite connection (see below for api).
... if a transaction is in pro
gress at the time this function is called, the transaction will be forcibly rolled back.
...And 2 more matches
Task.jsm
to use it, you first need to import the code module into your javascript scope: components.utils.import("resource://
gre/modules/task.jsm"); introduction for an introduction to tasks, you may start from the task.js documentation, keeping in mind that only the core subset is implemented in this module.
... async() simplifies the common pattern of implementing a method via a task, like this simple object with a
greet method that has a name parameter and spawns a task to send a
greeting and return its reply: let
greeter = { message: "hello, name!",
greet: function(name) { return task.spawn((function* () { return yield send
greeting(this.message.replace(/name/, name)); }).bind(this); }) }; with async(), the method can be declared succinctly: let
greeter = { message: "hello, name!", g...
...reet: task.async(function* (name) { return yield send
greeting(this.message.replace(/name/, name)); }) }; while maintaining identical semantics:
greeter.
greet("mitchell").then((reply) => { ...
...And 2 more matches
Localization technical reviews
this guide provides details on what a localization technical review is, what criteria are used for the technical reviews, and the process for requesting one and following its pro
gress.
... tracking your pro
gress you can track your reviews pro
gress two ways: within the bug and through your team's dashboard.
...these bugs are also pulled into the dashboards, which track your revision's pro
gress.
...And 2 more matches
Mozilla Development Strategies
minimize how you are affected by re
gressions unless you are the type to go out and tackle daily re
gressions, you need to find a way to not let them affect you.
...you'll need this one for re
gressions that require your immediate attention (a new crasher, a blocker, or problem in your area, for example).
... use this same tree for small, quick bugs or recent re
gressions or crashers.
...And 2 more matches
nss tech note3
there are 8 key usages: cert_sign crl_sign data_encipherment digital_signature govt_approved key_a
greement key_encipherment non_repudiation there are 9 cert types: email email_ca object_signing object_signing_ca ssl_ca ssl_client ssl_server status_responder time_stamp for the cert being checked, the requirements are: cert usage requried key usage required cert type -------------------- -------------------- ----------------------- sslclient: digital_signature; ssl_client; ...
... sslserver: key_a
greement or key_encipherment; ssl_server; sslserverwithstepup: govt_approved and ssl_server key_a
greement or key_encipherment sslca: cert_sign; ssl_ca; emailsigner: digital_signature; email; emailrecipient: key_a
greement or key_encipherment; email; objectsigner: digital_signature; object_signing; statusresponder: digital_signature; status_responder; verifyca cert_sign ssl_ca or email_ca or object_signing_ca or status_responder for ca certs in the cert chain, the requirements are: cert usage requried key usage required cert type -------------------- -------------------- ----------------------- sslserverwithstepup: govt_approved and cert_sign; ssl_ca; sslclient: cert_sign; ssl_ca; sslserver: cert_sign; s...
... cert_sign; ssl_ca; emailsigner: cert_sign; email_ca or ssl_ca emailrecipient: cert_sign; email_ca or ssl_ca objectsigner: cert_sign; object_signing_ca; usageanyca: cert_sign; object_signing_ca or email_ca or ssl_ca; statusresponder: cert_sign; object_signing_ca or email_ca or ssl_ca; note: when the required key usage is key_a
greement or key_encipherment, the actual key usage required depends on the key's algorithm.
...And 2 more matches
An Overview of XPCOM
interfaces and programming by contract an interface forms a contractual a
greement between components and clients.
... there is no code that enforces these a
greements, but ignoring them can be fatal.
...this is the contractual a
greement of this unencapsulated class: a set of rules that define when each method can be called and what it is expected to do.
...And 2 more matches
nsITransportEventSink
inherits from: nsisupports last changed in gecko 1.7 method overview void ontransportstatus(in nsitransport atransport, in nsresult astatus, in unsigned long long apro
gress, in unsigned long long apro
gressmax); methods ontransportstatus() transport status notification.
... void ontransportstatus( in nsitransport atransport, in nsresult astatus, in unsigned long long apro
gress, in unsigned long long apro
gressmax ); parameters atransport the transport sending this status notification.
...apro
gress the amount of data either read or written depending on the value of the status code.
...And 2 more matches
XPCOM Interface Reference by grouping
(i'm fully aware that this will be a
great point of discussion and probably will end in tears, but since i'm the first person to apparently take a swing at this, i get first dibs.) the primary sections consist of: browser this section contains elements associated with the view pane or the content of the "browser window" proper.
...ndow nsidomnode nsidomnshtmldocument nsidomstorageitem nsidomstoragemanager nsidomwindow nsidomwindow2 nsidomwindowinternal nsidomwindowutils nsidynamiccontainer nsieditor event nsidomevent nsidomeventgroup nsidomeventlistener nsidomeventtarget nsidommousescrollevent nsidommoztouchevent nsidomorientationevent nsidompro
gressevent nsidomsimplegestureevent nsidragdrophandler nsidragservice nsidragsession html nsiaccessibilityservice nsiaccessiblecoordinatetype nsiaccessibledocument nsiaccessibleeditabletext nsiaccessibleevent nsiaccessiblehyperlink nsiaccessiblehypertext nsiaccessibleimage nsiaccessibleprovider nsiaccessibleretrieval nsiaccessiblero...
...tableunicodeconverter nsiscripterror nsiscripterror2 stylesheet nsistylesheetservice url nsiuri nsiurl util nsidomserializer nsidomxpathevaluator nsidomxpathexception nsidomxpathexpression nsidomxpathresult xslt nsixsltexception nsixsltprocessor download nsidownload nsidownloadmanager nsidownloadpro
gresslistener element internal nsiworker nsiworkerglobalscope nsiworkermessageevent nsiworkermessageport nsiworkerscope tree nsitreeboxobject nsitreecolumn nsitreecolumns nsitreecontentview nsitreeselection nsitreeview xform nsixformsmodelelement nsixformsnsinstanceelement nsixformsnsmodelelement xmlhttprequest ...
...And 2 more matches
WebIDL bindings
(e.g., if (arg.foo.waspassed() { /* do nice things!*/ }) dictionary.isanymemberpresent() -
great for checking if you need to do anything.
...so, for example, given this idl: interface firstinterface { stringifier; }; interface secondinterface { stringifier domstring getstrin
grepresentation(); }; the corresponding c++ would be: class firstinterface { public: void stringify(nsastring& aresult); }; class secondinterface { public: void getstrin
grepresentation(nsastring& aresult); }; legacy callers only anonymous legacy callers are supported, and will invoke the c++ method called legacycall.
... the nameisenumerable and getsupportednames methods need to a
gree on which names are and are not enumerable.
...And 2 more matches
Work with animations - Firefox Developer Tools
the bar is: blue if a transition was used to animate a property orange if a @keyframes animation was used
green if the web animations api was used the bar contains a lightning bolt icon if the property was animated using the compositor thread (see more about the cost of animating different css properties).
... the img#icon animation: animated the filter and transform properties, to scale the icon and color it lasted 750ms, had an enddelay of 100ms used the compositor thread was given an easing value of ease-in: you can see this by the concave shape of the
green bar.
... the span#note animation: animated the width and opacity properties, to make the name gradually appear lasted 500ms, and had a delay of 150ms was given an easing value of ease-out: you can see this by the convex shape of the
green bar.
...And 2 more matches
Flame Chart - Firefox Developer Tools
but while the call tree organizes this data to show you where your program is spending most time in ag
gregate across the recording, the flame chart uses it to show you when in the recording particular functions are executing.
...underneath that, colored olive-
green, are the calls it's making to sort().
...the sort() code is just this: function sort(unsorted) { console.log(bubblesort(unsorted)); console.log(selectionsort(unsorted)); console.log(quicksort(unsorted)); } the markers labeled "bubb..." and colored olive-
green are presumably bubblesort().
...And 2 more matches
BiquadFilterNode.getFrequencyResponse() - Web APIs
the two output arrays, ma
gresponseoutput and phaseresponseoutput, must be created before calling this method; they must be the same size as the array of input frequency values (frequencyarray).
... syntax biquadfilternode.getfrequencyresponse(frequencyarray, ma
gresponseoutput, phaseresponseoutput); parameters frequencyarray a float32array containing an array of frequencies, specified in hertz, which you want to filter.
... ma
gresponseoutput a float32array to receive the computed magnitudes of the freqency response for each frequency value in the frequencyarray.
...And 2 more matches
BiquadFilterNode.type - Web APIs
the
greater the value is, the
greater is the peak.
...the
greater the value, the
greater the peak.
...the
greater the q value, the larger the frequency band.
...And 2 more matches
BiquadFilterNode - Web APIs
the
greater the value is, the
greater is the peak.
...the
greater the value, the
greater the peak.
...the
greater the q value, the smaller the frequency band.
...And 2 more matches
Manipulating video using canvas - Web APIs
this tutorial demonstrates how to perform chroma-keying (also known as the "
green screen effect") using javascript code.
... canvas c1 is used to display the current frame of the original video, while c2 is used to display the video after performing the chroma-keying effect; c2 is preloaded with the still image that will be used to replace the
green background in the video.
... the for loop that begins on line 6 scans through the frame's pixels, pulling out the red,
green, and blue values for each pixel, and compares the values against predetermined numbers that are used to detect the
green screen that will be replaced with the still background image imported from foo.png.
...And 2 more matches
Pixel manipulation with canvas - Web APIs
the data property returns a uint8clampedarray which can be accessed to look at the raw pixel data; each pixel is represented by four one-byte values (red,
green, blue, and alpha, in that order; that is, "rgba" format).
...0 * 4)) + 2]; if given a set of coordinates (x and y), you may end up doing something like this: var xcoord = 50; var ycoord = 100; var canvaswidth = 1024; function getcolorindicesforcoord(x, y, width) { var red = y * (width * 4) + x * 4; return [red, red + 1, red + 2, red + 3]; } var colorindices = getcolorindicesforcoord(xcoord, ycoord, canvaswidth); var redindex = colorindices[0]; var
greenindex = colorindices[1]; var blueindex = colorindices[2]; var alphaindex = colorindices[3]; var redforcoord = imagedata.data[redindex]; var
greenforcoord = imagedata.data[
greenindex]; var blueforcoord = imagedata.data[blueindex]; var alphaforcoord = imagedata.data[alphaindex]; or, if es2015 is appropriate: const xcoord = 50; const ycoord = 100; const canvaswidth = 1024; const getcolorindice...
...sforcoord = (x, y, width) => { const red = y * (width * 4) + x * 4; return [red, red + 1, red + 2, red + 3]; }; const colorindices = getcolorindicesforcoord(xcoord, ycoord, canvaswidth); const [redindex,
greenindex, blueindex, alphaindex] = colorindices; you may also access the size of the pixel array in bytes by reading the uint8clampedarray.length attribute: var numbytes = imagedata.data.length; creating an imagedata object to create a new, blank imagedata object, you should use the createimagedata() method.
...And 2 more matches
IIRFilterNode.getFrequencyResponse() - Web APIs
the two output arrays, ma
gresponseoutput and phaseresponseoutput, must be created before calling this method; they must be the same size as the array of input frequency values (frequencyarray).
... syntax iirfilternode.getfrequencyresponse(frequencyarray, ma
gresponseoutput, phaseresponseoutput); parameters frequencyarray a float32array containing an array of frequencies, specified in hertz, which you want to filter.
... ma
gresponseoutput a float32array to receive the computed magnitudes of the freqency response for each frequency value in the frequencyarray.
...And 2 more matches
Key Values - Web APIs
dead_e (0xfe83) gdk_key_dead_i (0xfe84) gdk_key_dead_i (0xfe85) gdk_key_dead_o (0xfe86) gdk_key_dead_o (0xfe87) gdk_key_dead_u (0xfe88) gdk_key_dead_u (0xfe89) gdk_key_dead_small_schwa (0xfe8a) ə gdk_key_dead_capital_schwa (0xfe8b) Ə gdk_key_dead_
greek (0xfe8c) function keys while various platforms support different numbers of the general-purpose function keys, such as f1–f12 (or f1–f10, or f1–f15, etc.), the first few are specifically defined as follows.
... vk_colored_key_0 keycode_prog_red (183) "colorf1
green" [3] general-purpose media funciton key, color-coded
green.
... vk_colored_key_1 keycode_prog_
green (184) "colorf2yellow" [3] general-purpose media funciton key, color-coded yellow.
...And 2 more matches
WebRTC connectivity - Web APIs
this is the most recent connection that both sides have fully a
greed to use.
... the pending description (returned by rtcpeerconnection.pendinglocaldescription and rtcpeerconnection.pendin
gremotedescription) indicates a description which is currently under consideration following a call to setlocaldescription() or setremotedescription(), respectively.
... when reading the description (returned by rtcpeerconnection.localdescription and rtcpeerconnection.remotedescription), the returned value is the value of pendinglocaldescription/pendin
gremotedescription if there's a pending description (that is, the pending description isn't null); otherwise, the current description (currentlocaldescription/currentremotedescription) is returned.
...And 2 more matches
Geometry and reference spaces in WebXR - Web APIs
to convert de
grees to radians, simply multiply the value in de
grees by π/180.
... the following code snippet shows two simple functions, de
greestoradians() and radianstode
grees(), which convert back and forth between the two units for measuring angles.
... const radians_per_de
gree = math.pi / 180.0; let de
greestoradians = (deg) => deg * radians_per_de
gree; let radianstode
grees = (rad) => rad / radians_per_de
gree; times and durations note that for security reasons, domhighrestimestamp usually introduces a small amount of imprecision to the clock in order to prevent it from being used in fingerprinting and timing-based attacks.
...And 2 more matches
Using IIR filters - Web APIs
musicdsp.org is also a
great resource if you want to read more about different filters and how they are implemented digitally.
... // arrays for our frequency response const totalarrayitems = 30; let myfrequencyarray = new float32array(totalarrayitems); let ma
gresponseoutput = new float32array(totalarrayitems); let phaseresponseoutput = new float32array(totalarrayitems); let's fill our first array with frequency values we want data to be returned on: myfrequencyarray = myfrequencyarray.map(function(item, index) { return math.pow(1.4, index); }); we could go for a linear approach, but it's far better when working with frequencies to take a log app...
... now let's get our response data: iirfilter.getfrequencyresponse(myfrequencyarray, ma
gresponseoutput, phaseresponseoutput); we can use this data to draw a filter frequency plot.
...And 2 more matches
XMLHttpRequest - Web APIs
please use server-sent events, web sockets, or responsetext from pro
gress events instead.
... since then, a number of additional event handlers have been implemented in various browsers (onload, onerror, onpro
gress, etc.).
... pro
gress fired periodically when a request receives more data.
...And 2 more matches
Implementing a Microsoft Active Accessibility (MSAA) Server - Accessibility
without downloading the sdk, you won't get the extremely useful tools, which help a
great deal in the learning process.
...true, it's not
great for documents, but it's the only existing widely-used standard for exposing accessibility.
... don't use msaa if you're working with a small number of at vendors, you can get everyone to a
gree on a different solution, and you're sure that you won't be needing to support other assistive technologies later.
...And 2 more matches
Variable fonts guide - CSS: Cascading Style Sheets
this is typically set in css using the font-stretch property, with values expressed as a percentage above or below ‘normal’ (100%), any number
greater than 0 is technically valid—though it is far more likely that the range would fall closer to the 100% mark, such as 75%-125%.
...the allowed range is generally 0 (upright) to 20 de
grees — any number value along that range can be supplied, so the font can be slanted just a tiny bit.
... however, any value from -90–90 de
grees is valid.
...And 2 more matches
<easing-function> - CSS: Cascading Style Sheets
depending on the specific function used, the calculated output can sometimes grow to be
greater than 1.0 or smaller than 0.0 during the course of an animation.
...for example, a color component
greater than 255 or smaller than 0 will be clipped to the closest allowed value (255 and 0, respectively).
... ease-in the animation starts slowly, and then pro
gressively speeds up until the end, at which point it stops abruptly.
...And 2 more matches
<gradient> - CSS: Cascading Style Sheets
the <gradient> css data type is a special type of <image> that consists of a pro
gressive transition between two or more colors.
... linear gradient linear gradients transition colors pro
gressively along an imaginary line.
... radial gradient radial gradients transition colors pro
gressively from a center point (origin).
...And 2 more matches
repeating-radial-gradient() - CSS: Cascading Style Sheets
syntax /* a gradient at the center of its container, starting red, changing to blue, and finishing
green, with the colors repeating every 30px */ repeating-radial-gradient(circle at center, red 0, blue,
green 30px); /* an elliptical gradient near the top left of its container, starting red, changing to
green and back again, repeating five times between the center and the bottom right corner, and only once between the center and the top left corner */ repeating-radial-gradient(farthest...
...-corner at 20% 20%, red 0,
green, red 20%); values <position> the position of the gradient, interpreted in the same way as background-position or transform-origin.
....radial-gradient { width: 120px; height: 120px; } .radial-gradient { background: repeating-radial-gradient(black, black 5px, white 5px, white 10px); } farthest-corner <div class="radial-gradient"></div> .radial-gradient { width: 240px; height: 120px; } .radial-gradient { background: repeating-radial-gradient(ellipse farthest-corner at 20% 20%, red, black 5%, blue 5%,
green 10%); background: repeating-radial-gradient(ellipse farthest-corner at 20% 20%, red 0 5%,
green 5% 10%); } the elliptical gradient will be centered 20% from the top left, and will repeat 10 times between the center and the farthest corner (the bottom right corner).
...And 2 more matches
revert - CSS: Cascading Style Sheets
so if you have a color:
green for all sections and all: revert on a specific section the color of the section will be black.
... h3 { font-weight: normal; color: blue; border-bottom: 1px solid
grey; } <h3>this will have custom styles</h3> <p>just some text</p> <h3 style="all: revert">this should be reverted to browser/user defaults</h3> <p>just some text</p> revert on a parent reverting effectively removes the value for the element you select with some rule and only for that element.
... to illustrate this we will set a
green color on a section and red color on a paragraph.
...And 2 more matches
transform-origin - CSS: Cascading Style Sheets
right | top | bottom ] | [ [ <length-percentage> | left | center | right ] && [ <length-percentage> | top | center | bottom ] ] <length>?where <length-percentage> = <length> | <percentage> examples code sample transform: none; <div class="box1"> </div> .box1 { margin: 0.5em; width: 3em; height: 3em; border: solid 1px; background-color: pale
green; transform: none; -webkit-transform: none; } transform: rotate(30deg); <div class="box2"> </div> .box2 { margin: 0.5em; width: 3em; height: 3em; border: solid 1px; background-color: pale
green; transform: rotate(30deg); -webkit-transform: rotate(30deg); } transform: rotate(30deg); transform-origin: 0 0...
...; <div class="box3"> </div> .box3 { margin: 0.5em; width: 3em; height: 3em; border: solid 1px; background-color: pale
green; transform-origin: 0 0; -webkit-transform-origin: 0 0; transform: rotate(30deg); -webkit-transform: rotate(30deg); } transform: rotate(30deg); transform-origin: 100% 100%; <div class="box4"> </div> .box4 { margin: 0.5em; width: 3em; height: 3em; border: solid 1px; background-color: pale
green; transform-origin: 100% 100%; -webkit-transform-origin: 100% 100%; transform: rotate(30deg); -webkit-transform: rotate(30deg); } transform: rotate(30deg); transform-origin: -1em -3em; <div class="box5"> </div> .box5 { margin: 0...
....5em; width: 3em; height: 3em; border: solid 1px; background-color: pale
green; transform-origin: -1em -3em; -webkit-transform-origin: -1em -3em; transform: rotate(30deg); -webkit-transform: rotate(30deg); } transform: scale(1.7); <div class="box6"> </div> .box6 { margin: 0.5em; width: 3em; height: 3em; border: solid 1px; background-color: pale
green; transform: scale(1.7); -webkit-transform: scale(1.7); } transform: scale(1.7); transform-origin: 0 0; <div class="box7"> </div> .box7 { margin: 0.5em; width: 3em; height: 3em; border: solid 1px; background-color: pale
green; transform: scale(1.7); -webkit-transform: scale(1.7); transform-origin: 0 0; -webkit-transform-origin:...
...And 2 more matches
<input type="checkbox"> - HTML: Hypertext Markup Language
essentially, then, the indeterminate attribute adds a third possible state to the checkbox: "i don't know." in this state, the browser may draw the checkbox in
grey or with a different mark inside the checkbox.
...in this example we keep track of the in
gredients we are collecting for a recipe.
... when you check or uncheck an in
gredient's checkbox, a javascript function checks the total number of checked in
gredients: if none are checked, the recipe name's checkbox is set to unchecked.
...And 2 more matches
<meter>: The HTML Meter element - HTML: Hypertext Markup Language
this must be
greater than the minimum value (min attribute), if specified.
...this must be
greater than the minimum value (min attribute), and it also must be less than the high value and maximum value (high attribute and max attribute, respectively), if any are specified.
...this must be less than the maximum value (max attribute), and it also must be
greater than the low value and minimum value (low attribute and min attribute, respectively), if any are specified.
...And 2 more matches
itemscope - HTML: Hypertext Markup Language
the itemtypes, recipe, ag
gregaterating, and nutritioninformation in the following example are part of the schema.org structured data for a recipe, as specified by the first itemtype, http://schema.org/recipe.
...i like to add a dash of nutmeg.</span> <br> <span itemprop="ag
gregaterating" itemscope itemtype="http://schema.org/ag
gregaterating"> <span itemprop="ratingvalue">4.0</span> stars based on <span itemprop="reviewcount">35</span> reviews </span> <br> prep time: <time datetime="pt30m" itemprop="preptime">30 min</time><br> cook time: <time datetime="pt1h" itemprop="cooktime">1 hou</time>r<br> total time: <time datetime="pt1h30m" itemprop="totaltime">1 ...
...me><br> yield: <span itemprop="recipeyield">1 9" pie (8 servings)</span><br> <span itemprop="nutrition" itemscope itemtype="http://schema.org/nutritioninformation"> serving size: <span itemprop="servingsize">1 medium slice</span><br> calories per serving: <span itemprop="calories">250 cal</span><br> fat per serving: <span itemprop="fatcontent">12 g</span><br> </span> <p> in
gredients:<br> <span itemprop="recipein
gredient">thinly-sliced apples: 6 cups<br></span> <span itemprop="recipein
gredient">white sugar: 3/4 cup<br></span> ...
...And 2 more matches
Microformats - HTML: Hypertext Markup Language
summary microformats (sometimes abbreviated μf) are standards used to embed semantics & structured data in html, and provide an api to be used by search engines, ag
gregators, and other tools.
...search engines benefit
greatly from direct access to this structured data because it allows them to understand the information on web pages and provide more relevant results to users.
...erty description p-name entry name/title p-author who wrote the entry, optionally embedded h-card dt-published when the entry was published p-summary short entry summary e-content full content of the entry parsed reply h-entry example <div class="h-entry"> <p><span class="p-author h-card"> <a href="https://quickthoughts.j
gregorymcverry.com/profile/jgmac1106" ><img class="u-photo" src="https://quickthoughts.j
gregorymcverry.com/file/2d6c9cfed7ac8e849f492b5bc7e6a630/thumb.jpg"/></a> <a class="p-name u-url" href="https://quickthoughts.j
gregorymcverry.com/profile/jgmac1106">
greg mcverry</a></span> replied to <a class="u-in-reply-to" href="/docs/web/html/microformats">a post on <strong>developer.mozilla.org</st...
...And 2 more matches
Regular expression syntax cheatsheet - JavaScript
this page provides an overall cheat sheet of all the capabilities of regexp syntax by ag
gregating the content of the articles in the regexp guide.
...for example, /
green|red/ matches "
green" in "
green apple" and "red" in "red apple".
...for example, /e?le?/ matches the "el" in "angel" and the "le" in "angle." if used immediately after any of the quantifiers *, +, ?, or {}, makes the quantifier non-
greedy (matching the minimum number of times), as opposed to the default, which is
greedy (matching the maximum number of times).
...And 2 more matches
Quantifiers - JavaScript
for example, /e?le?/ matches the "el" in "angel" and the "le" in "angle." if used immediately after any of the quantifiers *, +, ?, or {}, makes the quantifier non-
greedy (matching the minimum number of times), as opposed to the default, which is
greedy (matching the maximum number of times).
... by default quantifiers like * and + are "
greedy", meaning that they try to match as much of the string as possible.
...character after the quantifier makes the quantifier "non-
greedy": meaning that it will stop as soon as it finds a match.
...And 2 more matches
Web audio codec guide - Web media technologies
upon decoding, the output is, to varying de
grees, still understandable.
...if you need the ability to record audio at a minimal impact to network and/or storage capacity, amr can be a
great choice.
... flac is a
great choice for smaller audio effects files where pristine quality and tonal accuracy are desired, as well as for archival of music.
...And 2 more matches
Optimizing startup performance - Web Performance
you should present some kind of interface, such as a pro
gress bar, so that the user knows how much longer they'll need to wait while your app starts up.
...include a pro
gress indicator so the user knows what's going on and how long they'll be waiting.
...the source application might have a main loop that can easily be made to operate asynchronously (by running each main loop iteration separately); startup is often just a continuous, monolithic procedure that might periodically update a pro
gress meter.
...And 2 more matches
Performance Monitoring: RUM vs synthetic monitoring - Web Performance
rum is generally best suited for understanding long-term trends whereas synthetic monitoring is very well suited to re
gression testing and mitigating shorter-term performance issues during development.
... synthetic monitoring can be an important component of re
gression testing and production site monitoring.
...this is particularly important for large sites or complex apps, where the functionality or content is constantly changing, and where the population accessing the application may differ
greatly in life experiences from those creating it.
...And 2 more matches
d - SVG: Scalable Vector Graphics
25,10 50,10 s 70,90 90,90" /> <!-- cubic bézier curve with relative coordinates --> <path fill="none" stroke="red" d="m 110,90 c 20,0 15,-80 40,-80 s 20,80 40,80" /> <!-- highlight the curve vertex and control points --> <g id="controlpoints"> <!-- first cubic command control points --> <line x1="10" y1="90" x2="30" y2="90" stroke="light
grey" /> <circle cx="30" cy="90" r="1.5"/> <line x1="50" y1="10" x2="25" y2="10" stroke="light
grey" /> <circle cx="25" cy="10" r="1.5"/> <!-- second smooth command control points (the first one is implicit) --> <line x1="50" y1="10" x2="75" y2="10" stroke="light
grey" stroke-dasharray="2" /> <circle cx="75" cy="10" r="1.5" fill="light
grey"/> <line x1="90" y1="90" x2="70"...
... y2="90" stroke="light
grey" /> <circle cx="70" cy="90" r="1.5" /> <!-- curve vertex points --> <circle cx="10" cy="90" r="1.5"/> <circle cx="50" cy="10" r="1.5"/> <circle cx="90" cy="90" r="1.5"/> </g> <use xlink:href="#controlpoints" x="100" /> </svg> quadratic bézier curve quadratic bézier curves are smooth curve definitions using three points: starting point (current point) po = {xo, yo} end point pn = {xn, yn} control point pc = {xc, yc} (controls curvature) after drawing, the end point (pn) becomes the current point for the next command (po′).
...oints="10,50 25,25 40,50" stroke="rgba(0,0,0,.2)" fill="none" /> <circle cx="25" cy="25" r="1.5" /> <!-- curve vertex points --> <circle cx="10" cy="50" r="1.5"/> <circle cx="40" cy="50" r="1.5"/> <g id="smoothquadraticdown"> <polyline points="40,50 55,75 70,50" stroke="rgba(0,0,0,.2)" stroke-dasharray="2" fill="none" /> <circle cx="55" cy="75" r="1.5" fill="light
grey" /> <circle cx="70" cy="50" r="1.5" /> </g> <g id="smoothquadraticup"> <polyline points="70,50 85,25 100,50" stroke="rgba(0,0,0,.2)" stroke-dasharray="2" fill="none" /> <circle cx="85" cy="25" r="1.5" fill="light
grey" /> <circle cx="100" cy="50" r="1.5" /> </g> <use xlink:href="#smoothquadraticdown" x="60" /> <use xlink:href="#smoothquadraticup" x=...
...And 2 more matches
XUL Migration Guide - Archive of obsolete content
but there are some notable limitations in the sdk apis and even a fairly simple ui may need some de
gree of redesign to work with them.
... if you can find a third party package that does what you want, this is a
great way to use features not supported in the sdk without having to use the low-level apis.
... but this means that the more powerful modules you require(), the
greater is your exposure if your add-on is compromised.
...this applies with even
greater force to require("chrome"), since this gives full access to the browser's capabilities.
places/bookmarks - Archive of obsolete content
save() and search() are both asynchronous functions: they synchronously return a placesemitter object, which then asynchronously emits events as the operation pro
gresses and completes.
... // latest snapshot from the server as `saved` (with properties // such as `updated` and `id`), as well as the initial input // item as `inputitem` console.log(saved.title === inputitem.title); // true console.log(saved !== inputitem); // true console.log(inputitem === bookmark); // true }).on("end", function (saveditems, inputitems) { // similar to "data" events, except "end" is an ag
gregate of // all pro
gress events, with ordered arrays as `saveditems` // and `inputitems` }); creating several bookmarks with a new group let { bookmark, group, save } = require("sdk/places/bookmarks"); let group = group({ title: "guitars" }); let bookmarks = [ bookmark({ title: "ran", url: "http://ranguitars.com", group: group }), bookmark({ title: "ibanez", url: "http://ibanez.com", gro...
... data events are emitted for every individual operation (such as: each item saved, or each item found by a search query), whereas end events are emitted as the ag
gregate of an operation, passing an array of objects into the handler.
... end the end event is called when all bookmark items and dependencies have been saved, or an ag
gregate of all items returned from a search query.
On page load - Archive of obsolete content
if you need finer control over custom code execution—for example, as documents are loading or when tabs are switched—see pro
gress listeners.
... pro
gress listeners allow extensions to be notified of events associated with documents loading in the browser and with tab switching events.
... pro
gress listeners implement the nsiwebpro
gresslistener interface.
... // if (win.frameelement) return; // skip iframes/frames alert("page is loaded \n" +doc.location.href); } } window.addeventlistener("load", function load(event){ window.removeeventlistener("load", load, false); //remove listener, no longer needed myextension.init(); },false); references if you need to have a more complicated listener (not just onload), use pro
gress listeners.
Custom XUL Elements with XBL - Archive of obsolete content
person.setattribute("name", name); person.setattribute("
greeting",
greeting); // ...
... <content> <xul:hbox> <xul:image class="xulshoolhello-person-image" xbl:inherits="src=image" /> <xul:vbox flex="1"> <xul:label xbl:inherits="value=name" /> <xul:description xbl:inherits="value=
greeting" /> </xul:vbox> <xul:vbox> <xul:button label="&xulshoolhello.remove.label;" accesskey="&xulshoolhello.remove.accesskey;" oncommand="document.getbindingparent(this).remove(event);" /> </xul:vbox> </xul:hbox> </content> our element is very simple, displaying an image, a couple of text lines and a button.
...so, if you have this: <xshelloperson name="pete"
greeting="good morning" image="" />, then those attribute values are "inherited" to the content nodes that have this special attribute.
...we have a "click" handler that displays the
greeting when the "person" element is clicked: <handler phase="bubbling" event="click"><![cdata[ window.alert(this.
greeting); ]]></handler> handlers are not necessary all that often, since in most cases you'll need the events to only apply to a part of the binding, not the whole thing.
Mozilla Documentation Roadmap - Archive of obsolete content
there's a
great deal of free online documentation available on xul and extension development, but finding it and turning it into useful information can be a daunting task.
... the amo developer hub the amo developer hub is a
great guide for add-on developers.
...this is a
great place to ask questions and have them answered by experienced developers.
...this blog is maintained by the add-ons team at mozilla, and it's a
great way to stay up to date with amo development and add-on review policies.
Tabbed browser - Archive of obsolete content
xul: <menuitem oncommand="myextension.foo(event)" onclick="checkformiddleclick(this, event)" label="click me"/> js: var myextension = { foo: function(event) { openuilink("http://www.example.com", event, false, true); } } opening a url in an on demand tab cu.import("resource://
gre/modules/xpcomutils.jsm"); xpcomutils.definelazyservicegetter(this, "gsessionstore", "@mozilla.org/browser/sessionstore;1", "nsisessionstore"); // create new tab, but don't load the content.
...("tabmove", exampletabmoved, false); container.addeventlistener("tabclose", exampletabremoved, false); // when no longer needed container.removeeventlistener("tabopen", exampletabadded, false); container.removeeventlistener("tabmove", exampletabmoved, false); container.removeeventlistener("tabclose", exampletabremoved, false); note: starting in gecko 1.9.1, there's an easy way to listen on pro
gress events on all tabs.
... components.utils.import('resource://
gre/modules/services.jsm'); services.obs.addobserver(httpobs, 'http-on-modify-request', false); //services.obs.removeobserver(httpobs, 'http-on-modify-request'); //uncomment this line, or run this line when you want to remove the observer var httpobs = { observe: function (asubject, atopic, adata) { if (atopic == 'http-on-modify-request') { /*start - do not edit here*/ ...
...but if its an ajax call you may end up here } } } }; here's a cleaner example of the same thing: cu.import('resource://
gre/modules/services.jsm'); var httprequestobserver = { observe: function (subject, topic, data) { var httpchannel, requesturl; if (topic == "http-on-modify-request") { httpchannel = subject.queryinterface(ci.nsihttpchannel); requesturl = httpchannel.uri.spec; var newrequesturl, i; if (/someurl/.test(requesturl)) { ...
Index of archived content - Archive of obsolete content
using xpcom without chrome using third-party modules (jpm) bootstrapped extensions code snippets alerts and notifications autocomplete bookmarks boxes canvas code snippets cookies customizing the download pro
gress bar delayed execution dialogs and prompts downloading files drag & drop embedding svg examples and demos from articles file i/o finding window handles forms related code snippets html in xul for rich tooltips html to dom isdefaultnamespace j...
...ugger service javascript timers javascript daemons management label and description lookupnamespaceuri lookupprefix miscellaneous modules on page load page loading post data to window preferences pro
gress listeners queryselector rosetta running applications svg animation svg general scrollbar sidebar stringview tabbox toolbar tree uri parsing view source for xul applications windows xml-related code snipp...
... layout system overview multiple firefox profiles repackaging firefox style system overview using microformats firefox sync code snippets javascript client api syncing custom preferences force rtl
gre gre registration gecko coding help wanted http class overview hacking wiki help viewer creating a help content pack helper apps (and a bit of save as) hidden prefs how to write and land nanojit patches io guide/di...
... standard makefile header static analysis for windows code under linux stress testing string quick reference string rosetta stone structure of an installable bundle supporting per-window private browsing supporting private browsing mode table cellmap table cellmap - border collapse table layout re
gression tests table layout strategy tamarin abcasm tamarin acceptance testing abc assembler tests actionscript acceptance tests tamarin acceptance test template actionscript performance...
Embedding Mozilla in a Java Application using JavaXPCOM - Archive of obsolete content
first, the java application must find a suitable xulrunner installation: mozilla mozilla = mozilla.getinstance();
greversionrange[] range = new
greversionrange[1]; range[0] = new
greversionrange("1.8.0", true, "1.9", false); // work with trunk nightly version 1.9a1 ^^ try { file
grepath = mozilla.get
grepathwithproperties(range, null); locationprovider locprovider = new locationprovider(
grepath); mozilla.initembedding(
grepath,
grepath, locprovider); } catch (filenotfoundexception e) { // this ...
...exception is thrown if
gregrepathwithproperties cannot find a
gre } catch (xpcomexception e) { // this exception is thrown if initembedding failed } locationprovider is a class provided by the java application.
... if your code cannot find the
gre and keeps throwing filenotfoundexceptions during the get
grepathwithproperties(...) call, check whether you already registered the
gre on your system:
gre registration the initembedding method kicks off the embedding process, allowing the java application to work with xpcom and mozilla.
...l); // set this as the active window windowwatcher.setactivewindow(win); // hand over the application to xpcom/xul, this will block: appstartup.run(); here is an example of a locationprovider that works : public class locationprovider implements iappfilelocprovider { private final file libxulpath; int counter = 0; public locationprovider(file
grepath) { this.libxulpath =
grepath; } public file getfile(string aprop, boolean[] apersistent) { file file = null; if (aprop.equals("
gred") || aprop.equals("
grecomsd")) { file = libxulpath; if (aprop.equals("
grecomsd")) { file = new file(file, "components"); } } else if (aprop.equals("mozbind") || ...
Migrate apps from Internet Explorer to Mozilla - Archive of obsolete content
the text changes occur because authors encapsulate the areas with the anchor-setting markup: css: a:hover {color:
green;} html: <a href="foo.com">this text should turn
green when you hover over it.</a> <a name="anchor-name"> this text should change color when hovered over, but doesn't in internet explorer.
... </a> mozilla follows the css specification correctly and will change the color to
green in this example.
... you can use two ways to make mozilla behave like internet explorer and not change the color of the text when hovered over: first, you can change the css rule to be a:link:hover {color:
green;}, which will only change the color if the element is a link (has an href attribute).
... doctypes (short for document type declarations) look like this: <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> the section in blue is called the public identifier, the
green part is the system identifier, which is a uri.
Venkman Introduction - Archive of obsolete content
on other platforms, including mac os and unix, it is alone in offering this de
gree of flexibility, depth, and power in a visual debugging environment.
...when you enable profiling by clicking this button, a
green checkmark appears next to the button and profile data for every function is collected, and can be saved by choosing save profile data as...
... when pretty print is enabled you will see a
green check mark on the toolbar button, and the menu item will be checked as well.
... properties that show up in a bold
grey font are defined on an object from the prototype chain, and not on the actual object you are inspecting.
Document Object Model - Archive of obsolete content
our find files example it doesn't make sense to have the pro
gress bar and the dummy tree data displayed when the find files dialog is first displayed.
... we'll change the pro
gress meter so that its initially hidden.
...<splitter id="splitbar" resizeafter="grow" hidden="true"/> <hbox> <pro
gressmeter id="progmeter" value="50%" style="margin: 4px;" hidden="true"/> we've added the hidden attribute and set the value to true.
... function dofind(){ var meter = document.getelementbyid('progmeter'); meter.hidden = false; } this function first gets a reference to the pro
gress meter using its id, progmeter.
Skinning XUL Files by Hand - Archive of obsolete content
this independence of function and form is a
great advantage of xul, and it should not be overlooked.
... add the following lines to the file: @import url(chrome://global/skin/); box#bbox { background-color: light
grey; } button#rd { background-color: red; color: white; } save it in the same directory as your xul file.
... when you reload the xul file you have been working on, the box element you have used to create the navigation area in the xul file appear as follows: the skinned browser is not much to look at right now -- and you may note that this basic skin has trans
gressed upon some of the skinning guidelines because it overrides color information, but you can get a sense of what the possibilities are with the combination of the xul structure and the style rules of css.
... the syntax for creating all this information with text -- added to the distributed nature and the sheer volume of text required to define a single chrome -- can sometimes make the pro
gress seem slow.
XML - Archive of obsolete content
it attempts to balance precise control of layout with flexibility and ease of use, and in this respect it does a
great job.
... using a combination of xul's ready-made widgets (e.g., menubar, scrollbar, pro
gressmeter, and so on) and xul's incorporation of such standards as html4, dom1/2, and cascading stylesheets, you can design any interface that you can imagine, using any number of different features, tools, and methodologies.
... xul is made out of xml you don't need to know all about xml in order to use xul, but you may want to read through this article to get a sense of xul's pedi
gree as a specialized markup language.
... the heavy lifting is done by the in
gredients rather than the chef.
Back to the Server: Server-Side JavaScript On The Rise - Archive of obsolete content
e4x (ecmascript for xml) is an extension of javascript which provides direct support for xml,
greatly simplifying the process of consuming xml via javascript.
...however, taking advantage of frameworks such as aptana jaxer (spidermonkey) and helma (rhino) can reveal even
greater rewards as a
great deal of work has already been done for you.
... as stated earlier, aptana jaxer is built using the mozilla browser engine engine that powers mozilla firefox, which includes spidermonkey as its javascript interpreter, but lots more features beyond ssjs alone such as dom, db, file io, css, server sessions, e4x, etc...] this is a
great advantage to the developer as it presents a consistent server-side and client-side development environment for both browser and server contexts that is centered on open source and web standards.
...to be able to use jaxer to essentially create an xml based restful service in javascript is useful and shifts a
great deal of power to the javascript developer.
2D collision detection - Game development
green means collision, blue means no collision.</p> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/crafty/0.5.4/crafty-min.js"></script> crafty.init(200, 200); var dim1 = {x: 5, y: 5, w: 50, h: 50} var dim2 = {x: 20, y: 10, w: 60, h: 40} var rect1 = crafty.e("2d, canvas, color").attr(dim1).color("red"); var rect2 = crafty.e("2d, canvas, color, keyboard, fourway").four...
... this.color("
green"); } else { // no collision this.color("blue"); } }); note: another example without canvas or external libraries.
...
green means collision, blue means no collision.</p> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/crafty/0.5.4/crafty-min.js"></script> #cr-stage { position: static !important; height: 200px !important; } crafty.init(200, 200); var dim1 = {x: 5, y: 5} var dim2 = {x: 20, y: 20} crafty.c("circle", { circle: function(radius, color) { this.radius = radius; this.w = this.h = radius * 2; this.color = co...
... this.color = "
green"; } else { // no collision this.color = "blue"; } }); var circle1 = {radius: 20, x: 5, y: 5}; var circle2 = {radius: 12, x: 10, y: 5}; var dx = circle1.x - circle2.x; var dy = circle1.y - circle2.y; var distance = math.sqrt(dx * dx + dy * dy); if (distance < circle1.radius + circle2.radius) { // collision detected!
2D maze game with device orientation - Game development
we're loading two images first that will be used later in the preload state to show the pro
gress of loading all the other assets.
...in this state the preloadbar is showing the pro
gress on the screen.
... that pro
gress of the loaded assets is visualized by the framework with the use of one image.
... html5 gives us raw tools, the frameworks built on top of it are getting faster and better, so now is a
great time get into web game development.
RGB - MDN Web Docs Glossary: Definitions of Web-related terms
red
green blue (rgb) is a color model that represents colors as mixtures of three underlying components (or channels), namely, red,
green, and blue.
... each color is described by a sequence of three numbers (typically between 0.0 and 1.0, or between 0 and 255) that represent the different intensities (or contributions) of red,
green, and blue, in determining the final color.
...in css they can be represented as a single 24-bit integer in hexadecimal notation (for example, #add8e6 is light blue), or in functional notation as three separate 8-bit integers (for example, rgb(46, 139, 87) is sea
green).
... in opengl, webgl, and glsl the red-
green-blue components are fractions (floating-point numbers between 0.0 and 1.0), although in the actual color buffer they are typically stored as 8-bit integers.
Getting started with CSS - Learn web development
to turn all paragraphs
green you would use: p { color:
green; } you can target multiple selectors at once, by separating the selectors with a comma.
... if i want all paragraphs and all list items to be
green my rule looks like this: p, li { color:
green; } try this out in the interactive editor below (edit the code boxes), or in your local css document.
...you can use css to target these different states — the css below styles unvisited links pink and visited links
green.
... a:link { color: pink; } a:visited { color:
green; } you can change the way the link looks when the user hovers over it, for example removing the underline, which is achieved by in the next rule: a:hover { text-decoration: none; } in the live example below, you can play with different values for the various states of a link.
Client-side form validation - Learn web development
(required)</label> <input id="choose" name="i_like" required> <button>submit</button> </form> note the css that is included in the example file: input:invalid { border: 2px dashed red; } input:invalid:required { background-image: linear-gradient(to right, pink, light
green); } input:valid { border: 2px solid black; } this css causes the input to have a red dashed border when it is invalid and a more subtle solid black border when valid.
... tooshort: returns true if the value is shorter than the minimum length specified by the minlength attribute, or false if it is
greater than or equal to the minimum.
... rangeoverflow: returns true if the value is
greater than the maximum specified by the max attribute, or false if it is less than or equal to the maximum.
... rangeunderflow: returns true if the value is less than the minimum specified by the min attribute, or false if it is
greater than or equal to the minimum.
Sending form data - Learn web development
consider the following form: <form action="http://www.foo.com" method="get"> <div> <label for="say">what
greeting do you want to say?</label> <input name="say" id="say" value="hi"> </div> <div> <label for="to">who do you want to say it to?</label> <input name="to" id="to" value="mom"> </div> <div> <button>send my
greetings</button> </div> </form> since the get method has been used, you'll see the url www.foo.com/?say=hi&to=mom appear in the browser address bar when you submit ...
... <form action="https://www.foo.com" method="post"> <div> <label for="say">what
greeting do you want to say?</label> <input name="say" id="say" value="hi"> </div> <div> <label for="to">who do you want to say it to?</label> <input name="to" id="to" value="mom"> </div> <div> <button>send my
greetings</button> </div> </form> when the form is submitted using the post method, you get no data appended to the url, and the http request looks like so, with the ...
... from flask import flask, render_template, request app = flask(__name__) @app.route('/', methods=['get', 'post']) def form(): return render_template('form.html') @app.route('/hello', methods=['get', 'post']) def hello(): return render_template('
greeting.html', say=request.form['say'], to=request.form['to']) if __name__ == "__main__": app.run() the two templates referenced in the above code are as follows (these need to be in a subdirectory called templates in the same directory as the python-example.py file, if you try to run the example yourself): form.html: the same form as we saw above in the the post method section but with the...
...
greeting.html: this template just contains a line that renders the two bits of data passed to it when it is rendered.
The web and web standards - Learn web development
this article provides some useful background on the web — how it came about, what web standard technologies are, how they work together, why "web developer" is a
great career to choose, and what kinds of best practices you'll learn about through the course.
... web standards are created by standards bodies — institutions that invite groups of people from different technology companies to come together and a
gree on how the technologies should work in the best way to fulfill all of their use cases.
... "open" standards one of the key aspects of web standards, which timbl and the w3c a
greed on from the start, is that the web (and web technologies) should be free to both contribute and use, and not encumbered by patents/licensing.
...this includes using technologies that all the browsers support, delivering better experiences to browsers that can handle them (pro
gressive enhancement), and/or writing code so that it falls back to a simpler but still usable experience in older browsers (graceful degradation).
HTML table advanced features and accessibility - Learn web development
rather than have a screenreader read out the contents of many cells just to find out what the table is about, he or she can rely on a caption and then decide whether or not to read the table in
greater detail.
...>location</th> <th>date</th> <th>evaluation</th> <th>cost (€)</th> </tr> </thead> <tfoot> <tr> <td colspan="4">sum</td> <td>118</td> </tr> </tfoot> <tbody> <tr> <td>haircut</td> <td>hairdresser</td> <td>12/09</td> <td>
great idea</td> <td>30</td> </tr> <tr> <td>lasagna</td> <td>restaurant</td> <td>12/09</td> <td>re
grets</td> <td>18</td> </tr> <tr> <td>shoes</td> <td>shoeshop</td> <td>13/09</td> <td>big re
grets</td> <td>65</td> </tr> ...
...ke this: <thead> <tr> <th scope="col">purchase</th> <th scope="col">location</th> <th scope="col">date</th> <th scope="col">evaluation</th> <th scope="col">cost (€)</th> </tr> </thead> and each row could have a header defined like this (if we added row headers as well as column headers): <tr> <th scope="row">haircut</th> <td>hairdresser</td> <td>12/09</td> <td>
great idea</td> <td>30</td> </tr> screenreaders will recognize markup structured like this, and allow their users to read out the entire column or row at once, for example.
...e rewritten like this: <thead> <tr> <th id="purchase">purchase</th> <th id="location">location</th> <th id="date">date</th> <th id="evaluation">evaluation</th> <th id="cost">cost (€)</th> </tr> </thead> <tbody> <tr> <th id="haircut">haircut</th> <td headers="location haircut">hairdresser</td> <td headers="date haircut">12/09</td> <td headers="evaluation haircut">
great idea</td> <td headers="cost haircut">30</td> </tr> ...
Test your skills: Object basics - Learn web development
run the
greeting() method using dot notation (it will log the
greeting to the browser devtools' console).
...we want you to rewrite the
greeting() method so that it logs "hello, said bertie the cymric." to the browser devtools' console, but in a way that will work across any cat object of the same structure, regardless of its name or breed.
... when you are done, write your own object called cat2, which has the same structure, exactly the same
greeting() method, but a different name, breed, and color.
... call both
greeting() methods to check that they log appropriate
greetings to the console.
Accessibility in React - Learn web development
just above the return statement is a good place: const listheadin
gref = useref(null); prepare the heading heading elements like our <h2> are not usually focusable.
... let's add the tabindex attribute — written as tabindex in jsx — to the heading above our list of tasks, along with our headin
gref: <h2 id="list-heading" tabindex="-1" ref={listheadin
gref}> {headingtext} </h2> note: the tabindex attribute is
great for accessibility edge-cases, but you should take
great care to not overuse it.
... add the following into the body of your app() function, just below your previous additions: useeffect(() => { if (tasks.length - prevtasklength === -1) { listheadin
gref.current.focus(); } }, [tasks.length, prevtasklength]); we only try to focus on our list heading if we have fewer tasks now than we did before.
...the skills you’ve learned here will be a
great foundation to build on as you continue working with react.
Accessibility Features in Firefox
many users are finding the true
greatness of firefox lies in support for third party extensions.
... here are some examples of accessible extensions, although there are hundreds more to try (thank you to the gw micro knowledge base for some of this information): adblock plus removes ads (and other objects, like banners) from web pages
greasemonkey lets you add bits of javascript ("user scripts") to any web page to change its behavior.
...chen is a screen reader extension built just for firefox which can read mathml community contributions the real reason behind firefox's success is the
great community of volunteers and organizations that realize they have something to benefit from a browser open to utilizing their ideas and hard work.
... that's the
great thing about the open firefox community model and source code license -- anyone can contribute, and everyone benefits.
How to implement a custom autocomplete search component
const ci = components.interfaces; const cu = components.utils; cu.import('resource://
gre/modules/xpcomutils.jsm'); const class_id = components.id('x753d830-ba1e-11e0-962b-0800200c9a66'); // ← change this const class_name = "basic autocomplete"; const contract_id = '@mozilla.org/autocomplete/search;1?name=basic-autocomplete'; /** * @constructor * * @implements {nsiautocompleteresult} * * @param {string} searchstring * @param {number} searchresult * @param {number} defaultin...
...ch is complete */ startsearch: function(searchstring, searchparam, previousresult, listener) { var results = ['mary', 'john']; var autocomplete_result = new providerautocompleteresult(searchstring, ci.nsiautocompleteresult.result_success, 0, "", results, null); listener.onsearchresult(this, autocomplete_result); }, /** * stops an asynchronous search that is in pro
gress */ stopsearch: function() { }, queryinterface: xpcomutils.generateqi([ ci.nsiautocompletesearch ]) }; // the following line is what xpcom uses to create components const nsgetfactory = xpcomutils.generatensgetfactory([ providerautocompletesearch ]); then register your xpcom component.
... if (searchresults[i].comment) comments.push(searchresults[i].comment); else comments.push(null); } } var newresult = new simpleautocompleteresult(searchstring, ci.nsiautocompleteresult.result_success, 0, "", results, comments); listener.onsearchresult(this, newresult); } }, /* * stop an asynchronous search that is in pro
gress */ stopsearch: function() { }, queryinterface: function(aiid) { if (!aiid.equals(ci.nsiautocompletesearch) && !aiid.equals(ci.nsisupports)) throw components.results.ns_error_no_interface; return this; } }; // factory var simpleautocompletesearchfactory = { singleton: null, createinstance: function (aouter, aiid) { if (aouter != null) throw components.r...
...esults.ns_error_no_ag
gregation; if (this.singleton == null) this.singleton = new simpleautocompletesearch(); return this.singleton.queryinterface(aiid); } }; // module var simpleautocompletesearchmodule = { registerself: function(acompmgr, afilespec, alocation, atype) { acompmgr = acompmgr.queryinterface(components.interfaces.nsicomponentregistrar); acompmgr.registerfactorylocation(class_id, class_name, contract_id, afilespec, alocation, atype); }, unregisterself: function(acompmgr, alocation, atype) { acompmgr = acompmgr.queryinterface(components.interfaces.nsicomponentregistrar); acompmgr.unregisterfactorylocation(class_id, alocation); }, getclassobject: function(acompmgr, acid, aiid) { if (!aiid.equals(components.interfaces.nsifactory)) ...
Implementing QueryInterface
it addrefs the resulting interface, not this, thus following the com-correct way (particularly important in ag
gregation) it uses nscomtypeinfo<t>::getiid() instead of ktiid thus saving a global declaration and global space it uses c 's static_cast, via ns_static_cast, which detects errors when you can't really get to the desired interface.
... it will be difficult, if not impossible, to get the right thing to happen if any of your base classes participate in true ag
gregation.
... you won't be able to catch calls to queryinterface on the ag
gregated objects, which may then return wrong interfaces.
... one more reason to avoid ag
gregation specifically, and complicated hierarchies in general.
Add-on Repository
to import the add-on repository code module, use: components.utils.import("resource://
gre/modules/addonrepository.jsm"); method overview string getrecommendedurl() string getsearchurl(in string searchterms) void cancelsearch() void retrieverecommendedaddons(in integer maxresults, in searchcallback callback) void searchaddons(in string searchterms, in integer maxresults, in searchcallback callback) properties property ...
... issearching boolean true if a search is currently in pro
gress; otherwise false.
... cancelsearch() cancels the search in pro
gress.
... does nothing if there is no search in pro
gress.
Assert.jsm
otequal(actual, expected, message); undefined deepequal(actual, expected, message); undefined notdeepequal(actual, expected, message); undefined strictequal(actual, expected, message); undefined notstrictequal(actual, expected, message); undefined throws(block, expected, message); promise rejects(promise, expected, message); undefined
greater(lhs, rhs, message); undefined
greaterorequal(lhs, rhs, message); undefined less(lhs, rhs, message); undefined lessorequal(lhs, rhs, message); undefined setreporter(reporterfunc); undefined report(failed, actual, expected, message, operator); constructor creates a new assert object.
... promise rejects( promise, expected, message ); parameters promise promise promise to wait for rejection and catch eventual thrown errors expected test reference to evaluate against the thrown result from block message short explanation of the expected result
greater() the
greater than assertion tests two numbers with the > operator.
... undefined
greater( lhs, rhs, message ); parameters lhs the left hand side of the operator rhs the right hand side of the operator message short explanation of the expected result
greaterorequal() the
greater or equal than assertion tests two numbers with the >= operator.
... undefined
greaterorequal( lhs, rhs, message ); parameters lhs the left hand side of the operator rhs the right hand side of the operator message short explanation of the expected result less() the lesser than assertion tests two numbers with the < operator.
Index
17 localization sign-off reviews guide, localization, mozilla this article presents an overview of why we do sign-off reviews of localizations, the details on the criteria used for the sign-off reviews, and the process for requesting a review and for following its pro
gress.
... 18 localization technical reviews guide, localization, mozilla this guide provides details on what a localization technical review is, what criteria are used for the technical reviews, and the process for requesting one and following its pro
gress.
...repeating the process allows a localizer to create a testable package to see his or her work as they pro
gress to a final version.
...you are free to add, edit, remove, and localize everything in this section according to how the localization team for your language a
grees.
MathML Accessibility in Mozilla
torture test 21: ∑ p prime f ( p ) = ∫ t > 1 f ( t ) d π ( t ) __________ sum over pee prime of f of pee is equal to integral over t is
greater than 1 of f of t d pi of open t close __________ ∑ f ( p ) = ∫, subscript t > 1, f ( t ) d π ( t ) see webkit's bug 146407 sum.
...subscript t
greater 1.
... column 2 vertical ellipsis column 3 vertical ellipsis column 4 column 5 vertical ellipsis row 5 column 1 c sub n column 2 c sub n plus 1 end sub column 3 c sub n plus 2 end sub column 4 dot dot dot column 5 c sub 2 n end sub end determinant is
greater than 0 __________ det | table start, row 1, column 1, c subscript 0, row 1, column 2, c subscript 1, row 1, column 3, c subscript 2, row 1, column 4, ..., row 1, column 5, c subscript n, row 2, column 1, c subscript 1, row 2, column 2, c subscript 2, row 2, column 3, c subscript 3, row 2, column 4, ..., row 2, column 5, c subscript n + 1, row 3, column 1, c subscript 2, row 3, co...
...vertical bar
greater than 0 torture test 25: y x 2 __________ y sub x sub 2 end sub __________ y, subscript x, subscript 2, y.
Gecko Profiler FAQ
how to profile startup code that re
gresses just a little (<10-15ms ts_paint/tpaint) [mstange] we currently don’t have a good way to do that.
...then the call stacks whose cost increased the most in the “after” profile will be at the top, and those are the ones you usually want to look at if you caused a re
gression.
... for example, see julian’s
great investigation on the impact of cache line sharing across multiple cores on jemalloc’s multi-core performance in https://bugzilla.mozilla.org/show_bug.cgi?id=1291355#c26.
... how do we find performance re
gressions caused by third-party and system addons, especially ones that only show up after extended uptime?
Profiling with the Firefox Profiler
there are lighter
grey names to the right of tree elements that indicate where the code comes from.
... as we pro
gress into a more specific part of the tree, you'll notice that the 'running time' decreases.
...i’d be eager to hear people’s experience giving this a go – it might be a
great tool in determining what’s going on in firefox when it’s hung!
...at present there is no central list of these thread names, but you can find them by
grepping the source.
Scroll-linked effects
<body style="height: 5000px" onscroll="document.getelementbyid('toolbar').style.top = math.max(100, window.scrolly) + 'px'"> <div id="toolbar" style="position: absolute; top: 100px; width: 100px; height: 20px; background-color:
green"></div> </body> this implementation of sticky positioning relies on the scroll event listener to reposition the "toolbar" div.
...one way to implement this without the scroll event listener is to use the css property designed for this purpose: <body style="height: 5000px"> <div id="toolbar" style="position: sticky; top: 0px; margin-top: 100px; width: 100px; height: 20px; background-color:
green"></div> </body> this version works well with asynchronous scrolling because position of the "toolbar" div is updated by the browser as the user scrolls.
...estination); } } var timeoutid = null; addeventlistener("scroll", function() { if (timeoutid) cleartimeout(timeoutid); timeoutid = settimeout(snap, 200, parseint(document.getelementbyid('snaptarget').style.top)); }, true); </script> <div id="snaptarget" class="snaptarget" style="position: relative; top: 200px; width: 100%; height: 200px; background-color:
green"></div> </body> in this example, there is a scroll event listener which detects if the scroll position is within 200 pixels of the top of the "snaptarget" div.
... <body style="height: 5000px"> <style> body, /* blink currently has bug that requires declaration on `body` */ html { scroll-snap-type: y proximity; } .snaptarget { scroll-snap-align: start; position: relative; top: 200px; height: 200px; background-color:
green; } </style> <div class="snaptarget"></div> </body> this version can work smoothly in the browser even if there is slow-running javascript on the browser's main thread.
nss tech note5
you can find a list of cipher mechanisms in security/nss/lib/softoken/pkcs11.c -
grep for ckf_en_de_.
...you can find a list of digest mechanisms in security/nss/lib/softoken/pkcs11.c -
grep for ckf_digest.
...you can find a list of hmac mechanisms in security/nss/lib/softoken/pkcs11.c -
grep for ckf_sn_vr, and choose the mechanisms that contain hmac in the name ck_mechanism_type hmacmech = ckm_md5_hmac; <big>(for example)</big> choose a slot on which to to do the operation pk11slotinfo* slot = pk11_getbestslot(hmacmech, null); or pk11slotinfo* slot = pk11_getinternalkeyslot(); /* always returns int slot, may not be optimal */ prepare the key if using a r...
...you can find a list of key generation mechanisms in security/nss/lib/softoken/pkcs11.c -
grep for ckf_generate.
sslerr.html
ssl_error_bad_mac_read -12273 "ssl received a record with an incorrect message authentication code." this usually indicates that the client and server have failed to come to a
greement on the set of keys used to encrypt the application data and to check message integrity.
...this usually indicates that the client and server have failed to come to a
greement on the set of keys used to encrypt the application data and to check message integrity.
...the receipt of this alert is an error only if it occurs while a handshake is in pro
gress.
... ssl_error_token_insertion_removal -12205 "pkcs #11 token was inserted or removed while operation was in pro
gress." a cryptographic operation required to complete the handshake failed because the token that was performing it was removed while the handshake was underway.
Index
if str1 is
greater than str2, *result is
greater than 0.
...if the returned value is
greater than the length you specified, the string was truncated.
... 540 spidermonkey 1.8 spidermonkey spidermonkey 1.8 has one known significant re
gression from 1.7.
... 542 spidermonkey 1.8.7 spidermonkey draft in pro
gress - this is a draft, and right now it's mostly just a copy of the 1.8.5 release notes.
Web Replay
the current position within the recording is shown on the timeline with a pro
gress indicator.
... using the middleman provides the following advantages: ipdl communication is
greatly simplified.
... to allow these threads to be snapshotted, the call is instead performed on a separate thread that does not participate in the recording, so that the calling thread may enter the correct idle state even while its pro
gress is blocked on the call completing.
... in general, redirections are needed for any function that is (a) not compiled as part of gecko, and either (b) may behave differently between recording and replaying, or (c) depends on data produced by other redirected functions (for example, corefoundation types like cfarrayref and cfstrin
gref).
mozIStorageStatement
the optional callback routine receives notifications about the pro
gress of the query.
... mozistoragependingstatement executeasync( [optional] mozistoragestatementcallback acallback ); parameters acallback a callback object that will be notified of pro
gress, errors, and query completion.
... mozistorageag
gregatefunction create a new sqlite ag
gregate function.
... mozistoragepro
gresshandler monitor pro
gress during the execution of a statement.
nsIApplicationUpdateService
obsolete since gecko 1.9.1.7pre isdownloading boolean true if a download is in pro
gress, otherwise false.
... methods adddownloadlistener() adds a listener that receives pro
gress and state information about the update that is currently being downloaded.
...void adddownloadlistener( in nsirequestobserver listener ); parameters listener an object implementing nsirequestobserver and optionally nsipro
gresseventsink that will be notified of state and pro
gress information as the update is downloaded.
...removedownloadlistener() removes a listener that is receiving pro
gress and state information about the update that is currently being downloaded.
nsIDocumentLoader
it is also responsible for sending nsiwebpro
gresslistener notifications.
...nents.classes["@mozilla.org/docloaderservice;1"] .createinstance(components.interfaces.nsidocumentloader); method overview void clearparentdocloader(); obsolete since gecko 1.8 void createdocumentloader(out nsidocumentloader aninstance); obsolete since gecko 1.8 void destroy(); obsolete since gecko 1.8 void fireonlocationchange(in nsiwebpro
gress awebpro
gress, in nsirequest arequest, in nsiuri auri); obsolete since gecko 1.8 void fireonstatuschange(in nsiwebpro
gress awebpro
gress, in nsirequest arequest, in nsresult astatus, in wstring amessage); obsolete since gecko 1.8 void getcontentviewercontainer(in nsisupports adocumentid, out nsicontentviewercontainer aresult); native code only!
... fireonlocationchange() obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) void fireonlocationchange( in nsiwebpro
gress awebpro
gress, in nsirequest arequest, in nsiuri auri ); parameters awebpro
gress arequest auri fireonstatuschange() obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) void fireonstatuschange( in nsiwebpro
gress awebpro
gress, in nsirequest arequest, in nsresult astatus, in wstring amessage ); parameters ...
... awebpro
gress arequest astatus amessage native code only!getcontentviewercontainer obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0)this feature is obsolete.
nsIHttpChannel
exceptions thrown ns_error_in_pro
gress if set after the channel has been opened.
... exceptions thrown ns_error_in_pro
gress if set after the channel has been opened.
... exceptions thrown ns_error_in_pro
gress if called after the channel has been opened.
... exceptions thrown ns_error_in_pro
gress if called after the channel has been opened.
nsIURI
ts.interfaces.nsiioservice); return ioservice.newuri(aurl, aorigincharset, abaseuri); } components of a uri prepath path scheme userpass host port ref ftp :// username@password @ hostname : portnumber /pathname?query=value #ref method overview nsiuri clone(); nsiuri cloneignorin
gref(); boolean equals(in nsiuri other); boolean equalsexceptref(in nsiuri other); autf8string resolve(in autf8string relativepath); boolean schemeis(in string scheme); attributes attribute type description asciihost acstring the uri host with an ascii compatible encoding.
... specignorin
gref autf8string returns a string representation of the uri without the ref (part after the #) portion.
... cloneignorin
gref() clones the current uri, clearing the 'ref' attribute in the clone.
... nsiuri cloneignorin
gref(); parameters none.
nsIUpdateCheckListener
toolkit/mozapps/update/nsiupdateservice.idlscriptable an interface describing an object that listens to the pro
gress of an update check operation.
... 1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) method overview void oncheckcomplete(in nsixmlhttprequest request, [array, size_is(updatecount)] in nsiupdate updates, in unsigned long updatecount); void onerror(in nsixmlhttprequest request, in nsiupdate update); void onpro
gress(in nsixmlhttprequest request, in unsigned long position, in unsigned long totalsize); methods oncheckcomplete() called when the update check is completed.
... onpro
gress() called every time there is a pro
gress notification loading the update service file.
... void onpro
gress( in nsixmlhttprequest request, in unsigned long position, in unsigned long totalsize ); parameters request the nsixmlhttprequest object handling the update check.
Storage
opening a connection javascript example of opening my_db_file_name.sqlite in the profile directory: components.utils.import("resource://
gre/modules/services.jsm"); components.utils.import("resource://
gre/modules/fileutils.jsm"); let file = fileutils.getfile("profd", ["my_db_file_name.sqlite"]); let dbconn = services.storage.opendatabase(file); // will also create the file if it does not exist likewise, the c++ would look like this: nscomptr<nsifile> dbfile; rv = ns_getspecialdirectory(ns_app_user_profile_50_dir, ...
...if a transaction is already in pro
gress, no transaction is obtained.
... mozistorageag
gregatefunction create a new sqlite ag
gregate function.
... mozistoragepro
gresshandler monitor pro
gress during the execution of a statement.
Color vision simulation - Firefox Developer Tools
"color blindness" is a bit of a misnomer, since most people with these disorders can see colors, but do not see all of the distinctions that people with normal color vision can see; color vision deficiencies affect perception across the color spectrum, not only of specific colors like red or
green.
...the most common forms of color blindness (commonly lumped together as "red-
green color blindness") affect more men than women, because they are due to a mutation in a gene in the x chromosome, which men usually have only one copy of.
... in the simulate menu, you can choose one option at a time from the following list: none — choose this to return to normal display protanomaly (low red) deuteranomaly (low
green) tritanomaly (low blue) protanopia (no red) deuteranopia (no
green) tritanopia (no blue) contrast loss these simulations are not completely medically accurate.
... simulation image displayed none protanomaly (low red) deuteranomaly (low
green) tritanomaly (low blue) protanopia (no red) deuteranopia (no
green) tritanopia (no blue) contrast loss ...
DeviceOrientationEvent - Web APIs
deviceorientationevent.alpha read only a number representing the motion of the device around the z axis, express in de
grees with values ranging from 0 to 360.
... deviceorientationevent.beta read only a number representing the motion of the device around the x axis, express in de
grees with values ranging from -180 to 180.
... deviceorientationevent.gamma read only a number representing the motion of the device around the y axis, express in de
grees with values ranging from -90 to 90.
... deviceorientationevent.webkitcompassheading read only a number represents the difference between the motion of the device around the z axis of the world system and the direction of the north, express in de
grees with values ranging from 0 to 360.
EffectTiming.iterationStart - Web APIs
web animations api's effecttiming dictionary's iterationstart property specifies the repetition number which repetition the animation begins at and its pro
gress through it.
...the value of iterationstart corresponds directly to animationeffecttimin
greadonly.iterationstart in timing objects returned by animationeffectreadonly, keyframeeffectreadonly, and keyframeeffect.
...iterationstart represents the iteration index at which the animation effect begins as well as its pro
gress through that iteration.
... it's currently undefined what happens if you specify a value of iterationstart which is
greater than the value of animationeffecttimingproperties.iterations.
FileHandle API - Web APIs
var mysnapshot = null; var request = myfilehandle.getfile(); request.onsuccess = function () { mysnapshot = this.result; } managing pro
gress all the methods from the lockedfile interface return a filerequest object.
... such an object is basically a domrequest with an extra power: it allows to monitor the pro
gress of an operation.
...such monitoring can be done using the filerequest.onpro
gress event handler.
... var pro
gress = document.queryselector('pro
gress'); var myfile = myfilehandle.open('readonly'); // let's read a 1gb file var action = myfile.readasarraybuffer(1000000000); action.onpro
gress = function (event) { if (pro
gress) { pro
gress.value = event.loaded; pro
gress.max = event.total; } } action.onsuccess = function () { console.log('yeah \o/ just read a 1gb file'); } action.onerror = function () { console.log('oups :( unable to read a 1gb file') } file storage when a file handle is created, the associated file only exists as a "temporary file" as long as you hold the filehandle instance.
GeolocationCoordinates.longitude - Web APIs
the geolocationcoordinates interface's read-only longitude property is a double-precision floating point value which represents the longitude of a geographical position, specified in decimal de
grees.
... syntax let longitude = geolocationcoordinatesinstance.longitude value the value in longitude is the geographical longitude of the location on earth described by the coordinates object, in decimal de
grees.
... note: the zero meridian (also known as the prime meridian or the reference meridian) is not precisely the same as the
greenwhich meridian that most people think of.
... it is, instead, the iers reference meridian, which is located 5.3 arcseconds (102 meters / 335 feet) east of the
greenwich meridian.
GeolocationCoordinates - Web APIs
geolocationcoordinates.latitude read only secure context returns a double representing the position's latitude in decimal de
grees.
... geolocationcoordinates.longitude read only secure context returns a double representing the position's longitude in decimal de
grees.
...this value, specified in de
grees, indicates how far off from heading true north the device is.
... 0 de
grees represents true north, and the direction is determined clockwise (which means that east is 90 de
grees and west is 270 de
grees).
Node - Web APIs
node.nextsiblin
gread only returns a node representing the next node in the tree, or null if there isn't such node.
... node.previoussiblin
gread only returns a node representing the previous node in the tree, or null if there isn't such node.
... we use a wrapper function named
grep to do the searching: function
grep(parentnode, pattern) { const matches = [] let endscan = false eachnode(parentnode, function(node){ if (endscan) { return false } // ignore anything which isn't a text node if (node.nodetype !== node.text_node) { return } if (typeof pattern === "string") { if (-1 !== node.textcontent.indexof(pattern)) { matches.push...
...if (pattern.test(node.textcontent)) { if (!pattern.global) { endscan = true matches = node } else { matches.push(node) } } }) return matches } for example, to find text nodes that contain typos: const typos = ["teh", "adn", "btu", "adress", "youre", "msitakes"] const pattern = new regexp("\\b(" + typos.join("|") + ")\\b", "gi") const mistakes =
grep(document.body, pattern) console.log(mistakes) specifications specification status comment domthe definition of 'node' in that specification.
PannerNode.coneInnerAngle - Web APIs
the coneinnerangle property of the pannernode interface is a double value describing the angle, in de
grees, of a cone inside of which there will be no volume reduction.
...rotation in the 'horizontal plane') to an orientation vector const yrotationtovector = de
grees => { // convert de
grees to radians and offset the angle so 0 points towards the listener const radians = (de
grees - 90) * (math.pi / 180); // using cosine and sine here ensures the output values are always normalised // i.e.
...ew oscillatornode(context); osc.type = 'sawtooth'; const panner = new pannernode(context); panner.panningmodel = 'hrtf'; next, we set up the cone of our spatialised sound, determining the area in which it can be heard: // this value determines the size of the area in which the sound volume is constant // if coneinnerangle == 30, it means that when the sound is rotated // by at most 15 (30/2) de
grees either direction, the volume won't change panner.coneinnerangle = 30; // this value determines the size of the area in which the sound volume decreases gradually // if coneouterangle == 45 and coneinnerangle == 30, it means that when the sound is rotated // by between 15 (30/2) and 22.5 (45/2) de
grees either direction, // the volume will decrease gradually panner.coneouterangle = 45; // this va...
... // calculate the vector for no rotation // this means the sound will play at full volume const [x1, y1, z1] = yrotationtovector(0); // schedule the no-rotation vector immediately panner.orientationx.setvalueattime(x1, context.currenttime); panner.orientationy.setvalueattime(y1, context.currenttime); panner.orientationz.setvalueattime(z1, context.currenttime); // calculate the vector for -22.4 de
grees // since our coneouterangle is 45, this will just about make the sound audible // if we set it to +/-22.5, the sound volume will be 0, as the threshold is exclusive const [x2, y2, z2] = yrotationtovector(-22.4); panner.orientationx.setvalueattime(x2, context.currenttime + 2); panner.orientationy.setvalueattime(y2, context.currenttime + 2); panner.orientationz.setvalueattime(z2, context.currentt...
PannerNode.coneOuterAngle - Web APIs
the coneouterangle property of the pannernode interface is a double value describing the angle, in de
grees, of a cone outside of which the volume will be reduced by a constant value, defined by the coneoutergain property.
...rotation in the 'horizontal plane') to an orientation vector const yrotationtovector = de
grees => { // convert de
grees to radians and offset the angle so 0 points towards the listener const radians = (de
grees - 90) * (math.pi / 180); // using cosine and sine here ensures the output values are always normalised // i.e.
...ew oscillatornode(context); osc.type = 'sawtooth'; const panner = new pannernode(context); panner.panningmodel = 'hrtf'; next, we set up the cone of our spatialised sound, determining the area in which it can be heard: // this value determines the size of the area in which the sound volume is constant // if coneinnerangle == 30, it means that when the sound is rotated // by at most 15 (30/2) de
grees either direction, the volume won't change panner.coneinnerangle = 30; // this value determines the size of the area in which the sound volume decreases gradually // if coneouterangle == 45 and coneinnerangle == 30, it means that when the sound is rotated // by between 15 (30/2) and 22.5 (45/2) de
grees either direction, // the volume will decrease gradually panner.coneouterangle = 45; // this va...
... // calculate the vector for no rotation // this means the sound will play at full volume const [x1, y1, z1] = yrotationtovector(0); // schedule the no-rotation vector immediately panner.orientationx.setvalueattime(x1, context.currenttime); panner.orientationy.setvalueattime(y1, context.currenttime); panner.orientationz.setvalueattime(z1, context.currenttime); // calculate the vector for -22.4 de
grees // since our coneouterangle is 45, this will just about make the sound audible // if we set it to +/-22.5, the sound volume will be 0, as the threshold is exclusive const [x2, y2, z2] = yrotationtovector(-22.4); panner.orientationx.setvalueattime(x2, context.currenttime + 2); panner.orientationy.setvalueattime(y2, context.currenttime + 2); panner.orientationz.setvalueattime(z2, context.currentt...
SVGAnimatedRect - Web APIs
the svganimatedrect interface is used for attributes of basic sv
grect which can be animated.
... interface overview also implement none methods none properties readonly sv
grect baseval readonly sv
grect animval normative document svg 1.1 (2nd edition) properties name type description baseval sv
grect the base value of the given attribute before applying any animations.
... animval sv
grect a read only sv
grect representing the current animated value of the given attribute.
... if the given attribute is not currently being animated, then the sv
grect will have the same contents as baseval.
SVGTransformList - Web APIs
if the index is
greater than or equal to numberofitems, then the new item is appended to the end of the list.
... a domexception with code index_size_err is raised if the index number is
greater than or equal to numberofitems.
... a domexception with code index_size_err is raised if the index number is
greater than or equal to numberofitems.
... </script> <polygon fill="orange" stroke="black" stroke-width="5" points="100,225 100,115 130,115 70,15 70,15 10,115 40,115 40,225" onclick="transformme(evt)"/> <rect x="200" y="100" width="100" height="100" fill="yellow" stroke="black" stroke-width="5" onclick="transformme(evt)"/> <text x="40" y="250" font-family="verdana" font-size="16" fill="
green" > click on a shape to transform it </text> </svg> live preview: specifications specification status comment scalable vector graphics (svg) 2the definition of 'svgtransformlist' in that specification.
Using Service Workers - Web APIs
service worker syntax is more complex than that of appcache, but the trade off is that you can use javascript to control your appcache-implied behaviors with a fine de
gree of granularity, allowing you to handle this problem and many more.
... the below graphic shows a summary of the available service worker events: promises promises are a
great mechanism for running async operations, with success dependant on one another.
... note: one
great thing about service workers is that if you use feature detection like we’ve shown above, browsers that don’t support service workers can just use your app online in the normal expected fashion.
...with some kind of default fallback page as a response using match(), like this: caches.match('./fallback.html'); you can retrieve a lot of information about each request by calling parameters of the request object returned by the fetchevent: event.request.url event.request.method event.request.headers event.request.body recovering failed requests so caches.match(event.request) is
great when there is a match in the service worker cache, but what about cases when there isn’t a match?
WebGLRenderingContext.getRenderbufferParameter() - Web APIs
possible return values: gl.rgba4: 4 red bits, 4
green bits, 4 blue bits 4 alpha bits.
... gl.rgb565: 5 red bits, 6
green bits, 5 blue bits.
... gl.rgb5_a1: 5 red bits, 5
green bits, 5 blue bits, 1 alpha bit.
... gl.renderbuffer_
green_size: returns a glint that is the resolution size (in bits) for the
green color.
Matrix math for the web - Web APIs
// manually rotating a point about the origin without matrices let point = [10, 2]; // calculate the distance from the origin let distance = math.sqrt(point[0] * point[0] + point[1] * point[1]); // the equivalent of 60 de
grees, in radians let rotationinradians = math.pi / 3; let transformedpoint = [ math.cos(rotationinradians) * distance, math.sin(rotationinradians) * distance ]; it is possible to encode these type of steps into a matrix, and do it for each of the x, y, and z dimensions.
...for instance, to scale something down by 80%, move it down 200 pixels, and then rotate about the origin 90 de
grees would look something like the following in pseudo-code.
... let transformmatrix = mdn.multiplyarrayofmatrices([ rotatearoundzaxis(math.pi * 0.5), // step 3: rotate around 90 de
grees translate(0, 200, 0), // step 2: move down 100 pixels scale(0.8, 0.8, 0.8), // step 1: scale down ]); view on jsfiddle finally, a fun step to show how matrices work is to reverse the steps to bring the matrix back to the original identity matrix.
... let transformmatrix = mdn.multiplyarrayofmatrices([ scale(1.25, 1.25, 1.25), // step 6: scale back up translate(0, -200, 0), // step 5: move back up rotatearoundzaxis(-math.pi * 0.5), // step 4: rotate back rotatearoundzaxis(math.pi * 0.5), // step 3: rotate around 90 de
grees translate(0, 200, 0), // step 2: move down 100 pixels scale(0.8, 0.8, 0.8), // step 1: scale down ]); why matrices are important matrices are important because they comprise a small set of numbers that can describe a wide range of transformations in space.
WebGL model view projection - Web APIs
box.draw({ top : 0.5, // x bottom : -0.5, // x left : -0.5, // y right : 0.5, // y depth : 0, // z color : [1, 0.4, 0.4, 1] // red }); next, draw a
green box up top and behind the red box.
... box.draw({ top : 0.9, // x bottom : 0, // x left : -0.9, // y right : 0.9, // y depth : 0.5, // z color : [0.4, 1, 0.4, 1] //
green }); finally, for demonstration that clipping is actually going on, this box doesn't get drawn because it's entirely outside of clip space.
... box.draw({ top : 0.5, // y bottom : -0.5, // y left : -0.5, // x right : 0.5, // x w : 0.7, // w - enlarge this box depth : 0, // z color : [1, 0.4, 0.4, 1] // red }); now, we draw a
green box up top, but shrink it by setting the w component to 1.1 box.draw({ top : 0.9, // y bottom : 0, // y left : -0.9, // x right : 0.9, // x w : 1.1, // w - shrink this box depth : 0.5, // z color : [0.4, 1, 0.4, 1] //
green }); this last box doesn't get drawn because it's outside of clip spac...
...in reality we want to make sure that z is
greater than 0 for points in view, so we'll modify it slightly by changing the value to ((1.0 + z) * scalefactor).
Rendering and the WebXR frame animation callback - Web APIs
and because of those differences between what is seen by the left eye versus the right eye, the brain is able to infer a
great deal of information about how deep the object is, its size, and more.
... by combining that inferred depth information with other cues such as perspective, shadows, memories of what these relationships mean, and so forth, we can figure out a
great deal about the world around us.
... a basic renderer in this version of the webxr renderering callback, we use a very straightforward approach that works
great for relatively simple projects.
...for instance, if an object is rotating, you might apply the rotation like this: const xdeltarotation = (xrotationde
greespersecond * radians_per_de
gree) * deltatime; const ydeltarotation = (yrotationde
greespersecond * radians_per_de
gree) * deltatime; const zdeltarotation = (zrotationde
greespersecond * radians_per_de
gree) * deltatime; this computes the amount by which the object has rotated around each of the three axes since the last time the frame was drawn.
Starting up and shutting down a WebXR session - Web APIs
be sure to read the readme carefully; the polyfill comes in several versions depending on what de
gree of compatibility with newer javascript features your target browsers include.
...this is
great—if your player's viewpoint starts in the exact center of the world.
... similarly, the specific methodology you use for loading models and other information and setting up your webgl data—textures, vertex buffers, shaders, and so on—will vary a
great deal depending on your needs, what if any frameworks you're using, and the like.
...presumably the renderer uses this value to compute how often to render new frames as the animation loop pro
gresses, thus rendering less frequently the more "blurred" the scene becomes.
color - CSS: Cascading Style Sheets
the color css media feature can be used to test the number of bits per color component (red,
green, blue) of the output device.
... syntax the color feature is specified as an <integer> value that represents the number of bits per color component (red,
green, blue) of the output device.
...for example, if a display uses 5 bits for blue and red and 6 bits for
green, then the device is considered to use 5 bits per color component.
... examples html <p>this text should be black on non-color devices, red on devices with a low number of colors, and
greenish on devices with a high number of colors.</p> css p { color: black; } /* any color device */ @media (color) { p { color: red; } } /* any color device with at least 8 bits per color component */ @media (min-color: 8) { p { color: #24ba13; } } result specifications specification status comment media queries level 4the definition of 'color' in that specification.
Attribute selectors - CSS: Cascading Style Sheets
/* <a> elements with a title attribute */ a[title] { color: purple; } /* <a> elements with an href matching "https://example.org" */ a[href="https://example.org"] { color:
green; } /* <a> elements with an href containing "example" */ a[href*="example"] { font-size: 2em; } /* <a> elements with an href ending ".org" */ a[href$=".org"] { font-style: italic; } /* <a> elements whose class attribute contains the word "logo" */ a[class~="logo"] { padding: 2px; } syntax [attr] represents elements with an attribute name of attr.
...links with "insensitive" anywhere in the url, regardless of capitalization */ a[href*="insensitive" i] { color: cyan; } /* links with "case" anywhere in the url, with matching capitalization */ a[href*="case" s] { color: pink; } /* links that end in ".org" */ a[href$=".org"] { color: red; } /* links that start with "https" and end in ".org" */ a[href^="https"][href$=".org"] { color:
green; } html <ul> <li><a href="#internal">internal link</a></li> <li><a href="http://example.com">example link</a></li> <li><a href="#insensitive">insensitive internal link</a></li> <li><a href="http://example.org">example org link</a></li> <li><a href="https://example.org">example https org link</a></li> </ul> result languages css /* all divs with a `lang` attribute are bold.
...*/ div[lang~="en-us"] { color: blue; } /* all divs in portuguese are
green.
... */ div[lang="pt"] { color:
green; } /* all divs in chinese are red, whether simplified (zh-cn) or traditional (zh-tw).
Using feature queries - CSS: Cascading Style Sheets
in this guide you will learn how to implement pro
gressive enhancement using feature queries.
... how to use feature queries for pro
gressive enhancement feature queries are an incredibly useful tool when pro
gressively enhancing a site.
...in practice however, when using feature queries for pro
gressive enhancement, this doesn't matter.
... see also the @supports rule learn layout: supporting older browsers css grid layout and pro
gressive enhancement using feature queries in css ...
CSS grids, logical values, and writing modes - CSS: Cascading Style Sheets
rid; grid-gap: 20px; grid-template-columns: 1fr auto; font: 1em helvetica, arial, sans-serif; } .wrapper nav { writing-mode: vertical-lr; } .wrapper ul { list-style: none; margin: 0; padding: 1em; display: flex; justify-content: space-between; } .wrapper a { text-decoration: none; } <div class="wrapper"> <div class="content"> <p>turnip
greens yarrow ricebean rutabaga endive cauliflower sea lettuce kohlrabi amaranth water spinach avocado daikon napa cabbage asparagus winter purslane kale.
...lotus root water spinach fennel kombu maize bamboo shoot
green bean swiss chard seakale pumpkin onion chickpea gram corn pea.
...corn amaranth salsify bunya nuts nori azuki bean chickweed potato bell pepper artichoke.</p> <p>nori grape silver beet broccoli kombu beet
greens fava bean potato quandong celery.
... bunya nuts black-eyed pea prairie turnip leek lentil turnip
greens parsnip.
CSS Scrollbars - CSS: Cascading Style Sheets
basic example in this example we have chosen to use a thin scrollbar, with a
green track and purple thumb.
... .scroller { width: 300px; height: 100px; overflow-y: scroll; scrollbar-color: rebeccapurple
green; 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.
... gumbo beet
greens corn soko endive gumbo gourd.
... parsley shallot courgette tatsoi pea sprouts fava bean collard
greens dandelion okra wakame tomato.
clamp() - CSS: Cascading Style Sheets
the maximum value is the largest (most positive) expression value to which the value of the property will be assigned if the preferred value is
greater than this upper bound.
...this means that the font-size will be set at 1.2rem, unless the computed value of 1.2vw is
greater than that of 1.2rem, in which case it will be set to that value instead.
...this means that the font-size will be set at 1.8rem, until the computed value of 2.5vw becomes
greater than that of 1.8rem.
... at this point, font-size will be set at 2.5vw, until 2.5vw's computed value becomes
greater than that of 2.8rem.
cursor - CSS: Cascading Style Sheets
for example, this specifies two images using <url> values, providing <x><y> coordinates for the second one, and falling back to the pro
gress keyword value if neither image can be loaded: cursor: url(one.svg), url(two.svg) 5 5, pro
gress; values <url> a url(…) or a comma separated list url(…), url(…), …, pointing to an image file.
... pro
gress the program is busy in the background, but the user can still interact with the interface (in contrast to wait).
... wait the program is busy, and the user can't interact with the interface (in contrast to pro
gress).
..., ]* [ auto | default | none | context-menu | help | pointer | pro
gress | wait | cell | crosshair | text | vertical-text | alias | copy | move | no-drop | not-allowed | e-resize | n-resize | ne-resize | nw-resize | s-resize | se-resize | sw-resize | w-resize | ew-resize | ns-resize | nesw-resize | nwse-resize | col-resize | row-resize | all-scroll | zoom-in | zoom-out | grab | grabbing ] ] examples setting cursor types .foo { cursor: crosshair; } .bar { cur...
font-style - CSS: Cascading Style Sheets
valid values are de
gree values of -90deg to 90deg inclusive.
... if an angle is not specified, an angle of 14 de
grees is used.
... in general, for a requested angle of 14 de
grees or
greater, larger angles are prefered; otherwise, smaller angles are preferred (see the spec's font matching section for the precise algorithm).
... variable fonts variable fonts can offer a fine control over the de
gree to which an oblique face is slanted.
font-variant - CSS: Cascading Style Sheets
to change preferences in firefox, visit about:config.opera android full support 41safari ios full support 9.3samsung internet android full support 6.0
greek accented characterschrome no support nonotes no support nonotes notes some operating systems may correctly omit accents in all-uppercase
greek text.edge no support nonotes no support nonotes notes some operating sys...
...tems may correctly omit accents in all-uppercase
greek text.firefox no support nonotes no support nonotes notes some operating systems may correctly omit accents in all-uppercase
greek text.ie no support noopera no support nonotes no support nonotes notes some operating systems may correctly omit accents in all-uppercase
greek text.safari no support nowebview android no support nonotes no support nonotes notes some operating systems may...
... correctly omit accents in all-uppercase
greek.chrome android no support nonotes no support nonotes notes some operating systems may correctly omit accents in all-uppercase
greek text.firefox android no support nonotes no support nonotes notes some operating systems may correctly omit accents in all-uppercase
greek text.opera android no support nonotes no support nonotes notes some operating systems may correctly omit accents in all-uppercase
greek text.safari ios no support nosam...
...sung internet android no support nonotes no support nonotes notes some operating systems may correctly omit accents in all-uppercase
greek.i → İ and ı → ichrome full support 31edge full support 12firefox full support 14ie full support 4opera full support 18safari full support 8webview android full support ≤37chrome android full support 31fire...
font-weight - CSS: Cascading Style Sheets
if no match is found, look for available weights
greater than 500, in ascending order.
...if no match is found, look for available weights
greater than the target, in ascending order.
... if a weight
greater than 500 is given, look for available weights
greater than the target, in ascending order.
...however some fonts, called variable fonts, can support a range of weights with a more or less fine granularity, and this can give the designer a much closer de
gree of control over the chosen weight.
page-break-after - CSS: Cascading Style Sheets
recto if pages pro
gress left-to-right, then this acts like right.
... if pages pro
gress right-to-left, then this acts like left.
... verso if pages pro
gress left-to-right, then this acts like left.
... if pages pro
gress right-to-left, then this acts like right.
page-break-before - CSS: Cascading Style Sheets
recto if pages pro
gress left-to-right, then this acts like right.
... if pages pro
gress right-to-left, then this acts like left.
... verso if pages pro
gress left-to-right, then this acts like left.
... if pages pro
gress right-to-left, then this acts like right.
scrollbar-color - CSS: Cascading Style Sheets
syntax /* keyword values */ scrollbar-color: auto; scrollbar-color: dark; scrollbar-color: light; /* <color> values */ scrollbar-color: rebeccapurple
green; /* two valid colors.
...)where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> examples coloring overflow scrollbars css .scroller { width: 300px; height: 100px; overflow-y: scroll; scrollbar-color: rebeccapurple
green; } html <div class="scroller">veggies es bonus vobis, proinde vos postulo essum magis kohlrabi welsh onion daikon amaranth tatsoi tomatillo melon azuki bean garlic.
... gumbo beet
greens corn soko endive gumbo gourd.
... parsley shallot courgette tatsoi pea sprouts fava bean collard
greens dandelion okra wakame tomato.
text-transform - CSS: Cascading Style Sheets
in
greek (el), vowels lose their accent when the whole word is in uppercase (ά/Α), except for the disjunctive eta (ή/Ή).
... in
greek (el), the lowercase sigma character has two forms: σ and ς.
... uppercase (
greek vowels) <p>initial string <strong>Θα πάμε στο "Θεϊκό φαΐ" ή στη "Νεράιδα"</strong> </p> <p>text-transform: uppercase <strong><span>Θα πάμε στο "Θεϊκό φαΐ" ή στη "Νεράιδα"</span></strong> </p> span { text-transform: uppercase; } strong { float: right; } this demonstrates how
greek vowels except disjunctive eta should have no accent...
... lowercase (
greek Σ) <p>initial string <strong>Σ is a
greek letter that appears several times in ΟΔΥΣΣΕΥΣ.</strong> </p> <p>text-transform: lowercase <strong><span>Σ is a
greek letter that appears several times in ΟΔΥΣΣΕΥΣ.</span></strong> </p> span { text-transform: lowercase; } strong { float: right; } this demonstrates how the
greek character sigma (Σ) is transformed into the regu...
Audio and video manipulation - Developer guides
for example, let's process a video to display it in
greyscale.
... in this case, we'll show both the source video and the output
greyscale frames.
... ordinarily, if you were implementing a "play video in
greyscale" feature, you'd probably add display: none to the style for the <video> element, to keep the source video from being drawn to the screen while showing only the canvas showing the altered frames.
...tener("play", function() { self.width = self.video.width; self.height = self.video.height; self.timercallback(); }, false); }, computeframe: function() { this.ctx1.drawimage(this.video, 0, 0, this.width, this.height); var frame = this.ctx1.getimagedata(0, 0, this.width, this.height); var l = frame.data.length / 4; for (var i = 0; i < l; i++) { var
grey = (frame.data[i * 4 + 0] + frame.data[i * 4 + 1] + frame.data[i * 4 + 2]) / 3; frame.data[i * 4 + 0] =
grey; frame.data[i * 4 + 1] =
grey; frame.data[i * 4 + 2] =
grey; } this.ctx1.putimagedata(frame, 0, 0); return; } }; once the page has loaded you can call processor.doload() result this is a pretty simple example showing how to manipulate video frames ...
Challenge solutions - Developer guides
solution css supports common color names like orange, yellow, blue,
green, or black.
...the resulting file looks like this: p {color: blue; } strong {color: orange; text-decoration: underline;} later sections of this tutorial describe style rules and declarations in
greater detail.
... solution the following values are reasonable approximations of the named colors: strong { color: #f00; /* red */ background-color: #ddf; /* pale blue */ font: 200% serif; } .carrot { color: #fa0; /* orange */ } .spinach { color: #080; /* dark
green */ } p { color: #00f; /* blue */ } content add an image challenge add a one rule to your stylesheet so that it displays the image at the start of each line.
... solution the following rule achieves the desired result: #fixed-pin { position:fixed; top: 3px; right: 3px; } tables borders on data cells only challenge change the stylesheet to make the table have a
green border around only the data cells.
Content categories - Developer guides
, <canvas>, <cite>, <code>, <command>, <data>, <datalist>, <del>, <details>, <dfn>, <div>, <dl>, <em>, <embed>, <fieldset>, <figure>, <footer>, <form>, <h1>, <h2>, <h3>, <h4>, <h5>, <h6>, <header>, <hgroup>, <hr>, <i>, <iframe>, <img>, <input>, <ins>, <kbd>, <keygen>, <label>, <main>, <map>, <mark>, <math>, <menu>, <meter>, <nav>, <noscript>, <object>, <ol>, <output>, <p>, <picture>, <pre>, <pro
gress>, <q>, <ruby>, <s>, <samp>, <script>, <section>, <select>, <small>, <span>, <strong>, <sub>, <sup>, <svg>, <table>, <template>, <textarea>, <time>, <ul>, <var>, <video>, <wbr> and text.
... elements belonging to this category are <abbr>, <audio>, <b>, <bdo>, <br>, <button>, <canvas>, <cite>, <code>, <command>, <data>, <datalist>, <dfn>, <em>, <embed>, <i>, <iframe>, <img>, <input>, <kbd>, <keygen>, <label>, <mark>, <math>, <meter>, <noscript>, <object>, <output>, <picture>, <pro
gress>, <q>, <ruby>, <samp>, <script>, <select>, <small>, <span>, <strong>, <sub>, <sup>, <svg>, <textarea>, <time>, <var>, <video>, <wbr> and plain text (not only consisting of white spaces characters).
... <button> <fieldset> <input> <keygen> <label> <meter> <object> <output> <pro
gress> <select> <textarea> this category contains several sub-categories: listed elements that are listed in the form.elements and fieldset.elements idl collections.
...contains <button>, <input>, <keygen>, <meter>, <output>, <pro
gress>, <select>, and <textarea>.
HTML5 - Developer guides
performance and integration: providing
greater speed optimization and better usage of computer hardware.
... new semantic elements beside sections, media and forms elements, there are numerous new elements, like <mark>, <figure>, <figcaption>, <data>, <time>, <output>, <pro
gress>, or <meter> and <main>, increasing the number of valid html5 elements.
...this leads to far
greater predictability and interoperability between html5-compliant browsers.
... jit-compiling javascript engines the new generation of javascript engines is much more powerful, leading to
greater performance.
HTML attribute reference - HTML: Hypertext Markup Language
crossorigin <audio>, <img>, <link>, <script>, <video> how the element handles cross-origin requests csp <iframe> specifies the content security policy that an embedded document must a
gree to enforce upon itself.
... form <button>, <fieldset>, <input>, <keygen>, <label>, <meter>, <object>, <output>, <pro
gress>, <select>, <textarea> indicates the form that is the owner of the element.
... max <input>, <meter>, <pro
gress> indicates the maximum value allowed.
... usemap <img>, <input>, <object> value <button>, <data>, <input>, <li>, <meter>, <option>, <pro
gress>, <param> defines a default value which will be displayed in the element on page load.
Date and time formats used in HTML - HTML: Hypertext Markup Language
year numbers in order to simplify the basic format used for date strings in html, the specification requires that all years be given using the modern (or proleptic)
gregorian calendar.
... while user interfaces may allow entry of dates using other calendars, the underlying value always uses the
gregorian calendar.
... while the
gregorian calendar wasn't created until the year 1582 (replacing the similar julian calendar), for html's purposes, the
gregorian calendar is extended back to the year 1 c.e.
...there are two standard time bases, which are very close to the same, but not exactly the same: for dates after the establishment of coordinated universal time (utc) in the early 1960s, the time base is z and the offset indicates a particular time zone's offset from the time at the prime meridian at 0º longitude (which passes through the royal observatory at
greenwich, england).
<strong>: The Strong Importance element - HTML: Hypertext Markup Language
usage notes the <strong> element is for content that is of "strong importance," including things of
great seriousness or urgency (such as warnings).
... this could be a sentence that is of
great importance to the whole page, or you could merely try to point out that some words are of
greater importance compared to nearby content.
...the <strong> element is for content that is of
greater importance, while the <b> element is used to draw attention to text without indicating that it's more important.
...this is very dangerous.") both <strong> and <em> can be nested to increase the relative de
gree of importance or stress emphasis, respectively.
HTML elements reference - HTML: Hypertext Markup Language
the <em> element can be nested, with each level of nesting indicating a
greater de
gree of emphasis.
...there's a
great deal of further information about this available in the html forms guide.
... <pro
gress> the html <pro
gress> element displays an indicator showing the completion pro
gress of a task, typically displayed as a pro
gress bar.
...the html 2 standard recommended that lines shouldn't be broken when not
greater than 132 characters.
Microdata - HTML: Hypertext Markup Language
search engines benefit
greatly from direct access to this structured data because it allows search engines to understand the information on web pages and provide more relevant results to users.
... commonly used vocabularies: creative works: creativework, book, movie, musicrecording, recipe, tvseries embedded non-text objects: audioobject, imageobject, videoobject event health and medical types: notes on the health and medical types under medicalentity organization person place, localbusiness, restaurant product, offer, ag
gregateoffer review, ag
gregaterating action thing intangible major search engine operators like google, microsoft, and yahoo!
... example html <div itemscope itemtype="http://schema.org/softwareapplication"> <span itemprop="name">angry birds</span> - requires <span itemprop="operatingsystem">android</span><br> <link itemprop="applicationcategory" href="http://schema.org/gameapplication"/> <div itemprop="ag
gregaterating" itemscope itemtype="http://schema.org/ag
gregaterating"> rating: <span itemprop="ratingvalue">4.6</span> ( <span itemprop="ratingcount">8864</span> ratings ) </div> <div itemprop="offers" itemscope itemtype="http://schema.org/offer"> price: $<span itemprop="price">1.00</span> <meta itemprop="pricecurrency" content="usd" /> </div> </div> structured data ...
... itemscope itemtype softwareapplication (http://schema.org/softwareapplication) itemprop name angry birds itemprop operatingsystem android itemprop applicationcategory gameapplication (http://schema.org/gameapplication) itemscope itemprop[itemtype] ag
gregaterating [ag
gregaterating] itemprop ratingvalue 4.6 itemprop ratingcount 8864 itemscope itemprop[itemtype] offers [offer] itemprop price 1.00 itemprop pricecurrency usd result note: a handy tool for extracting microdata structures from html is google's structured data testing tool.
Evolution of HTTP - HTTP
http/1.1 – the standardized protocol in parallel to the somewhat chaotic use of the diverse implementations of http/1.0, and since 1995, well before the publication of http/1.0 document the next year, proper standardization was in pro
gress.
... content negotiation, including language, encoding, or type, has been introduced, and allows a client and a server to a
gree on the most adequate content to exchange.
... since 2005, the set of apis available to web pages
greatly increased and several of these apis created extensions, mostly new specific http headers, to the http protocol for specific purposes: server-sent events, where the server can push occasional messages to the browser.
... http/2 – a protocol for
greater performance over the years, web pages have become much more complex, even becoming applications in their own right.
Browser detection using the user agent - HTTP
there are ways to develop your website to pro
gressively enhance itself based on the availability of features rather than by targeting specific browsers.
...also, rethink your design: can you use pro
gressive enhancement or fluid layouts to help remove the need to do this?
... pro
gressive enhancement this design technique involves developing your web site in 'layers', using a bottom-up approach, starting with a simpler layer and improving the capabilities of the site in successive layers, each using more features.
...this can be harder to do, and less effective, than pro
gressive enhancement, but may be useful in some cases.
JavaScript modules - JavaScript
} which we then export: export { square }; over in main.js, we import it like this: import { square } from './modules/square.js'; and then use the class to draw our square: let square1 = new square(mycanvas.ctx, mycanvas.listid, 50, 50, 100, 'blue'); square1.draw(); square1.reportarea(); square1.reportperimeter(); ag
gregating modules there will be times where you'll want to ag
gregate modules together.
...this is possible using export syntax of the following forms in the parent module: export * from 'x.js' export { name } from 'x.js' for an example, see our module-ag
gregation directory.
... in this example (based on our earlier classes example) we've got an extra module called shapes.js, which ag
gregates all the functionality from circle.js, square.js, and triangle.js together.
... export { square }; next up comes the ag
gregation part.
Numbers and dates - JavaScript
76931348623157e+308) number.min_value the smallest representable number (±5e-324) number.nan special "not a number" value number.negative_infinity special negative infinite value; returned on overflow number.positive_infinity special positive infinite value; returned on overflow number.epsilon difference between 1 and the smallest value
greater than 1 that can be represented as a number (2.220446049250313e-16) number.min_safe_integer minimum safe integer in javascript (−253 + 1, or −9007199254740991) number.max_safe_integer maximum safe integer in javascript (+253 − 1, or +9007199254740991) methods of number method description number.parsefloat() parses a string argum...
... floor(), ceil() returns the largest/smallest integer less/
greater than or equal to an argument.
...the first statement creates a variable temp, assigning it a value using a conditional expression; if hour is
greater than 12, (hour - 12), otherwise simply hour, unless hour is 0, in which case it becomes 12.
... finally, a conditional expression appends "p.m." to temp if hour is 12 or
greater; otherwise, it appends "a.m." to temp.
Assertions - JavaScript
buggymultiline = `tey, ihe light-
greon apple tangs on ihe
greon traa`; // 1) use ^ to fix the matching at the begining of the string, and right after newline.
...fixedmultiline = buggymultiline.replace(/\bo/gim,'e'); console.log(4, fixedmultiline); // fix '
greon' but does not touch 'on'.
... let fruitsstartswithnota = fruits.filter(fruit => /^[^a]/.test(fruit)); console.log(fruitsstartswithnota); // [ 'watermelon', 'orange', 'strawberry' ] matching a word boundary let fruitswithdescription = ["red apple", "orange orange", "
green avocado"]; // select descriptions that contains 'en' or 'ed' words endings: let enedselection = fruitswithdescription.filter(descr => /(en|ed)\b/.test(descr)); console.log(enedselection); // [ 'red apple', '
green avocado' ] lookahead assertion // js lookahead assertion x(?=y) let regex = /first(?= test)/g; console.log('first test'.match(regex)); // [ 'first' ] console.log('first peach'.ma...
...an orange)[^?!]+[?!]/gi console.log(orangenotlemon.match(selectnotorangeregex)); // [ ' yes, i do not want to have a lemon!' ] lookbehind assertion let oranges = ['ripe orange a ', '
green orange b', 'ripe orange c',]; let ripe_oranges = oranges.filter( fruit => fruit.match(/(?<=ripe )orange/)); console.log(ripe_oranges); // [ 'ripe orange a ', 'ripe orange c' ] specifications specification ecmascript (ecma-262)the definition of 'regexp: assertions' in that specification.
Date.prototype.setHours() - JavaScript
if a value
greater than 23 is provided, the datetime will be incremented by the extra hours.
...if a value
greater than 59 is provided, the datetime will be incremented by the extra minutes.
...if a value
greater than 59 is provided, the datetime will be incremented by the extra seconds.
...if a value
greater than 999 is provided, the datetime will be incremented by the extra milliseconds.
Intl.DateTimeFormat.prototype.formatToParts() - JavaScript
relatedyear the string used for the related 4-digit
gregorian year, in the event that the calendar's representation would be a yearname instead of a year, for example "2019".
... these years are disambiguated by relationship to corresponding years on the
gregorian calendar.
... when this is the case, the result of formattoparts() will contain an entry for relatedyear when a year would normally be present, containing the 4-digit
gregorian year, instead of an entry for year.
... setting an entry in the bag for year (with any value) will yield both the and the yearname
gregorian relatedyear: let opts = { year: "numeric", month: "numeric", day: "numeric" }; let df = new intl.datetimeformat("zh-u-ca-chinese", opts); df.formattoparts(date.utc(2012, 11, 17, 3, 0, 42)); // return value [ { type: 'relatedyear', value: '2012' }, { type: 'literal', value: '年' }, { type: 'month', value: '十一月' }, { type: 'day', value: '4' } ] if the year option is not set in the bag (to any value), the result will include only the relatedyear: let df = new intl.datetimeformat("zh-u-ca-chinese"); df.formattoparts(date.utc(2012, 11, 17, 3, 0, 42)); // return value [ { type: 'relatedyear', value: '2012' }, { type: 'literal', value: '年' }, { type: 'month', va...
Math - JavaScript
math.ceil(x) returns the smallest integer
greater than or equal to x.
... examples converting between de
grees and radians the trigonometric functions sin(), cos(), tan(), asin(), acos(), atan(), and atan2() expect (and return) angles in radians.
... since humans tend to think in de
grees, and some functions (such as css transforms) can accept de
grees, it is a good idea to keep functions handy that convert between the two: function degtorad(de
grees) { return de
grees * (math.pi / 180); }; function radtodeg(rad) { return rad / (math.pi / 180); }; calculating the height of an equalateral triangle if we want to calculate the height of an equalateral triangle, and we know its side length is 100, we can use the formulae length of the adjacent multiplied by the tangent of the angle is equal to the opposite.
... we use our degtorad() function to convert 60 de
grees to radians, as math.tan() expects an input value in radians.
Promise.any() - JavaScript
if no promises in the iterable fulfil (if all of the given promises are rejected), then the returned promise is rejected with an ag
gregateerror, a new subclass of error that groups together individual errors.
... rejection if all of the passed-in promises reject, promise.any asynchronously rejects with an ag
gregateerror object, which extends error, and contains an errors property with an array of rejection values.
...ve, reject) => { reject("always fails"); }); const pslow = new promise((resolve, reject) => { settimeout(resolve, 500, "done eventually"); }); const pfast = new promise((resolve, reject) => { settimeout(resolve, 100, "done quick"); }); promise.any([perr, pslow, pfast]).then((value) => { console.log(value); // pfast fulfils first }) // expected output: "done quick" rejections with ag
gregateerror promise.any() rejects with an ag
gregateerror if no promise fulfils.
... const perr = new promise((resolve, reject) => { reject('always fails'); }); promise.any([perr]).catch((err) => { console.log(err); }) // expected output: "ag
gregateerror: no promise in promise.any was resolved" displaying the first image loaded in this example, we have a function that fetches an image and returns a blob.
String.prototype.charCodeAt() - JavaScript
if the unicode code point cannot be represented in a single utf-16 code unit (because its value is
greater than 0xffff) then the code unit returned will be the first part of a surrogate pair for the code point.
... syntax str.charcodeat(index) parameters index an integer
greater than or equal to 0 and less than the length of the string.
... because of this, in order to examine (or reproduce) the full character for individual character values of 65536 or
greater, for such characters, it is necessary to retrieve not only charcodeat(i), but also charcodeat(i+1) (as if manipulating a string with two letters), or to use codepointat(i) instead.
... charcodeat() returns nan if the given index is less than 0, or if it is equal to or
greater than the length of the string.
String.prototype.replace() - JavaScript
replacing a fahrenheit de
gree with its celsius equivalent the following example replaces a fahrenheit de
gree with its equivalent celsius de
gree.
... the fahrenheit de
gree should be a number ending with "f".
...the number of fahrenheit de
gree is accessible to the function through its second parameter, p1.
... the function sets the celsius number based on the fahrenheit de
gree passed in a string to the f2c() function.
export - JavaScript
n }; // renaming exports export { variable1 as name1, variable2 as name2, …, namen }; // exporting destructured assignments with renaming export const { name1, name2: bar } = o; // default exports export default expression; export default function (…) { … } // also class, function* export default function name1(…) { … } // also class, function* export { name1 as default, … }; // ag
gregating modules export * from …; // does not set the default export export * as name1 from …; // draft ecmascript® 2o21 export { name1, name2, …, namen } from …; export { import1 as name1, import2 as name2, …, namen } from …; export { default } from …; namen identifier to be exported (so that it can be imported via import in another script).
... name for example: // file test.js let k; export default k = 12; // some other file import m from './test'; // note that we have the freedom to use import m instead of import k, because k was default export console.log(m); // will log 12 you can also rename named exports to avoid naming conflicts: export { myfunction as function1, myvariable as variable }; re-exporting / ag
gregating it is also possible to "import/export" from different modules in a parent module so that they are available to import from that module.
... default function cube(x) { return x * x * x; } then, in another script, it is straightforward to import the default export: import cube from './my-module.js'; console.log(cube(3)); // 27 using export from let's take an example where we have the following hierarchy: childmodule1.js: exporting myfunction and myvariable childmodule2.js: exporting myclass parentmodule.js: acting as an ag
gregator (and doing nothing else) top level module: consuming the exports of parentmodule.js this is what it would look like using code snippets: // in childmodule1.js let myfunction = ...; // assign something useful to myfunction let myvariable = ...; // assign something useful to myvariable export {myfunction, myvariable}; // in childmodule2.js let myclass = ...; // assign something useful to...
... myclass export myclass; // in parentmodule.js // only ag
gregating the exports from childmodule1 and childmodule2 // to re-export them export { myfunction, myvariable } from 'childmodule1.js'; export { myclass } from 'childmodule2.js'; // in top-level module // we can consume the exports from a single module since parentmodule // "collected"/"bundled" them in a single source import { myfunction, myvariable, myclass } from 'parentmodule.js' specifications specification ecmascript (ecma-262)the definition of 'exports' in that specification.
glyph-orientation-horizontal - SVG: Scalable Vector Graphics
when the reference orientation direction is horizontal and the glyph-orientation-horizontal results in an orientation angle that is a multiple of 180 de
grees, then the current text position is incremented according to the horizontal metrics of the glyph.
... otherwise, if the value of this attribute is not a multiple of 180 de
grees, then the current text position is incremented according to the vertical metrics of the glyph.
... as a presentation attribute, it can be applied to any element but it has effect only on the following five elements: <altglyph>, <textpath>, <text>, <tref>, and <tspan> context notes value <angle> default value 0deg animatable no <angle> the value of the angle is restricted to 0, 90, 180, and 270 de
grees.
...a value of 90deg indicates an orientation of 90 de
grees clockwise from the reference orientation.
<feColorMatrix> - SVG: Scalable Vector Graphics
r' = r1*r + r2*g + r3*b + r4*a + r5 g' = g1*r + g2*g + g3*b + g4*a + g5 b' = b1*r + b2*g + b3*b + b4*a + b5 a' = a1*r + a2*g + a3*b + a4*a + a5 take the amount of red in the new pixel, or r': it is the sum of r1 times the old pixel's red r, r2 times the old pixel's
green g, r3 times of the old pixel's blue b, r4 times the old pixel's alpha a, plus a shift r5.
... r' = r1 * r + r2 * g + r3 * b + r4 * a + r5 new red = [ r1 * old red ] + [ r2 * old
green ] + [ r3 * old blue ] + [ r4 * old alpha ] + [ shift of r5 ] if, say, we want to make a completely black image redder, we can make the r5 a positive real number x, boosting the redness on every pixel of the new image by x.
... example svg <svg width="100%" height="100%" viewbox="0 0 150 500" preserveaspectratio="xmidymid meet" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <!-- ref --> <defs> <g id="circles"> <circle cx="30" cy="30" r="20" fill="blue" fill-opacity="0.5" /> <circle cx="20" cy="50" r="20" fill="
green" fill-opacity="0.5" /> <circle cx="40" cy="50" r="20" fill="red" fill-opacity="0.5" /> </g> </defs> <use href="#circles" /> <text x="70" y="50">reference</text> <!-- identity matrix --> <filter id="colormethesame"> <fecolormatrix in="sourcegraphic" type="matrix" values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1...
... 0" /> </filter> <use href="#circles" transform="translate(0 70)" filter="url(#colormethesame)" /> <text x="70" y="120">identity matrix</text> <!-- combine rgb into
green matrix --> <filter id="colorme
green"> <fecolormatrix in="sourcegraphic" type="matrix" values="0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 1 0" /> </filter> <use href="#circles" transform="translate(0 140)" filter="url(#colorme
green)" /> <text x="70" y="190">rgbto
green</text> <!-- saturate --> <filter id="colormesaturate"> <fecolormatrix in="sourcegraphic" type="saturate" values="0.2" /> </filter> <use href="#circles" transform="translate(0 210)" filter="url(#colormesaturate)" /> <text x="70" y="260">saturate</text> ...
SVG fonts - SVG: Scalable Vector Graphics
defining a font there are some in
gredients required for embedding a font in svg.
...again, you can use arbitrary svg to define the glyph, which allows for
great effects in supporting user agents.
...a" u2="v" k="20" /> referencing a font when you have put together your font declaration as described above, you can just use a simple font-family attribute to actually apply the font to some svg text: <font> <font-face font-family="super sans" /> <!-- and so on --> </font> <text font-family="super sans">my text uses super sans</text> however, you are free to combine several methods for
great freedom of how and where to define the font.
... to reference remote (and not so remote) fonts: <font id="super_sans"> <!-- and so on --> </font> <style type="text/css"> @font-face { font-family: "super sans"; src: url(#super_sans); } </style> <text font-family="super sans">my text uses super sans</text> option: reference a remote font the above mentioned font-face-uri element allows you to reference an external font, hence allowing
greater re-usability: <font> <font-face font-family="super sans"> <font-face-src> <font-face-uri xlink:href="fonts.svg#super_sans" /> </font-face-src> </font-face> </font> « previousnext » ...
Communicating With Other Scripts - Archive of obsolete content
type="button" value="send a message"/> <script type="text/javascript" src="page-script.js"></script> </body> </html> the content script "content-script.js" adds an event listener to the button, that sends a custom event containing a message: var messenger = document.getelementbyid("message"); messenger.addeventlistener("click", sendcustomevent, false); function sendcustomevent() { var
greeting = {"
greeting" : "hello world"}; var event = document.createevent('customevent'); event.initcustomevent("addon-message", true, true,
greeting); document.documentelement.dispatchevent(event); } finally, the page script "page-script.js" listens for the message and logs the
greeting to the web console: window.addeventlistener("addon-message", function(event) { console.log(event.detail.
...
greeting); }, false); after firefox 30: clone the message object this technique depends on being able to share the message payload between the content script scope and the page script scope.
... from firefox 30 this sharing requires an extra step: the content script needs to explicitly clone the message payload into the page script's scope using the global cloneinto() function: var messenger = document.getelementbyid("message"); messenger.addeventlistener("click", sendcustomevent, false); function sendcustomevent() { var
greeting = {"
greeting" : "hello world"}; var cloned = cloneinto(
greeting, document.defaultview); var event = document.createevent('customevent'); event.initcustomevent("addon-message", true, true, cloned); document.documentelement.dispatchevent(event); } messaging from page script to content script sending messages using custom dom events from the page script to the content script is just the same, but in reverse.
simple-storage - Archive of obsolete content
accessing storage from the console in the add-on debugger, you can access your add-on's simple-storage programmatically from the console using the following: loader.modules['resource://
gre/modules/commonjs/sdk/simple-storage.js'].exports.storage clarification from mozilla needed: writing the above line in add-on debugger console results in "referenceerror: loader is not defined".
...if your add-on is using more than its quota, this value is
greater than 1.0.
...a value
greater than 1 indicates that the storage exceeds quota.
Creating Event Targets - Archive of obsolete content
then open "index.js" and add the following 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).spec); }, onitemvisited: function(aitemid, avisitid, time) { console.log("visited ...
... create a new file in "lib" called "bookmarks.js", and add the following code: var { emit, on, once, off } = require("sdk/event/core"); var {cc, ci} = require("chrome"); var { xpcomutils }= require("resource://
gre/modules/xpcomutils.jsm"); var bookmarkservice = cc["@mozilla.org/browser/nav-bookmarks-service;1"] .getservice(ci.nsinavbookmarksservice); var bookmarkobserver = { onitemadded: function(aitemid, afolder, aindex) { emit(exports, "added", bookmarkservice.getbookmarkuri(aitemid).spec); }, onitemvisited: function(aitemid, avisitid, time) { emit(exports, "visit...
... open "bookmarks.js" and replace its contents with this code: var { emit } = require("sdk/event/core"); var { eventtarget } = require("sdk/event/target"); var { class } = require("sdk/core/heritage"); var { merge } = require("sdk/util/object"); 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); function createobserver(target) { var bookmarkobserver = { onitemadded: function(aitemid, afolder, aindex) { emit(target, "added", bookmarkservice.getbookmarkuri(aitemid).spec); }, onitemvisited: function(ait...
Miscellaneous - Archive of obsolete content
var osstring = services.appinfo.os; detecting the host application and version // get the name of the application running us services.appinfo.name; // returns "firefox" for firefox services.appinfo.version; // returns "2.0.0.1" for firefox version 2.0.0.1 retrieving the version of an extension as specified in the extension's install.rdf components.utils.import("resource://
gre/modules/addonmanager.jsm"); addonmanager.getaddonbyid("extension-guid@example.org", function(addon) { // this is an asynchronous callback function that might not be called immediately alert("my extension's version is " + addon.version); }); restarting firefox/thunderbird/seamonkey_2.0 for firefox 3 see onwizardfinish around here: http://mxr.mozilla.org/seamonkey/sou...pdates.js#1639 for ...
...put this code in the components/certsservice.js file: const cc = components.classes; const ci = components.interfaces; components.utils.import("resource://
gre/modules/xpcomutils.jsm"); const gobserver = cc['@mozilla.org/observer-service;1'].getservice(ci.nsiobserverservice); const gioservice = cc["@mozilla.org/network/io-service;1"].getservice(ci.nsiioservice); function certsservice() {} certsservice.prototype = { observe: function(asubject, atopic, adata) { switch(atopic) { case "app-startup": gobserver.addob...
... window.addeventlistener('fullscreen', function(){ alert('fullscreen mode on or off') }, false) getting addon install path first one using addon manager: components.utils.import('resource://
gre/modules/addonmanager.jsm'); addonmanager.getaddonbyid('example@addon', function(addon) { let path = addon.getresourceuri().path; // something like /home/username/....
Custom about: URLs - Archive of obsolete content
const {classes: cc, interfaces: ci, manager: cm, results: cr, utils: cu, constructor: cc} = components; cm.queryinterface(ci.nsicomponentregistrar); components.utils.import("resource://
gre/modules/services.jsm"); // globals const aboutpage_description = 'this is my custom about page'; const aboutpage_id = 'aa132730-2278-11e5-867f-0800200c9a66'; // make sure you generate a unique id from https://www.famkruithof.net/uuid/uuidgen const aboutpage_word = 'myaboutpage' const aboutpage_uri = 'data:text/html,hi this is the page that is shown when navigate to about:myaboutpage'; // const a...
...queryinterface() { return xpcomutils.generateqi([ci.nsiaboutmodule]); } constructor() { object.freeze(this); } geturiflags(auri) { return ci.nsiaboutmodule.allow_script; } newchannel(auri, asecurity_or_aloadinfo) { let channel; if (services.vc.compare(services.appinfo.version, '47.*') > 0) { const uri = services.io.newuri(aboutpage_uri, null, null); //
greater than or equal to firefox48 so asecurity_or_aloadinfo is aloadinfo channel = services.io.newchannelfromuriwithloadinfo(uri, asecurity_or_aloadinfo); } else { channel = services.io.newchannel(aboutpage_uri, null, null); } channel.originaluri = auri; return channel; } } class factory { constructor(component) { this.component = component; this.register...
...(); object.freeze(this); } createinstance(outer, iid) { if (outer) { throw cr.ns_error_no_ag
gregation; } return new this.component(); } register() { cm.registerfactory(this.component.classid, this.component.classdescription, this.component.contractid, this); } unregister() { cm.unregisterfactory(this.component.prototype.classid, this); } } instantiation firefox 4+ now in the startup procedure of your bootstrapped addon make sure to do register the factory, for example: let factory; function startup(adata, areason) { // ...
Enhanced Extension Installation - Archive of obsolete content
in the profile directory, the file compatibility.ini stores information about the version of the application (build info) that last started this profile - during startup this file is checked and if the version info held by the running app disa
grees with the info held by this file, a compatibility check is run on all installed items.
... the install operation finalization process loops continuously installing, upgrading and uninstalling items at pro
gressively lower locations until the size of the pending operations list is finally zero.
...this allows for the removal of the installlo
greader/writer objects in the extension manager.
Appendix: What you should know about open-source software licenses - Archive of obsolete content
when the user clicks “i a
gree,” the installation process finishes.
... because the oss license is intended to foster source-code reuse and mutual development, it avoids restrictions on source-code duplication, distribution, and modification to the
greatest extent possible.
... gpl license declaration template if you develop a new program, and you want it to be of the
greatest possible use to the public, the best way to achieve this is to make it free software that everyone can redistribute and change under these terms.
Chapter 3: Introduction to XUL—How to build a more intuitive UI - Archive of obsolete content
they can both take the values start (top or left), center, end (bottom or right), or stretch (extend this element to match the element with the
greatest height or width).
...listing 21 shows an example of a thermometer-style pro
gress bar, with its output shown in figure 17.
... <stack> <pro
gressmeter mode="normal" value="50"/> <hbox align="center"> <label value="in pro
gress…"/> </hbox> </stack> listing 21: overlapping with stack figure 17: pro
gress bar tab use the tab element to divide multiple pages, as used in the properties dialog; use the tabbox element to group related elements.
Security best practices in extensions - Archive of obsolete content
non-chrome urls in chrome xul or html such as the following example are not allowed: <script type="text/javascript" src="http://mysite.
greatsite.com/js/wow-content.js" /> in general, scripts that are from remote sources that run in the chrome context are not acceptable, as many times the source of the script can never be 100% guaranteed, and they are vulnerable to man-in-the-middle attacks.
...the usefulness of it and power of how it works is best illustrated by the popular
greasemonkey extension, which works on the premise of scripts being downloaded and stored locally, to be injected into the web content context via the sandbox.
... many extensions use the
greasemonkey compiler to bundle it in their extension for convenience.
Search Extension Tutorial (Draft) - Archive of obsolete content
cu.import("resource://
gre/modules/services.jsm"); // keep track of whether this is the first run.
...cu.import("resource://
gre/modules/services.jsm"); // the details of the engine to add const engine_details = { name: "example engine", iconurl: "data:image/png;base64,...", alias: "example-engine", description: "an example search engine", method: "get", // the http request method url: "https://www.example.com/?q=_searchterms_" }; // keep track of whether this is the first run.
...cu.import("resource://
gre/modules/services.jsm"); // these must be the same details as in your search.xml file.
CSS3 - Archive of obsolete content
though today no module with a level
greater than 3 is standardized, this will change in the future.
... the next iteration of the selectors specification is already in pro
gress, though it still hasn't reached the first public working draft stage.
... the css4 iteration of the backgrounds and borders specification is already in pro
gress, though it still hasn't reached the first public working draft stage, it plans to add the ability to clip a border (with the css border-clip, border-clip-top, border-clip-right, border-clip-bottom, and border-clip-left properties) or to control the shape of the border in a corner (using the css border-corner-shape property).
MMgc - Archive of obsolete content
furthermore we can run this check even more frequently than every mark increment, for instance every time our gc memory allocators request a new block from our primary allocator (the way our extremely helpful
greedy collection mode works).
...at the finest level of granularity everytime a a white object is written to a black object we push the white object onto the work queue (thus making it
grey).
...the ideal solution will result in only one mark incremental per frame unless the mutator is allocating memory so fast we need to mark more ag
gressively to get to the sweep.
Dehydra Object Reference - Archive of obsolete content
.parameters array of variable objects a function definition's parameter names and types .memberof ag
gregate type object indicates the ag
gregate type(class/struct) in the type system that this variable is a member of.
...applicable when accessing member variables or nonstatic member functions of ag
gregate types, e.g.
... ag
gregate types (class/struct/union/enum) this type object represents ag
gregate types in gcc.
Download Manager improvements in Firefox 3 - Archive of obsolete content
firefox 3 offers improvements to the download manager that allow multiple pro
gress listeners, use of the storage api for data management, download resuming, and more.
... download manager interfaces nsidownloadmanager gives applications and extensions access to the download manager, allowing them to add and remove files to the download list, retrieve information about past and present downloads, and request notifications as to the pro
gress of downloads.
... nsidownloadpro
gresslistener applications and extensions implement this interface to be made aware of changes in the status of downloads.
Monitoring downloads - Archive of obsolete content
this is part of the nsidownloadpro
gresslistener interface.
...setattribute("style", "text-align:right"); row.appendchild(cell); var status = statement.getint32(5); var style = "color:black"; cell = document.createelement('listcell'); var statusstr; switch(status) { case 0: statusstr = "downloading"; break; case 1: statusstr = "complete"; style = "color:
green"; break; case 2: statusstr = "failed"; style = "color:red"; break; case 3: statusstr = "canceled"; style = "color:purple"; break; case 4: statusstr = "paused"; style = "color:blue"; break; case 5: statusstr = "queued"; style = "c...
... see also storage, nsidownloadmanager, nsidownload, nsidownloadpro
gresslistener ...
LIR - Archive of obsolete content
48 not in use immediate 49 immi int immediate 50 immq 64 bit quad immediate 51 immd double immediate 52 not in use comparisons 53 eqi integer int equality 54 lti integer signed int less-than 55 gti integer signed int
greater-than 56 lei integer signed int less-than-or-equal 57 gei integer signed int
greater-than-or-equal 58 ltui integer unsigned int less-than 59 gtui integer unsigned int
greater-than 60 leui integer unsigned int less-than-or-equal 61 geui integer unsigned int
greater-than-or-equal 62 not in use ...
... 63 eqq integer 64 bit quad equality 64 ltq integer 64 bit signed quad less-than 65 gtq integer 64 bit signed quad
greater-than 66 leq integer 64 bit signed quad less-than-or-equal 67 geq integer 64 bit signed quad
greater-than-or-equal 68 ltuq integer 64 bit unsigned quad less-than 69 gtuq integer 64 bit unsigned quad
greater-than 70 leuq integer 64 bit unsigned quad less-than-or-equal 71 geuq integer 64 bit unsigned quad
greater-than-or-equal 72 not in use arithmetic 73 eqd integer double equality 74 ltd integer double less-than 75 gtd integer double
greater-than 76 led integer double less-than-or-equal 77 ...
... ged integer double
greater-than-or-equal 78 negi integer negate int 79 addi integer add int 80 subi integer subtract int 81 muli integer multiply int 82 divi integer i386/64 divide int 83 modi integer modulo int - lir_modi is a hack.
Priority Content - Archive of obsolete content
book length works in pro
gress: netscape gecko plugin api reference 1.0 original: netscape gecko plugin api reference 1.0 wiki location: gecko plugin api reference migrators: started: core javascript reference 1.5 original: core javascript reference 1.5 wiki location: core javascript 1.5 reference migrators: deb richardson in pro
gress: transforming xml: netscape and xslt 1.0 original: transforming xml: netscape ...
...keller in pro
gress: rapid application development with mozilla original: author's page and planned host, ben's temporary host wiki location: toc and links page still under construction.
...rted: scripting plugins: macromedia flash original: scripting plugins: macromedia flash wiki location: scripting plugins: macromedia flash migrators: dependant on (these parts need to be done, put your name down) completed: soap in netscape gecko-based browsers original: soap in netscape gecko-based browsers wiki location: soap in gecko-based browsers migrators: doron rosenberg in pro
gress: css support charts original: css support charts and archive.org mirror wiki location: css support charts migrators: serge k.
RDF Datasource How-To - Archive of obsolete content
ag
gregate the in-memory datasource.
... this is an extreme case of delegation, where you use xpcom ag
gregation to implement the nsirdfdatasource interface.
... see ag
gregating the in-memory datasource for technical details.
Supporting per-window private browsing - Archive of obsolete content
detecting private browsing mode determining whether or not a given dom window is private is simple: import resource://
gre/modules/privatebrowsingutils.jsm and use privatebrowsingutils.iswindowprivate(window).
... try { // firefox 20+ components.utils.import("resource://
gre/modules/privatebrowsingutils.jsm"); if (!privatebrowsingutils.iswindowprivate(window)) { ...
...to do this, import resource://
gre/modules/privatebrowsingutils.jsm and use privatebrowsingutils.getprivacycontextfromwindow(win), passing a window object that is related to the content in question.
Tamarin build documentation - Archive of obsolete content
there is also an ag
gregate target that will build both targets.
... note that, whereas before when you selected the ag
gregate target you got a 'shell' 32-bit executable and a 'shell64' 64-bit executable in the same folder, now because of the fix to bug 478714 you will get an 'avm' executable in two separate folders, /debug and /debug64 respectively.
... tryserver etiquette the sandbox is not a good substitute for running the re
gression tests locally to catch obvious problems.
Creating XPI Installer Modules - Archive of obsolete content
jar is a file format based on the zip file format and is used for ag
gregating multiple files into a single file.
...though the chrome directory still includes subdirectories of uncompressed files by default, a new way to ag
gregate and distribute the files has improved performance, made the ui components more portable and easier to install, and made the installation process a much easier one.
...barley/ content/ barley.gif barley.js barley.xul creating the contents.rdf file one of the most important in
gredients of the software package is the contents.rdf file that describes the contents of the package in terms that the chrome registry can make sense of.
treecell.mode - Archive of obsolete content
« xul reference home mode type: one of the values below for columns that are pro
gress meters, this determines the type of pro
gress meter to use.
... none no pro
gress meter is displayed.
... undetermined the pro
gressmeter is indeterminate.
The Joy of XUL - Archive of obsolete content
this de
gree of separation results in applications that are easier to maintain by programmers and readily customized by designers and language translators.
... by using xbl, developers can easily build custom user interface widgets such as pro
gress meters, fancy pop-up menus, and even toolbars and search forms.
...to improve performance a
greater proportion of application logic was migrated from javascript to the xpcom component.
Adding Style Sheets - Archive of obsolete content
<spacer class="titlespace"/> <hbox> <pro
gressmeter id="progmeter" value="50%" style="display:none;"/> the new xml-stylesheet line is used to import the style sheet.
...one that wasn't was the display property on the pro
gressmeter.
... this will be changed by a script so it was left in, as it doesn't really make sense to have the pro
gress bar visible initially.
Additional Install Features - Archive of obsolete content
the following code will make a copy of the file "/bin/
grep" and put it in the directory "/main".
... var binfolder = getfolder("file:///","bin"); var
grep = getfolder(binfolder, "
grep"); var mainfolder = getfolder("file:///", "main"); file.copy(
grep, mainfolder); the first line will retrieve a reference to the /bin directory.
... from there, we get the file '
grep' which is contained inside the 'bin' directory.
XUL Questions and Answers - Archive of obsolete content
what is an example of addpro
gresslistener?
... an example of this is this: // associate the pro
gress listener for a "browser" to a listener object browserobject.addpro
gresslistener( listobj, components.interfaces.nsiwebpro
gress.notify_state_window ); // remember to define the object, something like this: listobj = new object(); listobj.wpl = components.interfaces.nsiwebpro
gresslistener; listobj.queryinterface = function(aiid) { if (aiid.equals(listobj.wpl) || aiid.equals(components.interfaces.nsisupportsweakreference) || aiid.equals(components.interfaces.nsisupports)) return this; throw components.results.ns_nointerface; } listobj.onstatechange = function(apro
gress, arequest, aflag, astatus) { if (aflag & listobj.wpl.state_start) { // this fires when the load event is initiated } else { if (a...
... if ( aflag & listobj.wpl.state_is_network ) { // fires when all load are really over, // do something "final" here // (my two cents) } else { // this fires when a load finishes } } } return 0; } // this fires when the location bar changes i.e load event is confirmed // or when the user switches tabs listobj.onlocationchange = function(apro
gress, arequest, auri) { // do whatever you want to do return 0; } // for definitions of the remaining functions see xulplanet.com listobj.onpro
gresschange = function() { return 0 }; listobj.onstatuschange = function() { return 0 }; listobj.onsecuritychange = function() { return 0 }; listobj.onlinkiconavailable = function() { return 0 }; /* i use the pro
gress listener to trap the end of a local...
XUL controls - Archive of obsolete content
menulist reference related elements: menupopup menuitem <pro
gressmeter> a pro
gress meter is used to display the pro
gress of a lengthy task.
... <pro
gressmeter value="40"/> more information about the pro
gressmeter element.
... pro
gressmeter reference <radio> a radio button is used when only one of a set of options may be selected at a time.
treecell - Archive of obsolete content
mode type: one of the values below for columns that are pro
gress meters, this determines the type of pro
gress meter to use.
... none no pro
gress meter is displayed.
... undetermined the pro
gressmeter is indeterminate.
XULRunner tips - Archive of obsolete content
work in pro
gress.
...the following prefs must also be set to make the xpinstall dialog, extension manager, and theme manager work: pref("xpinstall.dialog.confirm", "chrome://mozapps/content/xpinstall/xpinstallconfirm.xul"); pref("xpinstall.dialog.pro
gress.skin", "chrome://mozapps/content/extensions/extensions.xul?type=themes"); pref("xpinstall.dialog.pro
gress.chrome", "chrome://mozapps/content/extensions/extensions.xul?type=extensions"); pref("xpinstall.dialog.pro
gress.type.skin", "extension:manager-themes"); pref("xpinstall.dialog.pro
gress.type.chrome", "extension:manager-extensions"); pref("extensions.update.enabled", true); pref("extensions.u...
...when using xulrunner 1.9 or
greater, you can create your own alias in your chrome manifest add a "skin" line: skin communicator classic/1.0 skin/communicator/ add a skin folder named "communicator" and add a single css file named "communicator.css" with this content: @import url("chrome://global/skin"); dom inspector to add dom inspector 2.0.* to your xulrunner 1.9.0.* application follow these s...
Gecko Compatibility Handbook - Archive of obsolete content
while they support the css 1 standard to some de
gree, the implementations are not complete and have non-standard features added.
...as time pro
gresses and the older browsers drop in market share, web page authors can transition to standards-based layout by using the appropriate doctype.
... the toolbox ag
gregates several invaluable w3c tools for diagnosing web page problems as well as validators, code samples, and more.
Mozilla release FAQ - Archive of obsolete content
this isn't quite so far fetched, but it has the problem of possibly doing a
great deal of harm to the relations between netscape and several unix vendors who bundle netscape's servers.
...also, pro
gressive display of the webpage would be completely gone with this idea.
...both are
great ways to meet others working on mozilla, including lots of netscape employees as well as other interested people (like myself).
Mozilla.dev.apps.firefox-2006-10-06 - Archive of obsolete content
a wiki and irc channel have been created to track their pro
gress.
... engineering student project - industry coach paul betts from ohio state university is looking for someone from mozilla to be his "industry coach" for engineering 494 - how
great ideas turn into
great products.
... mozilla is a
great product afterall.
2006-10-06 - Archive of obsolete content
a wiki and irc channel have been created to track their pro
gress.
... engineering student project - industry coach paul betts from ohio state university is looking for someone from mozilla to be his "industry coach" for engineering 494 - how
great ideas turn into
great products.
... mozilla is a
great product afterall.
2006-10-06 - Archive of obsolete content
adam gutherie replied that cbeard's blog post from nov 2005 is as close to a roadmap as exists right now and a
grees that needs to be done about this.
...ziga sancin replies with a link and re
grets about it being a bit out of date.
...beltzner says that (as per bon echo status meeting) that rc2 is going to be re-spun to fix some final bugs that were re
gressed and patches that were just landed.
Adobe Flash - Archive of obsolete content
determine if the flash version is
greater than 6r.49 // 3.
...if the browser is a mach-o browser, determine whether the version of the plugin // is
greater than 12, a hypothetical version when flash will fix the plugin to be // scriptable on mach-o browsers also var flashversionosxscriptable = 12; if(navigator.useragent.indexof("mach-o")!=-1) { if(flashversion < flashversionosxscriptable) // flash version is less than version 12, thus not scriptable on os x } // 6.
... accessing flash from javascript the simple example below shows how input into an html text box in a form field can be transferred to a flash animation (the
grey text box below).
Why use RSS - Archive of obsolete content
there are too many desktop and web-based rss ag
gregators out there to list them all.
... rss ag
gregators are everywhere one reason to use rss to syndicate is because there are an enormous amount of desktop and web-based rss ag
gregators out there.
... (too many to list.) and if you syndicate using rss, then all those desktop and web-based rss ag
gregators will be able to make use of and read your rss feed.
-ms-scrollbar-arrow-color - Archive of obsolete content
)where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> examples the following example shows how to use -ms-scrollbar-arrow-color and -ms-scrollbar-face-color to display a scroll bar with a blue scroll box and arrows, and a scroll bar with a
green scroll box and arrows.
... div { width: 150px; height: 150px; overflow-y: scroll; border-style: solid; border-width: thin; font-family: sans-serif; float: left; margin-right: 10px; } .bluescrollbox { scrollbar-face-color: blue; scrollbar-arrow-color: blue; } .
greenscrollbox { scrollbar-face-color:
green; scrollbar-arrow-color:
green; } <body> <div class="bluescrollbox"> lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
... </div> <div class="
greenscrollbox"> lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
-ms-scrollbar-face-color - Archive of obsolete content
)where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> examples this example uses -ms-scrollbar-face-color and -ms-scrollbar-arrow-color to display a scroll bar with a blue scroll box and arrows, and a scroll bar with a
green scroll box and arrows.
... div { width: 150px; height: 150px; overflow-y: scroll; border-style: solid; border-width: thin; font-family: sans-serif; float: left; margin-right: 10px; } .bluescrollbox { scrollbar-face-color: blue; scrollbar-arrow-color: blue; } .
greenscrollbox { scrollbar-face-color:
green; scrollbar-arrow-color:
green; } <body> <div class="bluescrollbox"> lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
... </div> <div class="
greenscrollbox"> lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
::-ms-check - Archive of obsolete content
ce font-size font-style font-weight height margin-bottom margin-left margin-right margin-top opacity outline-color outline-style outline-width padding-bottom padding-left padding-right padding-top transform transform-origin visibility width syntax ::-ms-check example html <form> <label for="redbutton">red</label> <input type="radio" id="redbutton"><br> <label for="
greencheckbox">
green</label> <input type="checkbox" id="
greencheckbox"> </form> css input, label { display: inline; } input[type=radio]::-ms-check { border-color: red; /* this will make the border red when the button is checked.
...*/ } input[type=checkbox]::-ms-check { border-color:
green; /* this will make the box
green when the button is checked.
... */ color:
green; /* this will make the checkmark
green when the button is checked.
CSS - Archive of obsolete content
it only works on mac os x.-ms-acceleratorthe -ms-accelerator css property is a microsoft extension that sets or retrieves a string indicating whether the object represents a keyboard shortcut.-ms-block-pro
gressionthe -ms-block-pro
gression css property is a microsoft extension that specifies the block pro
gression and layout orientation.-ms-content-zoom-chainingthe -ms-content-zoom-chaining css property is a microsoft extension specifying the zoom behavior that occurs when a user hits the zoom limit during page manipulation.-ms-content-zoom-limitthe -ms-content-zoom-limit css shorthand property is a mic...
...typically it is a triangle that points downward.::-ms-fillthe ::-ms-fill css pseudo-element is a microsoft extension that represents a pro
gress bar displayed by <pro
gress>.::-ms-fill-lowerthe ::-ms-fill-lower css pseudo-element represents the lower portion of the track of a slider control; that is, the portion corresponding to values less than the value currently selected by the thumb.
... a slider control is one possible representation of <input type="range">.::-ms-fill-upperthe ::-ms-fill-upper css pseudo-element is a microsoft extension that represents the upper portion of the track of a slider control; that is, the portion corresponding to values
greater than the value currently selected by the thumb.
XForms Custom Controls - Archive of obsolete content
implementation status the framework we use in the mozilla xforms processor is very much a "work in pro
gress".
... please keep in mind that just about everything we mention here may change to some de
gree as we continue to work on it.
...so you can always refer to our source code to get some
great examples of how xforms controls can be written.
RDF in Mozilla FAQ - Archive of obsolete content
for this reason, there is an observer interface that allows you to spy on a datasource's pro
gress.
... the following code illustrates its usage: // this is the object that will observe the rdf/xml load's pro
gress var observer = { onbeginload: function(asink) {}, oninterrupt: function(asink) {}, onresume: function(asink) {}, onendload: function(asink) { asink.removexmlsinkobserver(this); alert("done!"); }, onerror: function(asink, astatus, aerrormsg) { alert("error!
... { alert("the datasource was already loaded!"); } else { alert("the datasource wasn't loaded, but it's loading now!"); // rdf/xml datasources are all nsirdfxmlsinks var sink = ds.queryinterface(components.interfaces.nsirdfxmlsink); // attach the observer to the datasource-as-sink sink.addxmlsinkobserver(observer); // now observer's methods will be called-back as // the load pro
gresses.
Game distribution - Game development
you've followed a tutorial or two and created an html5 game — that's
great!
...you can put your html5 games into the same arena (see native desktop, later on) and you should because it's good to diversify the platforms you support, but you have to remember that developers creating desktop games have years of experience,
great tools and stable distribution channels.
...native stores are already filled with established devs selling
great games, so you have to be talented and lucky to get noticed.
Efficient animation for web games - Game development
though javascript animations can be easier to express at times, unless you have a
great need to synchronise ui animation state with game animation state, you’re unlikely to be able to do a better job than the browser.
...you may have a callback that ends up looking something like this: var starttime = -1; var animationlength = 2000; // animation length in milliseconds function doanimation(timestamp) { // calculate animation pro
gress var pro
gress = 0; if (starttime < 0) { starttime = timestamp; } else { pro
gress = timestamp - starttime; } // do animation ...
... if (pro
gress < animationlength) { requestanimationframe(doanimation); } } // start animation requestanimationframe(doanimation); you will note that we set starttime to -1 at the beginning, when we could just as easily have set the time using the date() object and avoided the extra code in the animation callback.
Tools for game development - Game development
asm.js asm.js is a very limited subset of the javascript language, which can be
greatly optimized and run in an ahead-of-time (aot) compiling engine for much faster performance than your typical javascript performance.
... this is, of course,
great for games.
...this is a
great tool for porting applications to the web!
Global object - MDN Web Docs Glossary: Definitions of Web-related terms
explanation: the global variable foo was stored in the window object, like this: foo: "foobar" access global functions function
greeting() { console.log("hi!"); } window.
greeting(); // it is the same as the normal invoking:
greeting(); the example above explains how global functions are stored as properties in the window object.
... we created a global function called
greeting, then invoked it using the window object.
... explanation: the global function
greeting was stored in the window object, like this:
greeting: function
greeting() { console.log("hi!"); } ...
HTML: A good basis for accessibility - Learn web development
previous overview: accessibility next a
great deal of web content can be made accessible just by making sure the correct hypertext markup language elements are used for the correct purpose at all times.
...for example, a control button to play a video on your site could be marked up like this: <div>play video</div> but as you'll see in
greater detail later on, it makes sense to use the correct element for the job: <button>play video</button> not only do html <button>s have some suitable styling applied by default (which you will probably want to override), they also have built-in keyboard accessibility — users can navigate between buttons using the tab key and activate their selection using return or enter.
...if you try navigating through this, you'll see that this is pretty easy to navigate: the screen reader reads each header out as you pro
gress through the content, notifying you what a heading is, what is a paragraph, etc.
HTML: A good basis for accessibility - Learn web development
previous overview: accessibility next a
great deal of web content can be made accessible just by making sure the correct hypertext markup language elements are used for the correct purpose at all times.
...for example, a control button to play a video on your site could be marked up like this: <div>play video</div> but as you'll see in
greater detail later on, it makes sense to use the correct element for the job: <button>play video</button> not only do html <button>s have some suitable styling applied by default (which you will probably want to override), they also have built-in keyboard accessibility — users can navigate between buttons using the tab key and activate their selection using return or enter.
...if you try navigating through this, you'll see that this is pretty easy to navigate: the screen reader reads each header out as you pro
gress through the content, notifying you what a heading is, what is a paragraph, etc.
Organizing your CSS - Learn web development
you will thank yourself when you come back to this project in a year or so, and can vaguely remember there was a
great tutorial about that thing, but where is it?
... .comment { display: grid; grid-template-columns: 1fr 3fr; } .comment img { border: 1px solid
grey; } .comment .content { font-size: .8rem; } .list-item { display: grid; grid-template-columns: 1fr 3fr; border-bottom: 1px solid
grey; } .list-item .content { font-size: .8rem; } in oocss, you would create one pattern called media that would have all of the common css for both patterns — a base class for things that are generally the shape of the media object.
... .media { display: grid; grid-template-columns: 1fr 3fr; } .media .content { font-size: .8rem; } .comment img { border: 1px solid
grey; } .list-item { border-bottom: 1px solid
grey; } in your html the comment would need both the media and comment classes applied: <div class="media comment"> <img /> <div class="content"></div> </div> the list-item would have media and list-item applied: <ul> <li class="media list-item"> <img /> <div class="content"></div> </li> </ul> the work that nicole sullivan did in describing this approach and promoting it means that even people who are not strictly following an oocss approach today will generally be reu...
HTML forms in legacy browsers - Learn web development
the webkit blog and planet webkit ag
gregate the best articles by webkit core developers.
... graceful degradation is web developer's best friend graceful degradation and pro
gressive enhancement are development patterns that allow you to build
great stuff by supporting a wide range of browsers at the same time.
... complete : function () { app.init(); } }); the modernizr team conveniently maintains a list of
great polyfills.
Styling web forms - Learn web development
this has historically been difficult — form controls vary
greatly in how easy they are to customize with css — but it is getting easier as old browsers are retired and modern browsers give us more features to use.
... <pro
gress> and <meter> again, we'll describe what can be done in terms of styling these elements in advanced form styling.
...simply put, we remove their borders and backgrounds, and redefine their padding and margin: input, textarea { font : 1.4em/1.5em "handwriting", cursive, sans-serif; border : none; padding : 0 10px; margin : 0; width : 80%; background : none; } when one of these fields gains focus, we highlight them with a light
grey, transparent, background (it is always important to have focus style, for usability and keyboard accessibility): input:focus, textarea:focus { background : rgba(0,0,0,.1); border-radius: 5px; } now that our text fields are complete, we need to adjust the display of the single and multiple line text fields to match, since they won't typically look the same using the defaults.
JavaScript basics - Learn web development
you may have to start small, and pro
gress gradually.
...if values couldn't change, then you couldn't do anything dynamic, like personalize a
greeting message or change an image displayed in an image gallery.
...this takes references to the new button and the heading, storing each inside variables: let mybutton = document.queryselector('button'); let myheading = document.queryselector('h1'); add the function below to set the personalized
greeting.
What’s in the head? Metadata in HTML - Learn web development
it will look something like this (although it may change over time): <meta name="description" content="the mdn web docs site provides information about open web technologies including html, css, and apis for both web sites and pro
gressive web apps."> now search for "mdn web docs" in your favorite search engine (we used google.) you'll notice the description <meta> and <title> element content used in the search result — definitely worth having!
... don't worry too much about implementing all these types of icon right now — this is a fairly advanced feature, and you won't be expected to have knowledge of this to pro
gress through the course.
... the css has caused the background to go
green, and the text to become bigger.
Making asynchronous programming easier with async and await - Learn web development
here is a trivial example: async function hello() { return
greeting = await promise.resolve("hello"); }; hello().then(alert); of course, the above example is not very useful, although it does serve to illustrate the syntax.
...take a look at the es class code we saw in our object-oriented javascript article, and then look at our modified version with an async method: class person { constructor(first, last, age, gender, interests) { this.name = { first, last }; this.age = age; this.gender = gender; this.interests = interests; } async
greeting() { return await promise.resolve(`hi!
...bye for now!`); }; } let han = new person('han', 'solo', 25, 'male', ['smuggling']); the first class method could now be used something like this: han.
greeting().then(console.log); browser support one consideration when deciding whether to use async/await is support for older browsers.
Functions — reusable blocks of code - Learn web development
you can also assign an anonymous function to be the value of a variable, for example: const my
greeting = function() { alert('hello'); } this function could now be invoked using: my
greeting(); this effectively gives the function a name; you can also assign the function to be the value of multiple variables, for example: let another
greeting = my
greeting; this function could now be invoked using either of: my
greeting(); another
greeting(); but this would just be confusing, so don't do it...
...when creating functions, it is better to just stick to this form: function my
greeting() { alert('hello'); } you will mainly use anonymous functions to just run a load of code in response to an event firing — like a button being clicked — using an event handler.
... for example, say you have an html file that is calling in two external javascript files, and both of them have a variable and a function defined that use the same name: <!-- excerpt from my html --> <script src="first.js"></script> <script src="second.js"></script> <script>
greeting(); </script> // first.js let name = 'chris'; function
greeting() { alert('hello ' + name + ': welcome to our company.'); } // second.js let name = 'zaptec'; function
greeting() { alert('our company is called ' + name + '.'); } both functions you want to call are called
greeting(), but you can only ever access the first.js file's
greeting() function (the second one is ignored).
Server-side web frameworks - Learn web development
exact, case-insensitive,
greater than, etc.), and can support complex statements (for example, you can specify a search on u11 teams that have a team name that starts with "fr" or ends with "al").
...by contrast, flask is a much lighter-weight framework and is
great for creating web apps running on embedded devices.
...there are many other
great server-side frameworks that you can discover using a basic internet search.
Introduction to client-side frameworks - Learn web development
users write papers, manage their budgets, stream music, watch movies, and communicate with others over
great distances instantaneously, with text, audio or video chat.
...this abstraction is
great for your experience as a developer, but it isn't free.
...this rfc serves as a
great example of the kind of research you should do for yourself when planning to use a front-end framework.
TypeScript support in Svelte - Learn web development
so typescript is going through a
great phase of adoption.
...you can now start adding types pro
gressively.
... there is work in pro
gress to support typescript in svelte projects in several code editors; the most complete support so far is available in the svelte for vs code extension, which is developed and maintained by the svelte team.
Deployment and next steps - Learn web development
after creating a new repo gitlab will
greet you with a message explaining different options to upload your existing files.
... you can also check the pro
gress of the current and previous jobs from the ci / cd > jobs menu option of your gitlab project.
... nevertheless, svelte.js — the complete guide by academind is a very popular option with
great ratings.
Handling common HTML and CSS problems - Learn web development
after the packages have finished installing, try loading up an html file and a css file: you'll see any issues highlighted with
green (for warnings) and red (for errors) circles next to the line numbers, and a separate panel at the bottom provides line numbers, error messages, and sometimes suggested values or other fixes.
... note: of course, this may not be a
great solution for your project's needs — the difference in visual presentation is not
great, plus it is harder to guarantee the data will be entered in the format you want it in.
...so for example: mozilla uses -moz- chrome/opera/safari use -webkit- microsoft uses -ms- here's some examples: -webkit-transform: rotate(90deg); background-image: -moz-linear-gradient(left,
green,yellow); background-image: -webkit-gradient(linear,left center,right center,from(
green),to(yellow)); background-image: linear-gradient(to right,
green,yellow); the first line shows a transform property with a -webkit- prefix — this was needed to make transforms work in chrome, etc.
Handling common JavaScript problems - Learn web development
ouble with javascript historically, javascript was plagued with cross-browser compatibility problems — back in the 1990s, the main browser choices back then (internet explorer and netscape) had scripting implemented in different language flavours (netscape had javascript, ie had jscript and also offered vbscript as an option), and while at least javascript and jscript were compatible to some de
gree (both based on the ecmascript specification), things were often implemented in conflicting, incompatible ways, causing developers many nightmares.
... after the packages have finished installing, try loading up a javascript file: you'll see any issues highlighted with
green (for warnings) and red (for errors) circles next to the line numbers, and a separate panel at the bottom provides line numbers, error messages, and sometimes suggested values or other fixes.
... for example: promises are a
great new feature for performing asynchronous operations and making sure those operations are complete before code that relies on their results is used for something else.
Introducing a complete toolchain - Learn web development
it offers a way to "commit" blocks of work as you pro
gress, along with comments such as "x new feature implemented", or "bug z now fixed due to y changes".
...if you're interested in using hooks, husky is a
greatly simplified route into using hooks.
...it's a key in
gredient of a good toolchain and one that many development projects will include by default.
Chrome Worker Modules
you only need to do it once for each worker, from within the chrome worker itself: importscripts("resource://
gre/modules/workers/require.js"); note: although you only need to do this once for each worker, it doesn't hurt if you do it more than once.
... this defines a global value require(), that you may now use as follows: // import the module // (here, we import the core of os.file) let core = require("resource://
gre/modules/osfile/osfile_shared_allthreads.jsm"); // we may now use module core.
...ports.key = publickey; // secretkey is not exported // publickey is exported with name "key" alternatively, if you prefer that style, you may write // variable |module| is a special global introduced by require() module.exports = { key: publickey }; once this is done, we may load the module and use the values that have been exported // assuming that mymodule.js is installed to resource://
gre/modules/mymodule.js let module = require("resource://
gre/modules/mymodule.js") foo(module.key); // module.key == "this is public"; // however, secretkey is not exported and cannot be used for the installation of resources, please see the documentation on moz.build (if your code is part of the platform) or on chrome manifests (if your code is part of an add-on).
Mozilla accessibility architecture
in the past, this was accomplished through ag
gregation -- two separate trees of objects were kept, one in accessible/src and one in widget/src.
...we cannot assume that all of the accessible children will come from the direct children, grandchildren or even
great-
great-
great-children of the current accessible's node.
... event_menuend nsdocaccessible::scrollpositiondidchange(), then nsdocaccessible::scrolltimercallback() nsiscrollpositonlistener and nsitimer callbacks event_scrollingend (quick timer is used to determine when scrolling pauses or stops, to avoid extra events being fired) nsdocaccessible::onstatechange(), :nsdocaccessible:onlocationchange() nsiwebpro
gresslistener callback event_state_change (msaa) event_reorder (atk) dom mutation events - multiple uses dom mutation events are a
great thing.
Continuous Integration
the sheriffs' role is to "keep the tree
green", or in other words, to keep the code in our respositories in a good state, to the extent that the state is reflected in the output shown on treeherder.
... each taskcluster job is represented by a colored label;
green means a job has succeeded, while other colors represent different kinds of problems.
... the talos indicators in treeherder appear
green if the job successfully completed; to see the performance data generated by the jobs, click on the performance tab of the job details panel that pops up when you click on a job in treeherder.
Creating a spell check dictionary add-on
the em:version should follow the rules of mozilla add-on version numbers, and if you update an existing dictionary add-on, the new version number must be
greater than the old one.
...the em:minversion should therefore be the same as in the example above (or
greater).
... update the em:maxversion to the
greatest versions available.
Debugging JavaScript
you can also start the browser console when you launch firefox, by launching firefox from the command line and passing --jsconsole as a flag: /path/to/firefox --jsconsole log to the browser console using the standard console api after importing console.jsm: let console = (cu.import("resource://
gre/modules/console.jsm", {})).console; console.log("hello from firefox code"); error console this is obsolete and is no longer enabled in firefox by default.
... console.log in browser console you can dump variables in the browser console from addon code, by adding this line to import the console utility: const { console } = components.utils.import("resource://
gre/modules/devtools/console.jsm", {}); this has an advantage over dump in that you can list out properties of an object logged with console.log.
... components.utils.import("resource://
gre/modules/log.jsm"); "debugger" keyword you can halt venkman or chromebug at a line using the keyword debugger.
Eclipse CDT
eclipse is open source, of course so if anyone feels like doing a bit of java hacking to fix these issues that'd be
great.
...it would be
great if the console tab gave you a shell prompt so that you could invoke commands to build directly from there.
...tick this (all of its sub-options should then be ticked), click "next" twice, accept the license a
greement, and then click "finish".
Experimental features in Firefox
the specification is still a work-in-pro
gress.
... see bug 1602129 for our pro
gress on this api.
...see bug 1622409 for implementation pro
gress.
Limitations of chrome scripts
nsiwebpro
gresslistener this api will work in the chrome process.
... there is a shim that gives you access to the domwindow property of the nsiwebpro
gress object passed into onstatechange.
... alternatively, you can use nsiwebpro
gresslistener in the content process.
Code Samples
components.utils.import("resource://
gre/modules/addonmanager.jsm"); addonmanager.getaddonbyid("yourextensionid", function(addon) { var addonlocation = addon.getresourceuri("").queryinterface(components.interfaces.nsifileurl).file.path; }); accessing file and version information components.utils.import("resource://
gre/modules/addonmanager.jsm"); addonmanager.getaddonbyid("my-addon@foo.com", function(addon) { alert("my extension's version is " + addon.version); alert("did i remember to include that file.txt file in my xpi?
..."yes!" : "no"); alert("let's pretend i did, it's available from the url " + addon.getresourceuri("file.txt").spec); }); uninstall an add-on components.utils.import("resource://
gre/modules/addonmanager.jsm"); addonmanager.getaddonbyid("youraddon@youraddon.com", function(addon) { addon.uninstall(); }); disable an add-on components.utils.import("resource://
gre/modules/addonmanager.jsm"); addonmanager.getaddonbyid("youraddon@youraddon.com", function(addon) { if (addon.isactive) addon.userdisabled = addon.isactive; }); listening for add-on uninstall this example sets a variable beinguninstalled that you can check when you get a profile-before-change message to do cleanup for your add-on on uninstall.
...einguninstalled; let listener = { onuninstalling: function(addon) { if (addon.id == "youraddon@youraddon.com") { beinguninstalled = true; } }, onoperationcancelled: function(addon) { if (addon.id == "youraddon@youraddon.com") { beinguninstalled = (addon.pendingoperations & addonmanager.pending_uninstall) != 0; } } } try { components.utils.import("resource://
gre/modules/addonmanager.jsm"); addonmanager.addaddonlistener(listener); } catch (ex) {} ...
Add-on Manager
for example: components.utils.import("resource://
gre/modules/addonmanager.jsm"); addonmanager.getalladdons(function(aaddons) { // here aaddons is an array of addon objects }); // this code will execute before the code inside the callback notifications about changes to installed add-ons are dispatched to any registered addonlisteners.
...these will pass an addoninstall instance to the callback, which can then be used to install the add-on: components.utils.import("resource://
gre/modules/addonmanager.jsm"); addonmanager.getinstallforurl("http://www.foo.com/test.xpi", function(ainstall) { // ainstall is an instance of addoninstall ainstall.install(); }, "application/x-xpinstall"); the pro
gress of addoninstalls can be monitored using an installlistener.
... for example, to take a look at the add-ons that were disabled at startup: components.utils.import("resource://
gre/modules/addonmanager.jsm"); let addonids = addonmanager.getstartupchanges(addonmanager.startup_change_disabled); if (addonids.length > 0) { // addonids is now an array of the add-on ids that have been disabled alert("note: " + addonids.length + " add-ons have been disabled."); } open add-on manager tab the add-on manager tab can be opened programatically with the function browseropenaddonsm...
Using JavaScript code modules
there are multiple pre-defined aliases set up by the xul runtime: app - alias to the location of the xul application
gre - alias to the location of the xul runtime the <relative-path> can be multiple levels deep and is always relative to the location defined by the <alias>.
...for example: // import services.jsm unless in a scope where it's already been imported components.utils.import("resource://
gre/modules/services.jsm"); var resprot = services.io.getprotocolhandler("resource") .queryinterface(components.interfaces.nsiresprotocolhandler); var aliasfile = components.classes["@mozilla.org/file/local;1"] .createinstance(components.interfaces.nsilocalfile); aliasfile.initwithpath("/some/absolute/path"); var aliasuri = services.io.newfileuri(ali...
...just call the following: const { require } = cu.import("resource://
gre/modules/commonjs/toolkit/require.js", {}) this will import require() into your scope.
Webapps.jsm
importing components.utils.import("resource://
gre/modules/webapps.jsm"); // exported symbol is domapplicationregistry method overview init: function() loadcurrentregistry: function() notifyappsregistrystart: function notifyappsregistrystart() notifyappsregistryready: function notifyappsregistryready() sanitizeredirects: function sanitizeredirects(asource) _savewidgetsfullpath: function(amanifest, adestapp) appkind: function(aapp, amanifest) updatepermissionsforapp: function(aid, aispreinstalled) updateofflinecacheforapp: function(aid) installpreinstalledapp: function installpreinstalledapp(aid) removeifhttpsduplicate: function(aid) installsystemapps: funct...
...d) _writemanifestfile: function(aid, aispackage, ajsonmanifest) _nextlocalid: function() _appidformanifesturl: function(auri) makeappid: function() _saveapps: function() _readmanifests: function(adata) _ensuresufficientstorage: function(anewapp) _checkdownloadsize: function(afreebytes, anewapp) _getrequestchannel: function(afullpackagepath, aislocalfileinstall, aoldapp,) _senddownloadpro
gressevent: function(anewapp, apro
gress) _getpackage: function(arequestchannel, aid, aoldapp, anewapp) _computefilehash: function(afilepath) _sendappliedevent: function(aapp) _openandreadpackage: function(azipfile, aoldapp, anewapp, aislocalfileinstall,) _openpackage: function(azipfile, aapp, aislocalfileinstall) _opensignedpackage: function(ainstallorigin, amanifesturl, azipfile, acertdb) _re...
... function(alocalid) getapplocalidbymanifesturl: function(amanifesturl) getcoreappsbasepath: function() getwebappsbasepath: function() _islaunchable: function(aapp) _notifycategoryandobservers: function(subject, topic, data, msg) registerbrowserelementparentforapp: function(amsg, amn) receiveappmessage: function(appid, message) _clearprivatedata: function(appid, browseronly, msg) _sendpro
gressevent: function() updatestatechanged: function appobs_update(aupdate, astate) applicationcacheavailable: function appobs_cacheavail(aapplicationcache) ...
XPCOMUtils.jsm
to use this, you first need to import the code module into your javascript scope: components.utils.import("resource://
gre/modules/xpcomutils.jsm"); using xpcomutils exposing a javascript class as a component using these utility methods requires four key steps: import xpcomutils.jsm, as explained previously.
...for example, if an extension named "myextension" bundles foo.jsm and bar.jsm, and foo.jsm needs to load bar.jsm, it can do so like this: components.utils.import("resource://
gre/modules/xpcomutils.jsm"); xpcomutils.importrelative(this, "bar.jsm"); in other words: importrelative will only work from other code modules (such as jsm files).
... examples definelazygetter var myservices = {}; cu.import('resource://
gre/modules/xpcomutils.jsm'); //set it up xpcomutils.definelazygetter(myservices, 'as', function () { return cc['@mozilla.org/alerts-service;1'].getservice(ci.nsialertsservice) }); //when you need to use it myservices.as.showalertnotification('chrome://branding/content/icon64.png', 'this was lazyloaded', 'this is a notification from myservices.as', null, null); ...
Application Translation with Mercurial
pro
gress tracking tool to track which strings and files already have been translated and later also to see which new strings have already been tested in the product as being a good translation for the functionality behind the translated strings and that the translated texts fit into the available, the translation pro
gress should be tracked.
... paste the following content into the file: [ui] username = firstname lastname <mynick@example.com> merge = internal:merge [alias] qexport = export -g -r qtip qexportall = diff -r qparent [defaults] commit = -v diff = -p -u 8 qdiff = -p -u 8 qnew = -u [diff] git = 1 showfunc = 1 unified = 8 [extensions] hgext.mq = pro
gress = [hooks] put in your name and email address which later will be public on the internet after your translation patch got accepted and uploaded.
... tracking the translation pro
gress if you translate more than a few strings, you usually want to keep track of what has already been translated (and later if the text has been tested in the product as fitting into the available area and suiting the functionality it describes).
Mozilla DOM Hacking Guide
mozilla gives you the opportunity not only to use very powerful and complete dom support, but also to work on a world-class implementation of one of the
greatest internet technologies ever created.
...if you can contribute any time or knowledge to this document, it is
greatly appreciated!
... the
great thing is that one can easily see the interfaces available from js through interface flattening by looking at the code.
Investigating leaks using DMD heap scan mode
if you are investigating a leak of www.example.com, then from $logdir you can do "
grep nsglobalwindow cc-edges* |
grep example.com".
... the result of that
grep will contain output that looks something like this: cc-edges.15873.log:0x7f0897082c00 [rc=1285] nsglobalwindowinner # 2147483662 inner https://www.example.com/ * cc-edges.15873.log: the first part is the file name where it was found.
... the output will look something like this, after a message about loading pro
gress: 0x7f0882fe3230 [fragmentorelement (xhtml) script https://www.example.com] --[[via hash] mlistenermanager]--> 0x7f0899b4e550 [eventlistenermanager] --[mlisteners event=onload listenertype=3 [i]]--> 0x7f0882ff8f80 [callbackobject] --[mincumbentglobal]--> 0x7f0897082c00 [nsglobalwindowinner # 2147483662 inner https://www.example.com] root 0x7f0882fe3230 is a ref counted objec...
Memory reporting
mystring *gmystring; class mystrin
greporter moz_final : public nsimemoryreporter { moz_define_malloc_size_of(mallocsizeof) public: ns_decl_isupports ns_method collectreports(nsihandlereportcallback* ahandlereport, nsisupports* adata) { // btw: if gmystring wasn't a pointer, you'd use // |gmystring.sizeofexcludingthis(mallocsizeof)| instead.
... return moz_collect_report( "explicit/mystring", kind_heap, units_bytes, gmystring->sizeofincludingthis(mallocsizeof), "memory used for mystring."); } }; ns_impl_isupports1(mystrin
greporter, nsimemoryreporter) note that moz_define_malloc_size_of defines a function of type mozilla::mallocsizeof that is specific to this memory reporter (and will be identified as such in dmd's output).
...for example: foo->sizeofincludingthis() // yes foo.sizeofexcludingthis() // yes foo.sizeofincludingthis() // no foo->sizeofexcludingthis() // no sometimes memory reporters are stand-alone objects, like the mystrin
greporter example above.
Power profiling overview
c-states intel processors have ag
gressive power-saving features.
... the correlation between each proxy measure and power consumption is hard to know and can vary
greatly.
...this can identify specific changes that caused re
gressions, for example.
Optimizing Applications For NSPR
this has proven to be quite challenging, a challenge that was met to a large de
gree, but there is always room for improvement.
... interrupting threads (via <tt>pr_interrupt()</tt>) on threads blocked in i/o functions is implemented to various de
grees on different platforms.
...on windows 3.1, when nspr detects a value in a 64 bit file offset
greater than 32bit significance, it terminates with an assert.
PRCallOnceType
syntax #include <prinit.h> typedef struct prcalloncetype { printn initialized; print32 inpro
gress; prstatus status; } prcalloncetype; fields the structure has these fields: initialized if not zero, the initialization process has been completed.
... inpro
gress if not zero, the initialization process is currently being executed.
... calling threads that observe this status block until inpro
gress is zero.
PR_ConnectContinue
if pr_connectcontinue() returns pr_failure, call pr_geterror(): - pr_in_pro
gress_error: the nonblocking connect is still in pro
gress and has not completed yet.
...after a nonblocking connect is initiated with pr_connect() (which fails with pr_in_pro
gress_error), one should call pr_poll() on the socket, with the in_flags pr_poll_write | pr_poll_except.
... when pr_poll() returns, one calls pr_connectcontinue() on the socket to determine whether the nonblocking connect has completed or is still in pro
gress.
NSS 3.17.2 release notes
this is a patch release to fix a re
gression and other bugs.
...this fixes a re
gression introduced in nss 3.16.2 that prevented nss from importing some rsa private keys (such as in pkcs #12 files) generated by other crypto libraries.
...previously nss would only validate the peer's public key before performing ecdh key a
greement.
Handling Mozilla Security Bugs
thus people have strong feelings about how security-related bugs are handled, and in particular about the de
gree to which information about such bugs is publicly disclosed.
... expanding the mozilla security bug group as previously described, the mozilla security module owner can select one or more peers to share the core work of coordinating investigation and resolution of mozilla security vulnerabilities, and will work with them to create some a
greed-upon ground rules for how this work can be most effectively shared among themselves.
... disclosure of security vulnerabilities the security module owner, peers, and other members of the mozilla security bug group will not be asked to sign formal nondisclosure a
greements or other legal paperwork.
AT APIs Support
introduction documentation is in pro
gress still.
... on windows platform mfcembed testing client - this is a very simple package,
great for testing basic html accessibility with your products and the gecko rendering engine (please contact us for a copy).
...the rest of the mozilla universal access support is in pro
gress.
XUL Accessibility
it is much in pro
gress.
...ag
gregating the text from element subtree if the child node is hidden then it's ignored excepting the case when the element used as label is hidden itself if the child node is text node then its rendered value is appended if the child node is element then if it implements nsidomxullabeledcontrolelement then the value of label property is appended otherwise if it's a label element then then value attribute is appended otherwise append tooltiptext attribute append the accessible value searching specific element in neighbour of the element search inside the element subtree go up through parents (max level is 5) and search inside theirs subtrees if the element is anonymous then sear...
...l for control" control="control" /> <hbox role="grouping" id="control" /> get tooltiptext attribute if the element is anonymous child of the element that is the direct child of toolbaritem element or the element is direct child of toolbaritem element then title attribute of toolbaritem element is used (currently it's used in firefox ui only) if the element has aria role and the role allows to ag
gregate name from subtree of element then generate name from subtree of the element description the following rules to generate accessible description are applied: check aria-describedby attribute, description is generated from elements pointed by aria-describedby attribute <description id="descr1">label1</description> <description id="descr2">label2</description> <textbox aria-describedby="desc...
How to build an XPCOM component in JavaScript
depth = @depth@ topsrcdir = @top_srcdir@ srcdir = @srcdir@ vpath = @srcdir@ include $(depth)/config/autoconf.mk # module specifies where header files from this makefile are installed # use dom if your component implements a dom api module = dom # name of the typelib xpidl_module = dom_apps # set to 1 if the module should be part of the gecko runtime common to all applications
gre_module = 1 # the idl sources xpidlsrcs = \ helloworld.idl \ $(null) include $(topsrcdir)/config/rules.mk xpidl_flags += \ -i$(topsrcdir)/dom/interfaces/base \ -i$(topsrcdir)/dom/interfaces/events \ $(null) creating the component using xpcomutils in firefox 3 and later you can use import xpcomutils.jsm using components.utils.import to simplify the process of writing your component sligh...
...to begin, include a line at the top of your interface to import the xpcomutils library: components.utils.import("resource://
gre/modules/xpcomutils.jsm"); then implement your interface the same way you did above, except with a few modifications so that xpcomutils can set it up properly: /*********************************************************** class definition ***********************************************************/ //class constructor function helloworld() { // if you only need to access your component from jav...
... var nsgetfactory = xpcomutils.generatensgetfactory(components); // firefox 4.0 and higher else var nsgetmodule = xpcomutils.generatensgetmodule(components); // firefox 3.x so the total simplified version of your component now looks like (of course documentation and comments aren't a bad thing, but as a template something smaller is nice to have): components.utils.import("resource://
gre/modules/xpcomutils.jsm"); function helloworld() { } helloworld.prototype = { classdescription: "my hello world javascript xpcom component", classid: components.id("{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}"), contractid: "@dietrich.ganx4.com/helloworld;1", queryinterface: xpcomutils.generateqi([components.interfaces.nsihelloworld]), hello: function() { return "hello world!
Components.utils.cloneInto
example this add-on script creates an object, clones it into the content window and makes it a property of the content window global: // add-on script var addonscriptobject = {"
greeting" : "hello from add-on"}; contentwindow.addonscriptobject = cloneinto(addonscriptobject, contentwindow); scripts running in the page can now access the object: // page script button.addeventlistener("click", function() { console.log(window.addonscriptobject.
greeting); // "hello from add-on" }, false); of course, you don't have to assign the clone to the window itself: you can assign it...
...suppose the page script defines a function like this: // page script function foo(
greeting) { console.log("they said: " +
greeting.message); } the add-on script can define an object, clone it, and pass it into this function: // add-on script var addonscriptobject = {"message" : "hello from add-on"}; contentwindow.foo(cloneinto(addonscriptobject, contentwindow)); // "they said: hello from add-on" cloning objects that have functions if the object to be cloned contains functions, you must pass the {clonefunctions:true} flag or you'll get an error.
... if you do pass this flag, then functions in the object are cloned using the same mechanism as that used in components.utils.exportfunction: // add-on script var addonscriptobject = {
greetme: function() { alert("hello from add-on"); } }; contentwindow.addonscriptobject = cloneinto(addonscriptobject, contentwindow, {clonefunctions: true}); // page script var test = document.getelementbyid("test"); test.addeventlistener("click", function() { window.addonscriptobject.
greetme(); }, false); cloning objects that contain dom elements by default, if the object you clone contains objects that are reflected from c++, such as dom elements, the cloning operation will fail with an error.
Components.utils.exportFunction
example export to global scope this add-on script defines a function, then exports it to a content window: // addon-script.js var salutation = "hello "; function
greetme(user) { return salutation + user; } components.utils.exportfunction(
greetme, contentwindow, {defineas: "foo"}); instead of using defineas, the script can assign the result of exportfunction to an object in the target scope: // addon-script.js var salutation = "hello "; function
greetme(user) { return salutation + user; } contentwindow.foo = components.utils.exportfunction(
greetme, ...
...contentwindow); either way, code running in the content window's scope can now call the function: // page-script.js var
greeting = foo("alice"); console.log(
greeting); // "hello alice" export to an existing local object instead of attaching the function to the target's global window object, the caller can attach it to any other object in the target context.
... suppose the content window defines a local variable bar: // page-script.js var bar = {}; now the add-on script can attach the function to bar: // addon-script.js components.utils.exportfunction(
greetme, contentwindow.bar, {defineas: "
greetme"}); // page-script.js var value = bar.
greetme("bob"); console.log(value); // "hello bob" ...
imgIDecoderObserver
it lets you monitor the pro
gress of loading an image.
...this means that the frames no longer exist in decoded form, and any attempt to access or draw the image will initiate a new series of pro
gressive decode notifications.
...by the time this callback is been called, the size has been set on the container and status_size_available has been set on the associated im
grequest.
nsIAccessibleRetrieval
; nsiaccessible getcachedaccessible(in nsidomnode anode, in nsiweakreference ashell); obsolete since gecko 2.0 nsiaccessnode getcachedaccessnode(in nsidomnode anode, in nsiweakreference ashell); obsolete since gecko 2.0 nsidomnode getrelevantcontentnodefor(in nsidomnode anode); astring getstringeventtype(in unsigned long aeventtype); astring getstrin
grelationtype(in unsigned long arelationtype); astring getstringrole(in unsigned long arole); nsidomdomstringlist getstringstates(in unsigned long astates, in unsigned long aextrastates); methods getaccessiblefor() return an nsiaccessible for a dom node in pres shell 0.
...getstrin
grelationtype() get the type of accessible relation as a string.
... astring getstrin
grelationtype( in unsigned long arelationtype ); parameters arelationtype the accessible relation type constant.
nsICacheEntryDescriptor
inherits from: nsicacheentryinfo last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview void close(); void doom(); void doomandfailpendin
grequests(in nsresult status); string getmetadataelement(in string key); void markvalid(); nsiinputstream openinputstream(in unsigned long offset); nsioutputstream openoutputstream(in unsigned long offset); void setdatasize(in unsigned long size); void setexpirationtime(in pruint32 expirationtime); void setmetadataelement(in string key, in string value); void visitmetadata(in nsicachemetadatavisitor visitor); attributes attribute type description accessgranted nscacheaccessmode ge...
...doomandfailpendin
grequests() this method with the write access can doom the cache entry and choose to fail pending requests.
...void doomandfailpendin
grequests( in nsresult status ); parameters status the access status.
nsIChannel
this is set by clients, who wish to provide a means to receive pro
gress, status and protocol-specific notifications.
... interfaces commonly requested include: nsipro
gresseventsink, nsiprompt, and nsiauthprompt / nsiauthprompt2.
... exceptions thrown ns_error_in_pro
gress if the channel is reopened.
nsIDOMGeoPositionCoords
last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) inherits from: nsisupports attributes attribute type description latitude double the user's current latitude, in de
grees.
... longitude double the user's current longitude, in de
grees.
... heading double the current heading at which the user is moving, in de
grees.
nsIFactory
(see also nsicomponentmanager.createinstance.) void createinstance( in nsisupports aouter, in nsiidref iid, [retval, iid_is(iid)] out nsqiresult result ); parameters aouter pointer to a component that wishes to be ag
gregated in the resulting instance.
... this can be nsnull if no ag
gregation is requested.
... ns_error_no_ag
gregation indicates that ag
gregation is not supported.
nsIFeedResultListener
toolkit/components/feeds/public/nsifeedlistener.idlscriptable this interface should be implemented by programs to receive events from the feed parser as parsing pro
gresses.
...if you don't care about doing pro
gress display or the like, this is all you need to implement in order to receive the parsed feed.
... see also nsifeedpro
gresslistener nsisupports interwiki link ...
nsIFile
to create an nsifile from a path you can use fileutils.jsm: var fileutils = cu.import("resource://
gre/modules/fileutils.jsm").fileutils var nsifile = new fileutils.file( filename ) note: nsilocalfile was merged with this interface in gecko 14.
... the value of this attribute is milliseconds since midnight (00:00:00), january 1, 1970
greenwich mean time (gmt).
... the value of this attribute is milliseconds since midnight (00:00:00), january 1, 1970
greenwich mean time (gmt).
nsIHTMLEditor
void getindentstate( out boolean acanindent, out boolean acanoutdent ); parameters acanindent acanoutdent getinlineproperty() gets ag
gregate properties of the current selection.
... the selection is set to parent-of-aelement with an offset 1
greater than aelement's offset but it enforces the html 4.0 dtd "cancontain" rules, so it should be useful for other elements.
... setcssinlineproperty() setinlineproperty() sets the ag
gregate properties on the current selection.
nsIMsgDBHdr
tyval); void markread(in boolean read); void markflagged(in boolean flagged); void markhasattachments(in boolean hasattachments); void setprioritystring(in string priority); unsigned long orflags(in unsigned long flags); unsigned long andflags(in unsigned long flags); void setreferences(in string references); acstring getstrin
greference(in long refnum); void setrecipientsarray(in string names, in string addresses,in unsigned long numaddresses); void setcclistarray(in string names, in string addresses,in unsigned long numaddresses); void setbcclistarray(in string names, in string addresses,in unsigned long numaddresses);new in thunderbird 3.1 [noscript] void getauthorcollationkey(out oct...
... getstrin
greference() returns one of the references in the list of references.
... acstring getstrin
greference(in long refnum); parameters refnum the index of the reference to return.
nsIMsgDatabase
idbchangelistener instigator); void markoffline(in nsmsgkey key, in boolean offline, in nsidbchangelistener instigator); void setlabel(in nsmsgkey key, in nsmsglabelvalue label); void setstringproperty(in nsmsgkey akey, in string aproperty, in string avalue); void markimapdeleted(in nsmsgkey key, in boolean deleted, in nsidbchangelistener instigator); void applyretentionsettings(in nsims
gretentionsettings ams
gretentionsettings, in boolean adeleteviafolder); boolean hasnew(); void clearnewlist(in boolean notify); void addtonewlist(in nsmsgkey key); void startbatch(); void endbatch(); nsimsgofflineimapoperation getofflineopforkey(in nsmsgkey messagekey, in boolean create); void removeofflineop(in nsimsgofflineimapoperation op); nsisimpleenumerator enumerateofflineops()...
...anumkeys) in nsmsgkey anewhits, out unsigned long anumbadhits, array, size_is(anumbadhits) out nsmsgkey astalehits); void updatehdrincache(in string asearchfolderuri, in nsimsgdbhdr ahdr, in boolean aadd); boolean hdrisincache(in string asearchfolderuri, in nsimsgdbhdr ahdr); attributes attribute type description dbfolderinfo nsidbfolderinfo readonly: firstnew nsmsgkey readonly: ms
gretentionsettings nsims
gretentionsettings msgdownloadsettings nsimsgdownloadsettings lowwaterarticlenum nsmsgkey readonly: highwaterarticlenum nsmsgkey readonly: nextpseudomsgkey nsmsgkey for undo-redo of move pop->imap.
... void applyretentionsettings(in nsims
gretentionsettings ams
gretentionsettings, in boolean adeleteviafolder); hasnew() boolean hasnew(); clearnewlist() void clearnewlist(in boolean notify); addtonewlist() void addtonewlist(in nsmsgkey key); startbatch() batching - can be used to cache file stream for local mail, and perhaps to use the mdb batching mechanism as well.
nsIWebBrowser
the chrome object may optionally implement nsiwebpro
gresslistener instead of explicitly calling addwebbrowserlistener() and removewebbrowserlistener() to register a pro
gress listener object.
...typically this method will be called to register an object to receive nsiwebpro
gresslistener or nsishistorylistener notifications in which case the the iid is that of the interface.
... see also nsibasewindow nsicontextmenulistener nsidomwindow nsiembeddingsitewindow nsiinterfacerequestor nsishistorylistener nsitooltiplistener nsiuricontentlistener nsiweakreference nsiwebbrowserchrome nsiwebbrowserchromefocus nsiwebpro
gresslistener ...
nsIXMLHttpRequestEventTarget
onpro
gress nsidomeventlistener a javascript function object that gets invoked zero or more times, after the loadstart event, but before any abort, error, or load events occur.
... handling the events when the handler functions for these events are called, they receive as a parameter a pro
gressevent, which implements the nsidompro
gressevent interface.
... see also using xmlhttprequest xmlhttprequest nsixmlhttprequest nsidompro
gressevent ...
nsIXPConnect
obsolete since gecko 2.0 jsval varianttojs(in jscontextptr ctx, in jsobjectptr scope, in nsivariant value); void wrapjs(in jscontextptr ajscontext, in jsobjectptr ajsobj, in nsiidref aiid, [iid_is(aiid),retval] out nsqiresult result); void wrapjsag
gregatedtonative(in nsisupports aouter, in jscontextptr ajscontext, in jsobjectptr ajsobj, in nsiidref aiid, [iid_is(aiid),retval] out nsqiresult result); nsixpconnectjsobjectholder wrapnative(in jscontextptr ajscontext, in jsobjectptr ascope, in nsisupports acomobj, in nsiidref aiid); void wrapnativetojsval(in jscontextptr ajscontext, in jsobjectptr ascope, in nsisupports acomobj, ...
... void wrapjs( in jscontextptr ajscontext, in jsobjectptr ajsobj, in nsiidref aiid, [iid_is(aiid),retval] out nsqiresult result ); parameters ajscontext missing description ajsobj missing description aiid missing description result missing description exceptions thrown missing exception missing description wrapjsag
gregatedtonative() wrapjsag
gregatedtonative() is just like wrapjs() except it is used in cases where the jsobject is also ag
gregated to some native xpcom object.
... void wrapjsag
gregatedtonative( in nsisupports aouter, in jscontextptr ajscontext, in jsobjectptr ajsobj, in nsiidref aiid, [iid_is(aiid),retval] out nsqiresult result ); parameters aouter missing description ajscontext missing description ajsobj missing description aiid missing description result missing description exceptions thrown missing exception missing description wrapnative() wrapnative() will create a new jsobject or return an existing one.
Weak reference
this would be possible if the weak reference was actually ag
gregated to the target object.
...this is impossible in our situation, since we explicitly rely on the the fact that part of the `ag
gregate' can be destroyed.
... it's clear, therefore, that the weak reference can't be ag
gregated to the target object.
XPCOM tasks
see bug 23737 work is pro
gressing on this.
... work is pro
gressing on this.
... p3 we need to check for ag
gregation in createinstance().
Debugging Tips
let { ctypes } = components.utils.import("resource://
gre/modules/ctypes.jsm", {}); let i = ctypes.int32_t(10); console.log(i); let point = ctypes.structtype("point", [{ x: ctypes.int32_t }, { y: ctypes.int32_t }]) let p = point(10, 20); console.log(p); let pp = p.address(); console.log(pp); the result will be as following: cdata { value: 10 } cdata { x: 10, y: 20 } cdata { contents: cdata } to see more descriptive information, you can use .tosource().
... let { ctypes } = components.utils.import("resource://
gre/modules/ctypes.jsm", {}); let i = ctypes.int32_t(10); console.log(i.tosource()); let point = ctypes.structtype("point", [{ x: ctypes.int32_t }, { y: ctypes.int32_t }]) let p = point(10, 20); console.log(p.tosource()); let pp = p.address(); console.log(pp.tosource()); the result will be : ctypes.int32_t(10) point(10, 20) point.ptr(ctypes.uint64("0x15fdafb08")) to see the complete type information, you can use .constructor.tosource(), to print the source of ctype.
... let { ctypes } = components.utils.import("resource://
gre/modules/ctypes.jsm", {}); let i = ctypes.int32_t(10); console.log(i.constructor.tosource()); let point = ctypes.structtype("point", [{ x: ctypes.int32_t }, { y: ctypes.int32_t }]) let p = point(10, 20); console.log(p.constructor.tosource()); let pp = p.address(); console.log(pp.constructor.tosource()); the result will be as per the following: ctypes.int32_t ctypes.structtype("point", [{ "x": ctypes.int32_t }, { "y": ctypes.int32_t }]) ctypes.structtype("point", [{ "x": ctypes.int32_t }, { "y": ctypes.int32_t }]).ptr ...
CData
readstrin
greplacemalformed() converts a character array to a javascript string.
... string readstrin
greplacemalformed(); parameters none.
... here is a method to read "malformed", it attempts to do readstring on it, if it errors then it tries to read it in another way, so this is an alternative to readstrin
greplacemalformed, it is an attempt at readingmalformed function readaschar8thenaschar16(stringptr, known_len, jschar) { // when reading as jschar it assumes max length of 500 // stringptr is either char or jschar, if you know its jschar for sure, pass 2nd arg as true // if known_len is passed, then assumption is not made, at the known_len position in array we will see a null char // i tried getting known_len from stringptr but its not possible, it has be known, i trie...
Plug-in Basics - Plugins
advanced: you can determine which directories a gecko program checks with the linux strace command, for example: strace -e open /usr/bin/firefox 2>&1 |
grep plugin but with version firefox-41.0.2 we can not check.
... i found other way how check which paths support firefox : $ strace -y /usr/bin/firefox 2>&1 |
grep acces |
grep -v search |
grep plugins access("/home/user_name/.mozilla/firefox/dqh2nb5k.default-1441864569209/plugins", f_ok) = -1 enoent (no such file or directory) access("/home/user_name/.mozilla/plugins", f_ok) = -1 enoent (no such file or directory) access("/usr/lib64/firefox/browser/plugins", f_ok) = -1 enoent (no such file or directory) access("/usr/lib/mozilla/plugins", f_ok) = 0 this output i have after close firefox.
...although plug-ins are platform-specific, the plug-in api is designed to provide the maximum de
gree of flexibility and to be functionally consistent across all platforms.
Streams - Plugins
the plug-in can set the output parameter type to one of these transmission modes: np_normal: (default): the plug-in can process the data pro
gressively as it arrives from the network or file system through a series of calls to npp_writeready and npp_write.
... after a call to npp_newstream, in which the plug-in requested a normal-mode stream, the browser delivers the data in the stream pro
gressively in a series of calls to npp_writeready and npp_write.
...after a call to npp_newstream, in which the plug-in requested a normal-mode stream, the browser delivers the data in the stream pro
gressively in a series of calls to npp_writeready and npp_write.
Index - Firefox Developer Tools
11 application application, debugging, devtools, firefox, guide, manifests, service workers the application panel provides tools for inspecting and debugging modern web apps (also known as pro
gressive web apps).
... 38 ag
gregate view before firefox 48, this was the default view of a heap snapshot.
... after firefox 48, the default view is the tree map view, and you can switch to the ag
gregate view using the dropdown labeled "view:": 39 basic operations before firefox 50, the memory tool is not enabled by default.
Applying styles and colors - Web APIs
we use the two variables i and j to generate a unique rgb color for each square, and only modify the red and
green values.
...it is then equal to the cosecant of half the minimum inner angle of connecting segments below which no miter join will be rendered, but only a bevel join: miterlimit = max miterlength / linewidth = 1 / sin ( min θ / 2 ) the default miter limit of 10.0 will strip all miters for sharp angles below about 11 de
grees.
...you do this to make very sharp color transitions—in this case from white to
green.
Drawing shapes with canvas - Web APIs
note: angles in the arc function are measured in radians, not de
grees.
... to convert de
grees to radians you can use the following javascript expression: radians = (math.pi/180)*de
grees.
...the endangle starts at 180 de
grees (half a circle) in the first column and is increased by steps of 90 de
grees, culminating in a complete circle in the last column.
Transformations - Web APIs
reminder: angles are in radians, not de
grees.
... to convert, we are using: radians = (math.pi/180)*de
grees.
... function draw() { var ctx = document.getelementbyid('canvas').getcontext('2d'); // left rectangles, rotate from canvas origin ctx.save(); // blue rect ctx.fillstyle = '#0095dd'; ctx.fillrect(30, 30, 100, 100); ctx.rotate((math.pi / 180) * 25); //
grey rect ctx.fillstyle = '#4d4e53'; ctx.fillrect(30, 30, 100, 100); ctx.restore(); // right rectangles, rotate from rectangle center // draw blue rect ctx.fillstyle = '#0095dd'; ctx.fillrect(150, 30, 100, 100); ctx.translate(200, 80); // translate to rectangle center // x = x + 0.5 * width // y = y + 0.5 * height ctx.rotate((math.pi / 180) * 25); // rotate ctx.translate(-200, -80); // translate back // draw
grey rect ctx.fillstyle = '#4d4e53'; ctx.fi...
Canvas API - Web APIs
basic example this simple example draws a
green rectangle onto a canvas.
...the fillstyle property makes the rectangle
green.
... const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.fillstyle = '
green'; ctx.fillrect(10, 10, 150, 100); result reference htmlcanvaselement canvasrenderingcontext2d canvasgradient canvasimagesource canvaspattern imagebitmap imagedata renderingcontext textmetrics offscreencanvas path2d imagebitmaprenderingcontext note: the interfaces related to the webglrenderingcontext are referenced under webgl.
DeviceMotionEventRotationRate - Web APIs
properties devicemotioneventrotationrate.alpha read only the amount of rotation around the z axis, in de
grees per second.
... devicemotioneventrotationrate.beta read only the amount of rotation around the x axis, in de
grees per second.
... devicemotioneventrotationrate.gamma read only the amount of rotation around the y axis, in de
grees per second.
DeviceOrientationEvent.DeviceOrientationEvent() - Web APIs
options optional options are as follows: alpha: a number representing the motion of the device around the z axis, express in de
grees with values ranging from 0 to 360.
... beta: a number representing the motion of the device around the x axis, express in de
grees with values ranging from -180 to 180.
... gamma: a number representing the motion of the device around the y axis, express in de
grees with values ranging from -90 to 90.
Document Object Model (DOM) - Web APIs
lement svghatchpathelement svghkernelement svgimageelement svglineargradientelement svglineelement svgmarkerelement svgmaskelement svgmeshelement svgmeshgradientelement svgmeshpatchelement svgmeshrowelement svgmetadataelement svgmissingglyphelement svgmpathelement svgpathelement svgpatternelement svgpolylineelement svgpolygonelement svgradialgradientelement sv
grectelement svgscriptelement svgsetelement svgsolidcolorelement svgstopelement svgstyleelement svgsvgelement svgswitchelement svgsymbolelement svgtextcontentelement svgtextelement svgtextpathelement svgtextpositioningelement svgtitleelement svgtrefelement svgtspanelement svguseelement svgunknownelement svgviewelement svgvkernelement svg data type interfaces here are th...
...raticrel svgpathsegarcabs svgpathsegarcrel svgpathseglinetohorizontalabs svgpathseglinetohorizontalrel svgpathseglinetoverticalabs svgpathseglinetoverticalrel svgpathsegcurvetocubicsmoothabs svgpathsegcurvetocubicsmoothrel svgpathsegcurvetoquadraticsmoothabs svgpathsegcurvetoquadraticsmoothrel svgpathseglist svgpoint svgpointlist svgpreserveaspectratio sv
grect svgstringlist svgtransform svgtransformlist animated type svganimatedangle svganimatedboolean svganimatedenumeration svganimatedinteger svganimatedlength svganimatedlengthlist svganimatednumber svganimatednumberlist svganimatedpathdata svganimatedpoints svganimatedpreserveaspectratio svganimatedrect svganimatedstring svganimatedtransformlist smil-related interfaces...
... elementtimecontrol timeevent other svg interfaces getsvgdocument shadowanimation svgcolorprofilerule svgcssrule svgdocument svgexception svgexternalresourcesrequired svgfittoviewbox svglangspace svglocatable sv
grenderingintent svgstylable svgtests svgtransformable svgunittypes svguseelementshadowroot svgurireference svgviewspec svgzoomandpan svgzoomevent specifications specification status comment dom living standard ...
EXT_texture_compression_rgtc - Web APIs
rgtc is a block-based texture compression format suited for unsigned and signed red and red-
green textures (red-
green texture compression).
... ext.compressed_red_
green_rgtc2_ext each 4x4 block of texels consists of 64 bits of compressed unsigned red image data followed by 64 bits of compressed unsigned
green image data.
... ext.compressed_signed_red_
green_rgtc2_ext each 4x4 block of texels consists of 64 bits of compressed signed red image data followed by 64 bits of compressed signed
green image data.
FileReader - Web APIs
filereader.onpro
gress a handler for the pro
gress event.
... pro
gress fired periodically as data is read.
... also available via the onpro
gress property.
HTMLElement.hidden - Web APIs
example here's an example where a hidden block is used to contain a thank you message that is displayed after a user a
grees to an unusual request.
... the welcome panel <div id="welcome" class="panel"> <h1>welcome to foobar.com!</h1> <p>by clicking "ok" you a
gree to be awesome every day!</p> <button class="button" id="okbutton">ok</button> </div> this html creates a panel (in a <div> block) that welcomes the user to a site and tells them what they're a
greeing to by clicking the ok button.
...the follow-up panel looks like this in html: <div id="awesome" class="panel" hidden> <h1>thanks!</h1> <p>thank you <strong>so</strong> much for a
greeing to be awesome today!
HTMLInputElement - Web APIs
for checkboxes, the effect is that the appearance of the checkbox is obscured/
greyed in some way as to indicate its state is indeterminate (not checked but not unchecked).
...(if you set this to a negative number, an exception will be thrown.) min string: returns / sets the element's min attribute, containing the minimum (numeric or date-time) value for this item, which must not be
greater than its maximum (max attribute) value.
...if this is not set to any, the control accepts only values at multiples of the step value
greater than the minimum.
MediaTrackConstraints - Web APIs
colortemperature a constraindouble (a double-precision integer) specifying a desired color temperature in de
grees kelvin.
... contrast a constraindouble (a double-precision integer) specifying the de
gree of difference between light and dark.
... saturation a constraindouble (a double-precision integer) specifying the de
gree of color intensity.
Using the Notifications API - Web APIs
this is not only best practice — you should not be spamming users with notifications they didn't a
gree to — but going forward browsers will explicitly disallow notification permission requests not triggered in response to a user gesture.
... var n = new notification('my
great song'); document.addeventlistener('visibilitychange', function() { if (document.visibilitystate === 'visible') { // the tab has become visible so clear the now-stale notification.
...tion // if not, let's ask for it if (window.notification && notification.permission !== "granted") { notification.requestpermission(function (status) { if (notification.permission !== status) { notification.permission = status; } }); } var button = document.getelementsbytagname('button')[0]; button.addeventlistener('click', function () { // if the user a
greed to get notified // let's try to send ten notifications if (window.notification && notification.permission === "granted") { var i = 0; // using an interval cause some browsers (including firefox) are blocking notifications if there are too much in a certain time.
PannerNode.coneOuterGain - Web APIs
rotation in the 'horizontal plane') to an orientation vector const yrotationtovector = de
grees => { // convert de
grees to radians and offset the angle so 0 points towards the listener const radians = (de
grees - 90) * (math.pi / 180); // using cosine and sine here ensures the output values are always normalised // i.e.
...ew oscillatornode(context); osc.type = 'sawtooth'; const panner = new pannernode(context); panner.panningmodel = 'hrtf'; next, we set up the cone of our spatialised sound, determining the area in which it can be heard: // this value determines the size of the area in which the sound volume is constant // if coneinnerangle == 30, it means that when the sound is rotated // by at most 15 (30/2) de
grees either direction, the volume won't change panner.coneinnerangle = 30; // this value determines the size of the area in which the sound volume decreases gradually // if coneouterangle == 45 and coneinnerangle == 30, it means that when the sound is rotated // by between 15 (30/2) and 22.5 (45/2) de
grees either direction, // the volume will decrease gradually panner.coneouterangle = 45; // this va...
... // calculate the vector for no rotation // this means the sound will play at full volume const [x1, y1, z1] = yrotationtovector(0); // schedule the no-rotation vector immediately panner.orientationx.setvalueattime(x1, context.currenttime); panner.orientationy.setvalueattime(y1, context.currenttime); panner.orientationz.setvalueattime(z1, context.currenttime); // calculate the vector for -22.4 de
grees // since our coneouterangle is 45, this will just about make the sound audible // if we set it to +/-22.5, the sound volume will be 0, as the threshold is exclusive const [x2, y2, z2] = yrotationtovector(-22.4); panner.orientationx.setvalueattime(x2, context.currenttime + 2); panner.orientationy.setvalueattime(y2, context.currenttime + 2); panner.orientationz.setvalueattime(z2, context.currentt...
PannerNode.orientationX - Web APIs
rotation in the 'horizontal plane') to an orientation vector const yrotationtovector = de
grees => { // convert de
grees to radians and offset the angle so 0 points towards the listener const radians = (de
grees - 90) * (math.pi / 180); // using cosine and sine here ensures the output values are always normalised // i.e.
...ew oscillatornode(context); osc.type = 'sawtooth'; const panner = new pannernode(context); panner.panningmodel = 'hrtf'; next, we set up the cone of our spatialised sound, determining the area in which it can be heard: // this value determines the size of the area in which the sound volume is constant // if coneinnerangle == 30, it means that when the sound is rotated // by at most 15 (30/2) de
grees either direction, the volume won't change panner.coneinnerangle = 30; // this value determines the size of the area in which the sound volume decreases gradually // if coneouterangle == 45 and coneinnerangle == 30, it means that when the sound is rotated // by between 15 (30/2) and 22.5 (45/2) de
grees either direction, // the volume will decrease gradually panner.coneouterangle = 45; // this va...
... // calculate the vector for no rotation // this means the sound will play at full volume const [x1, y1, z1] = yrotationtovector(0); // schedule the no-rotation vector immediately panner.orientationx.setvalueattime(x1, context.currenttime); panner.orientationy.setvalueattime(y1, context.currenttime); panner.orientationz.setvalueattime(z1, context.currenttime); // calculate the vector for -22.4 de
grees // since our coneouterangle is 45, this will just about make the sound audible // if we set it to +/-22.5, the sound volume will be 0, as the threshold is exclusive const [x2, y2, z2] = yrotationtovector(-22.4); panner.orientationx.setvalueattime(x2, context.currenttime + 2); panner.orientationy.setvalueattime(y2, context.currenttime + 2); panner.orientationz.setvalueattime(z2, context.currentt...
PannerNode.orientationY - Web APIs
rotation in the 'horizontal plane') to an orientation vector const yrotationtovector = de
grees => { // convert de
grees to radians and offset the angle so 0 points towards the listener const radians = (de
grees - 90) * (math.pi / 180); // using cosine and sine here ensures the output values are always normalised // i.e.
...ew oscillatornode(context); osc.type = 'sawtooth'; const panner = new pannernode(context); panner.panningmodel = 'hrtf'; next, we set up the cone of our spatialised sound, determining the area in which it can be heard: // this value determines the size of the area in which the sound volume is constant // if coneinnerangle == 30, it means that when the sound is rotated // by at most 15 (30/2) de
grees either direction, the volume won't change panner.coneinnerangle = 30; // this value determines the size of the area in which the sound volume decreases gradually // if coneouterangle == 45 and coneinnerangle == 30, it means that when the sound is rotated // by between 15 (30/2) and 22.5 (45/2) de
grees either direction, // the volume will decrease gradually panner.coneouterangle = 45; // this va...
... // calculate the vector for no rotation // this means the sound will play at full volume const [x1, y1, z1] = yrotationtovector(0); // schedule the no-rotation vector immediately panner.orientationx.setvalueattime(x1, context.currenttime); panner.orientationy.setvalueattime(y1, context.currenttime); panner.orientationz.setvalueattime(z1, context.currenttime); // calculate the vector for -22.4 de
grees // since our coneouterangle is 45, this will just about make the sound audible // if we set it to +/-22.5, the sound volume will be 0, as the threshold is exclusive const [x2, y2, z2] = yrotationtovector(-22.4); panner.orientationx.setvalueattime(x2, context.currenttime + 2); panner.orientationy.setvalueattime(y2, context.currenttime + 2); panner.orientationz.setvalueattime(z2, context.currentt...
PannerNode.orientationZ - Web APIs
rotation in the 'horizontal plane') to an orientation vector const yrotationtovector = de
grees => { // convert de
grees to radians and offset the angle so 0 points towards the listener const radians = (de
grees - 90) * (math.pi / 180); // using cosine and sine here ensures the output values are always normalised // i.e.
...ew oscillatornode(context); osc.type = 'sawtooth'; const panner = new pannernode(context); panner.panningmodel = 'hrtf'; next, we set up the cone of our spatialised sound, determining the area in which it can be heard: // this value determines the size of the area in which the sound volume is constant // if coneinnerangle == 30, it means that when the sound is rotated // by at most 15 (30/2) de
grees either direction, the volume won't change panner.coneinnerangle = 30; // this value determines the size of the area in which the sound volume decreases gradually // if coneouterangle == 45 and coneinnerangle == 30, it means that when the sound is rotated // by between 15 (30/2) and 22.5 (45/2) de
grees either direction, // the volume will decrease gradually panner.coneouterangle = 45; // this va...
... // calculate the vector for no rotation // this means the sound will play at full volume const [x1, y1, z1] = yrotationtovector(0); // schedule the no-rotation vector immediately panner.orientationx.setvalueattime(x1, context.currenttime); panner.orientationy.setvalueattime(y1, context.currenttime); panner.orientationz.setvalueattime(z1, context.currenttime); // calculate the vector for -22.4 de
grees // since our coneouterangle is 45, this will just about make the sound audible // if we set it to +/-22.5, the sound volume will be 0, as the threshold is exclusive const [x2, y2, z2] = yrotationtovector(-22.4); panner.orientationx.setvalueattime(x2, context.currenttime + 2); panner.orientationy.setvalueattime(y2, context.currenttime + 2); panner.orientationz.setvalueattime(z2, context.currentt...
PannerNode - Web APIs
pannernode.coneinnerangle is a double value describing the angle, in de
grees, of a cone inside of which there will be no volume reduction.
... pannernode.coneouterangle a double value describing the angle, in de
grees, of a cone outside of which the volume will be reduced by a constant value, defined by the coneoutergain attribute.
...for distances
greater than this the volume will be reduced based on rollofffactor and distancemodel.
PointerEvent - Web APIs
pointerevent.tiltx read only the plane angle (in de
grees, in the range of -90 to 90) between the y–z plane and the plane containing both the pointer (e.g.
... pointerevent.tilty read only the plane angle (in de
grees, in the range of -90 to 90) between the x–z plane and the plane containing both the pointer (e.g.
...pen stylus) around its major axis in de
grees, with a value in the range 0 to 359.
Pointer events - Web APIs
tiltx the plane angle (in de
grees, in the range of -90 to 90) between the y–z plane and the plane containing both the pointer (e.g.
... tilty the plane angle (in de
grees, in the range of -90 to 90) between the x–z plane and the plane containing both the pointer (e.g.
...pen stylus) around its major axis in de
grees, with a value in the range 0 to 359.
RTCPeerConnection - Web APIs
for details on the difference, see pending and current descriptions in webrtc connectivity.pendin
gremotedescription read only the read-only property rtcpeerconnection.pendin
gremotedescription returns an rtcsessiondescription object describing a pending configuration change for the remote end of the connection.
...this happens whenever the ag
gregate state of the connection changes.ondatachannel the rtcpeerconnection.ondatachannel property is an eventhandler which specifies a function which is called when the datachannel event occurs on an rtcpeerconnection.
...this state essentially represents the ag
gregate state of all ice transports (which are of type rtcicetransport or rtcdtlstransport) being used by the connection.
SVGLengthList - Web APIs
if the index is
greater than or equal to numberofitems, then the new item is appended to the end of the list.
... a domexception with code index_size_err is raised if the index number is
greater than or equal to numberofitems.
... a domexception with code index_size_err is raised if the index number is
greater than or equal to numberofitems.
SVGNumberList - Web APIs
if the index is
greater than or equal to numberofitems, then the new item is appended to the end of the list.
... a domexception with code index_size_err is raised if index is
greater than or equal to numberofitems.
... a domexception with code index_size_err is raised if index is
greater than or equal to numberofitems.
SVGPathSegList - Web APIs
if the index is
greater than or equal to numberofitems, then the new item is appended to the end of the list.
... a domexception with code index_size_err is raised if index is
greater than or equal to numberofitems.
... a domexception with code index_size_err is raised if index is
greater than or equal to numberofitems.
SVGPointList - Web APIs
if the index is
greater than or equal to numberofitems, then the new item is appended to the end of the list.
... a domexception with code index_size_err is raised if the index number is
greater than or equal to numberofitems.
... a domexception with code index_size_err is raised if the index number is
greater than or equal to numberofitems.
SVGSVGElement - Web APIs
svgsvgelement.viewport an sv
grect containing the position and size of the viewport (implicit or explicit) that corresponds to the given <svg> element.
...the object is initialized to a value of 0 de
grees (unitless).
... svgsvgelement.createsv
grect() creates an sv
grect object outside of any document trees.
SVGStringList - Web APIs
if the index is
greater than or equal to numberofitems, then the new item is appended to the end of the list.
... a domexception with code index_size_err is raised if the index number is
greater than or equal to numberofitems.
... a domexception with code index_size_err is raised if the index number is
greater than or equal to numberofitems.
SubtleCrypto.deriveKey() - Web APIs
ecdh ecdh (elliptic curve diffie-hellman) is a key-a
greement algorithm.
...it's designed to derive key material from some high-entropy input, such as the output of an ecdh key a
greement operation.
... /* derive an aes key, given: - our ecdh private key - their ecdh public key */ function derivesecretkey(privatekey, publickey) { return window.crypto.subtle.derivekey( { name: "ecdh", public: publickey }, privatekey, { name: "aes-gcm", length: 256 }, false, ["encrypt", "decrypt"] ); } async function a
greesharedsecretkey() { // generate 2 ecdh key pairs: one for alice and one for bob // in more normal usage, they would generate their key pairs // separately and exchange public keys securely let aliceskeypair = await window.crypto.subtle.generatekey( { name: "ecdh", namedcurve: "p-384" }, false, ["derivekey"] ); let bobskeypair = await window.crypto.subtle.g...
ValidityState - Web APIs
rangeoverflow read only a boolean that is true if the value is
greater than the maximum specified by the max attribute, or false if it is less than or equal to the maximum.
... rangeunderflow read only a boolean that is true if the value is less than the minimum specified by the min attribute, or false if it is
greater than or equal to the minimum.
... tooshort read only a boolean that is true if the value fails to meet the specified minlength for htmlinputelement or htmltextareaelement objects, or false if its length is
greater than or equal to the minimum length.
WebGLRenderingContext.copyTexImage2D() - Web APIs
possible values: gl.alpha: discards the red,
green and blue components and reads the alpha component.
... gl.rgb: discards the alpha components and reads the red,
green and blue components.
... gl.rgba: red,
green, blue and alpha components are read from the color buffer.
WebGLRenderingContext.readPixels() - Web APIs
possible values: gl.alpha: discards the red,
green and blue components and reads the alpha component.
... gl.rgb: discards the alpha components and reads the red,
green and blue components.
... gl.rgba: red,
green, blue and alpha components are read from the color buffer.
Raining rectangles - Web APIs
l5 canvas.</canvas> body { text-align : center; } canvas { display : block; width : 280px; height : 210px; margin : auto; padding : 0; border : none; background-color : black; } button { display : block; font-size : inherit; margin : auto; padding : 0.6em; } ;(function(){ "use strict" window.addeventlistener("load", setupanimation, false); var gl, timer, rainin
grect, scoredisplay, missesdisplay; function setupanimation (evt) { window.removeeventlistener(evt.type, setupanimation, false); if (!(gl = getrenderingcontext())) return; gl.enable(gl.scissor_test); rainin
grect = new rectangle(); timer = settimeout(drawanimation, 17); document.queryselector("canvas") .addeventlistener("click", playerclick, false); var displays = document...
....queryselectorall("strong"); scoredisplay = displays[0]; missesdisplay = displays[1]; } var score = 0, misses = 0; function drawanimation () { gl.scissor(rainin
grect.position[0], rainin
grect.position[1], rainin
grect.size[0] , rainin
grect.size[1]); gl.clear(gl.color_buffer_bit); rainin
grect.position[1] -= rainin
grect.velocity; if (rainin
grect.position[1] < 0) { misses += 1; missesdisplay.innerhtml = misses; rainin
grect = new rectangle(); } // we are using settimeout for animation.
... var diffpos = [ position[0] - rainin
grect.position[0], position[1] - rainin
grect.position[1] ]; if ( diffpos[0] >= 0 && diffpos[0] < rainin
grect.size[0] && diffpos[1] >= 0 && diffpos[1] < rainin
grect.size[1] ) { score += 1; scoredisplay.innerhtml = score; rainin
grect = new rectangle(); } } function rectangle () { // keeping a reference to the new rectangle object, rather // than using the confusing this...
Writing WebSocket servers - Web APIs
the client will send a pretty standard http request with headers that looks like this (the http version must be 1.1 or
greater, and the method must be get): get /chat http/1.1 host: example.com:8000 upgrade: websocket connection: upgrade sec-websocket-key: dghlihnhbxbszsbub25jzq== sec-websocket-version: 13 the client can solicit extensions and/or subprotocols here; see miscellaneous for details.
...you're still using xml and its syntax, but you're additionally restricted by a structure you a
greed on.
...like a doctype or schema, both parties must a
gree on the subprotocol; unlike a doctype or schema, the subprotocol is implemented on the server and cannot be externally refered to by the client.
Advanced techniques: Creating and sequencing audio - Web APIs
the oscillator now we can create an oscillatornode and set its wave to the one we've created: function playsweep() { let osc = audioctx.createoscillator(); osc.setperiodicwave(wave); osc.frequency.value = 440; osc.connect(audioctx.destination); osc.start(); osc.stop(audioctx.currenttime + 1); } controlling amplitude this is
great, but wouldn't it be nice if we had an amplitude envelope to go with it?
... the "pulse" — low frequency oscillator modulation
great, now we've got our sweep!
... while (nextnotetime < audioctx.currenttime + scheduleaheadtime ) { schedulenote(currentnote, nextnotetime); nextnote(); } timerid = window.settimeout(scheduler, lookahead); } we also need a draw function to update the ui, so we can see when the beat pro
gresses.
Using the Web Audio API - Web APIs
great, now the user can update the track's volume!
...there is also a pannernode, which allows for a
great deal of control over 3d space, or sound spatialisation, for creating more complex effects.
... summary
great!
Web Audio API - Web APIs
web audio api target audience the web audio api can seem intimidating to those that aren't familiar with audio or music terms, and as it incorporates a
great deal of functionality it can prove difficult to get started if you are a developer.
...uilding things with the advance tutorial and others as a guide (the above linked tutorial covers scheduling notes, creating bespoke oscillators and envelopes, as well as an lfo among other things.) if you aren't familiar with the programming basics, you might want to consult some beginner's javascript tutorials first and then come back here — see our beginner's javascript learning module for a
great place to begin.
...this should have shown you how to use the basics, and helped you to understand what it's useful for and how it works.using the web audio api
great!
Window - Web APIs
window.orientation read only returns the orientation in de
grees (in 90 de
gree increments) of the viewport relative to the device's natural orientation.
... window.requestanimationframe() tells the browser that an animation is in pro
gress, requesting that the browser schedule a repaint of the window for the next animation frame.
... event handlers implemented from elsewhere globaleventhandlers.onabort called when the loading of a resource has been aborted, such as by a user canceling the load while it is still in pro
gress windoweventhandlers.onafterprint called when the print dialog box is closed.
XDomainRequest - Web APIs
event handlers xdomainrequest.onpro
gress a handler for when the request has made pro
gress between the send method call and the onload event.
... example if(window.xdomainrequest){ var xdr = new xdomainrequest(); xdr.open("get", "http://example.com/api/method"); xdr.onpro
gress = function () { //pro
gress }; xdr.ontimeout = function () { //timeout }; xdr.onerror = function () { //error occurred }; xdr.onload = function() { //success(xdr.responsetext); } settimeout(function () { xdr.send(); }, 0); } note: the xdr.send() call is wrapped in a timeout (see window.settimeout() to prevent an issue with the interface where some requests are lost if multiple xdom...
... note: the xdr.onpro
gress event should always be defined, even as an empty function, or xdomainrequest may not fire onload for duplicate requests.
Web APIs
elelement htmllegendelement htmllinkelement htmlmapelement htmlmarqueeelement htmlmediaelement htmlmenuelement htmlmenuitemelement htmlmetaelement htmlmeterelement htmlmodelement htmlolistelement htmlobjectelement htmloptgroupelement htmloptionelement htmloptionscollection htmlorforeignelement htmloutputelement htmlparagraphelement htmlparamelement htmlpictureelement htmlpreelement htmlpro
gresselement htmlquoteelement htmlscriptelement htmlselectelement htmlshadowelement htmlslotelement htmlsourceelement htmlspanelement htmlstyleelement htmltablecaptionelement htmltablecellelement htmltablecolelement htmltableelement htmltablerowelement htmltablesectionelement htmltemplateelement htmltextareaelement htmltimeelement htmltitleelement htmltrackelement htmlulistelement htmlunknownelemen...
...ktiming performancemark performancemeasure performancenavigation performancenavigationtiming performanceobserver performanceobserverentrylist performancepainttiming performanceresourcetiming performanceservertiming performancetiming periodicwave permissionstatus permissions photocapabilities plugin pluginarray point pointerevent popstateevent positionoptions processinginstruction pro
gressevent promiserejectionevent publickeycredential publickeycredentialcreationoptions publickeycredentialrequestoptions pushevent pushmanager pushmessagedata pushregistrationmanager pushsubscription r rtcansweroptions rtccertificate rtcconfiguration rtcdtmfsender rtcdtmftonechangeevent rtcdatachannel rtcdatachannelevent rtcdtlstransport rtcerror rtcerrorevent rtcicecandidate rtcice...
...ment svggradientelement svggraphicselement svghkernelement svgimageelement svglength svglengthlist svglineelement svglineargradientelement svgmpathelement svgmaskelement svgmatrix svgmeshelement svgmetadataelement svgmissingglyphelement svgnumber svgnumberlist svgpathelement svgpatternelement svgpoint svgpolygonelement svgpolylineelement svgpreserveaspectratio svgradialgradientelement sv
grect sv
grectelement sv
grenderingintent svgsvgelement svgscriptelement svgsetelement svgsolidcolorelement svgstopelement svgstringlist svgstylable svgstyleelement svgswitchelement svgsymbolelement svgtrefelement svgtspanelement svgtests svgtextcontentelement svgtextelement svgtextpathelement svgtextpositioningelement svgtitleelement svgtransform svgtransformlist svgtransformable svgurireference...
Using the aria-valuemax attribute - Accessibility
description the aria-valuemax attribute is used to define the maximum value allowed for a range widget such as a slider, spinbutton or pro
gressbar.
...the value of aria-valuemax must be
greater than or equal to the value of aria-valuemin.
... <div role="slider" aria-valuenow="4" aria-valuemin="1" aria-valuemax="10"> working examples: pro
gressbar example slider example spinbutton example notes used with aria roles pro
gressbar scrollbar slider spinbutton related aria techniques aria-valuemin aria-valuenow aria-valuetext compatibility tbd: add support information for common ua and at product combinations additional resources wai-aria specification for the aria-valuemax attribute ...
Using the aria-valuenow attribute - Accessibility
the aria-valuenow attribute is used to define the current value for a range widget such as a slider, spinbutton or pro
gressbar.
... value string representation of a number possible effects on user agents and assistive technology for elements with role pro
gressbar and scrollbar, assistive technologies should render the actual value as a percentage, calculated as a position on the range from aria-valuemin to aria-valuemax if both are defined, otherwise the actual value with a percent indicator.
... <div role="slider" aria-valuenow="4" aria-valuemin="1" aria-valuemax="10"> working examples: pro
gressbar example slider example spinbutton example notes used with aria roles pro
gressbar scrollbar slider spinbutton related aria techniques aria-valuemax aria-valuemin aria-valuetext compatibility tbd: add support information for common ua and at product combinations additional resources wai-aria specification for the aria-valuenow attribute ...
Cognitive accessibility - Accessibility
for example, dementia and alzheimer's are permanent cognitive impairments that get pro
gressively worse.
...ent, such as text written using plain-language standards; focusing attention on important content; minimizing distractions, such as unnecessary content or advertisements; providing consistent web page layout and navigation; incorporating familiar elements, such as underlined links that are blue when not visited and purple when visited; dividing processes into logical, essential steps with pro
gress indicators; making website authentication as easy as possible without compromising security; and making forms easy to complete, such as with clear error messages and simple error recovery.
...some users may experience
great difficulty in recognizing written words yet they understand extremely complex and sophisticated documents when the text is read aloud, or when key processes and ideas are illustrated visually.
:indeterminate - CSS: Cascading Style Sheets
the :indeterminate css pseudo-class represents any form element whose state is indeterminate, such as checkboxes which have their html indeterminate attribute set to true, radio buttons which are members of a group in which all radio buttons are unchecked, and indeterminate <pro
gress> elements.
... /* selects any <input> whose state is indeterminate */ input:indeterminate { background: lime; } elements targeted by this selector are: <input type="checkbox"> elements whose indeterminate property is set to true by javascript <input type="radio"> elements, when all radio buttons with the same name value in the form are unchecked <pro
gress> elements in an indeterminate state syntax :indeterminate examples checkbox & radio button this example applies special styles to the labels associated with indeterminate form fields.
...x" id="checkbox"> <label for="checkbox">this label starts out lime.</label> </div> <div> <input type="radio" id="radio"> <label for="radio">this label starts out lime.</label> </div> css input:indeterminate + label { background: lime; } javascript var inputs = document.getelementsbytagname("input"); for (var i = 0; i < inputs.length; i++) { inputs[i].indeterminate = true; } pro
gress bar html <pro
gress> css pro
gress { margin: 4px; } pro
gress:indeterminate { opacity: 0.5; background-color: lightgray; box-shadow: 0 0 2px 1px red; } result specifications specification status comment html living standardthe definition of ':indeterminate' in that specification.
:valid - CSS: Cascading Style Sheets
e" name="fname" type="text" required> <span></span> </div> to provide these indicators, we use the following css: input + span { position: relative; } input + span::before { position: absolute; right: -20px; top: 5px; } input:invalid { border: 2px solid red; } input:invalid + span::before { content: '✖'; color: red; } input:valid + span::before { content: '✓'; color:
green; } we set the <span>s to position: relative so that we can position the generated content relative to them.
... we then absolutely position different generated content depending on whether the form's data is valid or invalid — a
green check or a red cross, respectively.
... accessibility concerns the color
green is commonly used to indicate valid input.
scan - CSS: Cascading Style Sheets
pro
gressive the device draws all lines in sequence.
... all computer screens use pro
gressive scanning.
...if your screen uses pro
gressive scanning, you should see a serif font.</p> css p { font-family: cursive; } @media (scan: interlace) { p { font-family: sans-serif; } } @media (scan: pro
gressive) { p { font-family: serif; } } result specifications specification status comment media queries level 4the definition of 'scan' in that specification.
Mozilla CSS extensions - CSS: Cascading Style Sheets
menuseparator -moz-mac-unified-toolbar -moz-win-borderless-glass -moz-win-browsertabbar-toolbox -moz-win-communications-toolbox -moz-win-glass -moz-win-media-toolbox -moz-window-button-box -moz-window-button-box-maximized -moz-window-button-close -moz-window-button-maximize -moz-window-button-minimize -moz-window-button-restore -moz-window-titlebar -moz-window-titlebar-maximized pro
gressbar pro
gresschunk radio radio-container radio-label radiomenuitem resizer resizerpanel scale-horizontal scalethumb-horizontal scalethumb-vertical scale-vertical scrollbarbutton-down scrollbarbutton-left scrollbarbutton-right scrollbarbutton-up scrollbar-small scrollbarthumb-horizontal scrollbarthumb-vertical scrollbartrack-horizontal scrollbartrack-vertical separator spinne...
...ode :-moz-list-bullet :-moz-list-number :-moz-loading :-moz-locale-dir(ltr) :-moz-locale-dir(rtl) :-moz-lwtheme :-moz-lwtheme-brighttext :-moz-lwtheme-darktext n – r :-moz-native-anonymous :-moz-only-whitespace ::-moz-page ::-moz-page-sequence ::-moz-pagebreak ::-moz-pagecontent :-moz-placeholderobsolete since gecko 51 ::-moz-placeholderdeprecated since gecko 51 ::-moz-pro
gress-bar ::-moz-range-pro
gress ::-moz-range-thumb ::-moz-range-track :-moz-read-only :-moz-read-write s ::-moz-scrolled-canvas ::-moz-scrolled-content ::-moz-scrolled-page-sequence ::-moz-selectiondeprecated since gecko 62 :-moz-submit-invalid :-moz-suppressed ::-moz-svg-foreign-content t ::-moz-table ::-moz-table-cell ::-moz-table-column ::-moz-table-column-group ::-moz...
...-table-outer ::-moz-table-row ::-moz-table-row-group :-moz-tree-cell :-moz-tree-cell-text :-moz-tree-cell-text(hover) :-moz-tree-checkbox :-moz-tree-column :-moz-tree-drop-feedback :-moz-tree-image :-moz-tree-indentation :-moz-tree-line :-moz-tree-pro
gressmeter :-moz-tree-row :-moz-tree-row(hover) :-moz-tree-separator :-moz-tree-twisty u – x :-moz-ui-invalid :-moz-ui-valid :-moz-user-disabled ::-moz-viewport ::-moz-viewport-scroll :-moz-window-inactive ::-moz-xul-anonymous-block at-rules @-moz-document media features -moz-mac-graphite-theme -moz-maemo-classic -moz-device-pixel-ratio -moz-os-version -moz-scrollbar-end-backward -moz-scrollbar-end-forward -moz-scrollbar-start-backward -moz-scrollbar-start-forward -moz-scrollbar-thumb-proportio...
Universal selectors - CSS: Cascading Style Sheets
/* selects all elements */ * { color:
green; } beginning with css3, the asterisk may be used in combination with namespaces: ns|* - matches all elements in namespace ns *|* - matches all elements |* - matches all elements without any declared namespace syntax * { style properties } the asterisk is optional with simple selectors.
... examples css * [lang^=en] { color:
green; } *.warning { color: red; } *#maincontent { border: 1px solid blue; } .floating { float: left } /* automatically clear the next sibling after a floating element */ .floating + * { clear: left; } html <p class="warning"> <span lang="en-us">a
green span</span> in a red paragraph.
... </p> <p id="maincontent" lang="en-gb"> <span class="warning">a red span</span> in a
green paragraph.
WebKit CSS extensions - CSS: Cascading Style Sheets
webkit-border-start-width** -webkit-border-vertical-spacing -webkit-box-align** -webkit-box-direction** -webkit-box-flex-group** -webkit-box-flex** -webkit-box-lines** -webkit-box-ordinal-group** -webkit-box-orient** -webkit-box-pack** -webkit-box-reflect** c -webkit-column-axis -webkit-column-break-after -webkit-column-break-before -webkit-column-break-inside -webkit-column-pro
gression -webkit-cursor-visibility d-i -webkit-dashboard-region -webkit-font-size-delta -webkit-font-smoothing -webkit-highlight -webkit-hyphenate-character -webkit-hyphenate-limit-after -webkit-hyphenate-limit-before -webkit-hyphenate-limit-lines -webkit-initial-letter l -webkit-line-align -webkit-line-box-contain -webkit-line-clamp -webkit-line-grid -webkit-line-snap -webkit...
... deprecated -webkit- properties the following properties were once supported with the -webkit- prefix but are no longer supported in ever
green browsers, with or without the -webkit- prefix.
...-captions-button ::-webkit-media-controls-volume-control-container ::-webkit-media-controls-volume-control-hover-background ::-webkit-media-controls-volume-slider ::-webkit-meter-bar ::-webkit-meter-even-less-good-value ::-webkit-meter-inner-element ::-webkit-meter-optimum-value ::-webkit-meter-suboptimum-value -webkit-media-text-track-container ::-webkit-outer-spin-button ::-webkit-pro
gress-bar ::-webkit-pro
gress-inner-element ::-webkit-pro
gress-value ::-webkit-search-cancel-button ::-webkit-search-results-button ::-webkit-slider-runnable-track ::-webkit-slider-thumb note: generally, if there is an invalid pseudo-element or pseudo-class within in a chain or group of selectors, the whole selector list is invalid.
<angle> - CSS: Cascading Style Sheets
the <angle> css data type represents an angle value expressed in de
grees, gradians, radians, or turns.
... units deg represents an angle in de
grees.
...1rad is 180/π de
grees.
border-left - CSS: Cascading Style Sheets
border-left-style: dotted; border-left: thick
green; ...
... border-left-style: dotted; border-left: none thick
green; ...
... constituent properties this property is a shorthand for the following css properties: border-left-color border-left-style border-left-width syntax border-left: 1px; border-left: 2px dotted; border-left: medium dashed
green; the three values of the shorthand property can be specified in any order, and one or two of them may be omitted.
border-right - CSS: Cascading Style Sheets
border-right-style: dotted; border-right: thick
green; ...
... border-right-style: dotted; border-right: none thick
green; ...
... constituent properties this property is a shorthand for the following css properties: border-right-color border-right-style border-right-width syntax border-right: 1px; border-right: 2px dotted; border-right: medium dashed
green; the three values of the shorthand property can be specified in any order, and one or two of them may be omitted.
border-top - CSS: Cascading Style Sheets
border-top-style: dotted; border-top: thick
green; ...
... border-top-style: dotted; border-top: none thick
green; ...
... constituent properties this property is a shorthand for the following css properties: border-top-color border-top-style border-top-width syntax border-top: 1px; border-top: 2px dotted; border-top: medium dashed
green; the three values of the shorthand property can be specified in any order, and one or two of them may be omitted.
line-height - CSS: Cascading Style Sheets
the first, with the
green border, uses a unitless line-height value.
... html <div class="box
green"> <h1>avoid unexpected results by using unitless line-height.</h1> length and percentage line-heights have poor inheritance behavior ...
...</div> <!-- the first <h1> line-height is calculated from its own font-size (30px × 1.1) = 33px --> <!-- the second <h1> line-height results from the red div's font-size (15px × 1.1) = 16.5px, probably not what you want --> css .
green { line-height: 1.1; border: solid lime
green; } .red { line-height: 1.1em; border: solid red; } h1 { font-size: 30px; } .box { width: 18em; display: inline-block; vertical-align: top; font-size: 15px; } result specifications specification status comment css level 2 (revision 1)the definition of 'line-height' in that specification.
mix-blend-mode - CSS: Cascading Style Sheets
ner normal"> <div class="group"> <div class="item firefox"></div> <svg viewbox="0 0 150 150"> <defs> <lineargradient id="red"> <stop offset="0" stop-color="hsl(0,100%,50%)" /> <stop offset="100%" stop-color="hsl(0,0%,100%)" /> </lineargradient> <lineargradient id="
green"> <stop offset="0" stop-color="hsl(120,100%,50%)" /> <stop offset="100%" stop-color="hsl(120,0%,100%)" /> </lineargradient> <lineargradient id="blue"> <stop offset="0" stop-color="hsl(240,100%,50%)" /> <stop offset="100%" stop-color="hsl(240,0%,100%)" /> </lineargradient...
...} .container { position: relative; background: linear-gradient(to right, #000 0%, transparent 50%, #fff 100%), linear-gradient(to bottom, #ff0 0%, #f0f 50%, #0ff 100%); width: 150px; height: 150px; margin: 0 auto; } .r { transform-origin: center; transform: rotate(-30deg); fill: url(#red); } .g { transform-origin: center; transform: rotate(90deg); fill: url(#
green); } .b { transform-origin: center; transform: rotate(210deg); fill: url(#blue); } .isolate .group { isolation: isolate; } .normal .item { mix-blend-mode: normal; } .multiply .item { mix-blend-mode: multiply; } .screen .item { mix-blend-mode: screen; } .overlay .item { mix-blend-mode: overlay; } .darken .item { mix-blend-mode: darken; } .lighten .item { mix-ble...
...mix-blend-mode: luminosity; } using mix-blend-mode with html html <div class="isolate"> <div class="circle circle-1"></div> <div class="circle circle-2"></div> <div class="circle circle-3"></div> </div> css .circle { width: 80px; height: 80px; border-radius: 50%; mix-blend-mode: screen; position: absolute; } .circle-1 { background: red; } .circle-2 { background: light
green; left: 40px; } .circle-3 { background: blue; left: 20px; top: 40px; } .isolate { isolation: isolate; /* without isolation, the background color will be taken into account */ position: relative; } result using mix-blend-mode with svg svg <svg> <g class="isolate"> <circle cx="40" cy="40" r="40" fill="red"/> <circle cx="80" cy="40" r="40" fill="light
green"/> <circ...
radial-gradient() - CSS: Cascading Style Sheets
the radial-gradient() css function creates an image consisting of a pro
gressive transition between two or more colors that radiate from an origin.
... syntax /* a gradient at the center of its container, starting red, changing to blue, and finishing
green */ radial-gradient(circle at center, red 0, blue,
green 100%) values <position> the position of the gradient, interpreted in the same way as background-position or transform-origin.
... <color-hint> th color-hint is an interpolation hint defining how the gradient pro
gresses between adjacent color stops.
repeating-linear-gradient() - CSS: Cascading Style Sheets
syntax /* a repeating gradient tilted 45 de
grees, starting blue and finishing red, repeating 3 times */ repeating-linear-gradient(45deg, blue, red 33.3%); /* a repeating gradient going from the bottom right to the top left, starting blue and finishing red, repeating every 20px */ repeating-linear-gradient(to left top, blue, red 20px); /* a gradient going from the bottom to top, starting blue, turning
green after 40%, and finishi...
...this gradient doesn't repeat because the last color stop defaults to 100% */ repeating-linear-gradient(0deg, blue,
green 40%, red); /* a gradient repeating five times, going from the left to right, starting red, turning
green, and back to red */ repeating-linear-gradient(to right, red 0%,
green 10%, red 20%); values <side-or-corner> the position of the gradient line's starting point.
... <color-hint> th color-hint is an interpolation hint defining how the gradient pro
gresses between adjacent color stops.
shape-image-threshold - CSS: Cascading Style Sheets
any pixels whose alpha component's value is
greater than the threshold are considered to be part of the shape for the purposes of determining its boundaries.
...the shape is defined by the pixels whose alpha value is
greater than the threshold.
...the gradient is established as a css shape using shape-outside, so that pixels within the gradient which are at least 20% opaque (that is, those pixels with an alpha component
greater than 0.2) are considered part of the shape.
Overview of events and handlers - Developer guides
the pattern starts with an a
greement over a kind of event and: the name string used for the event, the type of the data structure used to represent the key properties of that event, and the javascript object which will 'emit' that event.
... the pattern is implemented by defining a javascript function which takes as an argument the data structure which was a
greed upon, and registering the function using the name string with the object which will emit the event.
... this code relies on the a
greement that there is a kind of event called 'click' which will call any listener (or 'handler') function with an event object argument (actually, in this case a derivative mouseevent object) and which will be fired by html button elements after user interaction.
A hybrid approach - Developer guides
the good responsive web design is
great — right now it is the best technique available for making layouts look as good as possible in a variety of circumstances.
... every page on the site should look
great at a wide variety of resolutions, being built with responsive design in mind.
...subscribe to the mozilla webdev blog for updates about our pro
gress.
disabled - HTML: Hypertext Markup Language
often browsers
grey out such controls and it won't receive any browsing events, like mouse clicks or focus-related ones.
... usability browsers display disabled form controls
greyed as disabled form controls are immutable, won't receive focus or any browsing events, like mouse clicks or focus-related ones, and aren't submitted with the form.
... examples when form controls are disabled, many browsers will display them in a lighter,
greyed-out color by default.
<input type="email"> - HTML: Hypertext Markup Language
this value must also be
greater than or equal to the value of minlength.
... the input will fail constraint validation if the length of the text value of the field is
greater than maxlength utf-16 code units long.
...the value must be a number
greater than zero, and the default value is 20.
<input type="password"> - HTML: Hypertext Markup Language
this value must also be
greater than or equal to the value of minlength.
... the input will fail constraint validation if the length of the text entered into the field is
greater than maxlength utf-16 code units long.
...the value must be a number
greater than zero, and the default value is 20.
<input type="search"> - HTML: Hypertext Markup Language
this value must also be
greater than or equal to the value of minlength.
... the input will fail constraint validation if the length of the text entered into the field is
greater than maxlength utf-16 code units long.
...the value must be a number
greater than zero, and the default value is 20.
<input type="tel"> - HTML: Hypertext Markup Language
this value must also be
greater than or equal to the value of minlength.
... the input will fail constraint validation if the length of the text entered into the field is
greater than maxlength utf-16 code units long.
...the value must be a number
greater than zero, and the default value is 20.
<input type="text"> - HTML: Hypertext Markup Language
this value must also be
greater than or equal to the value of minlength.
... the input will fail constraint validation if the length of the text value of the field is
greater than maxlength utf-16 code units long.
...the value must be a number
greater than zero, and the default value is 20.
<input type="url"> - HTML: Hypertext Markup Language
this value must also be
greater than or equal to the value of minlength.
... the input will fail constraint validation if the length of the text value of the field is
greater than maxlength utf-16 code units long.
...the value must be a number
greater than zero, and the default value is 20.
Using the application cache - HTML: Hypertext Markup Language
the process for loading documents and updating the application cache is specified in
greater detail below: when the browser visits a document that includes the manifest attribute, if no application cache exists, the browser loads the document and then fetches all the entries listed in the manifest file, creating the first version of the application cache.
...for each file fetched into this temporary cache, the browser sends a pro
gress event to the applicationcache object.
... resource categories are described in
greater detail below.
HTTP Index - HTTP
there are ways to develop your website to pro
gressively enhance itself based on the availability of features rather than by targeting specific browsers.
... 231 303 see other http, http status code, reference, redirects the hypertext transfer protocol (http) 303 see other redirect status response code indicates that the redirects don't link to the newly uploaded resources, but to another page (such as a confirmation page or an upload pro
gress page).
...http provides a special kind of response, called http redirect, to perform this operation and is used for numerous goals: temporary redirection while site maintenance is ongoing, permanent redirection to keep external links working after a change of the site's architecture, pro
gress pages when uploading a file, and so on.
Protocol upgrade mechanism - HTTP
this means that a typical request that includes upgrade would look something like: get /index.html http/1.1 host: www.example.com connection: upgrade upgrade: example/1, foo/2 other headers may be required depending on the requested protocol; for example, websocket upgrades allow additional headers to configure details about the websocket connection as well as to offer a de
gree of security in opening the connection.
... sec-websocket-extensions: extensions extensions a comma-separated list of extensions to request (or a
gree to support).
...this header can be used when insecure (http) clients wish to upgrade, in order to offer some de
gree of protection against abuse.
Redirections in HTTP - HTTP
redirects accomplish numerous goals: temporary redirects during site maintenance or downtime permanent redirects to preserve existing links/bookmarks after changing the site's urls, pro
gress pages when uploading a file, etc.
...temporary redirections are also used when creating, updating, or deleting resources, to show temporary pro
gress pages.
...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 pro
gress, or allows to cancel it.
A re-introduction to JavaScript (JS tutorial) - JavaScript
since everything (bar core types) in javascript is an object, any javascript program naturally involves a
great deal of hash table lookups.
...an important detail of nested functions in javascript is that they can access variables in their parent function's scope: function parentfunc() { var a = 1; function nestedfunc() { var b = 4; // parentfunc can't use this return a + b; } return nestedfunc(); // 5 } this provides a
great deal of utility in writing more maintainable code.
... this is also a
great counter to the lure of global variables.
Indexed collections - JavaScript
the simplest way to do this is as follows: let colors = ['red', '
green', 'blue'] for (let i = 0; i < colors.length; i++) { console.log(colors[i]) } if you know that none of the elements in your array evaluate to false in a boolean context—if your array consists only of dom nodes, for example—you can use a more efficient idiom: let divs = document.getelementsbytagname('div') for (let i = 0, div; div = divs[i]; i++) { /* process div in some way */ } thi...
... the foreach() method provides another way of iterating over an array: let colors = ['red', '
green', 'blue'] colors.foreach(function(color) { console.log(color) }) // red //
green // blue alternatively, you can shorten the code for the foreach parameter with es2015 arrow functions: let colors = ['red', '
green', 'blue'] colors.foreach(color => console.log(color)) // red //
green // blue the function passed to foreach is executed once for every item in the array, with the array item passed as the argument to the function.
...ill sort by the last letter of a string: let sortfn = function(a, b) { if (a[a.length - 1] < b[b.length - 1]) return -1; if (a[a.length - 1] > b[b.length - 1]) return 1; if (a[a.length - 1] == b[b.length - 1]) return 0; } myarray.sort(sortfn) // sorts the array so that myarray = ["wind","fire","rain"] if a is less than b by the sorting system, return -1 (or any negative number) if a is
greater than b by the sorting system, return 1 (or any positive number) if a and b are considered equivalent, return 0.
Unicode property escapes - JavaScript
note: as there are many properties and values available, we will not describe them exhaustively here but rather provide various examples rationale before es2018 there was no performance-efficient way to match characters from different sets based on scripts (like macedonian,
greek, georgian etc.) or propertyname (like emoji etc) in javascript.
... for example, a belongs to the latin script and ε to the
greek script.
... let mixedcharacters = "aεЛ"; // using the canonical "long" name of the script mixedcharacters.match(/\p{script=latin}/u); // a // using a short alias for the script mixedcharacters.match(/\p{script=
greek}/u); // ε // using the short name sc for the script property mixedcharacters.match(/\p{sc=cyrillic}/u); // Л for more details, please refer to the unicode specification and the scripts table in the ecmascript specification.
SyntaxError: function statement requires a name - JavaScript
examples statements vs expressions a function statement (or function declaration) requires a name, this won't work: function () { return 'hello world'; } // syntaxerror: function statement requires a name you can use a function expression (assignment) instead: var
greet = function() { return 'hello world'; }; or, you function is maybe intended to be an iife (immediately invoked function expression), which is a function that runs as soon as it is defined.
...this doesn't work: function
greeter() { german: function () { return "moin"; } } // syntaxerror: function statement requires a name this would work, for example: function
greeter() { german: function g() { return "moin"; } } object methods if you intended to create a method of an object, you will need to create an object.
... var
greeter = { german: function () { return "moin"; } }; callback syntax also, check your syntax when using callbacks.
Intl.Locale.prototype.calendar - JavaScript
while most of the world uses the
gregorian calendar, there are several regional calendar eras used around the world.
...5493 b.c.e) ethiopic ethiopic calendar, amete mihret (epoch approx, 8 c.e.)
gregory
gregorian calendar hebrew traditional hebrew calendar indian indian calendar islamic islamic calendar islamic-umalqura islamic calendar, umm al-qura islamic-tbla islamic calendar, tabular (intercalary years [2,5,7,10,13,16,18,21,24,26,29] - astronomical epoch) islamic-civil islamic calendar, tabular (intercalary years ...
...[2,5,7,10,13,16,18,21,24,26,29] - civil epoch) islamic-rgsa islamic calendar, saudi arabia sighting iso8601 iso calendar (
gregorian calendar using the iso 8601 calendar week rules) japanese japanese imperial calendar persian persian calendar roc republic of china calendar the islamicc calendar key has been deprecated.
Object - JavaScript
for example: var person = function(name) { this.name = name; this.cantalk = true; }; person.prototype.
greet = function() { if (this.cantalk) { console.log('hi, i am ' + this.name); } }; var employee = function(name, title) { person.call(this, name); this.title = title; }; employee.prototype = object.create(person.prototype); employee.prototype.constructor = employee; //if you don't set object.prototype.constructor to employee, //it will take pr...
... employee.prototype.
greet = function() { if (this.cantalk) { console.log('hi, i am ' + this.name + ', the ' + this.title); } }; var customer = function(name) { person.call(this, name); }; customer.prototype = object.create(person.prototype); customer.prototype.constructor = customer; //if you don't set object.prototype.constructor to customer, //it will take prototype.constructor of person (parent).
... var bob = new employee('bob', 'builder'); var joe = new customer('joe'); var rg = new employee('red
green', 'handyman'); var mike = new customer('mike'); var mime = new mime('mime'); bob.
greet(); // hi, i am bob, the builder joe.
greet(); // hi, i am joe rg.
greet(); // hi, i am red
green, the handyman mike.
greet(); // hi, i am mike mime.
greet(); specifications specification ecmascript (ecma-262)the definition of 'object' in that specification.
String.prototype.indexOf() - JavaScript
for fromindex values lower than 0, or
greater than str.length, the search starts at index 0 and str.length, respectively.
...on the other hand, 'hello world'.indexof('o', 11) (and with any fromindex value
greater than 11) will return -1, as the search is started at position 11, a position after the end of the string.
...with no fromindex value, or any fromindex value lower than the string's length, the returned value is the same as the fromindex value: 'hello world'.indexof('') // returns 0 'hello world'.indexof('', 0) // returns 0 'hello world'.indexof('', 3) // returns 3 'hello world'.indexof('', 8) // returns 8 however, with any fromindex value equal to or
greater than the string's length, the returned value is the string's length: 'hello world'.indexof('', 11) // returns 11 'hello world'.indexof('', 13) // returns 11 'hello world'.indexof('', 22) // returns 11 in the former instance, js seems to find an empty string just after the specified index value.
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 below.
... any argument value that is less than 0 or
greater than stringname.length is treated as if it were 0 and stringname.length, respectively.
... the substring() method swaps its two arguments if indexstart is
greater than indexend, meaning that a string is still returned.
Digital audio concepts - Web media technologies
all of this means there is a fundamental question that has to be asked and answered before choosing a codec: given the content of the sound, the usage context, and the target audience, is it acceptable to lose some de
gree of audio fidelity, and if so, how much; or is it necessary that, upon decoding the data, the result be identical to the source audio?
...on the other hand, if some de
gree of reduction of audio fidelity is okay, a lossy codec can be used.
...the diagram compares the frequency range of human hearing (
green) to the frequency range of human speech (red) and the range of frequencies in which the majority of human vocalizations lie (yellow).
Codecs used by WebRTC - Web media technologies
to communicate, the two devices need to be able to a
gree upon a mutually-understood codec for each track so they can successfully communicate and present the shared media.
...opus's scalability and flexibility are useful when dealing with audio that may have varying de
grees of complexity.
... audio in general, if it's available and the audio you wish to send has a sample rate
greater than 8 khz, you should strongly consider using opus as your primary codec.
The "codecs" parameter in common media types - Web media technologies
mc the two-digit matrix_coefficients constant selects the matrix coefficients used to convert the red, blue, and
green channels into luma and chroma signals.
... 64 00 pro
gressive high profile (phip) essentially high profile without support for field coding.
...this value indicates which set of coefficients to use when mapping from the native red, blue, and
green primaries to the luma and chroma signals.
Animation performance and frame rate - Web Performance
for animated media, such as video and animated gifs, the main performance concern is file size - downloading the file size fast enough to not negatively impact performance is the
greatest issue.
...the predominance of
green is telling us that we're spending a lot of time painting.
...it will look something like this: waterfall overview compared with the version that uses margin, we're seeing a lot less
green and a lot more pink, which could be either layout or style recalculation.
Performance budgets - Web Performance
a performance budget is a limit to prevent re
gressions.
... their primary goal is to prevent re
gressions, but they can provide insights to forecast trends (i.e.
... file size checks are the first line of defense against re
gressions but translating size back into time metrics can be difficult since development environments could be missing 3rd party scripts, and optimizations commonly provided by a cdn.
Understanding latency - Web Performance
the
greater the number and size of these requests, the
greater the impact of high latency on user experience.
...the
greater the number of hostnames, the more dns lookups need to be done.
...like dns, the
greater the number of server connections needed, the more time is spend creating server connections.
SVG Presentation Attributes - SVG: Scalable Vector Graphics
value: normal|bold|lighter|bolder|100|200|300|400|500|600|700|800|900; animatable: yes glyph-orientation-horizontal deprecated since svg 2 it controls glyph orientation when the inline-pro
gression-direction is horizontal.
... value: <angle>|inherit; animatable: no glyph-orientation-vertical deprecated since svg 2 it controls glyph orientation when the inline-pro
gression-direction is vertical.
... value: <length>|inherit; animatable: yes writing-mode specifies whether the initial inline-pro
gression-direction for a <text> element shall be left-to-right, right-to-left, or top-to-bottom.
clip-path - SVG: Scalable Vector Graphics
k>, <path>, <pattern>, <polygon>, <polyline>, <rect>, <svg>, <symbol>, <text>, <use> html,body,svg { height:100% } <svg viewbox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"> <clippath id="myclip" clippathunits="objectboundingbox"> <circle cx=".5" cy=".5" r=".5" /> </clippath> <!-- top-left: apply a custom defined clipping path --> <rect x="1" y="1" width="8" height="8" stroke="
green" clip-path="url(#myclip)" /> <!-- top-right: apply a css basic shape on a fill-box geometry.
... this is the same as having a custom clipping path with a clippathunits set to objectboundingbox --> <rect x="11" y="1" width="8" height="8" stroke="
green" clip-path="circle() fill-box" /> <!-- bottom-left --> <rect x="1" y="11" width="8" height="8" stroke="
green" clip-path="circle() stroke-box" /> <!-- bottom-right: apply a css basic shape on a view-box geometry.
... this is the same as having a custom clipping path with a clippathunits set to userspaceonuse --> <rect x="11" y="11" width="8" height="8" stroke="
green" clip-path="circle() view-box" /> </svg> usage notes value <url> | [ <basic-shape> || <geometry-box> ] | none default value none animatable yes <geometry-box> an extra information to tell how a <basic-shape> is applied to an element: fill-box indicates to use the object bounding box; stroke-box indicates to use the object bounding box extended with the stroke; view-box indicates to use the nearest svg viewport as the reference box.
rotate - SVG: Scalable Vector Graphics
setting rotate's value to a number specifies a constant rotation, in de
grees, that does not change with the animation.
... examples svg <svg width="400" height="120" viewbox="0 0 480 120" xmlns="http://www.w3.org/2000/svg"> <!-- draw the outline of the motion path in
grey --> <path d="m10,110 a120,120 -45 0,1 110 10 a120,120 -45 0,1 10,110" stroke="light
grey" stroke-width="2" fill="none" id="themotionpath"/> <!-- red arrow which will not rotate --> <path fill="red" d="m-5,-5 l10,0 -5,5 0,0 z"> <!-- define the motion path animation --> <animatemotion dur="6s" repeatcount="indefinite" rotate="0"> <mpath href="#themotionpath"/> </animatemotion> </path> <g transform="translate(100, 0)"> <use href="#themotionpath"/> <!--
green arrow which will rotate along the motion path --> <...
...path fill="
green" d="m-5,-5 l10,0 -5,5 0,0 z"> <!-- define the motion path animation --> <animatemotion dur="6s" repeatcount="indefinite" rotate="auto"> <mpath href="#themotionpath"/> </animatemotion> </path> </g> <g transform="translate(200, 0)"> <use href="#themotionpath"/> <!-- blue arrow which will rotate backwards along the motion path --> <path fill="blue" d="m-5,-5 l10,0 -5,5 0,0 z"> <!-- define the motion path animation --> <animatemotion dur="6s" repeatcount="indefinite" rotate="auto-reverse"> <mpath href="#themotionpath"/> </animatemotion> </path> </g> <g transform="translate(300, 0)"> <use href="#themotionpath"/> <!-- purple arrow which will have a static rotation of 210 de
grees --> <path fill="purple" d="m-5,-...
<feDiffuseLighting> - SVG: Scalable Vector Graphics
<svg width="440" height="140" xmlns="http://www.w3.org/2000/svg"> <!-- no light is applied --> <text text-anchor="middle" x="60" y="22">no light</text> <circle cx="60" cy="80" r="50" fill="
green" /> <!-- the light source is a fepointlight element --> <text text-anchor="middle" x="170" y="22">fepointlight</text> <filter id="lightme1"> <fediffuselighting in="sourcegraphic" result="light" lighting-color="white"> <fepointlight x="150" y="60" z="20" /> </fediffuselighting> <fecomposite in="sourcegraphic" in2="light" operator="arithmetic" k1...
...="1" k2="0" k3="0" k4="0"/> </filter> <circle cx="170" cy="80" r="50" fill="
green" filter="url(#lightme1)" /> <!-- the light source is a fedistantlight element --> <text text-anchor="middle" x="280" y="22">fedistantlight</text> <filter id="lightme2"> <fediffuselighting in="sourcegraphic" result="light" lighting-color="white"> <fedistantlight azimuth="240" elevation="20"/> </fediffuselighting> <fecomposite in="sourcegraphic" in2="light" operator="arithmetic" k1="1" k2="0" k3="0" k4="0"/> </filter> <circle cx="280" cy="80" r="50" fill="
green" filter="url(#lightme2)" /> <!-- the light source is a fespotlight source --> <text text-anchor="middle" x="390" y="22">fespotlight</text> <filter id="lightme3"> <fediffusel...
...ighting in="sourcegraphic" result="light" lighting-color="white"> <fespotlight x="360" y="5" z="30" limitingconeangle="20" pointsatx="390" pointsaty="80" pointsatz="0"/> </fediffuselighting> <fecomposite in="sourcegraphic" in2="light" operator="arithmetic" k1="1" k2="0" k3="0" k4="0"/> </filter> <circle cx="390" cy="80" r="50" fill="
green" filter="url(#lightme3)" /> </svg> expected rendering: live rendering: specifications specification status comment filter effects module level 1the definition of '<fediffuselighting>' in that specification.
Basic Transformations - SVG: Scalable Vector Graphics
use the rotate() transformation for this: <svg width="31" height="31"> <rect x="12" y="-10" width="20" height="20" transform="rotate(45)" /> </svg> this example shows a square that is rotated by 45 de
grees.
... the value for rotate() is given in de
grees.
... <svg width="40" height="50" style="background-color:#bff;"> <rect x="0" y="0" width="10" height="10" transform="translate(30,40) rotate(45)" /> </svg> this example shows again the small square shown above that this time is also rotated by 45 de
grees.
Clipping and masking - SVG: Scalable Vector Graphics
masking on the other hand allows soft edges by taking transparency and
grey values of the mask into account.
...="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <lineargradient id="gradient"> <stop offset="0" stop-color="black" /> <stop offset="1" stop-color="white" /> </lineargradient> <mask id="mask"> <rect x="0" y="0" width="200" height="200" fill="url(#gradient)" /> </mask> </defs> <rect x="0" y="0" width="200" height="200" fill="
green" /> <rect x="0" y="0" width="200" height="200" fill="red" mask="url(#mask)" /> </svg> you see a
green-filled rect at the lowest layer and on top a red-filled rect.
...as a result the pixels of the red rectangle use the luminance value of the mask content as the alpha value (the transparency), and we see a
green-to-red gradient as a result: screenshotlive sample transparency with opacity there is a simple possibility to set the transparency for a whole element.
Getting started - SVG: Scalable Vector Graphics
<svg version="1.1" baseprofile="full" width="300" height="200" xmlns="http://www.w3.org/2000/svg"> <rect width="100%" height="100%" fill="red" /> <circle cx="150" cy="100" r="80" fill="
green" /> <text x="150" y="125" font-size="60" text-anchor="middle" fill="white">svg</text> </svg> copy the code and paste it in a file demo1.svg.
... a
green circle <circle> with a radius of 80px is drawn atop the center of the red rectangle (center of circle offset 150px to the right, and 100px downward from the top left corner).
...the text is positioned by setting an anchor where we want the midpoint to be: in this case, the midpoint should correspond to the center of the
green circle.
2015 MDN Fellowship Program - Archive of obsolete content
the fellow will also share the results of their projects at 1-2 events a
greed upon by the fellow and the program director, as well as on their personal channels (blog, social media, etc).
...fellows will be required to sign mozilla’s fellowship a
greement in order to participate.
SDK and XUL Comparison - Archive of obsolete content
advantages of the sdk simplicity the sdk provides high-level javascript apis to simplify many common tasks in add-on development, and tool support which
greatly simplifies the process of developing, testing, and packaging an add-on.
... advantages of xul-based add-ons user interface flexibility xul overlays offer a
great deal of options for building a ui and integrating it into the browser.
core/heritage - Archive of obsolete content
}) sometimes (single) inheritance is not enough and defining reusable, composable pieces of functionality does a better job: var hex = class({ hex: function hex() { return '#' + this.color; } }); var rgb = class({ red: function red() { return parseint(this.color.substr(0, 2), 16); },
green: function
green() { return parseint(this.color.substr(2, 2), 16); }, blue: function blue() { return parseint(this.color.substr(4, 2), 16); } }); var cmyk = class({ black: function black() { var color = math.max(math.max(this.red(), this.
green()), this.blue()); return (1 - color / 255).tofixed(4); }, magenta: function magenta() { var k = this.black(); return ...
...(((1 - this.
green() / 255).tofixed(4) - k) / (1 - k)).tofixed(4); }, yellow: function yellow() { var k = this.black(); return (((1 - this.blue() / 255).tofixed(4) - k) / (1 - k)).tofixed(4); }, cyan: function cyan() { var k = this.black(); return (((1 - this.red() / 255).tofixed(4) - k) / (1 - k)).tofixed(4); } }); such composable pieces can be combined into a single class definition by passing special implements option to a class function: // composing `color` prototype out of reusable components: var color = class({ implements: [ hex, rgb, cmyk ], initialize: function initialize(color) { this.color = color; } }); var pink = color('ffc0cb'); // rgb pink.red() // => 255 pink.
green() // => 192 pink.blue() /...
jpm-mobile - Archive of obsolete content
$ adb shell pm list packages |
grep org.mozilla package:org.mozilla.firefox $ jpm-mobile run -b firefox # the package name is firefox -v --verbose verbose operation.
... $ adb shell pm list packages |
grep org.mozilla package:org.mozilla.firefox $ jpm-mobile run -b firefox # the package name is firefox -v --verbose verbose operation.
Adding Events and Commands - Archive of obsolete content
for example: <button label="&xulschoolhello.default
greeting.label;" oncommand="xulschoolchrome.browseroverlay.change
greeting(event);" /> then on the javascript code you would have something like this: change
greeting : function(aevent) { // more stuff aevent.target.setattribute("label", somenew
greeting); } the target in this example is the button element, so clicking on it will change its text.
...document.addeventlistener( "xshello
greetingevent", function(aevent) { /* do stuff*/ }, false); be careful when doing this!
Adding windows and dialogs - Archive of obsolete content
the confirmex and prompt methods are the most customizable, allowing a
great deal of options that cover most common dialog cases.
...luckily, you still get a
great deal of help from the platform if you use the dialog element as the document root instead of the more generic window element.
Appendix E: DOM Building and Insertion (HTML & XUL) - Archive of obsolete content
the demo of this is seen at jsfiddle :: jsontodom example var json = ['html:div', {style:'background-color:spring
green'}, ['html:form', {id:'myfirstform'}, ['html:input', {type:'text', value:'my field'}], ['html:button', {id:'mybtn'}, 'button text content'] ], ['html:form', {id:'mysecondform'}, ['html:input', {type:'text', value:'my field for second form'}], ['html:div', {}, 'sub div with textcontent and siblings', ['htm...
...
great care must be taken in these situations.
XPCOM Objects - Archive of obsolete content
*/ _singletonobj: null, createinstance: function(aouter, aiid) { if (aouter != null) { throw cr.ns_error_no_ag
gregation; } // in this case we need a unique instance of the service.
... if (!this._singletonobj) { this._singletonobj = messagecounter; } return this._singletonobj.queryinterface(aiid); } }; if we wanted a class that can be instantiated, instead of a singleton service, the factory would look like this: var counterfactory = { createinstance: function(aouter, aiid) { if (aouter != null) { throw cr.ns_error_no_ag
gregation; } return (new counter()).queryinterface(aiid); } }; the instructions on how to build an idl file are included in the section setting up a development environment.
An Interview With Douglas Bowman of Wired News - Archive of obsolete content
the brains and primary driving force behind this compelling new design is douglas bowman, network design manager for terra lycos, who graciously a
greed to an interview and in the process shed a lot of light on what goes into a standards-based redesign.
...around that time, i started discovering
great sites like glish.com and bluerobot.com.
List of Mozilla-Based Applications - Archive of obsolete content
es emusic download manager music downloader for emusic emusic remote music manager enlis genome personal genome browser esxx javascript application server uses mozilla rhino etna xml wysiwyg editor eudora mail and news application the upcoming version 8 will be based on thunderbird ever
green library automation system evolution email client uses nss exe elearning xhtml editor seems to be using xul for some of their webui facebook open platform facebook open platform the fbml parser used in the platform is based on mozilla code fennec browser for mobiles as mark notes: fennec is not firefox, it’s a completely differ...
...aboration server previously called mozngw linbox kiosk browser (fr) web browser dedicated browser for french prefecture and town hall litl internet computer for home uses spidermonkey and gecko lizilayers gis application 3liz also creates some gis firefox add-ons logitech harmony remote software software for remote control device uses
gre or xulrunner longman dictionary of contemporary english cd-rom lotus notes / sametime groupware the latest version of ibm lotus notes and sametime can embed xul applications lucidor e-book reader lx-office accounting tool looks like it makes at least some use of xul maavis simple ui & communications for accessibility fra...
Bypassing Security Restrictions and Signing Code - Archive of obsolete content
early versions of firefox allowed web sites to se
gregate principals using signed scripts, and request extra permissions for scopes within signed scripts using a function called enableprivelege.
...signed script se
gregation was removed in bug 726125, the enableprivilege prompt was removed in bug 750859, and enableprivilege itself was nerfed in bug 757046.
Structure of an installable bundle - Archive of obsolete content
additional resources (such as chrome:// or resource:// providers can be registered in the chrome.manifest) application-specific /searchplugins/*.src sherlock search plugins firefox 1.5 and
greater.
... /searchplugins/*.xml mozsearch and opensearch plugins firefox 2 and
greater /dictionaries/*.{aff|dic} myspell dictionaries firefox 2 and
greater of course, an extension need not (and normally won't) have all of these directories.
Embedding FAQ - Archive of obsolete content
here is the code : import org.eclipse.swt.swt; import org.eclipse.swt.browser.mozillabrowser; import org.eclipse.swt.browser.pro
gressevent; import org.eclipse.swt.browser.pro
gresslistener; import org.eclipse.swt.widgets.display; import org.eclipse.swt.widgets.shell; import org.mozilla.xpcom.nsidomdocument; public class test { public static void main(string args[]) { display display = new display(); shell shell = new shell(display); final mozillabrowser browser = new mo...
...zillabrowser(shell,wt.border); browser.seturl("http://www.google.com"); browser.addpro
gresslistener(new pro
gresslistener() { public void changed(pro
gressevent event) { } public void completed(pro
gressevent event) { nsidomdocument doc = browser.getdocument(); system.out.println(doc); } }); while (!shell.isdisposed()) { if (!display.readanddispatch()) { display.sleep(); } } } how to map a javascript function to a c++ function define an xpcom class defining the function you'...
Style System Overview - Archive of obsolete content
p { color:
green; font-size: 12em; } selector { property: value; property: value; } css style rules what do style rules mean?
... css style rule representation h1, h2 { color:
green; text-align: right; text-indent: 0; } cssstyleruleimpl cssstyleruleimpl ↓ ↓ ↓ ↓ h1 nscssdeclaration h2 ↙ ↘ nscsscolor — color:
green nscsstext — text-align: right text-indent: 0 css style rule representation problem: the ru...
Tabs - Archive of obsolete content
blah(lengthstringfocusedstringtostringstringpopstringpushstrin
greversestringshiftstringsortstringsplicestringunshiftstring)this is some default text lengththe number of open tabsstring focusedthe current tab in your browserstring tostringstuffstring popstuffstring pushstuffstring reversestuffstring shiftstuffstring sortstuffstring splicestuffstring unshiftstuffstring onready()when the inherited document is fully loaded.
... urlurl to be openedstring jetpack.tabs.open("http://www.example.com/"); blah(lengthstringfocusedstringtostringstringpopstringpushstrin
greversestringshiftstringsortstringsplicestringunshiftstring)this is some default text lengththe number of open tabsstring focusedthe current tab in your browserstring tostringstuffstring popstuffstring pushstuffstring reversestuffstring shiftstuffstring sortstuffstring splicestuffstring unshiftstuffstring onready()when the inherited document is fully loaded.
Space Manager Detailed Design - Archive of obsolete content
the algorithm to provide the band data is as follows: get a vertical offset in world coordinates (instead of frame-relative coordinates) by adding the y-origin of the spacemanager to the y offset passed in if the (adjusted) y value passed in is
greater than the
greatest band being managed, then all space is available so a single trapezoid is returned,marked as available and sized to the maximum size value (passed in).
... if the (adjusted) y offset intersects a band, then gather the banddata: walk the internal banddata list from head to tail for each band data entry, see if the top of the band is
greater than the (adjusted) y offset requested if it is, then band is below the offset requested, so the area between the band and the y offset is available - create a trapezoid with that region and return it.
Tamarin Build System Documentation - Archive of obsolete content
the page is divided into the phase table at the top and the waterfall table below the phase table shows all phases at the top of the page, each slave is shown as a box with a red,
green, or yellow color: red means failed,
green passed, and yellow has warnings.
...cent phase run or click on an individual box to display the test result below the phase table the waterfall displays each buildstep and result the left side contains the time column and the user/revision link to represent the revision triggering a build, mouse over the user to see the revision and submission notes each buildstep run on a slave is a box with color indicating status, red is failed,
green passed, yellow has warnings click the stdio link to see the output click on the build yellow box at the bottom of a set of buildsteps to see the result of all of the buildsteps for a build and the time each buildstep took scroll down to see previous builds triggered at the bottom of the page click on the [next page] link to display more previous builds what are the goals of the build syste...
Tamarin-central rev 703:2cee46be9ce0 - Archive of obsolete content
osdefault-jitinterpretedag
gressive jit mac (os/x 10.4 intel, 2ghz dual core)tc-703 vs tc-700: 0.0%tc-703 vs flash10: 1.1% slowertc-703 vs tc-700: 17.4% fastertc-703 vs flash10: 165.3% fastertc-703 vs tc-700: 0.1% fastertc-703 vs flash10: 0.8% slower windows (xp pro, 2.13ghz dual core)tc-703 vs tc-700: 0.6% fastertc-703 vs flash10: 0.8% fastertc-703 vs tc-700: 16.4% fastertc-703 vs flash10: 148.7% fastertc-70...
... osdefault-jitinterpretedag
gressive jit mac (os/x 10.4 intel, 2ghz dual core)tc-703 vs tc-700: 2.0% smallertc-703 vs tc-663: 7.8% smallertc-703 vs tc-700: 7.1% largertc-703 vs tc-663: 14.6% largertc-703 vs tc-700: 16.4% largertc-703 vs tc-663: 2.1% larger windows (xp pro, 2.13ghz dual core)tc-703 vs tc-700: 3.2% largertc-703 vs tc-663: 7.6% largertc-703 vs tc-700: 3.9% largertc-703 vs tc-663: 12.4% largertc-7...
How to implement a custom XUL query processor component - Archive of obsolete content
here is our sample javascript xpcom query processor: components.utils.import("resource://
gre/modules/xpcomutils.jsm"); // basic wrapper for nsixultemplateresult function templateresult(adata) { this._data = adata; // just make a random number for the id this._id = math.random(100000).tostring(); } templateresult.prototype = { queryinterface: xpcomutils.generateqi([components.interfaces.nsixultemplateresult]), // private storage _data: null, // right now our results are...
...eturn new templateresultset(this._data); }, addbinding: function(arulenode, avar, aref, aexpr) { // add a variable binding for a particular rule, which we aren't using yet }, translateref: function(adatasource, arefstring) { // if we return null, everything stops return new templateresult(null); }, compareresults: function(aleft, aright, avar) { // -1 less, 0 ==, +1
greater var leftvalue = aleft.getbindingfor(avar); var rightvalue = aright.getbindingfor(avar); if (leftvalue < rightvalue) { return -1; } else if (leftvalue > rightvalue) { return 1; } else { return 0; } } }; var components = [templatequeryprocessor]; function nsgetmodule(compmgr, filespec) { return xpcomutils.generatemodule(components); } ...
Methods - Archive of obsolete content
« xul reference home acceptdialog additemtoselection addpane addpro
gresslistener addsession addtab addtabspro
gresslistener advance advanceselectedtab appendcustomtoolbar appendgroup appenditem appendnotification blur cancel canceldialog centerwindowonscreen checkadjacentelement clearresults clearselection click close collapsetoolbar contains decrease decreasepage docommand ensureelementisvisible ensureindexisvisible ensureselectedelementisvisible expandtoolbar extra1 extra2 focus getbrowseratindex getbrowserfordocument getbrowserfortab getbrowserindexfordocument getbutton getdefaultsession geteditor getelementsbyattribute getelementsbyattributens getformattedstring gethtmleditor getindexoffir...
...oveto movetoalertposition onsearchcomplete ontextentered ontextreverted openpopup openpopupatscreen opensubdialog openwindow preferenceforelement reload reloadalltabs reloadtab reloadwithflags removeallitems removeallnotifications removealltabsbut removecurrentnotification removecurrenttab removeitemat removeitemfromselection removenotification removepro
gresslistener removesession removetab removetabspro
gresslistener removetransientnotifications replacegroup reset rewind scrollbyindex scrollbypixels scrolltoindex select selectall selectitem selectitemrange selecttabatindex setselectionrange showpane showpopup sizeto startediting stop stopediting swapdocshells syncsessions timedselect toggleitemsele...
Multiple Rules - Archive of obsolete content
operatordescriptionexample equalsmatch if a value equals anothermatch a specific value lessmatch if a number is less than anothermatch only negative values with one rule, positive values with another
greatermatch if a number is
greater than anotherdisplay values
greater than 1000 differently beforematch if a value comes before another alphabetically aftermatch if a value comes after another alphabetically startswithmatch if a value starts with a specific string endswithmatch if a value ends with a specific string containsmatch if a value contains a substringto highlight results that contain a sea...
...for example, although there is no '
greater or equal' operator, you can acheive this effect with a negated 'less' operator.
Things I've tried to do with XUL - Archive of obsolete content
(to add insult, xul layout code *explicitly* trims off '%' from width/height, thus treating it as pixels.) for reference, i'd like the following to give a vbox that resizes along with the window, with the
green, red, and blue inside boxes always maintaining a 30%-20%-50% ratio to the height of the parent vbox.
... <vbox flex="1"> <box height="30%" flex="1" style="background:
green;"/> <box height="20%" flex="1" style="background: red;"/> <box height="50%" flex="1" style="background: blue;"/> </vbox> workaround: no real good ones; the closest i've gotten is to use a div instead of a box container: <html:div style="-moz-box-flex: 1; width: 100%; height: 100%;"> <box style="height: 30%" flex="1" style="background:
green;"/> <box style="height: 20%" flex="1" style="background:
green;"/> <box style="height: 50%" flex="1" style="background:
green;"/> </html:div> using flex="3" flex="2" flex="5" would give the right display visually for the empty boxes; however, flex only applies to how empty space is allocated.
Localization - Archive of obsolete content
the codes < and > are examples of entities which can be used to place less than and
greater than signs into the text.
...e;" flex="1"/> </treecols> <treechildren> <treeitem> <treerow> <treecell label="mozilla"/> <treecell label="/usr/local"/> <treecell label="&bytes.before;2520&bytes.after;"/> </treerow> </treeitem> </treechildren> </tree> <splitter id="splitbar" resizeafter="grow" style="display: none;"/> <spacer class="titlespace"/> <hbox> <pro
gressmeter id="progmeter" value="50%" style="display: none;"/> <spacer flex="1"/> <button id="find-button" label="&button.find;" oncommand="dofind()"/> <button id="cancel-button" label="&button.cancel;" oncommand="window.close();"/> </hbox> </vbox> </window> each text string has been replaced by an entity reference.
Numeric Controls - Archive of obsolete content
if the user enters a value less or
greater than this value, it will be reset to the minimum or maximum value as necessary.
...this way, you do not have to check for valid dates, ensure that the day isn't
greater than the number of days in the month, handle leap years, and so forth.
Stacks and Decks - Archive of obsolete content
for example, a pro
gress bar might be created using a bar and a label overlaid on top of it.
...shadowing is very useful for creating the disabled appearance of buttons: example 2 : source view <stack style="background-color: #c0c0c0"> <description value="disabled" style="color: white; padding-left: 1px; padding-top: 1px;"/> <description value="disabled" style="color:
grey;"/> </stack> this arrangement of text and shadow colors creates the disabled look under some platforms.
XUL Reference - Archive of obsolete content
ker deck description dialog dialogheader dropmarker editor grid grippy groupbox hbox iframe image key keyset label listbox listcell listcol listcols listhead listheader listitem member menu menubar menuitem menulist menupopup menuseparator notification notificationbox observes overlay page panel param popupset preference preferences prefpane prefwindow pro
gressmeter query queryset radio radiogroup resizer richlistbox richlistitem row rows rule scale script scrollbar scrollbox scrollcorner separator spacer spinbuttons splitter stack statusbar statusbarpanel stringbundle stringbundleset tab tabbrowser (firefox-only starting with firefox 3/gecko 1.9) tabbox tabpanel tabpanels tabs template textnode textbox textbox (firef...
...panel dialogheader notification notificationbox menubar menu menuitem menuseparator menupopup panel tooltip popupset toolbar toolbarbutton toolbargrippy toolbaritem toolbarpalette toolbarseparator toolbarset toolbarspacer toolbarspring toolbox tabbox tabs tab tabpanels tabpanel groupbox caption separator spacer button checkbox colorpicker datepicker menulist pro
gressmeter radio radiogroup scale splitter textbox textbox (firefox autocomplete) textbox (mozilla autocomplete) timepicker description label image listbox listitem listcell listcol listcols listhead listheader richlistbox richlistitem tree treecell treechildren treecol treecols treeitem treerow treeseparator box hbox vbox bbox deck stack grid columns column rows...
resizer - Archive of obsolete content
attributes dir, element, type examples resizing a window <window xmlns="http://www.mozilla.org/keymaster/gat...re.is.only.xul" hidechrome="true" windowtype="main" orient="vertical" sizemode="normal" width="400" height="300" persist="screenx screeny width height"> <hbox flex="1"> <vbox width="2" style="background-color:
grey;"> <resizer dir="topleft" height="2" style="cursor: nw-resize;"/> <resizer dir="left" flex="1" style="cursor: w-resize;"/> <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" hei...
...ght="2" style="background-color:
grey; cursor: s-resize;"/> </vbox> <vbox width="2" style="background-color:
grey; overflow: 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 dir="topleft" style="background: black; -moz-appearance: none;" element="button" left="0" top="0" width="16" height="16"/> <resizer dir="topright" style="background: black; -moz-appearance: none;" element="button" right="0" top="0" width="16" height="16"...
Debugging a XULRunner Application - Archive of obsolete content
add the following code to your xul app: components.utils.import('resource://
gre/modules/devtools/dbg-server.jsm'); if (!debuggerserver.initialized) { debuggerserver.init(); // don't specify a window type parameter below if "navigator:browser" // is suitable for your app.
... debuggerserver.addbrowseractors("myxulrunnerappwindowtype"); } debuggerserver.openlistener(6000); for xulrunner version 37+ the code to enable the debugger has changed: components.utils.import('resource://
gre/modules/devtools/dbg-server.jsm'); if (!debuggerserver.initialized) { debuggerserver.init(); debuggerserver.addbrowseractors(); debuggerserver.allowchromeprocess = true; } let dbglistener=debuggerserver.createlistener(); dbglistener.portorpath=6000; dbglistener.open(); add the following to your prefs.js: (in recent ffox, edit about:config instead) pref("devtools.debugger.remote-enabled", true); in firefox, go to tools > web developer > connect...
Extentsions FAQ - Archive of obsolete content
use wm_copydata how to creating an extension that can replace html code on a specific page that does not use
greasemonkey?
...can "partial" data be read from the cache while the request is still in pro
gress?how difficult is to write a firefox extensions that does intercetp, process and redirect http request?
2006-11-03 - Archive of obsolete content
in ie 7 at least, the use of an ev certificate is tied to the
green background in the url bar.
...if it does make a difference, does it warrant a different ui presentation for these certificates (ie the
green bar).
NPClass - Archive of obsolete content
this field is available only if structversion is np_class_struct_version_enum (2) or
greater.
...this field is available only if structversion is np_class_struct_version_ctor (3) or
greater.
Using Firebug and jQuery (Screencast) - Archive of obsolete content
related links: firebug firefox extension jquery javascript library jquery selector documentation digg learning jquery: jquerify bookmarklet if you wish to use
greasemonkey instead of a bookmarklet, then by all means, please do so.
... you can use the ability to quickly analyze and inspect a page that firebug and jquery affords you, using the results to build a
greasemonkey script, instead of a simple bookmarklet.
Browser Feature Detection - Archive of obsolete content
an experimental approach to discovering de
gree of support for standards.
... it is clear from these test results that netscape 7.0x and mozilla firefox have the
greatest dom support although internet explorer, safari, and opera have sufficient dom css 1 and dom level 1 & 2 document property and method support to enable cross browser web development.
:-moz-system-metric(windows-default-theme) - Archive of obsolete content
example html content <p id="defaultthemes"> this paragraph should have a
green background with luna/royale/zune/aero windows themes and red with other themes.
... </p> <p id="nondefaultthemes"> this paragraph should have a
green background with windows classic or third-party themes and red with other themes.
::-ms-fill-upper - Archive of obsolete content
the ::-ms-fill-upper css pseudo-element is a microsoft extension that represents the upper portion of the track of a slider control; that is, the portion corresponding to values
greater than the value currently selected by the thumb.
... see also ::-ms-fill-lower ::-ms-track ::-ms-thumb ::-moz-range-pro
gress css-tricks: styling cross-browser compatible range inputs with css quirksmode: styling and scripting sliders ...
azimuth - Archive of obsolete content
leftwards: moves the sound counter-clockwise by 20 de
grees, relative to the current angle.
... rightwards: moves the sound clockwise by 20 de
grees, relative to the current angle.
Accessing XML children - Archive of obsolete content
list[1] = "
green"; changes the xml document to read <foo> <bar baz="1">red</bar> <bar baz="2">
green</bar> </foo> special types of nodes xml objects have methods for accessing xml lists of certain common types of nodes as well.
...for instance <pets> <dog color="brown">fido</dog> <cat color="
grey">fluffy</cat> </pets> e4x allows you to access the attributes of a particular element with the .@ operator.
Reference - Archive of obsolete content
inheritance and private variables the guide section links to an interesting document discussing how to create and use private variables in objects, which is
great if you want to protect the various properties within an object from being poked at accidentally.
...if anyone disa
grees, you can always revert.
Archived open Web documentation - Archive of obsolete content
browser feature detection an experimental approach to discovering de
gree of support for standards css obsolete css features displaying notifications (deprecated) firefox offers support for "desktop notifications"; these are notifications that are displayed to the user outside the context of the web content, using the standard notification system provided by the operating system.
... talk:javascript reference the guide section links to an interesting document discussing how to create and use private variables in objects, which is
great if you want to protect the various properties within an object from being poked at accidentally.
Common causes of memory leaks in extensions - Extensions
the following example shows how to unload your modules again (bootstrap.js): components.utils.import("resource://
gre/modules/services.jsm"); function startup(data, reason) { // this assumes your add-on did register some chrome components.utils.import("chrome://myaddon/content/mymodule.jsm"); } function shutdown(data, reason) { // no need to do regular clean up when the application is closed // unless you need to break circular references that might negatively // impact the shutdown process.
... components.utils.unload("chrome://myaddon/content/mymodule.jsm"); } note: modules not belonging to your add-on — such as services.jsm — should not be unloaded by your add-on, as this might cause errors and/or performance re
gressions and will actually increase the memory usage.
Anatomy of a video game - Game development
the same principles as above apply with a slight twist: each frame of animation pro
gresses the cycle and any change in user input is caught at the first available turn.
...time you will need to make hard decisions about your main loop: how to simulate the accurate pro
gress of time.
Index - Game development
61 build the brick field beginner, canvas, games, graphics, javascript, tutorial after modifying the gameplay mechanics, we are now able to lose — this is
great as it means the game is finally feeling more like a game.
... 65 game over beginner, canvas, games, graphics, javascript, tutorial, game over it's fun to watch the ball bouncing off the walls and be able to move the paddle around, but other than that the game does nothing and doesn't have any pro
gression or end goal.
Introduction to game development for the Web - Game development
a
great way to save game state and other information locally so it doesn't have to be downloaded every time it's needed.
...this is a
great way to do anything from downloading new game levels and artwork to transmitting non-real-time game status information back and forth.
Publishing games - Game development
game distribution so you've followed a tutorial or two and created an html5 game — that's
great!
...there are many game promotion techniques — many of them free — so even if you're struggling to make a living as an indie dev with zero budget you can still do a lot to let people know about your
great new game.
Building up a basic demo with the PlayCanvas engine - Game development
it's time to add the ambient light: app.scene.ambientlight = new pc.color(0.2, 0.2, 0.2); the code above assign a dark
grey ambient light for the whole scene.
...we're wrapping the y scale value in math.abs to pass the absolute values (
greater or equal to 0); sin varies between -1 and 0, and for negative values the cylinder scaling can render unexpectedly (in this case it looks black half the time.) now onto the movement part.
Building up a basic demo with Three.js - Game development
let's explain values we are setting for the code above: the value we set for the field of view, 70, is something we can experiment with: the higher the value, the
greater the amount of scene the camera will show.
...we're wrapping the scale value in math.abs, to pass the absolute values,
greater or equal to 0.
GLSL Shaders - Game development
fragment shaders fragment (or texture) shaders define rgba (red, blue,
green, alpha) colors for each pixel being processed — a single fragment shader is called once per pixel.
... the texture shader code now we'll add the texture shader to the code — add the code below to the body's second <script> tag: void main() { gl_fragcolor = vec4(0.0, 0.58, 0.86, 1.0); } this will set an rgba color to recreate the current light blue one — the first three float values (ranging from 0.0 to 1.0) represent the red,
green, and blue channels while the fourth one is the alpha transparency (ranging from 0.0 — fully transparent — to 1.0 — fully opaque).
Collision detection - Game development
for the center of the ball to be inside the brick, all four of the following statements need to be true: the x position of the ball is
greater than the x position of the brick.
... the y position of the ball is
greater than the y position of the brick.
Create the Canvas and draw on it - Game development
we're not limited to rectangles — here's a piece of code for printing out a
green circle.
... try adding this to the bottom of your javascript, saving and refreshing: ctx.beginpath(); ctx.arc(240, 160, 20, 0, math.pi*2, false); ctx.fillstyle = "
green"; ctx.fill(); ctx.closepath(); as you can see we're using the beginpath() and closepath() methods again.
WAI-ARIA basics - Learn web development
accessibility of non-semantic controls: when a series of nested <div>s along with css/javascript is used to create a complex ui-feature, or a native control is
greatly enhanced/changed via javascript, accessibility can suffer — screenreader users will find it difficult to work out what the feature does if there are no semantics or other clues.
... accessibility of non-semantic controls this follows on from the previous section — when a series of nested <div>s along with css/javascript is used to create a complex ui-feature, or a native control is
greatly enhanced/changed via javascript, not only can keyboard accessibility suffer, but screenreader users will find it difficult to work out what the feature does if there are no semantics or other clues.
Advanced styling effects - Learn web development
first, background-blend-mode — here we'll show a couple of simple <div>s, so you can compare the original with the blended version: <div> </div> <div class="multiply"> </div> now some css — we are adding to the <div> one background image and a
green background color: div { width: 250px; height: 130px; padding: 10px; margin: 10px; display: inline-block; background: url(https://mdn.mozillademos.org/files/13090/colorful-heart.png) no-repeat center 20px; background-color:
green; } .multiply { background-blend-mode: multiply; } the result we get is this — you can see the original on the left, and the multiply blend mode on ...
...'ll style this with: article { width: 280px; height: 180px; margin: 10px; position: relative; display: inline-block; } div { width: 250px; height: 130px; padding: 10px; margin: 10px; } article div:first-child { position: absolute; top: 10px; left: 0; background: url(https://mdn.mozillademos.org/files/13090/colorful-heart.png) no-repeat center 20px; background-color:
green; } article div:last-child { background-color: purple; position: absolute; bottom: -10px; right: 0; z-index: -1; } .multiply-mix { mix-blend-mode: multiply; } this gives us the following results: you can see here that the multiply mix blend has blended together not only the two background images, but also the color from the <div> below it too.
CSS building blocks - Learn web development
in this article and its sub-articles, we'll run through the different types in
great detail, seeing how they work.
...as you pro
gress in your study and begin to work with layout, an understanding of writing modes will be very helpful to you, therefore we will introduce them in this article.
Positioning - Learn web development
timeter</dd> <dd>airplane</dd> <dt>b</dt> <dd>bird</dd> <dd>buzzard</dd> <dd>bee</dd> <dd>banana</dd> <dd>beanstalk</dd> <dt>c</dt> <dd>calculator</dd> <dd>cane</dd> <dd>camera</dd> <dd>camel</dd> <dt>d</dt> <dd>duck</dd> <dd>dime</dd> <dd>dipstick</dd> <dd>drone</dd> <dt>e</dt> <dd>egg</dd> <dd>elephant</dd> <dd>e
gret</dd> </dl> the css might look as follows.
...timeter</dd> <dd>airplane</dd> <dt>b</dt> <dd>bird</dd> <dd>buzzard</dd> <dd>bee</dd> <dd>banana</dd> <dd>beanstalk</dd> <dt>c</dt> <dd>calculator</dd> <dd>cane</dd> <dd>camera</dd> <dd>camel</dd> <dt>d</dt> <dd>duck</dd> <dd>dime</dd> <dd>dipstick</dd> <dd>drone</dd> <dt>e</dt> <dd>egg</dd> <dd>elephant</dd> <dd>e
gret</dd> </dl> sticky elements are "sticky" relative to the nearest ancestor with a "scrolling mechanism", which is determined by its ascendants' position property.
Responsive design - Learn web development
whether the user's screen is
greater than a certain width, or a certain resolution) and apply css selectively to style the page appropriately for the user's needs.
...essentially, this describes changing font sizes within media queries to reflect lesser or
greater amounts of screen real estate.
create fancy boxes - Learn web development
i want to be fancy.</div> okay, let's have fun with backgrounds: .fancy { padding : 1em; width: 100%; height: 200px; box-sizing: border-box; /* at the bottom of our background stack, let's have a misty
grey solid color */ background-color: #e4e4d9; /* we stack linear gradients on top of each other to create our color strip effect.
...so let's see an example with a slightly different html snippet (which provide us an opportunity to see how to also handle design localization): <blockquote>people who think they know everything are a
great annoyance to those of us who do.
Styling lists - Learn web development
the unstyled example is available on github (check out the source code too.) the html for our list example looks like so: <h2>shopping (unordered) list</h2> <p>paragraph for reference, paragraph for reference, paragraph for reference, paragraph for reference, paragraph for reference, paragraph for reference.</p> <ul> <li>hummus</li> <li>pita</li> <li>
green salad</li> <li>halloumi</li> </ul> <h2>recipe (ordered) list</h2> <p>paragraph for reference, paragraph for reference, paragraph for reference, paragraph for reference, paragraph for reference, paragraph for reference.</p> <ol> <li>toast pita, leave to cool, then slice down the edge.</li> <li>fry the halloumi in a shallow, non-stick pan, until browned on both sides.</li> <li>wash and...
... chop the salad.</li> <li>fill pita with salad, hummus, and fried halloumi.</li> </ol> <h2>in
gredient description list</h2> <p>paragraph for reference, paragraph for reference, paragraph for reference, paragraph for reference, paragraph for reference, paragraph for reference.</p> <dl> <dt>hummus</dt> <dd>a thick dip/sauce generally made from chick peas blended with tahini, lemon juice, salt, garlic, and other in
gredients.</dd> <dt>pita</dt> <dd>a soft, slightly leavened flatbread.</dd> <dt>halloumi</dt> <dd>a semi-hard, unripened, brined cheese with a higher-than-usual melting point, usually made from goat/sheep milk.</dd> <dt>
green salad</dt> <dd>that
green healthy stuff that many of us just use to garnish kebabs.</dd> </dl> if you go to the live example now and investi...
What is the difference between webpage, website, web server, and search engine? - Learn web development
we'll cover these terms and technologies in more detail as we explore further, but these quick definitions will be a
great start for you: web page a document which can be displayed in a web browser such as firefox, google chrome, opera, microsoft internet explorer or edge, or apple's safari.
...more importantly, since a web server can host multiple websites, the term web server is never used to designate a website, as it could cause
great confusion.
How do I start to design my website? - Learn web development
such a website is the best way to ag
gregate all the stuff we want to publish in a single place (good for goals 3, 5, and 6) and promote interaction between us and the public (good for goals 2 and 4).
...and those small steps will add up to
great achievements.
Tips for authoring fast-loading HTML pages - Learn web development
reduce the number of inline scripts inline scripts can be expensive for page loading since the parser must assume that an inline script could modify the page structure while parsing is in pro
gress.
... choose your user-agent requirements wisely to achieve the
greatest improvements in page design, make sure that reasonable user-agent requirements are specified for projects.
Advanced text formatting - Learn web development
nother fairly common element you'll meet when looking around the web is <abbr> — this is used to wrap around an abbreviation or acronym, and provide a full expansion of the term (included inside a title attribute.) let's look at a couple of examples: <p>we use <abbr title="hypertext markup language">html</abbr> to structure our web documents.</p> <p>i think <abbr title="reverend">rev.</abbr>
green did it in the kitchen with the chainsaw.</p> these will come out looking something like this (the expansion will appear in a tooltip when the term is hovered over): note: there is another element, <acronym>, which basically does the same thing as <abbr>, and was intended specifically for acronyms rather than abbreviations.
...to find way more html elements, you can take a look at our html element reference (the inline text semantics section would be a
great place to start.) in the next article we will look at the html elements you'd use to structure the different parts of an html document.
Adding vector graphics to the Web - Learn web development
make sure your svg code snippet begins and ends with the <svg></svg> tags (don't include anything outside those.) here's a very simple example of what you might paste into your document: <svg width="300" height="200"> <rect width="100%" height="100%" fill="
green" /> </svg> pros putting your svg inline saves an http request, and therefore can reduce a bit your loading time.
...itable code</h2> <p class="a11y-label">press esc to move focus away from the code area (tab inserts a tab character).</p> <textarea id="code" class="input" style="width: 95%;min-height: 200px;"> <svg width="100%" height="100%"> <rect width="100%" height="100%" fill="red" /> <circle cx="100%" cy="100%" r="150" fill="blue" stroke="black" /> <polygon points="120,0 240,225 0,225" fill="
green"/> <text x="50" y="100" font-family="verdana" font-size="55" fill="white" stroke="black" stroke-width="2"> hello!
Responsive images - Learn web development
you might think that vector images would solve these problems, and they do to a certain de
gree — they are small in file size and scale well, and you should use them wherever possible.
...vector images are
great for simple graphics, patterns, interface elements, etc., but it starts to get very complex to create a vector-based image with the kind of detail that you'd find in say, a photo.
Introducing asynchronous JavaScript - Learn web development
' + eachname); }); in this example we loop through an array of
greek gods and print the index numbers and values to the console.
... conclusion in its most basic form, javascript is a synchronous, blocking, single-threaded language, in which only one operation can be in pro
gress at a time.
Looping code - Learn web development
at this point, you probably understand the high-level concepts behind loops, but you are probably thinking "ok,
great, but how does this help me write better javascript code?" as we said earlier, loops are all to do with doing the same thing over and over again, which is
great for rapidly completing repetitive tasks.
...but it's not quite that easy — we don't want to let phil and lola in because they are
greedy and rude, and always eat all the food!
Test your skills: Strings - Learn web development
use a combination of the variables you have and available string properties/methods to trim down the original quote to "i do not like
green eggs and ham.", and store it in a variable called revisedquote.
... in fixedquote, replace "
green eggs and ham" with another food that you really don't like.
What went wrong? Troubleshooting JavaScript - Learn web development
an error message to indicate what's gone wrong: "typeerror: guesssubmit.addeventlistener is not a function" a "learn more" link that links through to an mdn page that explains what this error means in
greater detail.
...it won't always be that simple to work out what's wrong in your code, but at least this will save you a few hours of sleep and allow you to pro
gress a bit faster when things don't turn out right, especially in the earlier stages of your learning journey.
Ember interactivity: Events, classes and state - Learn web development
coming back to our browser tab with the app running, we can type whatever we want, and when we hit enter we'll be
greeted with an alert message telling us exactly what we typed.
...you should find that now the text submitted in the <input> is properly reflected in the ui: summary ok, so that's
great pro
gress for now.
Ember app structure and componentization - Learn web development
t let's plan on splitting the html out into the following components: the component groupings are as follows: the main input / "new-todo" (red in the image) the containing body of the todo list + the mark-all-complete button (purple in the image) the mark-all-complete button, explicitly highlighted for reasons given below (yellow in the image) each todo is an individual component (
green in the image) the footer (blue in the image) something odd to note is that the mark-all-complete checkbox (marked in yellow), while in the "main" section, is rendered next to the "new-todo" input.
... summary
great!
Getting started with React - Learn web development
</p> </header> </div> ); } when you save, your browser should display "hello, react!" instead of "hello, world!" variables are convenient, but the one we've just set doesn’t make
great use of react's features.
... function app(props) { const subject = props.subject; return ( // return statement ); } when you save, the app should now
greet you with "hello, clarice!".
React resources - Learn web development
in more complex apps, this view is
great for understanding parent/child relationships at a glance.
...the official react docs are a
great place to start learning about them.
Introduction to automated testing - Learn web development
we a
gree — testing all the things we've looked at in previous articles manually can be a real pain.
...this is a
great way to perform tasks like linting and minifying code, adding in css prefixes or transpiling nascent javascript features for maximum cross-browser reach, and so on.
Deploying our app - Learn web development
deploying to hosting tends to be at the tail-end of the project life cycle, but with services such as netlify bringing down the cost of deployments (both in financial terms and also the time required to actually deploy) it's possible to deploy during development to either share work in pro
gress or to have a pre-release for some other purpose.
...there’s many
great tutorials and books available, and our git and github page is a good place to start.
Accessibility API cross-reference
<p> <p> shows percentage completion for task pro
gressbar pro
gress_bar n/a pro
gressbar page showing properties of something propertypage n/a n/a n/a your average, run-of-the-mill button pushbutton push_button push_button button <button> only one radio button in a group is selectable.
... n/a n/a aria-errormessage an item that has been expanded, such as a tree item or accordion expanded expanded expanded aria-expanded=true indicates this object allows pro
gressive disclosure of its children.
Links and Resources
dive into accessibility - another
great, easy-to-understand resource on accessible website authoring.
...this tool will measure accurately the de
gree of legibility of a webpage.
Mozilla's Section 508 Compliance
(k) software shall not use flashing or blinking text, objects, or other elements having a flash or blink frequency
greater than 2 hz and lower than 55 hz.
...gnopernicus support in beta no screen reader support on mac os x b) at least one mode of operation and information retrieval that does not require visual acuity
greater than 20/70 shall be provided in audio and enlarged print output working together or independently, or support for assistive technology used by people who are visually impaired shall be provided.
Mozilla’s UAAG evaluation report
(p1) vg uses title bar color and focus indicator to indicate with view port has focus the currently focused content frame has a dotted outline, until a key is pressed or scrolling occurs the focus appearance is not configurable 10.8 indicate rendering pro
gress.
... (p3) vg a pro
gress bar and status bar message indicates loading pro
gress the scroll bar indicates how far into the document the current graphical view is the size of the current document is in the page info screen, sometimes it says unavailable guideline 11.
Creating Sandboxed HTTP Connections
} gchannel = null; }, // nsichanneleventsink onchannelredirect: function (aoldchannel, anewchannel, aflags) { // if redirecting, store the new channel gchannel = anewchannel; }, // nsiinterfacerequestor getinterface: function (aiid) { try { return this.queryinterface(aiid); } catch (e) { throw components.results.ns_nointerface; } }, // nsipro
gresseventsink (not implementing will cause annoying exceptions) onpro
gress : function (arequest, acontext, apro
gress, apro
gressmax) { }, onstatus : function (arequest, acontext, astatus, astatusarg) { }, // nsihttpeventsink (not implementing will cause annoying exceptions) onredirect : function (aoldchannel, anewchannel) { }, // we are faking an xpcom interface, so we need to implement q...
...i queryinterface : function(aiid) { if (aiid.equals(components.interfaces.nsisupports) || aiid.equals(components.interfaces.nsiinterfacerequestor) || aiid.equals(components.interfaces.nsichanneleventsink) || aiid.equals(components.interfaces.nsipro
gresseventsink) || aiid.equals(components.interfaces.nsihttpeventsink) || aiid.equals(components.interfaces.nsistreamlistener)) return this; throw components.results.ns_nointerface; } }; quick note: storing the channel in a global (especially in an extension) isn't a good idea, but was done to make the code easier to read.
Debugging on Mac OS X
(these will then be pro
gressively added under the root item <project-name> in the left-hand pane.
... note that subdirectories may initially appear to be empty, but they too will pro
gressively be populated as xcode processes the sourse files.
Simple Instantbird build
windows build prerequisites gnu/linux build prerequisites mac os x build prerequisites tip: after completing setup for your os, and before you get the source, you can opt to add the pro
gressextension to your mercurial.ini (for windows) or .hgrc (for *nix / mac) file.
...see: configure mercurial .hgrc file for pro
gress extension.
Contributing to the Mozilla code base
fix your pet peeve if there's something you'd like to fix about firefox, thunderbird, or your other favorite mozilla application, this can be a
great place to start.
...they're all about small changes, sometimes as little as a few lines, but they're a
great way to learn about setting up your development environment, navigating bugzilla, and making contributions to the mozilla codebase.
Error codes returned by Mozilla APIs
ns_error_no_ag
gregation (0x80040110) ns_error_not_available (0x80040111) an operation could not be completed because some other necessary component or resource was not available.
... ns_error_connection_refused (0x804b000d) ns_error_net_timeout (0x804b000e) ns_error_in_pro
gress (0x804b000f) the requested action could not be completed while the object is busy.
Performance best practices for Firefox front-end engineers
for a very down-to-earth explanation of the style, layout, paint and composite steps of the pipeline, this hacks blog post does a
great job of explaining it.
...this is
great, because it reduces build times, and means we can do our work faster.
CSS -moz-bool-pref() @supports function
html <div id="pref-test"> this will have a
green background if the <code>test</code> preference is enabled.
... </div> css @supports -moz-bool-pref("test") { #pref-test { background:
green; } } @supports not -moz-bool-pref("test") { #pref-test { background: red; } } result ...
HTTP Cache
ce wrapping following four arguments into a single one: private-browsing boolean flag anonymous load boolean flag app id number (0 for no app) is-in-browser boolean flag helper functions to create nsiloadcontextinfo objects: c++ consumers: functions at loadcontextinfo.h exported header js consumers: resource://
gre/modules/loadcontextinfo.jsm module methods two storage objects created with the same set of nsiloadcontextinfo arguments are identical, containing the same cache entries.
...current behavior is simpler and causes a serious memory consumption re
gression (bug 975367).
Internationalized Domain Names (IDN) Support in Mozilla Browsers
during the discussion phase of the idn protocols development, there were some competing ascii-compatible encoding (ace) schemes proposed but an a
greement was reached eventually to standardize on a type of ace called "punycode".
... as an example, an output string to be sent to a dns server for a japanese domain name, "http://ジェーピーニック.jp", will look like the following in ace form: http://xn--hckqz9bzb1cyrb.jp domain name registration after the technical standards were established by ietf, the last remaining issue was for domain name registrars to a
gree on an international guideline on the use of idn characters.
AddonInstall
pro
gress integer the pro
gress of any necessary downloads.
... maxpro
gress integer the expected size of any necessary downloads or -1 if unknown.
CustomizableUI.jsm
negative values or values
greater than the number of widgets will be interpreted to mean moving the widget to respectively the first or last position.
...ser.selectedtab.linkedbrowser.contentwindow; //this is the html window of the currently selected tab thiswindowsselectedtabswindow.alert('alert from html window of selected tab'); thisdomwindow.alert('alert from xul window'); } }); //end - use customizableui.jsm to create the widget //start - use style sheet service to style our widget to give it an icon cu.import('resource://
gre/modules/services.jsm'); var sss = cc['@mozilla.org/content/style-sheet-service;1'].getservice(ci.nsistylesheetservice); var css = ''; css += '@-moz-document url("chrome://browser/content/browser.xul") {'; css += ' #id_of_my_widget_within_customizableui_and_dom {'; css += ' list-style-image: url("chrome://branding/content/icon16.png")'; //a 16px x 16px icon for when in toolbar css += ' ...
DeferredTask.jsm
to use it, you first need to import the code module into your javascript scope: components.utils.import("resource://
gre/modules/deferredtask.jsm"); use this, for instance, if you write data to a file and you expect that you may have to rewrite data very soon afterwards.
...ending write is processed, using the latest version of the data if the timer is armed: asyncshutdown.profilebeforechange.addblocker( "example service: shutting down", () => savedeferredtask.finalize() ); instead, if you are going to delete the saved data from disk anyways, you might as well prevent any pending write from starting, while still ensuring that any write that is currently in pro
gress terminates, so that the file is not in use any more: savedeferredtask.disarm(); savedeferredtask.finalize().then(() => os.file.remove(...)) .then(null, components.utils.reporterror); ...
Interfacing with the Add-on Repository
importing the repository code module before you can use the add-on repository api, you need to import the code module: components.utils.import("resource://
gre/modules/addonrepository.jsm"); having done this, you can then access the api through the resulting addonrepository object.
...the most common cause of failure (other than the search url preference being incorrect) is if there is already a pending request, since only one request can be in pro
gress at a time.
JNI.jsm
to use it, you first need to import the code module into your javascript scope: components.utils.import("resource://
gre/modules/jni.jsm"); this module was available in firefox since version 17.
...this shows how to get the paths to the "pictures" folder: components.utils.import("resource://
gre/modules/jni.jsm"); components.utils.import("resource://
gre/modules/osfile.jsm"); // because we use os.path.join in this example var my_jenv = null; try { my_jenv = jni.getforthread(); var sig = { environment: 'landroid/os/environment;', string: 'ljava/lang/string;', file: 'ljava/io/file;' }; var environment = jni.loadclass(my_jenv, sig.environment.substr...
Log.jsm
pro
gress is tracked in bugzilla using dependencies of bug 451283.
...to use it, you first need to import the code module into your javascript scope: components.utils.import("resource://
gre/modules/log.jsm"); basic usage components.utils.import("resource://
gre/modules/log.jsm"); // get a logger, give it a name unique to this chunk of code.
WebChannel.jsm
components.utils.import("resource://
gre/modules/webchannel.jsm"); constructor webchannel(string webchannelid, nsiuri originorpermission); 2nd argument is a valid origin that should be part of requests for this channel.
... examples setting up a webchannel between chrome code and a webpage chrome code let channel = new webchannel(webchannelid, services.io.newuri("https://mozilla.org", null, null)); // receive messages channel.listen(function (webchannelid, message, sendercontext) { // send messages channel.send({ data: {
greeting: true } }, sendercontext); }); webpage code receive messages from an existing webchannel in content code window.addeventlistener("webchannelmessagetocontent", function(e) { // receive messages console.log(e.detail); }, true); send messages to an existing webchannel in chrome code window.dispatchevent(new window.customevent("webchannelmessagetochrome", { detail: { id: we...
source-editor.jsm
it may have the following properties: property type description backwards boolean if true, the search begins at start (or the end of the text, if start is not specified) and pro
gresses toward the beginning of the text.
... otherwise the search pro
gresses forward.
Initial setup
for now, simply be aware that these will become important as your efforts pro
gress.
... locale-specific bugzilla component having a bugzilla component specific to your locale will help us to track your localization's pro
gress from first steps to official release.
Creating localizable web applications
'</p>'; one might argue that adding plural support here is not necessary because, for instance, the number of daily users in the example above will always be
greater than 1, i.e.
...while this is true for english, it should be noted that some languages require different forms of strings for numbers
greater than 1 as well.
Mozilla projects on GitHub
this is a
great place to start looking for any projects not listed below.
... opennews the knight-mozilla open news project, helping the journalism/technology community do
great work through shared knowledge and code.
Activity Monitor, Battery Status Menu and top
using the high-performance gpu can
greatly increase power consumption, and should be avoided whenever possible.
... ioreg -l |
grep board-id in contrast, on mac os 10.9 it is computed via a simpler machine model-independent formula that only factors in cpu usage and wakeup frequency.
Automated performance testing and sheriffing
currently we ag
gregate this information in the perfherder web application where performance sheriffs watch for significant re
gressions, filing bugs as appropriate.
... current list of automated systems we are tracking (at least to some de
gree): talos: the main performance system, run on virtually every check-in to an integration branch build metrics: a grab bag of performance metrics generated by the build system arewefastyet: a generic javascript and web benchmarking system areweslimyet: a memory benchmarking tool ...
Profiling with Xperf
you'll have to a
gree to a eula for the microsoft symbols -- if you're not prompted for this, then something isn't configured right in your symbol path.
...also experiment with turning columns on and off; removing a column will allow data to be ag
gregated without considering that column's contributions.
TimerFirings logging
cat out |
grep timer | sort | uniq -c | sort -r -n the following is sample output from this command.
... it is sometimes useful to pre-process the output by stripping out certain parts of each line before doing this ag
gregation step, for example, by inserting one or more of the following commands into the command pipeline.
about:memory
├───40,214,384 b (04.17%) -- add-ons │ ├──21,184,320 b (02.20%) ++ {d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}/js-non-window/zones/zone(0x100496800)/compartment([system principal], jar:file:///users/njn/library/application%20support/firefox/profiles/puna0zr8.new/extensions/%7bd10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d%7d.xpi!/bootstrap.js (from: resource://
gre/modules/addons/xpiprovider.jsm:4307)) │ ├──11,583,312 b (01.20%) ++ jid1-xufzosoflzsoxg@jetpack/js-non-window/zones/zone(0x100496800) │ ├───5,574,608 b (00.58%) -- {59c81df5-4b7a-477b-912d-4e0fdf64e5f2} │ │ ├──5,529,280 b (00.57%) -- window-objects │ │ │ ├──4,175,584 b (00.43%) ++ top(chrome://chatzilla/content/chatzilla.xul, id=4293) │ │...
...for example, in the "explicit" tree all dom and layout measurements are broken down by window by window, but in "other measurements" those measurements are ag
gregated into totals for the whole browser, as the following example shows.
browser.urlbar.formatting.enabled
the preference browser.urlbar.formatting.enabled controls whether the domain name including the top level domain is highlighted in the address bar by coloring it black and the other parts
grey.
... type:boolean default value: true exists by default: yes application support:firefox 6.0 status: active; last updated 2012-04-03 introduction: pushed to nightly on 2011-05-03 bugs: bug 451833 values true (default) the domain name including the top level domain is highlighted in the address bar by coloring it black and the other parts
grey.
Preference reference
"search <search engine> for <selected text>" opening a new tab will give focus to it and load it in the foreground or keep focus on the current tab and open it in the background.browser.urlbar.formatting.enabledthe preference browser.urlbar.formatting.enabled controls whether the domain name including the top level domain is highlighted in the address bar by coloring it black and the other parts
grey.browser.urlbar.trimurlsthe preference browser.urlbar.trimurls controls whether the protocol http and the trailing slash behind domain name (if the open page is exactly the domain name) are hidden.dom.event.clipboardevents.enableddom.event.clipboardevents.enabled lets websites get notifications if the user copies, pastes, or cuts something from a web page, and it lets them know which part of the ...
...by default, the reader mode in firefox mobile is only enabled if the memory is
greater than 384mb.ui.alertnotificationoriginui.alertnotificationorigin controls the position and direction from which popup notifications invoked by nsialertsservice are sliding in.ui.spellcheckerunderlineui.spellcheckerunderline holds the colour which is used to underline words not recognized by the spellchecker.ui.spellcheckerunderlinestyleui.spellcheckerunderlinestyle holds the style which is use...
AsyncTestUtils extended framework
your test functions need to a
gree to the following contract: the asynchronous function contract a function should yield false or return false when something asynchronous is going on.
...if you pass a number
greater than 1, then you get a direct reply-chain that long.
NSPR Contributor Guide
license under mpl or gpl when you contribute material to nspr, you a
gree to allow your contribution to be licensed under the mpl or gpl.
... generally useful platform abstractions you a
gree to sustain, bug fix may rely on the nspr api may not rely on any other library api new platform ports all nspr api items must be implemented platform specific headers in pr/include/md/_platformname.[h!cfg] platform specific code in pr/src/md/platform/*.c make rules in config/_platform.mk documentation the files for nspr's documentation are maintained using a proprietary word processi...
PR_EnterMonitor
if the monitor's entry count is
greater than zero and the calling thread is recognized as the holder of the lock, pr_entermonitor increments the entry count by one and returns.
... if the entry count is
greater than zero and the calling thread is not recognized as the holder of the lock, the thread is blocked until the entry count reaches zero.
PR_GetConnectStatus
if pr_geterror returns pr_in_pro
gress_error, the nonblocking connection is still in pro
gress and has not completed yet.other errors indicate that the connection has failed.
... description after pr_connect on a nonblocking socket fails with pr_in_pro
gress_error, you may wait for the connection to complete by calling pr_poll on the socket with the in_flags pr_poll_write | pr_poll_except.
An overview of NSS Internals
because public key encryption is more expensive (more calculations required) than symmetric encryption (where both parties use the same key), a key a
greement protocol will be executed, where the public and private keys are used to proof and verify the exchanged initial information.
... once the key a
greement is done, a symmetric encryption will be used (until a potential re-handshake on an existing channel).
4.3.1 Release Notes
jss only supports the native threading model (no
green threads).
...to obtain the version info from the jar file use, "system.out.println(org.mozilla.jss.cryptomanager.jar_jss_version)" and to check the shared library: strings libjss4.so |
grep -i header feedback bugs discovered should be reported by filing a bug report with bugzilla.
4.3 Release Notes
jss only supports the native threading model (no
green threads).
... to obtain the version info from the jar file use, "system.out.println(org.mozilla.jss.cryptomanager.jar_jss_version)" and to check the shared library: strings libjss4.so |
grep -i header feedback bugs discovered should be reported by filing a bug report with bugzilla.
NSS Key Log Format
exporter_secret: the hex-encoded exporter secret (for tls 1.3, used for 1-rtt keys in older quic drafts) the rsa form allows ciphersuites using rsa key-a
greement to be logged and was the first form supported by wireshark 1.6.0.
... it has been superseded by client_random which also works with other key-a
greement algorithms (such as those based on diffie-hellman) and is supported since wireshark 1.8.0.
NSS 3.14.1 release notes
bug 812399 - in nss 3.14, a re
gression caused bug 641052 / cve-2011-3640 to be re-introduced under certain situations.
... this re
gression only affected applications that initialize nss via the nss_nodb_init function.
NSS 3.16.2.2 release notes
this is a patch release to fix a re
gression.
...this fixes a re
gression introduced in nss 3.16.2 that prevented nss from importing some rsa private keys (such as in pkcs #12 files) generated by other crypto libraries.
NSS 3.16.6 release notes
this is a patch release to fix a re
gression.
...this fixes a re
gression introduced in nss 3.16.2 that prevented nss from importing some rsa private keys (such as in pkcs #12 files) generated by other crypto libraries.
NSS 3.24 release notes
these checks have been disabled by default, as they can cause a performance re
gression.
...the caller is no longer required to use sslkeatype explicitly to select a "slot" into which the certificate is configured (which incorrectly identifies a key a
greement type rather than a certificate).
NSS 3.25 release notes
source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_25_rtm/src/ new in nss 3.25 new functionality implemented dhe key a
greement for tls 1.3.
... re
gression fix: nss no longer reports a failure if an application attempts to disable the ssl v2 protocol.
NSS 3.35 release notes
nss 3.30 had introduced a re
gression, preventing nss from reading some aes encrypted data, produced by older versions of nss.
... nss 3.35 fixes this re
gression and restores the ability to read affected data.
NSS 3.36.1 release notes
this is a patch release to fix re
gression bugs.
...that change had caused an interoperability re
gression with operating systems that are limited to 600 k iterations.
NSS sources building testing
nss/test this directory contains the nss test suite, which is routinely used to ensure that changes to nss don't introduce re
gressions.
... running the nss test suite this is an important part of development work, in order to ensure your changes don't introduce re
gressions.
Python binding for NSS
this allows other python threads to execute during the time a nss/nspr function is pro
gress in another thread.
...responder nss.disable_ocsp_default_responder the following files were added: src/py_traceback.h doc/examples/verify_cert.py test/test_misc.py the following constants were added: nss.ku_digital_signature nss.ku_non_repudiation nss.ku_key_encipherment nss.ku_data_encipherment nss.ku_key_a
greement nss.ku_key_cert_sign nss.ku_crl_sign nss.ku_encipher_only nss.ku_all nss.ku_digital_signature_or_non_repudiation nss.ku_key_a
greement_or_encipherment nss.ku_ns_govt_approved nss.pk11certlistunique nss.pk11certlistuser nss.pk11certlistrootunique nss.pk11certlistca nss.pk11certlistcaunique nss.pk11certli...
TLS Cipher Suite Discovery
in order to communicate securely, an tls client and tls server must a
gree on the cryptographic algorithms and keys that they will both use on the secured connection.
... they must a
gree on these items: key establishment algorithm (such as rsa, dh, or ecdh) peer authentication algorithm (such as rsa, dsa, ecdsa) bulk data encryption algorithm (such as rc4, des, aes) and key size digest algorithm for message authentication checking (sha1, sha256) there are numerous available choices for each of those categories, and the number of possible combinations of all those choices is large.
Installing Pork
-f gcc${gcc_maj_ver}${gcc_min_ver}_predef_std.h; then - echo " generating g*.h header files" - ${cc} -e -xc -dm /dev/null | sort |
grep ' *#define *_' \ + echo " generating g*.h header files: ${cppflags}" + ${cc} ${cppflags} -e -xc -dm /dev/null | sort |
grep ' *#define *_' \ > gcc${gcc_maj_ver}${gcc_min_ver}_predef_std.h - ${cc} -e -xc -dm /dev/null | sort |
grep -e ' *#define *[a-za-z]+' \ + ${cc} ${cppflags} -e -xc -dm /dev/null | sort |
grep -e ' *#define *[a-za-z]+' \ ...
... > gcc${gcc_maj_ver}${gcc_min_ver}_predef_old.h - ${cxx} -e -xc++ -dm /dev/null | sort |
grep ' *#define *_' \ + ${cxx} ${cppflags} -e -xc++ -dm /dev/null | sort |
grep ' *#define *_' \ > gxx${gcc_maj_ver}${gcc_min_ver}_predef_std.h - ${cxx} -e -xc++ -dm /dev/null | sort |
grep -e ' *#define *[a-za-z]+' \ + ${cxx} ${cppflags} -e -xc++ -dm /dev/null | sort |
grep -e ' *#define *[a-za-z]+' \ > gxx${gcc_maj_ver}${gcc_min_ver}_predef_old.h fi if test ${host_system} = sys_cygwin; then if you don't do this, mcpp will get the wrong set of automatic definitions and you'll end up with an unpleasant hybrid x86-64/i686 build system.
Rhino JavaScript compiler
may not be combined with optimization at an optlevel
greater than zero.
...if optlevel is
greater than zero, -debug may not be specified.
Rhino requirements and limitations
requirements recent versions of rhino have only been tested with jdk 1.4 and
greater.
... to use the javaadapter feature or an optimization level of 0 or
greater, rhino must be running under a security manager that allows the definition of class loaders.
Creating JavaScript jstest reftests
non262 tests the directory js/src/tests/non262/ should contain all tests of the following type: re
gressions of spidermonkey non-standard spidermonkey extensions to the javascript language test of "implementation-defined" details of the ecmascript standard for example, the exact definition of pi or some details of array sorting.
...before using test262, spidermonkey had a fair number of internal tests of conformance to ecmascript, and many of those tests remain in the js/src/non262 directory as re
gressions.
GC Rooting Guide
} return obj; } autorooters gc thing pointers that appear as part of a stack-allocated ag
gregates (array, structure, class, union) should use js::rooted<t> when possible.
... use js::rooted<t> fields when possible for ag
gregates, otherwise use an autorooter.
SpiderMonkey Internals
the line-to-pc direction "rounds" toward the next bytecode generated from a line
greater than or equal to the input line, and may return the pc of a for-loop update part, if given the line number of the loop body's closing brace.
... jsutil.cpp, jsutil.h the js_assert macro is used throughout the source as a proof device to make invariants and preconditions clear to the reader, and to hold the line during maintenance and evolution against re
gressions or violations of assumptions that it would be too expensive to test unconditionally at run-time.
JS_GetGCParameter
the heap will be collected if it is
greater than: max(allocthreshold, lastsize) * thresholdfactor, this establishes allocthreshold as a baseline or default heap size.
...jsgc_allocation_threshold_factor_avoid_interrupt is used when a gc is already in pro
gress for other zones and we may wish to avoid interrupting it.
WebReplayRoadmap
ag
gregate call graph and data flow (not yet implemented) when developing a complex web app it is often hard to find where a function is called, the callees at a call site, where some data in an object came from or where it is used, or what type a value has.
... static type integration (not yet implemented) static type systems like flow and typescript are
great and really useful for managing an app's codebase, but they are unsound by design, and it is pretty easy to satisfy the type system and yet have different types in practice.
Signing Mozilla apps for Mac OS X
if the "developer id" radio button is
greyed out you probably have a group account.
...you can find it by running this command in the terminal: openssl x509 -text -noout -inform der -in devloperid_application.cer |
grep subject putting it all together, you'll wind up using a command similar to the one below to sign your app.
Gecko object attributes
value attributes valuetext a text equivalent to the current value, such as "high" in a slider or "unzipping files" in a pro
gress meter.
... applied to: anything that supports the value interface, especially a slider or pro
gress meter ...
XPCOM glue
this linkage strategy is used when an embedder needs to bootstrap xpcom by finding a compatible
gre on disk and loading it.
...this is typically done using
gre_get
grepathwithproperties.
Component Internals
this is how the api is used, for example, in the gecko runtime environment (
gre).
...for example, this is the object that may start a network download and implement interfaces that will listen to the pro
gress.
Creating the Component Code
this is the object that contains the business logic, that implements functionality such as starting a network download, implementing interfaces that listen to the download pro
gress, or providing a new content type handler.
...the next parameter is for ag
gregation, which the weblock component does not support.
Components.utils.import
example components.utils.import("resource://
gre/modules/xpcomutils.jsm", this); difference from mozijssubscriptloader the differences from mozijssubscriptloader: the behavior when importing/loading the same code from different locations: the subscript loader evaluates the specified code each time it is invoked, with the caller's global object.
... for example: var scope1 = {}, scope2 = {}; components.utils.import("resource://
gre/modules/json.jsm", scope1); components.utils.import("resource://
gre/modules/json.jsm", scope2); assert(scope2.xpcomutils === scope1.xpcomutils); ...returns true, whereas: var someurl = "resource://
gre/modules/json.jsm"; var obj1 = {}, obj2 = {}; var loader = components.classes["@mozilla.org/moz/jssubscript-loader;1"] .getservice(components.interfaces.mozijssubscriptloader); loader.loadsubscript(someurl, obj1); loader.loadsubscript(someurl, obj2); assert(obj2 === obj1); ...returns false.
Components.utils.importGlobalProperties
example components.utils.import("resource://
gre/modules/devtools/console.jsm"); components.utils.importglobalproperties(["atob", "btoa"]); var encoded = btoa("hello"); console.log(encoded); // "sgvsbg8=" console.log(atob(encoded)); // "hello" alternative methods if importglobalproperties does not support the targeted firefox version, here are some alternative methods to import these objects.
...knowing that, we can just get a valid blob by importing a known module that has the objects, such as services.jsm const {blob, file, services} = cu.import("resource://
gre/modules/services.jsm", {}); reference: stackoverflow :: use blob on firefox add-on hiddendomwindow the hidden domwindow has all of these objects automatically imported.
IAccessibleTable
the result is
greater than 1 if the specified cell spans multiple columns.
...the result is
greater than 1 if the specified cell spans multiple rows.
IAccessibleValue
1.0 66 introduced gecko 1.9 inherits from: iunknown last changed in gecko 1.9 (firefox 3) the iaccessiblevalue interface represents a single numerical value and should be implemented by any class that supports numerical value like pro
gress bars and spin boxes.
...the argument is clipped to the valid interval whose upper and lower bounds are returned by the methods maximumvalue() and minimumvalue(), that is if it is lower than the minimum value the new value will be the minimum and if it is
greater than the maximum then the new value will be the maximum.
imgIRequest
status_load_partial 0x2 used internally by im
grequest to flag that a request is being cancelled as a result of a failure of a proxy holder and not an internal failure.
...regardless, there's no reason for this flag to be public, and it should either go away or become a private state flag within im
grequest.
mozIStorageFunction
mozistorageag
gregatefunction create a new sqlite ag
gregate function.
... mozistoragepro
gresshandler monitor pro
gress during the execution of a statement.
mozIStorageValueArray
mozistorageag
gregatefunction create a new sqlite ag
gregate function.
... mozistoragepro
gresshandler monitor pro
gress during the execution of a statement.
nsIAccessibleRole
role_pro
gressbar 48 represents a pro
gress bar, dynamically showing the user the percent complete of an operation in pro
gress.
... it is used for xul:pro
gressmeter, role="pro
gressbar".
nsIComponentManager
adelegate the outer object used for ag
gregation.
... adelegate the outer object used for ag
gregation.
nsIComponentRegistrar
xpcom >= 1.9: if aspec is null, static components,
gre components, and the the application's component directories will be registered.
... see ns_
gre_dir, ns_xpcom_component_dir, and ns_xpcom_component_dir_list in nsdirectoryservice.
nsIDOMMouseScrollEvent
methods initmousescrollevent() initializes the pro
gress event object.
...must be one of "abort", "error", "load", "loadstart", or "pro
gress".
nsIDOMMozNetworkStatsManager
if the filtering start date is
greater than the end date, an exception is thrown.
... exceptions thrown ns_error_invalid_arg the filtering start date is
greater than the end date.
nsIDOMWindowUtils
audiovolume float range:
greater or equal to 0.
... arotationangles an array of angles in de
grees for each touch's touch oval.
getFile
ns_xpcom_component_dir "comsd" ns_xpcom_component_dir_list "comsdl" ns_xpcom_component_registry_file "comregf" ns_xpcom_xpti_registry_file "xptiregf" ns_xpcom_library_file "xpcomlib" ns_
gre_dir "
gred" note: on mac os x, up through firefox 34 this is the contents/macos directory within the application's bundle.
... ns_
gre_component_dir "
grecomsd" platform-specific locations some symbolic names represent platform-specific locations.
nsIDocShell
beginrestore() begin firing webpro
gresslistener notifications for restoring a page presentation.
...finishrestore() finish firing webpro
gresslistener notifications and dom events for restoring a page presentation.
nsIDragService
the only exception is getcurrentsession(), since there's currently no way to check for a drag in pro
gress using standard dom methods or properties.
... return value the current drag session, or null if no drag is in pro
gress.
nsIFeed
textinput nsiwritablepropertybag2 information about a text box that can be displayed along with the feed by ag
gregators that support it, to allow the reader to send a response back to the source of the feed.
... note: this field is almost never used, and is incompatible with many ag
gregators.
nsIMsgSearchSession
an isstringattribute(in nsmsgsearchattribvalue attrib); void addallscopes(in nsmsgsearchscopevalue attrib); void search(in nsimsgwindow awindow); void interruptsearch(); void pausesearch(); void resumesearch(); [noscript] nsmsgsearchtype setsearchparam(in nsmsgsearchtype type, in voidptr param); [noscript] void addresultelement(in nsms
gresultelement element); boolean matchhdr(in nsimsgdbhdr amsghdr, in nsimsgdatabase adatabase); void addsearchhit(in nsimsgdbhdr header, in nsimsgfolder folder); attributes attribute type description searchterms nsisupportsarray readonly: numsearchterms unsigned long readonly: runningadapter nsimsgsearchadapter re...
... void pausesearch(); resumesearch() void resumesearch(); setsearchparam() [noscript] nsmsgsearchtype setsearchparam(in nsmsgsearchtype type, in voidptr param); parameters type param addresultelement() [noscript] void addresultelement(in nsms
gresultelement element); parameters element matchhdr() boolean matchhdr(in nsimsgdbhdr amsghdr, in nsimsgdatabase adatabase); parameters amsghdr adatabase addsearchhit() void addsearchhit(in nsimsgdbhdr header, in nsimsgfolder folder); parameters header folder ...
nsITransactionList
return value missing description getnumchildrenforitem() returns the number of child (auto-ag
greated) transactions the item at aindex has.
... return value the number of child (auto-ag
greated) transactions the item at aindex has.
nsITransactionManager
a value
greater than zero indicates the max number of transactions that can exist at any time on both the undo and redo stacks.
... beginbatch() turns on the transaction manager's batch mode, forcing all transactions executed by the transaction manager's dotransaction() method to be ag
gregated together until endbatch() is called.
nsIVersionComparator
see here: nsixulappinfo components.utils.import("resource://
gre/modules/services.jsm"); var curentbrowserversion = services.appinfo.platformversion; //example: '31.*' var comparetothisversion = '25.*'; var compareresult = services.vc.compare(curentbrowserversion, comparetothisversion); if (compareresult == -1) { //currentbrowserversion is less than '25.*' (comparetothisversion) } else if (compareresult == 0) { //currentbrowserversion is '25.*' (com...
...paretothisversion) } else if (compareresult == 1) { //currentbrowserversion is
greater than '25.*' (comparetothisversion) } else { //will never get here as services.vc.compare only returns -1, 0, or 1 } see also toolkit version format ...
nsIWebBrowserPersist
pro
gresslistener nsiwebpro
gresslistener callback listener for pro
gress notifications.
...this includes the basic set, accented letters,
greek letters and certain special markup symbols.
nsIWebContentHandlerRegistrar
cu.import('resource://
gre/modules/services.jsm'); var nsiwchr = cc["@mozilla.org/embeddor.implemented/web-content-handler-registrar;1"] .getservice(ci.nsiwebcontenthandlerregistrar); var htmlcontentwindow = undefined; var registeruri = 'http://mail.live.com/secure/start?action=compose&to=%s'; var myurihostname = services.io.newuri(registeruri, null, null).host; // this section here is long and daunting,...
... protocol handler' when calling method: [nsiwebcontenthandlerregistrar::registerprotocolhandler] if the host names do match then a confirmation like this will be seen: this domain check can be bypassed by setting the preference of gecko.handlerservice.allowregisterfromdifferenthost to true as in this code here: var {classes: cc, interfaces: ci, utils: cu} = components; cu.import("resource://
gre/modules/services.jsm"); var nsiwchr = cc["@mozilla.org/embeddor.implemented/web-content-handler-registrar;1"] .getservice(ci.nsiwebcontenthandlerregistrar); var allowregisterfromdifferenthost = services.prefs.getboolpref('gecko.handlerservice.allowregisterfromdifferenthost'); if (!allowregisterfromdifferenthost) { services.prefs.setboolpref('gecko.handlerservice.allowregisterfr...
Address book sync client design
the interface of
greater interest is the address book sync listener.
...this method is * called only once, at the beginning of a sync transaction * */ void onstartoperation(in print32 atransactionid, in pruint32 amsgsize); /** * notify the observer that pro
gress as occurred for the ab sync operation */ void onpro
gress(in print32 atransactionid, in pruint32 apro
gress, in pruint32 apro
gressmax); /** * notify the observer with a status message for sync operation */ void onstatus(in print32 atransactionid, in wstring amsg); /** * notify the observer that the ab sync operation has been completed.
Creating a gloda message query
so if we had a "color" constraint such as query.color("red", "
green", "blue") would mean any of red,
green, or blue is okay.
... so if we had a "shape" constraint such as query.shape("square") and we combined it with the previous color constraint it would match a red square, a
green square, or a blue square.
Mail client architecture overview
mail reader gecko (xul and html rendering) rdf (dynamic widgets) js (menus, events) libmime mail datasources mail javascript folder/message management msgdb imap/nntp/pop3 necko (networking) sections in
grey refer to modules outside of mail/news the base module the base module provides a generic interface to a set of protocol-independant messaging services.
... mail window management - each mail window maintains a certain amount of state to aid in view navigation, pro
gress display, etc.
Zombie compartments
compartments firefox’s javascript memory is se
gregated into zones and compartments.
... js-compartment([system principal], 0x7f10f1250000) compartment(atoms) js-compartment(about:home) js-compartment(about:blank) compartment([system principal], resource://
gre/modules/addons/xpiprovider.jsm) when looking at user compartments there are a couple of things to be aware of.
js-ctypes reference
this doc is a work in pro
gress.
...it is obtained by by loading the ctypes module: components.utils.import("resource://
gre/modules/ctypes.jsm"); you can use the ctypes object to load libraries, construct types, and perform miscellaneous tasks such as type casting.
Mozilla
toolbars, menu bars, pro
gress bars, and window title bars are all examples of elements that are typically part of the chrome.
... mozilla dom hacking guide mozilla gives you the opportunity not only to use very powerful and complete dom support, but also to work on a world-class implementation of one of the
greatest internet technologies ever created.
Plugin Roadmap for Firefox - Plugins
to support the transition away from flash, firefox is working with other browsers to pro
gressively and carefully make flash usage less common.
...this change will be rolled out pro
gressively during august and september 2017.
Examine, modify, and watch variables - Firefox Developer Tools
examine variables when the code has stopped at a breakpoint, you can examine its state in the variables pane of the debugger: variables are grouped by scope: in function scope you'll see the built-in arguments and this variables as well as local variables defined by the function like user and
greeting.
... similarly, in global scope you'll see global variables you've defined, like
greetme, as well as built-in globals like localstorage and console.
Debugger.Frame - Firefox Developer Tools
if it is a function, spidermonkey calls it when execution in this frame makes a small amount of pro
gress, passing no arguments and providing this debugger.frame instance as the thisvalue.
... what constitutes “a small amount of pro
gress” varies depending on the implementation, but it is fine-grained enough to implement useful “step” and “next” behavior.
Tutorial: Set a breakpoint - Firefox Developer Tools
save the following text to an html file: <div onclick="report('the best div');">click me!</div> <div onclick="report('another
great div');">or me!</div> <script> function report(what) { console.log('clicked: ' + what); } </script> visit the html file in your browser, and open the browser content toolbox by opening the firefox menu, choosing “web developer”, and then “browser content toolbox”.
... click on the scratchpad panel and enter the following code: components.utils.import("resource://
gre/modules/jsdebugger.jsm"); components.utils.import("resource://
gre/modules/console.jsm"); // this simply defines 'debugger' in this scratchpad; // it doesn't actually start debugging anything.
Memory - Firefox Developer Tools
the ag
gregate view shows memory usage as a table of allocated types.
... if you've opted to record allocation stacks for the snapshot, the ag
gregate and dominators views can show you exactly where in your code allocations are happening.
Examine and edit CSS - Firefox Developer Tools
displaying pseudo-elements the rule view displays the following pseudo-elements, if they are applied to the selected element: ::after ::backdrop ::before ::first-letter ::first-line ::selection :-moz-color-swatch :-moz-number-spin-box :-moz-number-spin-down :-moz-number-spin-up :-moz-number-text :-moz-number-wrapper :-moz-placeholder :-moz-pro
gress-bar :-moz-range-pro
gress :-moz-range-thumb :-moz-range-track :-moz-selection if the selected element has pseudo-elements applied to it, they are displayed before the selected element but hidden by a disclosure triangle: clicking the triangle displays them: viewing common pseudo-classes there's a button to the right of the filter box: click the button to see checkboxes that you ca...
... overridden declarations if a css declaration is overridden by some other css rule with a
greater weight, then the declaration is shown with a line through it.
Animating CSS properties - Firefox Developer Tools
the predominance of
green is telling us that we're spending a lot of time painting.
...it will look something like this: waterfall overview compared with the version that uses margin, we're seeing a lot less
green and a lot more pink, which could be either layout or style recalculation.
Waterfall - Firefox Developer Tools
filtering markers you can control which markers are displayed using a button in the toolbar: waterfall patterns exactly what you'll see in the waterfall is very dependent on the kind of thing your site is doing: javascript-heavy sites will have a lot of orange, while visually dynamic sites will have a lot of purple and
green.
...if you're seeing drops in the frame rate, especially during graphically-intensive operations and transitions, check the waterfall for long
green markers.
AddressErrors - Web APIs
please check for any errors."; const invalidcountryerror = "at this time, we only ship to the united states, canada,
great britain, japan, china, and germany."; let shippingaddress = ev.target.shippingaddress; let shippingaddresserrors = {}; let updatedetails = {}; if (!validcountries.includes(shippingaddress.country)) { ev.target.shippingoptions = []; shippingaddresserrors.country = invalidcountryerror; updatedetails = { error: genericaddresserror, shippingaddresserrors, ..
...please check for any errors."; const invalidcountryerror = "at this time, we only ship to the united states, canada,
great britain, japan, china, and germany."; let shippingaddress = ev.target.shippingaddress; let shippingaddresserrors = {}; let updatedetails = {}; if (!validcountries.includes(shippingaddress.country)) { ev.target.shippingoptions = []; shippingaddresserrors.country = invalidcountryerror; updatedetails = { error: genericaddresserror, shippingaddresserrors, ..
AudioBuffer.copyFromChannel() - Web APIs
exceptions indexsizeerror one of the input parameters has a value that is outside the accepted range: the value of channelnumber specifies a channel number which doesn't exist (that is, it's
greater than or equal to the value of numberofchannels on the channel).
... the value of startinchannel is outside the current range of samples that already exist in the source buffer; that is, it's
greater than its current length.
AudioBuffer.copyToChannel() - Web APIs
if channelnumber is
greater than or equal to audiobuffer.numberofchannels, an index_size_err will be thrown.
...if startinchannel is
greater than audiobuffer.length, an index_size_err will be thrown.
AudioContext - Web APIs
audiocontext.resume() resumes the pro
gression of time in an audio context that has previously been suspended/paused.
... audiocontext.suspend() suspends the pro
gression of time in the audio context, temporarily halting audio hardware access and reducing cpu/battery usage in the process.
CSSPrimitiveValue - Web APIs
conversions are allowed between absolute values (from millimeters to centimeters, from de
grees to radians, and so on) but not between relative values.
... css_deg the value is an <angle> in de
grees.
CanvasRenderingContext2D.fillRect() - Web APIs
examples a simple filled rectangle this example draws a filled
green rectangle using the fillrect() method.
... const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.fillstyle = '
green'; ctx.fillrect(20, 10, 150, 100); result filling the whole canvas this code snippet fills the entire canvas with a rectangle.
CanvasRenderingContext2D.isPointInPath() - Web APIs
if yes, the circle becomes
green, otherwise it is red.
...telementbyid('canvas'); const ctx = canvas.getcontext('2d'); // create circle const circle = new path2d(); circle.arc(150, 75, 50, 0, 2 * math.pi); ctx.fillstyle = 'red'; ctx.fill(circle); // listen for mouse moves canvas.addeventlistener('mousemove', function(event) { // check whether point is inside circle if (ctx.ispointinpath(circle, event.offsetx, event.offsety)) { ctx.fillstyle = '
green'; } else { ctx.fillstyle = 'red'; } // draw circle ctx.clearrect(0, 0, canvas.width, canvas.height); ctx.fill(circle); }); result specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.ispointinpath' in that specification.
CanvasRenderingContext2D.isPointInStroke() - Web APIs
if yes, the ellipse's stroke becomes
green, otherwise it is red.
... ellipse = new path2d(); ellipse.ellipse(150, 75, 40, 60, math.pi * .25, 0, 2 * math.pi); ctx.linewidth = 25; ctx.strokestyle = 'red'; ctx.fill(ellipse); ctx.stroke(ellipse); // listen for mouse moves canvas.addeventlistener('mousemove', function(event) { // check whether point is inside ellipse's stroke if (ctx.ispointinstroke(ellipse, event.offsetx, event.offsety)) { ctx.strokestyle = '
green'; } else { ctx.strokestyle = 'red'; } // draw ellipse ctx.clearrect(0, 0, canvas.width, canvas.height); ctx.fill(ellipse); ctx.stroke(ellipse); }); result specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.ispointinstroke' in that specification.
CanvasRenderingContext2D.strokeRect() - Web APIs
examples a simple stroked rectangle this example draws a rectangle with a
green outline using the strokerect() method.
... const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.strokestyle = '
green'; ctx.strokerect(20, 10, 160, 100); result applying various context settings this example draws a rectangle with a drop shadow and thick, beveled outlines.
console.count() - Web APIs
examples for example, given code like this: let user = ""; function
greet() { console.count(); return "hi " + user; } user = "bob";
greet(); user = "alice";
greet();
greet(); console.count(); console output will look something like this: "default: 1" "default: 2" "default: 3" "default: 4" the label is displayed as default because no explicit label was supplied.
... if we pass the user variable as the label argument to the first invocation of count(), and the string "alice" to the second: let user = ""; function
greet() { console.count(user); return "hi " + user; } user = "bob";
greet(); user = "alice";
greet();
greet(); console.count("alice"); we will see output like this: "bob: 1" "alice: 1" "alice: 2" "alice: 3" we're now maintaining separate counts based only on the value of label.
Console.countReset() - Web APIs
examples for example, given code like this: let user = ""; function
greet() { console.count(); return "hi " + user; } user = "bob";
greet(); user = "alice";
greet();
greet(); console.count(); console.countreset(); console output will look something like this: "default: 1" "default: 2" "default: 3" "default: 4" "default: 0" note that the call to console.counterreset() resets the value of the default counter to zero.
... if we pass the user variable as the label argument with the string "bob" to the first invocation of count(), and the string "alice" to the second: let user = ""; function
greet() { console.count(user); return "hi " + user; } user = "bob";
greet(); user = "alice";
greet();
greet(); console.countreset("bob"); console.count("alice"); we will see output like this: "bob: 1" "alice: 1" "alice: 2" "bob: 0" "alice: 3" resetting the value of the counter "bob" only changes the value of that counter.
DOMMatrixReadOnly.scale() - Web APIs
examples this svg contains three squares, one red, one blue, and one
green, each positioned at the document origin: <svg width="250" height="250" viewbox="0 0 25 25"> <rect width="25" height="25" fill="red" /> <rect id="transformed" width="25" height="25" fill="blue" /> <rect id="transformedorigin" width="25" height="25" fill="
green" /> </svg> this javascript first creates an identity matrix, then uses the scale() method to create a new matrix with a single pa...
... these new matrices are then applied to the blue and
green squares as a transform, changing their dimensions and position.
DeviceMotionEventRotationRate: alpha - Web APIs
this property indicates the rate of rotation around the z axis -- in de
grees per second -- in a devicemotioneventrotationrate object.
... return value alpha a double indicating the rate of rotation around the z axis, in de
grees per second.
DeviceMotionEventRotationRate: beta - Web APIs
this property indicates the rate of rotation around the x axis -- in de
grees per second -- in a devicemotioneventrotationrate object.
... return value beta a double indicating the rate of rotation around the x axis, in de
grees per second.
DeviceMotionEventRotationRate: gamma - Web APIs
this property indicates the rate of rotation around the y axis -- in de
grees per second -- in a devicemotioneventrotationrate object.
... return value gamma a double indicating the rate of rotation around the y axis, in de
grees per second.
Document - Web APIs
globaleventhandlers.onloadend is an eventhandler representing the code to be called when the loadend event is raised (when pro
gress has stopped on the loading of a resource.) globaleventhandlers.onloadstart is an eventhandler representing the code to be called when the loadstart event is raised (when pro
gress has begun on the loading of a resource.) globaleventhandlers.onlostpointercapture is an eventhandler representing the code to be called when the lostpointercapture event type is raised.
... globaleventhandlers.onpro
gress is an eventhandler representing the code to be called when the pro
gress event is raised.
Examples of web and XML development using the DOM - Web APIs
t: 50px; width: 500px;"> </p> <div id="output"> </div> </body> </html> example 2: image attributes <!doctype html> <html lang="en"> <head> <title>modifying an image border</title> <script> function setborderwidth(width) { document.getelementbyid("img1").style.borderwidth = width + "px"; } </script> </head> <body> <p> <img id="img1" src="image1.gif" style="border: 5px solid
green;" width="100" height="100" alt="border test"> </p> <form name="formname"> <input type="button" value="make border 20px-wide" onclick="setborderwidth(20);" /> <input type="button" value="make border 5px-wide" onclick="setborderwidth(5);" /> </form> </body> </html> example 3: manipulating styles in this simple example, some basic style properties of an html paragraph element are ...
... the properties of event objects differs
greatly between browsers, the whatwg dom standard lists the standard properties, however many browsers have extended these
greatly.
Introduction to the DOM - Web APIs
different browsers have different implementations of the dom, and these implementations exhibit varying de
grees of conformance to the actual dom standard (a subject we try to avoid in this documentation), but every web browser uses some document object model to make web pages accessible via javascript.
... <select onchange="setbodyattr('text', this.options[this.selectedindex].value);"> <option value="black">black</option> <option value="red">red</option> </select> <p><b><tt>bgcolor</tt></b></p> <select onchange="setbodyattr('bgcolor', this.options[this.selectedindex].value);"> <option value="white">white</option> <option value="light
grey">gray</option> </select> <p><b><tt>link</tt></b></p> <select onchange="setbodyattr('link', this.options[this.selectedindex].value);"> <option value="blue">blue</option> <option value="
green">
green</option> </select> <small> <a href="http://some.website.tld/page.html" id="sample"> (sample link) </a> </small><br ...
EffectTiming.easing - Web APIs
the value of easing corresponds directly to animationeffecttimin
greadonly.easing in timing objects returned by animationeffectreadonly, keyframeeffectreadonly, and keyframeeffect.
...it must be a positive integer (
greater than 0).
EffectTiming.endDelay - Web APIs
the animation's end time—the time at which an iteration is considered to have finished—is the time at which the animation finishes an iteration (its initial delay, animationeffecttimin
greadonly.delay, plus its duration,duration, plus its end delay.
...the value of enddelay corresponds directly to animationeffecttimin
greadonly.enddelay in timing objects returned by animationeffectreadonly, keyframeeffectreadonly, and keyframeeffect.
Element.scrollLeft - Web APIs
if specified as a value less than 0 (
greater than 0 for right-to-left elements), scrollleft is set to 0.
... if specified as a value
greater than the maximum that the content can be scrolled, scrollleft is set to the maximum.
Event - Web APIs
clicking the mouse button or tapping keyboard, or generated by apis to represent the pro
gress of an asynchronous task.
...ntationevent deviceproximityevent domtransactionevent dragevent editingbeforeinputevent errorevent fetchevent focusevent gamepadevent hashchangeevent idbversionchangeevent inputevent keyboardevent mediastreamevent messageevent mouseevent mutationevent offlineaudiocompletionevent overconstrainederror pagetransitionevent paymentrequestupdateevent pointerevent popstateevent pro
gressevent relatedevent rtcdatachannelevent rtcidentityerrorevent rtcidentityevent rtcpeerconnectioniceevent sensorevent storageevent svgevent svgzoomevent timeevent touchevent trackevent transitionevent uievent userproximityevent webglcontextevent wheelevent constructor event() creates an event object, returning it to the caller.
FileReader: abort event - Web APIs
bubbles no cancelable no interface pro
gressevent event handler property filereader.onabort examples live example html <div class="example"> <div class="file-select"> <label for="avatar">choose a profile picture:</label> <input type="file" id="avatar" name="avatar" accept="image/png, image/jpeg"> </div> <img src="" class="preview" height="200" alt="image preview..."> <div class="event-log"> <label>event log:</label> <textarea readonly class="event-log-contents"></textarea> </div> </div> css img.preview { margin: 1rem 0; } .event-...
...entlog.textcontent = eventlog.textcontent + `${event.type}: ${event.loaded} bytes transferred\n`; if (event.type === "load") { preview.src = reader.result; } } function addlisteners(reader) { reader.addeventlistener('loadstart', handleevent); reader.addeventlistener('load', handleevent); reader.addeventlistener('loadend', handleevent); reader.addeventlistener('pro
gress', handleevent); reader.addeventlistener('error', handleevent); reader.addeventlistener('abort', handleevent); } function handleselected(e) { eventlog.textcontent = ''; const selectedfile = fileinput.files[0]; if (selectedfile) { addlisteners(reader); reader.readasdataurl(selectedfile); } reader.abort(); } fileinput.addeventlistener('change', handles...
FileReader: load event - Web APIs
bubbles no cancelable no interface pro
gressevent event handler property filereader.onload examples live example html <div class="example"> <div class="file-select"> <label for="avatar">choose a profile picture:</label> <input type="file" id="avatar" name="avatar" accept="image/png, image/jpeg"> </div> <img src="" class="preview" height="200" alt="image preview..."> <div class="event-log"> <label>event log:</label> <textarea readonly class="event-log-contents"></textarea> </div> </div> css img.preview { margin: 1rem 0; } .event-log-contents { width: 18rem; height: 5rem; bor...
...entlog.textcontent = eventlog.textcontent + `${event.type}: ${event.loaded} bytes transferred\n`; if (event.type === "load") { preview.src = reader.result; } } function addlisteners(reader) { reader.addeventlistener('loadstart', handleevent); reader.addeventlistener('load', handleevent); reader.addeventlistener('loadend', handleevent); reader.addeventlistener('pro
gress', handleevent); reader.addeventlistener('error', handleevent); reader.addeventlistener('abort', handleevent); } function handleselected(e) { eventlog.textcontent = ''; const selectedfile = fileinput.files[0]; if (selectedfile) { addlisteners(reader); reader.readasdataurl(selectedfile); } } fileinput.addeventlistener('change', handleselected); result ...
FileReader: loadend event - Web APIs
bubbles no cancelable no interface pro
gressevent event handler property filereader.onloadend examples live example html <div class="example"> <div class="file-select"> <label for="avatar">choose a profile picture:</label> <input type="file" id="avatar" name="avatar" accept="image/png, image/jpeg"> </div> <img src="" class="preview" height="200" alt="image preview..."> <div class="event-log"> <label>event log:</label> <textarea readonly class="event-log-contents"></textarea> </div> </div> css img.preview { margin: 1rem 0; } .event-log-contents { width: 18rem; ...
...entlog.textcontent = eventlog.textcontent + `${event.type}: ${event.loaded} bytes transferred\n`; if (event.type === "load") { preview.src = reader.result; } } function addlisteners(reader) { reader.addeventlistener('loadstart', handleevent); reader.addeventlistener('load', handleevent); reader.addeventlistener('loadend', handleevent); reader.addeventlistener('pro
gress', handleevent); reader.addeventlistener('error', handleevent); reader.addeventlistener('abort', handleevent); } function handleselected(e) { eventlog.textcontent = ''; const selectedfile = fileinput.files[0]; if (selectedfile) { addlisteners(reader); reader.readasdataurl(selectedfile); } } fileinput.addeventlistener('change', handleselected); result ...
FileReader: loadstart event - Web APIs
bubbles no cancelable no interface pro
gressevent event handler property filereader.onloadstart examples live example html <div class="example"> <div class="file-select"> <label for="avatar">choose a profile picture:</label> <input type="file" id="avatar" name="avatar" accept="image/png, image/jpeg"> </div> <img src="" class="preview" height="200" alt="image preview..."> <div class="event-log"> <label>event log:</label> <textarea readonly class="event-log-contents"></textarea> </div> </div> css img.preview { margin: 1rem 0; } .event-log-contents { width: 18rem; height: 5re...
...entlog.textcontent = eventlog.textcontent + `${event.type}: ${event.loaded} bytes transferred\n`; if (event.type === "load") { preview.src = reader.result; } } function addlisteners(reader) { reader.addeventlistener('loadstart', handleevent); reader.addeventlistener('load', handleevent); reader.addeventlistener('loadend', handleevent); reader.addeventlistener('pro
gress', handleevent); reader.addeventlistener('error', handleevent); reader.addeventlistener('abort', handleevent); } function handleselected(e) { eventlog.textcontent = ''; const selectedfile = fileinput.files[0]; if (selectedfile) { addlisteners(reader); reader.readasdataurl(selectedfile); } } fileinput.addeventlistener('change', handleselected); result ...
Using the Gamepad API - Web APIs
values are monotonically increasing, meaning that they can be compared to determine the ordering of updates, as newer values will always be
greater than or equal to older values.
...; b.classname = "buttons"; for (var i = 0; i < gamepad.buttons.length; i++) { var e = document.createelement("span"); e.classname = "button"; //e.id = "b" + i; e.innerhtml = i; b.appendchild(e); } d.appendchild(b); var a = document.createelement("div"); a.classname = "axes"; for (var i = 0; i < gamepad.axes.length; i++) { var p = document.createelement("pro
gress"); p.classname = "axis"; //p.id = "a" + i; p.setattribute("max", "2"); p.setattribute("value", "1"); p.innerhtml = i; a.appendchild(p); } d.appendchild(a); // see https://github.com/luser/gamepadtest/blob/master/index.html var start = document.getelementbyid("start"); if (start) { start.style.display = "none"; } document.body.appendchild(d); reques...
GeolocationCoordinates.heading - Web APIs
this value, specified in de
grees, indicates how far off from heading due north the device is.
... zero de
grees represents true true north, and the direction is determined clockwise (which means that east is 90 de
grees and west is 270 de
grees).
GeolocationCoordinates.latitude - Web APIs
the geolocationcoordinates.latitude read-only property is a double representing the latitude of the position in decimal de
grees.
... syntax let lat = geolocationcoordinatesinstance.latitude value a double representing the latitude of the position in decimal de
grees.
GlobalEventHandlers.onreset - Web APIs
html <form id="form"> <label>test field: <input type="text"></label> <br><br> <button type="reset">reset form</button> </form> <p id="log"></p> javascript function lo
greset(event) { log.textcontent = `form reset!
... time stamp: ${event.timestamp}`; } const form = document.getelementbyid('form'); const log = document.getelementbyid('log'); form.onreset = lo
greset; result specification specification status comment html living standardthe definition of 'onreset' in that specification.
GlobalEventHandlers - Web APIs
globaleventhandlers.onloadend is an eventhandler representing the code to be called when the loadend event is raised (when pro
gress has stopped on the loading of a resource.) globaleventhandlers.onloadstart is an eventhandler representing the code to be called when the loadstart event is raised (when pro
gress has begun on the loading of a resource.) globaleventhandlers.onlostpointercapture is an eventhandler representing the code to be called when the lostpointercapture event type is raised.
... globaleventhandlers.onpro
gress is an eventhandler representing the code to be called when the pro
gress event is raised.
HTMLFormElement: reset event - Web APIs
html <form id="form"> <label>test field: <input type="text"></label> <br><br> <button type="reset">reset form</button> </form> <p id="log"></p> javascript function lo
greset(event) { log.textcontent = `form reset!
... time stamp: ${event.timestamp}`; } const form = document.getelementbyid('form'); const log = document.getelementbyid('log'); form.addeventlistener('reset', lo
greset); result specifications specification status comment html living standardthe definition of 'reset' in that specification.
HTMLInputElement.setSelectionRange() - Web APIs
an index
greater than the length of the element's value is treated as pointing to the end of the value.
...an index
greater than the length of the element's value is treated as pointing to the end of the value.
HTMLMediaElement: loadeddata event - Web APIs
the readystate just increased to ' + 'have_current_data or
greater for the first time.'); }); using the onloadeddata event handler property: const video = document.queryselector('video'); video.onloadeddata = (event) => { console.log('yay!
... the readystate just increased to ' + 'have_current_data or
greater for the first time.'); }; specifications specification status html living standardthe definition of 'loadeddata media event' in that specification.
HTMLTableElement - Web APIs
if the index is smaller than -1 or
greater than the number of rows in the collection, a domexception with the value indexsizeerror is raised.
...if the index value is -1 the last row is removed; if it smaller than -1 or
greater than the amount of rows in the collection, a domexception with the value indexsizeerror is raised.
HTMLTableRowElement - Web APIs
if the given position is
greater (or equal as it starts at zero) than the amount of cells in the row, or is smaller than 0, it raises a domexception with the indexsizeerror value.
...if the given position is
greater (or equal as it starts at zero) than the amount of cells in the row, or is smaller than -1, it raises a domexception with the indexsizeerror value.
HTMLTableSectionElement - Web APIs
if the given position is
greater (or equal as it starts at zero) than the amount of rows in the section, or is smaller than 0, it raises a domexception with the indexsizeerror value.
...if the given position is
greater (or equal as it starts at zero) than the amount of rows in the section, or is smaller than -1, it raises a domexception with the indexsizeerror value.
Basic concepts - Web APIs
the only way to change the version is by opening it with a
greater version than the current one.
...the key must be of a data type that has a number that is
greater than the one before it.
Using IndexedDB - Web APIs
it indicates that the version of the database stored on the disk is
greater than the version that you are trying to open.
...when you call open() with a
greater version than the actual version of the database, all other open databases must explicitly acknowledge the request before you can start making changes to the database (an onblocked event is fired until they are closed or reloaded).
Intersection Observer API - Web APIs
the de
gree of intersection between the target element and its root is the intersection ratio.
... when the callback is invoked, it receives a list of intersectionobserverentry objects, one for each observed target which has had the de
gree to which it intersects the root change such that the amount exposed crosses over one of the thresholds, in either direction.
KeyboardEvent.code - Web APIs
moverate and turnrate are the number of pixels forward and backward each keystroke moves the ship and how many de
grees of rotation the left and right steering controls apply per keystroke.
... angle is the current amount of rotation applied to the ship, in de
grees; it starts at 0° (pointing straight up).
KeyframeEffect.setKeyframes() - Web APIs
element.animate({ opacity: [ 0, 1 ], // offset: 0, 1 backgroundcolor: [ "red", "yellow", "
green" ], // offset: 0, 0.5, 1 }, 2000); the special keys offset, easing, and composite (described below) may be specified alongside the property values.
... examples // passing an array of keyframe objects existingkeyframeeffect.setkeyframes( [ { color: 'blue' }, { color: '
green', left: '10px' } ] ); // passing an object with arrays for values existingkeyframeeffect.setkeyframes( { color: ['blue', '
green'], left: [ '0', '10px'] } ); // passing a single-member object existingkeyframeeffect.setkeyframes( { color: 'blue' } ); specifications specification status comment web animationsthe definition of 'keyframeeffect.setkey...
MediaStreamConstraints.audio - Web APIs
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: 4px; color: white; background-color: dark
green; } javascript content let audioelement = document.getelementbyid("audio"); let logelement = document.getelementbyid("log"); function log(msg) { logelement.innerhtml += msg + "<br>"; } document.getelementbyid("startbutton").addeventlistener("click", function() { navigator.mediadevices.getusermedia({ audio: true }).then(stream => audioelement.srcobject = stream) .catch(err => l...
...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: 4px; color: white; background-color: dark
green; } javascript content let audioelement = document.getelementbyid("audio"); let logelement = document.getelementbyid("log"); function log(msg) { logelement.innerhtml += msg + "<br>"; } document.getelementbyid("startbutton").addeventlistener("click", function() { navigator.mediadevices.getusermedia({ audio: { samplesize: 8, echocancellation: true } }).then(stream =>...
MediaStreamConstraints.video - Web APIs
video" width="160" height="120" autoplay></video><br> <div id="log"></div> css content body { font: 14px "open sans", "arial", sans-serif; } video { margin-top: 20px; border: 1px solid black; } .button { cursor: pointer; width: 160px; border: 1px solid black; font-size: 16px; text-align: center; padding-top: 2px; padding-bottom: 4px; color: white; background-color: dark
green; } javascript content let videoelement = document.getelementbyid("video"); let logelement = document.getelementbyid("log"); function log(msg) { logelement.innerhtml += msg + "<br>"; } document.getelementbyid("startbutton").addeventlistener("click", function() { navigator.mediadevices.getusermedia({ video: true }).then(stream => videoelement.srcobject = stream) .catch(err =>...
...video" width="160" height="120" autoplay></video><br> <div id="log"></div> css content body { font: 14px "open sans", "arial", sans-serif; } video { margin-top: 20px; border: 1px solid black; } .button { cursor: pointer; width: 160px; border: 1px solid black; font-size: 16px; text-align: center; padding-top: 2px; padding-bottom: 4px; color: white; background-color: dark
green; } javascript content let videoelement = document.getelementbyid("video"); let logelement = document.getelementbyid("log"); function log(msg) { logelement.innerhtml += msg + "<br>"; } document.getelementbyid("startbutton").addeventlistener("click", function() { navigator.mediadevices.getusermedia({ video: { width: 160, height: 120, framerate: 15 } ...
Capabilities, constraints, and settings - Web APIs
traints; reason is why */ }); } here, after ensuring that the constrainable properties for which matches must be found are supported (width, height, framerate, and facingmode), we set up constraints which request a width no smaller than 640 and no larger than 1920 (but preferably 1920), a height no smaller than 400 (but ideally 1080), an aspect ratio of 16:9 (1.777777778), and a frame rate no
greater than 30 frames per second.
...class="button" id="stopbutton"> stop video </div> <div id="log"> </div> css content body { font: 14px "open sans", "arial", sans-serif; } video { margin-top: 20px; border: 1px solid black; } .button { cursor: pointer; width: 150px; border: 1px solid black; font-size: 16px; text-align: center; padding-top: 2px; padding-bottom: 4px; color: white; background-color: dark
green; } .wrapper { margin-bottom: 10px; width: 600px; } .trackrow { height: 200px; } .leftside { float: left; width: calc(calc(100%/2) - 10px); } .rightside { float: right; width: calc(calc(100%/2) - 10px); } textarea { padding: 8px; } h3 { margin-bottom: 3px; } #supportedconstraints { column-count: 2; -moz-column-count: 2; } #log { padding-top: 10px; } javascript co...
OfflineAudioContext.suspend() - Web APIs
the suspend() method of the offlineaudiocontext interface schedules a suspension of the time pro
gression in the audio context at the specified time and returns a promise.
... invalidstateerror if the quantized frame number is one of the following: a negative number is less than or equal to the current time is
greater than or equal to the total render duration is scheduled by another suspend for the same time specifications specification status comment web audio apithe definition of 'suspend()' in that specification.
OfflineAudioContext - Web APIs
offlineaudiocontext.suspend() schedules a suspension of the time pro
gression in the audio context at the specified time and returns a promise.
... deprecated methods offlineaudiocontext.resume() resumes the pro
gression of time in an audio context that has previously been suspended.
PointerEvent.tiltX - Web APIs
the tiltx read-only property of the pointerevent interface is the angle (in de
grees) between the y-z plane of the pointer and the screen.
... syntax var tiltx = pointerevent.tiltx; return value tiltx the angle in de
grees between the y-z plane of the pointer (stylus) and the screen.
PointerEvent.tiltY - Web APIs
the tilty read-only property of the pointerevent interface is the angle (in de
grees) between the x-z plane of the pointer and the screen.
... syntax var tilty = pointerevent.tilty; return value tilty the angle in de
grees between the x-z plane of the pointer (stylus) and the screen.
PointerEvent.twist - Web APIs
the twist read-only property of the pointerevent interface represents the clockwise rotation of the pointer (e.g., pen stylus) around its major axis, in de
grees.
... syntax var twist = pointerevent.twist; return value a long value representing the amount of twist, in de
grees, applied to the transducer (pointer).
RTCPeerConnection.createDataChannel() - Web APIs
alternatively (true), they can be negotiated out of-band, where both sides call createdatachannel with an a
greed-upon id.
...tion(event) { console.log(event.data); } // answerer side var pc = new rtcpeerconnection(options); pc.ondatachannel = function(event) { var channel = event.channel; channel.onopen = function(event) { channel.send('hi back!'); } channel.onmessage = function(event) { console.log(event.data); } } alternatively, more symmetrical out-of-band negotiation can be used, using an a
greed-upon id (0 here): // both sides var pc = new rtcpeerconnection(options); var channel = pc.createdatachannel("chat", {negotiated: true, id: 0}); channel.onopen = function(event) { channel.send('hi!'); } channel.onmessage = function(event) { console.log(event.data); } for a more thorough example showing how the connection and channel are established, see a simple rtcdatachannel sample.
RTCPeerConnection.setLocalDescription() - Web APIs
because descriptions will be exchanged until the two peers a
gree on a configuration, the description submitted by calling setlocaldescription() does not immediately take effect.
...only then does the a
greed-upon configuration take effect.
RTCPeerConnection.setRemoteDescription() - Web APIs
because descriptions will be exchanged until the two peers a
gree on a configuration, the description submitted by calling setremotedescription() does not immediately take effect.
...only then does the a
greed-upon configuration take effect.
RTCSessionDescription - Web APIs
once the two peers a
gree upon a configuration for the connection, negotiation is complete.
...in other words, this session description describes the a
greed-upon configuration, and is being sent to finalize negotiation.
Range.setEnd() - Web APIs
endoffset an integer
greater than or equal to zero representing the offset for the end of the range from the start of endnode.
... indexsizeerror the value specified by endoffset is either
greater than or equal to the length of the node or is less than zero.
Resize Observer API - Web APIs
for example, media queries / window.matchmedia are
great for updating layouts at specific points when the viewport changes sizes, but what if you want to change layout in response to a specific element's size changing, which isn't the outer container?
... examples you find a couple of simple examples on our github repo: resize-observer-border-radius.html (see source): a simple example with a
green box, sized as a percentage of the viewport size.
SVGColorProfileElement - Web APIs
it takes one of the rendering_intent_* constants defined on the sv
grenderingintent interface that corresponds to the value of the rendering-intent attribute.
... methods this interface does not provide any specific methods, but implements those of its parent, svgelement, and implements methods of svgurireference and sv
grenderingintent.
getBBox() - Web APIs
getbbox returns different values than getboundingclientrect(), as the latter returns value relative to the viewport syntax let bboxrect = object.getbbox(); return value the returned value is a sv
grect object, which defines the bounding box.
... example html <svg viewbox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"> <g id="group_text_1"> <text x="5" y="16" transform="scale(2, 2)">hello world!</text> <text x="8" y="32" transform="translate(0 20) scale(1.25 1)">hello world again!</text> </g> <!-- shows bbox in
green --> <rect id="rect_1" stroke="#00ff00" stroke-width="3" fill="none"> </rect> <!-- shows boundingclientrect in red --> <rect id="rect_2" stroke="#ff0000" stroke-width="3" fill="none"></rect> </svg> javascript var rectbbox = document.queryselector('#rect_1'); var rectboundingclientrect = document.queryselector('#rect_2'); var groupelement = document.queryselector('#group_text_1'); ...
SourceBuffer - Web APIs
whether an sourcebuffer.appendbuffer(), sourcebuffer.appendstream(), or sourcebuffer.remove() operation is currently in pro
gress.
...this example was written by nick desaulniers and can be viewed live here (you can also download the source for further investigation.) var video = document.queryselector('video'); var asseturl = 'frag_bunny.mp4'; // need to be specific for blink regarding codecs // ./mp4info frag_bunny.mp4 |
grep codec var mimecodec = 'video/mp4; codecs="avc1.42e01e, mp4a.40.2"'; if ('mediasource' in window && mediasource.istypesupported(mimecodec)) { var mediasource = new mediasource(); //console.log(mediasource.readystate); // closed video.src = url.createobjecturl(mediasource); mediasource.addeventlistener('sourceopen', sourceopen); } else { console.error('unsupported mime type or codec: ',...
SpeechRecognition - Web APIs
this may involve some de
gree of recognition, which doesn't meet or exceed the confidence threshold.
... var grammar = '#jsgf v1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray |
green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar,...
TextEncoder.prototype.encodeInto() - Web APIs
the textencoder.prototype.encodeinto() method takes a usvstring to encode and a destination uint8array to put resulting utf-8 encoded text into, and returns a dictionary object indicating the pro
gress of the encoding.
...u8array.subarray(position|0) : u8array); } var u8array = new uint8array(8); encodeintoatposition("hello", u8array, 2); console.log( "" + u8array.join() ); // 0,0,104,101,108,108,111,0 buffer sizing to convert a javascript string s, the output space needed for full conversion is never less than s.length bytes and never
greater than s.length * 3 bytes.
TextEncoder - Web APIs
textencoder.prototype.encodin
gread only always returns "utf-8".
... textencoder.prototype.encodeinto() takes a usvstring to encode and a destination uint8array to put resulting utf-8 encoded text into, and returns a dictionary object indicating the pro
gress of the encoding.
Touch() - Web APIs
"rotationangle", optional and defaulting to 0, of type float, that is the angle (in de
grees) that the ellipse described by radiusx and radiusy is rotated clockwise about its center; 0 if no value is known.
... the value must be
greater than or equal to 0 and less than 90.
Touch.rotationAngle - Web APIs
summary returns the rotation angle, in de
grees, of the contact area ellipse defined by touch.radiusx and touch.radiusy.
... syntax var angle = touchitem.rotationangle; return value angle the number of de
grees of rotation to apply to the described ellipse to align with the contact area between the user and the touch surface.
Using Touch Events - Web APIs
implementation and deployment status the touch events browser compatibility data indicates touch event support among mobile browsers is relatively broad, with desktop browser support lagging although additional implementations are in pro
gress.
...the touch point's rotation angle - the number of de
grees of rotation to apply to the described ellipse to align with the contact area - is also be standardized as is the amount of pressure applied to a touch point.
WEBGL_compressed_texture_etc - Web APIs
ext.compressed_rg11_eac two-channel (red and
green) unsigned format compression.
... ext.compressed_signed_rg11_eac two-channel (red and
green) signed format compression.
WebGLRenderingContext.blendColor() - Web APIs
syntax void gl.blendcolor(red,
green, blue, alpha); parameters red a glclampf for the red component in the range of 0 to 1.
...
green a glclampf for the
green component in the range of 0 to 1.
WebGLRenderingContext.blendFuncSeparate() - Web APIs
syntax void gl.blendfuncseparate(srcrgb, dstrgb, srcalpha, dstalpha); parameters srcrgb a glenum specifying a multiplier for the red,
green and blue (rgb) source blending factors.
... dstrgb a glenum specifying a multiplier for the red,
green and blue (rgb) destination blending factors.
WebGLRenderingContext.clearColor() - Web APIs
syntax void gl.clearcolor(red,
green, blue, alpha); parameters red a glclampf specifying the red color value used when the color buffers are cleared.
...
green a glclampf specifying the
green color value used when the color buffers are cleared.
WebGLRenderingContext.colorMask() - Web APIs
syntax void gl.colormask(red,
green, blue, alpha); parameters red a glboolean specifying whether or not the red color component can be written into the frame buffer.
...
green a glboolean specifying whether or not the
green color component can be written into the frame buffer.
WebGLRenderingContext.getFramebufferAttachmentParameter() - Web APIs
when using a webgl 2 context, the following values are available additionally: gl.framebuffer_attachment_alpha_size gl.framebuffer_attachment_blue_size gl.framebuffer_attachment_color_encoding gl.framebuffer_attachment_component_type gl.framebuffer_attachment_depth_size gl.framebuffer_attachment_
green_size gl.framebuffer_attachment_red_size gl.framebuffer_attachment_stencil_size gl.framebuffer_attachment_texture_layer when using the ovr_multiview2 extension: ext.framebuffer_attachment_texture_num_views_ovr: the number of views of the framebuffer object attachment.
... gl.framebuffer_attachment_
green_size a glint indicating the number of bits in the
green component of the attachment.
Using shaders to apply color in WebGL - Web APIs
let's say we want to render a gradient in which each corner of the square is a different color: red, blue,
green, and white.
... const colors = [ 1.0, 1.0, 1.0, 1.0, // white 1.0, 0.0, 0.0, 1.0, // red 0.0, 1.0, 0.0, 1.0, //
green 0.0, 0.0, 1.0, 1.0, // blue ]; const colorbuffer = gl.createbuffer(); gl.bindbuffer(gl.array_buffer, colorbuffer); gl.bufferdata(gl.array_buffer, new float32array(colors), gl.static_draw); return { position: positionbuffer, color: colorbuffer, }; } this code starts by creating a javascript array containing four 4-value vectors, one for each vertex color.
WebGL best practices - Web APIs
and to a lesser de
gree, vao attachments (vertexattribpointer, disable/enablevertexattribarray) drawing from static, unchanging vaos is faster than mutating the same vao for every draw call.
...depth/stencil and/or multisampled attachments in particular are
great candidates for invalidateframebuffer.
Lifetime of a WebRTC session - Web APIs
these need to be a
greed upon before the webrtc session can begin.
... each peer connects to an a
greed-upon signaling server, such as a websocket server they both know how to exchange messages with.
Viewpoints and viewers: Simulating cameras in WebXR - Web APIs
the following function returns a projection perspective matrix that integrates the specified field of view angle as well as the given near and far clipping plane distances: function createperspectivematrix(viewport, fovde
grees, nearclip, farclip) { const fovradians = fov * (math.pi / 180.0); const aspectratio = viewport.width / viewport.height; const transform = mat4.create(); mat4.perspective(transform, fovradians, aspectratio, nearclip, farclip); return transform; } after converting the fov angle, fovde
grees, from de
grees to radians and computing the aspect ratio of the xrviewport spe...
...panning is
great for establishing a setting or providing a sense of scope in a vast space or on a vast object.
Inputs and input sources - Web APIs
user-selected the most complex way to determine a primary input source is highly flexible but can require a
great deal of work to implement.
...you can enhance this
greatly by applying some knowledge of physics to have the acceleration change over time based on how long the key is held down and other factors.
Lighting a WebXR setting - Web APIs
computational costs of lighting to be visible, a scene must include lighting of some sort, so all or nearly all scenes will have at least one light source and may have a
great many of them.
... since your scene is intended to represent a setting a person or their avatar can exist within, you should try to achieve some de
gree of consistency and realism in terms of the positioning and presentation of your light sources.
WebXR Device API - Web APIs
a typical xr device can have either 3 or 6 de
grees of freedom and might or might not have an external positional sensor.
... guides and tutorials the following guides and tutorials are a
great resource to learn how to comprehend webxr and the underlying 3d and vr/ar graphics concepts.
Basic concepts behind Web Audio API - Web APIs
via the nyquist–shannon sampling theorem, the sampling frequency must be
greater than twice the maximum frequency one wishes to reproduce.
... therefore, the sampling rate has to be
greater than 40 khz.
How to check the security state of an XMLHTTPRequest over SSL - Web APIs
or.name + "\n"); } let secinfo = channel.securityinfo; // print general connection security state dump("security information:\n"); if (secinfo instanceof ci.nsitransportsecurityinfo) { secinfo.queryinterface(ci.nsitransportsecurityinfo); dump("\tsecurity state of connection: "); // check security state flags if ((secinfo.securitystate & ci.nsiwebpro
gresslistener.state_is_secure) == ci.nsiwebpro
gresslistener.state_is_secure) { dump("secure connection\n"); } else if ((secinfo.securitystate & ci.nsiwebpro
gresslistener.state_is_insecure) == ci.nsiwebpro
gresslistener.state_is_insecure) { dump("insecure connection\n"); } else if ((secinfo.securitystate & ci.nsiwebpro
gresslistener.state_is_broke...
...n) == ci.nsiwebpro
gresslistener.state_is_broken) { dump("unknown\n"); dump("\tsecurity description: " + secinfo.shortsecuritydescription + "\n"); dump("\tsecurity error message: " + secinfo.errormessage + "\n"); } } else { dump("\tno security info available for this channel\n"); } // print ssl certificate details if (secinfo instanceof ci.nsisslstatusprovider) { var cert = secinfo.queryinterface(ci.nsisslstatusprovider) .sslstatus.queryinterface(ci.nsisslstatus).servercert; dump("\tcommon name (cn) = " + cert.commonname + "\n"); dump("\tissuer = " + cert.issuerorganization + "\n"); dump("\torganisation = " + cert.organization + "\n"); dump("\tsha1 fingerp...
XMLHttpRequest: abort event - Web APIs
bubbles no cancelable no interface pro
gressevent event handler property onabort examples live example html <div class="controls"> <input class="xhr success" type="button" name="xhr" value="click to start xhr (success)" /> <input class="xhr error" type="button" name="xhr" value="click to start xhr (error)" /> <input class="xhr abort" type="button" name="xhr" value="click to start xhr (abort)" /> </div> <textarea readonly class="event-log"></textarea> css .event-log { width: 25rem; height: 4rem; border: 1px solid black; margin: .5rem; padding: .2rem; } input { width: 11rem; ...
...eryselector('.xhr.abort'); const log = document.queryselector('.event-log'); function handleevent(e) { log.textcontent = log.textcontent + `${e.type}: ${e.loaded} bytes transferred\n`; } function addlisteners(xhr) { xhr.addeventlistener('loadstart', handleevent); xhr.addeventlistener('load', handleevent); xhr.addeventlistener('loadend', handleevent); xhr.addeventlistener('pro
gress', handleevent); xhr.addeventlistener('error', handleevent); xhr.addeventlistener('abort', handleevent); } function runxhr(url) { log.textcontent = ''; const xhr = new xmlhttprequest(); addlisteners(xhr); xhr.open("get", url); xhr.send(); return xhr; } xhrbuttonsuccess.addeventlistener('click', () => { runxhr('https://mdn.mozillademos.org/files/16553/dgszyj...
XMLHttpRequest: error event - Web APIs
bubbles no cancelable no interface pro
gressevent event handler property onerror examples live example html <div class="controls"> <input class="xhr success" type="button" name="xhr" value="click to start xhr (success)" /> <input class="xhr error" type="button" name="xhr" value="click to start xhr (error)" /> <input class="xhr abort" type="button" name="xhr" value="click to start xhr (abort)" /> </div> <textarea readonly class="event-log"></textarea> css .event-log { width: 25rem; height: 4rem; border: 1px solid black; margin: .5rem; padding: .2rem; } input { width: 11rem; margin: .5rem; } js const xhrbuttonsuccess = docume...
...eryselector('.xhr.abort'); const log = document.queryselector('.event-log'); function handleevent(e) { log.textcontent = log.textcontent + `${e.type}: ${e.loaded} bytes transferred\n`; } function addlisteners(xhr) { xhr.addeventlistener('loadstart', handleevent); xhr.addeventlistener('load', handleevent); xhr.addeventlistener('loadend', handleevent); xhr.addeventlistener('pro
gress', handleevent); xhr.addeventlistener('error', handleevent); xhr.addeventlistener('abort', handleevent); } function runxhr(url) { log.textcontent = ''; const xhr = new xmlhttprequest(); addlisteners(xhr); xhr.open("get", url); xhr.send(); return xhr; } xhrbuttonsuccess.addeventlistener('click', () => { runxhr('https://mdn.mozillademos.org/files/16553/dgszyj...
XMLHttpRequest: load event - Web APIs
bubbles no cancelable no interface pro
gressevent event handler property onload examples live example html <div class="controls"> <input class="xhr success" type="button" name="xhr" value="click to start xhr (success)" /> <input class="xhr error" type="button" name="xhr" value="click to start xhr (error)" /> <input class="xhr abort" type="button" name="xhr" value="click to start xhr (abort)" /> </div> <textarea readonly class="event-log"></textarea> css .event-log { width: 25rem; height: 4rem; border: 1px solid black; margin: .5rem; padding: .2rem; } input { width: 11rem; margin: .5rem; } js const xhrbutt...
...eryselector('.xhr.abort'); const log = document.queryselector('.event-log'); function handleevent(e) { log.textcontent = log.textcontent + `${e.type}: ${e.loaded} bytes transferred\n`; } function addlisteners(xhr) { xhr.addeventlistener('loadstart', handleevent); xhr.addeventlistener('load', handleevent); xhr.addeventlistener('loadend', handleevent); xhr.addeventlistener('pro
gress', handleevent); xhr.addeventlistener('error', handleevent); xhr.addeventlistener('abort', handleevent); } function runxhr(url) { log.textcontent = ''; const xhr = new xmlhttprequest(); addlisteners(xhr); xhr.open("get", url); xhr.send(); return xhr; } xhrbuttonsuccess.addeventlistener('click', () => { runxhr('https://mdn.mozillademos.org/files/16553/dgszyj...
XMLHttpRequest: loadend event - Web APIs
bubbles no cancelable no interface pro
gressevent event handler property onloadend examples live example html <div class="controls"> <input class="xhr success" type="button" name="xhr" value="click to start xhr (success)" /> <input class="xhr error" type="button" name="xhr" value="click to start xhr (error)" /> <input class="xhr abort" type="button" name="xhr" value="click to start xhr (abort)" /> </div> <textarea readonly class="event-log"></textarea> css .event-log { width: 25rem; height: 4rem; border: 1px solid black; margin: .5rem; padding: .2rem; } input { wi...
...eryselector('.xhr.abort'); const log = document.queryselector('.event-log'); function handleevent(e) { log.textcontent = log.textcontent + `${e.type}: ${e.loaded} bytes transferred\n`; } function addlisteners(xhr) { xhr.addeventlistener('loadstart', handleevent); xhr.addeventlistener('load', handleevent); xhr.addeventlistener('loadend', handleevent); xhr.addeventlistener('pro
gress', handleevent); xhr.addeventlistener('error', handleevent); xhr.addeventlistener('abort', handleevent); } function runxhr(url) { log.textcontent = ''; const xhr = new xmlhttprequest(); addlisteners(xhr); xhr.open("get", url); xhr.send(); return xhr; } xhrbuttonsuccess.addeventlistener('click', () => { runxhr('https://mdn.mozillademos.org/files/16553/dgszyj...
XMLHttpRequest: loadstart event - Web APIs
bubbles no cancelable no interface pro
gressevent event handler property onloadstart examples live example html <div class="controls"> <input class="xhr success" type="button" name="xhr" value="click to start xhr (success)" /> <input class="xhr error" type="button" name="xhr" value="click to start xhr (error)" /> <input class="xhr abort" type="button" name="xhr" value="click to start xhr (abort)" /> </div> <textarea readonly class="event-log"></textarea> css .event-log { width: 25rem; height: 4rem; border: 1px solid black; margin: .5rem; padding: .2rem; } input { width: 11rem; margin: .5rem; } js const xhrbuttonsucces...
...eryselector('.xhr.abort'); const log = document.queryselector('.event-log'); function handleevent(e) { log.textcontent = log.textcontent + `${e.type}: ${e.loaded} bytes transferred\n`; } function addlisteners(xhr) { xhr.addeventlistener('loadstart', handleevent); xhr.addeventlistener('load', handleevent); xhr.addeventlistener('loadend', handleevent); xhr.addeventlistener('pro
gress', handleevent); xhr.addeventlistener('error', handleevent); xhr.addeventlistener('abort', handleevent); } function runxhr(url) { log.textcontent = ''; const xhr = new xmlhttprequest(); addlisteners(xhr); xhr.open("get", url); xhr.send(); return xhr; } xhrbuttonsuccess.addeventlistener('click', () => { runxhr('https://mdn.mozillademos.org/files/16553/dgszyj...
XMLHttpRequest: timeout event - Web APIs
the timeout event is fired when pro
gression is terminated due to preset time expiring.
... bubbles no cancelable no interface pro
gressevent event handler property ontimeout examples const client = new xmlhttprequest(); client.open('get', 'http://www.example.org/example.txt'); client.ontimeout = () => { console.error('timeout!!') }; client.send(); you could also set up the event handler using the addeventlistener() method: client.addeventlistener('timeout', () => { console.error("timeout!!"); }); specifications specification status comment xmlhttprequestthe definition of 'timeout event' in that specification.
XMLHttpRequest.upload - Web APIs
the xmlhttprequest upload property returns an xmlhttprequestupload object that can be observed to monitor an upload's pro
gress.
... pro
gress onpro
gress periodically delivered to indicate the amount of pro
gress made so far.
XMLHttpRequestResponseType - Web APIs
accessing response during a pro
gress event returns the data received so far.
... outside the pro
gress event handler, the value of response is always null.
XRPose.emulatedPosition - Web APIs
a basic xr headset provides three de
grees of freedom (3dof), tracking the pitch, yaw, and roll of the user's head.
... contrariwise, xr devices which can also track movement forward and backward as well as laterally—six de
gree of freedom (6dof) devices—don't require any information from other sources to determine the user's position, so the value of emulatedposition is false.
Using the alert role - Accessibility
dynamic changes that are less urgent should use a less ag
gressive method, such as aria-live="polite" or other live region roles.
... let myalert = document.createelement("p"); myalert.setattribute("role", "alert"); let myalerttext = document.createtextnode("you must a
gree with our terms of service to create an account."); myalert.appendchild(myalerttext); document.body.appendchild(myalert); note: the same result can be achieved with less code when using a script library like jquery: $("<p role='alert'>you must a
gree with our terms of service to create an account.</p>").appendto(document.body); example 3: adding alert role to an existing element sometimes it...
Using the aria-valuemin attribute - Accessibility
the aria-valuemin attribute is used to define the minimum value allowed for a range widget such as a slider, spinbutton or pro
gressbar.
... <div role="slider" aria-valuenow="4" aria-valuemin="1" aria-valuemax="10"> working examples: pro
gressbar example slider example spinbutton example notes used with aria roles pro
gressbar scrollbar slider spinbutton related aria techniques aria-valuemax aria-valuenow aria-valuetext compatibility tbd: add support information for common ua and at product combinations additional resources wai-aria specification for the aria-valuemin attribute ...
Using the aria-valuetext attribute - Accessibility
the aria-valuetext attribute is used to define the human readable text alternative of aria-valuenow for a range widget such as pro
gressbar, spinbutton or slider.
... <div role="slider" aria-valuenow="1" aria-valuemin="1" aria-valuemax="7" aria-valuetext="sunday"> working examples: notes used with aria roles pro
gressbar scrollbar slider spinbutton related aria techniques aria-valuenow compatibility tbd: add support information for common ua and at product combinations additional resources wai-aria specification for the aria-valuetext attribute ...
ARIA: tab role - Accessibility
by="tab-2" hidden> <p>content for the second panel</p> </div> <div id="panel-3" role="tabpanel" tabindex="0" aria-labelledby="tab-3" hidden> <p>content for the third panel</p> </div> </div> .tabs { padding: 1em; } [role="tablist"] { margin-bottom: -1px; } [role="tab"] { position: relative; z-index: 1; background: white; border-radius: 5px 5px 0 0; border: 1px solid
grey; border-bottom: 0; padding: 0.2em; } [role="tab"][aria-selected="true"] { z-index: 3; } [role="tabpanel"] { position: relative; padding: 0 0.5em 0.5em 0.7em; border: 1px solid
grey; border-radius: 0 0 5px 5px; background: white; z-index: 2; } [role="tabpanel"]:focus { border-color: orange; outline: 1px solid orange; } there are two things we need to do with javascript:...
...if the counter is
greater than the number of tab elements we have, we circle back to the first tab by setting that counter to 0.
ARIA: listbox role - Accessibility
<p id="listbox1label" role="label">select a color:</p> <div role="listbox" tabindex="0" id="listbox1" aria-labelledby="listbox1label" onclick="return listitemclick(event);" onkeydown="return listitemkeyevent(event);" onkeypress="return listitemkeyevent(event);" aria-activedescendant="listbox1-1"> <div role="option" id="listbox1-1" class="selected" aria-selected="true">
green</div> <div role="option" id="listbox1-2">orange</div> <div role="option" id="listbox1-3">red</div> <div role="option" id="listbox1-4">blue</div> <div role="option" id="listbox1-5">violet</div> <div role="option" id="listbox1-6">periwinkle</div> </div> this could have more easily been handled with the native html <select> and <label> elements <label for="listbox1">select a...
... color:</label> <select id="listbox1"> <option selected>
green</option> <option>orange</option> <option>red</option> <option>blue</option> <option>violet</option> <option>periwinkle</option> </select> more examples scrollable listbox example: single-select listbox that scrolls to reveal more options, similar to html select with size attribute
greater than one.
Keyboard - Accessibility
see also tabindex global html attribute global event handlers: onkeydown global event handlers: onkeyup avoid using tabindex attribute
greater than zero the tabindex attribute indicates that an element is focusable using the keyboard.
... see also tabindex global html attribute understanding focus order don't use tabindex
greater than 0 clickable elements must be focusable and should have interactive semantics if an element can be clicked with a pointing device, such as a mouse, then it should also be focusable using the keyboard, and the user should be able to do something by interacting with it.
Text labels and names - Accessibility
this applies to all types of <input> items, as well as <button>, <output>, <select>, <textarea>, <pro
gress> and <meter> elements, as well as any element with the switch aria role.
... example <label>i a
gree to the terms and conditions.
-moz-orient - CSS: Cascading Style Sheets
formal definition initial valueinlineapplies toany element; it has an effect on pro
gress and meter, but not on <input type="range"> or other elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax inline | block | horizontal | vertical examples html <p> the following pro
gress meter is horizontal (the default): </p> <pro
gress max="100" value="75"></pro
gress> <p> the following pro
gress meter is vertical: </p> <pro
gress class="vert" max="100" valu...
...e="75"></pro
gress> css .vert { -moz-orient: vertical; width: 16px; height: 150px; } result specifications not part of any standard.
::backdrop - CSS: Cascading Style Sheets
syntax ::backdrop examples styling the backdrop for full-screen video in this example, the backdrop style used when a video is shifted to full-screen mode is configured to be a
grey-blue color rather than the black it defaults to in most browsers.
... video::backdrop { background-color: #448; } the resulting screen looks like this: note the dark
grey-blue letterbox effect above and below where the backdrop is visible.
::before (:before) - CSS: Cascading Style Sheets
html <ul> <li>buy milk</li> <li>take the dog for a walk</li> <li>exercise</li> <li>write code</li> <li>play music</li> <li>relax</li> </ul> css li { list-style-type: none; position: relative; margin: 2px; padding: 0.5em 0.5em 0.5em 2em; background: light
grey; font-family: sans-serif; } li.done { background: #ccff99; } li.done::before { content: ''; position: absolute; border-color: #009933; border-style: solid; border-width: 0 0.3em 0.25em 0; height: 1em; top: 1.3em; left: 0.6em; margin-top: -1em; transform: rotate(45deg); width: 0.5em; } javascript var list = document.queryselector('ul'); list.addeventlistener('click',...
... html <ol> <li>crack eggs into bowl</li> <li>add milk</li> <li>add flour</li> <li aria-current='step'>mix thoroughly into a smooth batter</li> <li>pour a ladleful of batter onto a hot,
greased, flat frying pan</li> <li>fry until the top of the pancake loses its gloss</li> <li>flip it over and fry for a couple more minutes</li> <li>serve with your favorite topping</li> </ol> css li { padding:0.5em; } li[aria-current='step'] { font-weight:bold; } li[aria-current='step']::after { content: " \21e6"; /* hexadecimal for unicode leftwards white arrow*/ display: inline;...
::placeholder - CSS: Cascading Style Sheets
greg whitworth — how to use -ms-high-contrast labels placeholders are not a replacement for the <label> element.
... mdn basic form hints placeholders in form fields are harmful — nielsen norman group examples red text html <input placeholder="type something here!"> css input::placeholder { color: red; font-size: 1.2em; font-style: italic; } result
green text html <input placeholder="type something here..."> css input::placeholder { color:
green; } result specifications specification status comment css pseudo-elements level 4the definition of '::placeholder' in that specification.
font-stretch - CSS: Cascading Style Sheets
if the font does not provide a face that exactly matches the given value, then values less than 100% map to a narrower face, and values
greater than or equal to 100% map to a wider face.
...however some fonts, called variable fonts, can support a range of stretching with more or less fine granularity, and this can give the designer a much closer de
gree of control over the chosen weight.
unicode-range - CSS: Cascading Style Sheets
for example, a site with many localizations could provide separate font resources for english,
greek and japanese.
... for users viewing the english version of a page, the font resources for
greek and japanese fonts wouldn't need to be downloaded, saving bandwidth.
orientation - CSS: Cascading Style Sheets
keyword values portrait the viewport is in a portrait orientation, i.e., the height is
greater than or equal to the width.
... landscape the viewport is in a landscape orientation, i.e., the width is
greater than the height.
Box-shadow generator - CSS: Cascading Style Sheets
; this.saturation = 0; this.value = 0; } color.prototype.copy = function copy(obj) { if(obj instanceof color !== true) { console.log("typeof instance not color"); return; } this.r = obj.r; this.g = obj.g; this.b = obj.b; this.a = obj.a; this.hue = obj.hue; this.saturation = obj.saturation; this.value = obj.value; } color.prototype.setrgba = function setrgba(red,
green, blue, alpha) { if (red != undefined) this.r = red | 0; if (
green != undefined) this.g =
green | 0; if (blue != undefined) this.b = blue | 0; if (alpha != undefined) this.a = alpha | 0; } /** * hsv/hsb (hue, saturation, value / brightness) * @param hue 0-360 * @param saturation 0-100 * @param value 0-100 */ color.prototype.sethsv = function sethsv(hue, satu...
...(c, x, m); return; } if (h >= 1 && h < 2) { this.setrgba(x, c, m); return; } if (h >= 2 && h < 3) { this.setrgba(m, c, x); return; } if (h >= 3 && h < 4) { this.setrgba(m, x, c); return; } if (h >= 4 && h < 5) { this.setrgba(x, m, c); return; } if (h >= 5 && h < 6) { this.setrgba(c, m, x); return; } } color.prototype.updatehsv = function updatehsv() { var red = this.r / 255; var
green = this.g / 255; var blue = this.b / 255; var cmax = math.max(red,
green, blue); var cmin = math.min(red,
green, blue); var delta = cmax - cmin; var hue = 0; var saturation = 0; if (delta) { if (cmax === red ) { hue = ((
green - blue) / delta); } if (cmax ===
green ) { hue = 2 + (blue - red) / delta; } if (cmax === blue ) { hue = 4 + (red -
green) / delta; } if (cmax) ...
Logical properties for margins, borders and padding - CSS: Cascading Style Sheets
the below code, in a horizontal writing mode, would give you a 2px
green solid border on the top and bottom of the box, and a 4px dotted purple border on the left and right.
... .box { border-block: 2px solid
green; border-inline-width: 4px; border-inline-style: dotted; border-inline-color: rebeccapurple; } note: these two value shorthands shipped in firefox 66, check browser support before using as other browsers may not have implemented them yet.
Using CSS transforms - CSS: Cascading Style Sheets
examples here is an unaltered image of the mdn logo: rotating here is the mdn logo rotated 90 de
grees from its bottom-left corner.
... <img style="transform: rotate(90deg); transform-origin: bottom left;" src="https://udn.realityripple.com/samples/6d/6633f3efc0.png"> skewing and translating here is the mdn logo, skewed by 10 de
grees and translated by 150 pixels on the x-axis.
border-image-width - CSS: Cascading Style Sheets
if this property's value is
greater than the element's border-width, the border image will extend beyond the padding (and/or content) edge.
...stet clita kasd guber
gren, no sea takimata sanctus est lorem ipsum dolor sit amet.</p> css p { border: 20px solid; border-image: url("/static/external/21/214842819586a8dd293c17b38d0fd0e26430146a86dd04294a53ecaeeea7d0e2.png") 30 round; border-image-width: 16px; padding: 40px; } result specifications specification status comment css backgrounds and borders module level 3the de...
flex-wrap - CSS: Cascading Style Sheets
formal definition initial valuenowrapapplies toflex containersinheritednocomputed valueas specifiedanimation typediscrete formal syntax nowrap | wrap | wrap-reverse examples setting flex container wrap values html <h4>this is an example for flex-wrap:wrap </h4> <div class="content"> <div class="red">1</div> <div class="
green">2</div> <div class="blue">3</div> </div> <h4>this is an example for flex-wrap:nowrap </h4> <div class="content1"> <div class="red">1</div> <div class="
green">2</div> <div class="blue">3</div> </div> <h4>this is an example for flex-wrap:wrap-reverse </h4> <div class="content2"> <div class="red">1</div> <div class="
green">2</div> <div class="blue">3</div> </div> css /* common st...
...yles */ .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: yellow
green; } .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 specification.
gap (grid-gap) - CSS: Cascading Style Sheets
examples flex layout html <div id="flexbox"> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> </div> css #flexbox { display: flex; flex-wrap: wrap; width: 300px; gap: 20px 5px; } #flexbox > div { border: 1px solid
green; background-color: lime; flex: 1 1 auto; width: 100px; height: 50px; } result grid layout html <div id="grid"> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> </div> css #grid { grid-gap: 20px 5px; } #grid { display: grid; height: 200px; grid-template: repeat(3, 1fr) / repeat(3, 1fr); g...
...ap: 20px 5px; } #grid > div { border: 1px solid
green; background-color: lime; } result multi-column layout html <p class="content-box"> this is some multi-column text with a 40px column gap created with the css <code>gap</code> property.
grid-auto-columns - CSS: Cascading Style Sheets
minmax(min, max) is a functional notation that defines a size range
greater than or equal to min and less than or equal to max.
...minmax(auto, max-content)), except that the track size is clamped at argument if it is
greater than the auto minimum.
grid-template-columns - CSS: Cascading Style Sheets
minmax(min, max) is a functional notation that defines a size range
greater than or equal to min and less than or equal to max.
...minmax(auto, max-content)), except that the track size is clamped at argument if it is
greater than the auto minimum.
grid-template-rows - CSS: Cascading Style Sheets
minmax(min, max) is a functional notation that defines a size range,
greater than or equal to min, and less than or equal to max.
...minmax(auto, max-content)), except that the track size is clamped at argument if it is
greater than the auto minimum.
Inheritance - CSS: Cascading Style Sheets
given the style rules: p { color:
green; } ...
...the words "emphasized text" will appear
green, since the em element has inherited the value of the color property from the p element.
text-overflow - CSS: Cascading Style Sheets
for example: overflow: hidden; white-space: nowrap; the text-overflow property only affects content that is overflowing a block container element in its inline pro
gression direction (not text overflowing at the bottom of a box, for example).
...values
greater than the width of the line box are clipped to the width of the line box.
perspective() - CSS: Cascading Style Sheets
the
greater the value, the further away the perspective of the user is.
...; } .perspective-box-far { transform: perspective(9cm) rotatex(-15deg) rotatey(30deg); } .perspective-box-closer { transform: perspective(4cm) rotatex(-15deg) rotatey(30deg); } .top { background-color: skyblue; transform: rotatex(90deg) translate3d(0, 0, 50px); } .left { background-color: pink; transform: rotatey(-90deg) translate3d(0, 0, 50px); } .front { background-color: lime
green; transform: translate3d(0, 0, 50px); } result specifications specification status comment css transforms level 2the definition of 'perspective()' in that specification.
width - CSS: Cascading Style Sheets
e containing blockcomputed valuea percentage or auto or the absolute lengthanimation typea length, percentage or calc(); formal syntax auto | <length> | <percentage> | min-content | max-content | fit-content(<length-percentage>)where <length-percentage> = <length> | <percentage> examples default width p.goldie { background: gold; } <p class="goldie">the mozilla community produces a lot of
great software.</p> pixels and ems .px_length { width: 200px; background-color: red; color: white; border: 1px solid black; } .em_length { width: 20em; background-color: white; color: red; border: 1px solid black; } <div class="px_length">width measured in px</div> <div class="em_length">width measured in em</div> percentage .percent { width: 20%; background-color: silv...
...er; border: 1px solid red; } <div class="percent">width in percentage</div> max-content p.max
green { background: light
green; width: intrinsic; /* safari/webkit uses a non-standard name */ width: -moz-max-content; /* firefox/gecko */ width: -webkit-max-content; /* chrome */ width: max-content; } <p class="max
green">the mozilla community produces a lot of
great software.</p> min-content p.minblue { background: lightblue; width: -moz-min-content; /* firefox */ width: -webkit-min-content; /* chrome */ width: min-content; } <p class="minblue">the mozilla community produces a lot of
great software.</p> specifications specification status comment css box sizing module level 4the definition of 'width' in that specification...
z-index - CSS: Cascading Style Sheets
formal definition initial valueautoapplies topositioned elementsinheritednocomputed valueas specifiedanimation typean integercreates stacking contextyes formal syntax auto | <integer> examples visually layering elements html <div class="dashed-box">dashed box <span class="gold-box">gold box</span> <span class="
green-box">
green box</span> </div> css .dashed-box { position: relative; z-index: 1; border: dashed; height: 8em; margin-bottom: 1em; margin-top: 2em; } .gold-box { position: absolute; z-index: 3; /* put .gold-box above .
green-box and .dashed-box */ background: gold; width: 80%; left: 60px; top: 3em; } .
green-box { position: absolute; z-index: 2; /* put .
green-box above...
... .dashed-box */ background: light
green; width: 20%; left: 65%; top: -25px; height: 7em; opacity: 0.9; } result specifications specification status comment css level 2 (revision 1)the definition of 'z-index' in that specification.
Live streaming web audio and video - Developer guides
this is often known as a pro
gressive download.
...it can also be used instead of the traditional pro
gressive download method for audio and video on demand: there are several advantages to this: latency is generally lower so media will start playing more quickly adaptive streaming makes for better experiences on a variety of devices media is downloaded just in time which makes bandwidth usage more efficient streaming protocols while static media is usually served over http, there are severa...
Audio and Video Delivery - Developer guides
you can also choose how to make your player responsive — for example you might remove the pro
gress bar under certain conditions.
... media buffering, seeking, and time ranges sometimes it's useful to know how much <audio> or <video> has downloaded or is playable without delay — a good example of this is the buffered pro
gress bar of an audio or video player.
HTML attribute: maxlength - HTML: Hypertext Markup Language
any maxlength value must be
greater than or equal to the value of minlength, if present and valid.
... the input will fail constraint validation if the length of the text value of the field is
greater than maxlength utf-16 code units long.
HTML attribute: step - HTML: Hypertext Markup Language
for example, if we have <input type="number" min="10" step="2"> any even integer, 10 or
great, is valid.
...the number spinner, if present, will only show valid float values of 1.2 and
greater note: when the data entered by the user doesn't adhere to the stepping configuration, the value is considered invalid in contraint validation and will match the :invalid and :out-of-range pseudoclasses see client-side validation and stepmismatch for more information.
<article>: The Article Contents element - HTML: Hypertext Markup Language
examples <article class="film_review"> <header> <h2>jurassic park</h2> </header> <section class="main_review"> <p>dinos were
great!</p> </section> <section class="user_reviews"> <article class="user_review"> <p>way too scary for me.</p> <footer> <p> posted on <time datetime="2015-05-16 19:00">may 16</time> by lisa.
... </p> </footer> </article> <article class="user_review"> <p>i a
gree, dinos are my favorite.</p> <footer> <p> posted on <time datetime="2015-05-17 19:00">may 17</time> by tom.
<dl>: The Description List element - HTML: Hypertext Markup Language
<dl> <dt>name</dt> <dd>godzilla</dd> <dt>born</dt> <dd>1952</dd> <dt>birthplace</dt> <dd>japan</dd> <dt>color</dt> <dd>
green</dd> </dl> tip: it can be handy to define a key-value separator in the css, such as: dt::after { content: ": "; } wrapping name-value groups in <div> elements whatwg html allows wrapping each name-value group in a <dl> element in a <div> element.
... <dl> <div> <dt>name</dt> <dd>godzilla</dd> </div> <div> <dt>born</dt> <dd>1952</dd> </div> <div> <dt>birthplace</dt> <dd>japan</dd> </div> <div> <dt>color</dt> <dd>
green</dd> </div> </dl> notes do not use this element (nor <ul> elements) to merely create indentation on a page.
<img>: The Image Embed element - HTML: Hypertext Markup Language
an alt decision tree • images • wai web accessibility tutorials alt-texts: the ultimate guide — axess lab how to design
great alt text: an introduction | deque mdn understanding wcag, guideline 1.1 explanations understanding success criterion 1.1.1 | w3c understanding wcag 2.0 the title attribute the title attribute is not an acceptable substitute for the alt attribute.
... implicit aria role with non-empty alt attribute or no alt attribute: img with empty alt attribute: no corresponding role permitted aria roles with non-empty alt attribute: button checkbox link menuitem menuitemcheckbox menuitemradio option pro
gressbar scrollbar separator slider switch tab treeitem with empty alt attribute, none or presentation with no alt attribute, no role permitted dom interface htmlimageelement specifications specification status comment referrer policythe definition of 'referrer attribute' in that specification.
<input type="datetime-local"> - HTML: Hypertext Markup Language
the problem is with the server side of things: storage of dates
greater than 231-1.
...if you are stuck with other hardware, you can try to emulate 64-bit hardware inside a 32-bit virtual machine, but most vms don't support this kind of virtualization, stability may suffer, and performance will definately suffer
greatly.
<ol>: The Ordered List element - HTML: Hypertext Markup Language
for example: steps in a recipe turn-by-turn directions the list of in
gredients in decreasing proportion on nutrition information labels to determine which list to use, try changing the order of the list items; if the meaning changes, use the <ol> element — otherwise you can use <ul>.
... examples simple example <ol> <li>fee</li> <li>fi</li> <li>fo</li> <li>fum</li> </ol> the above html will output: using roman numeral type <ol type="i"> <li>introduction</li> <li>list of
greivances</li> <li>conclusion</li> </ol> the above html will output: using the start attribute <p>finishing places of contestants not in the winners’ circle:</p> <ol start="4"> <li>speedwalk stu</li> <li>saunterin’ sam</li> <li>slowpoke rodriguez</li> </ol> the above html will output: nesting lists <ol> <li>first item</li> <li>second item <!-- closing </li> tag not here!
<time> - HTML: Hypertext Markup Language
a precise date in the
gregorian calendar (with optional time and timezone information).
... this element should not be used for dates prior to the introduction of the
gregorian calendar (due to complications in calculating those dates).
<tr>: The Table Row element - HTML: Hypertext Markup Language
the "joined" and "canceled" headers let's style these two header cells with
green and red hues to represent the "good" of a new member and the "bummer" of a canceled membership.
... thead > tr:last-of-type > th:nth-of-type(1) { background-color: rgb(225, 255, 225); } thead > tr:last-of-type > th:nth-of-type(2) { background-color: rgb(255, 225, 225); } here we dig into the last row of the table's header block and give the first header cell in it (the "joined" header) a
greenish color, and the second header cell in it (the "canceled" header) a reddish hue.
itemtype - HTML: Hypertext Markup Language
<br> </span> product #: <span itemprop="mpn">925872<br></span> <span itemprop="ag
gregaterating" itemscope itemtype="http://schema.org/ag
gregaterating"> rating: <span itemprop="ratingvalue">4.4</span> stars, based on <span itemprop="reviewcount">89 </span> reviews </span><p> <span itemprop="offers" itemscope itemtype="http://schema.org/offer"> regular price: $179.99<br> <meta itemprop="pricecurrency" content="usd" /> <span itemprop="price">sale price: $119...
... itemprop mpn 925872 itemprop brand [thing] itemprop name acme itemscope itemprop[itemtype] ag
gregaterating[ag
gregaterating] itemprop ratingvalue 4.4 itemprop reviewcount 89 itemprop offers [offer] http://schema.org/offer itemprop pricecurrency usd itemprop price 119.99 itemprop pricevaliduntil 2020-11-05 itemprop itemcondition http://schema.org/usedcondition itemprop avai...
Content negotiation - HTTP
even if server-driven content negotiation is the most common way to a
gree on a specific representation of a resource, it has several drawbacks: the server doesn't have total knowledge of the browser.
...it is comma-separated lists of mime types, each combined with a quality factor, a parameter indicating the relative de
gree of preference between the different mime types.
Using Feature Policy - HTTP
enforcing best practices for good user experiences it's difficult to build a website that uses all the latest best practices and provides
great performance and user experiences.
...you can use feature policies to specify the desired best practices, and rely on the browser to enforce the policies to prevent re
gressions.
Link prefetching FAQ - HTTP
in the current implementation (mozilla 1.2), idle time is determined using the nsiwebpro
gresslistener api.
... we attach a listener to the toplevel nsiwebpro
gress object ("@mozilla.org/docloaderservice;1").
An overview of HTTP - HTTP
new functionality can even be introduced by a simple a
greement between a client and a server about a new header's semantics.
... experiments are in pro
gress to design a better transport protocol more suited to http.
Expressions and operators - JavaScript
var1 !== "3" 3 !== '3'
greater than (>) returns true if the left operand is
greater than the right operand.
... var2 > var1 "12" > 2
greater than or equal (>=) returns true if the left operand is
greater than or equal to the right operand.
Introduction - JavaScript
for the sake of simplicity, it can be imagined that every time something is entered into the console, it is actually surrounded by console.log around eval, like so: function
greetme(yourname) { alert("hello " + yourname) } console.log(eval('3 + 5')) multi-line input in the web console the single-line input mode of the web console is
great for quick testing of javascript expressions, but although you can execute multiple lines, it's not very convenient for that.
... hello world to get started with writing javascript, open the web console in multi-line mode, and write your first "hello world" javascript code: (function(){ "use strict"; /* start of your code */ function
greetme(yourname) { alert('hello ' + yourname); }
greetme('world'); /* end of your code */ })(); press cmd+enter or ctrl+enter (or click the run button) to watch it unfold in your browser!
Regular expressions - JavaScript
character classes ^, $, x(?=y), x(?!y), (?<=y)x, (?<!y)x, \b, \b assertions (x), (?:x), (?<name>x), x|y, [xyz], [^xyz], \number groups and ranges *, +, ?, x{n}, x{n,}, x{n,m} quantifiers \p{unicodeproperty}, \p{unicodeproperty} unicode property escapes note: a larger cheatsheet is also available (only ag
gregating parts of those individual articles).
... the g flag is used with the .exec() method to get iterative pro
gression.
Using Promises - JavaScript
one of the
great things about using promises is chaining.
...when used correctly, this gives
greater precision in error recovery: dosomethingcritical() .then(result => dosomethingoptional(result) .then(optionalresult => dosomethingextranice(optionalresult)) .catch(e => {})) // ignore if optional stuff fails; proceed.
Working with objects - JavaScript
= 'random number'; myobj[obj] = 'object'; myobj[''] = 'even an empty string'; console.log(myobj); please note that all keys in the square bracket notation are converted to string unless they're symbols, since javascript object property names (keys) can only be strings or symbols (at some point, private names will also be added as the class fields proposal pro
gresses, but you won't use them with [] form).
... the following statement creates an object and assigns it to the variable x if and only if the expression cond is true: if (cond) var x = {
greeting: 'hi there'}; the following example creates myhonda with three properties.
RangeError: radix must be an integer - JavaScript
the javascript exception "radix must be an integer at least 2 and no
greater than 36" occurs when the optional radix parameter of the number.prototype.tostring() or the bigint.prototype.tostring() method was specified and is not between 2 and 36.
... message rangeerror: invalid argument (edge) rangeerror: radix must be an integer at least 2 and no
greater than 36 (firefox) rangeerror: tostring() radix argument must be between 2 and 36 (chrome) error type rangeerror what went wrong?
SyntaxError: missing formal parameter - JavaScript
all these function declarations fail, as they are providing values for their parameters: function square(3) { return number * number; }; // syntaxerror: missing formal parameter function
greet("howdy") { return
greeting; }; // syntaxerror: missing formal parameter function log({ obj: "value"}) { console.log(arg) }; // syntaxerror: missing formal parameter you will need to use identifiers in function declarations: function square(number) { return number * number; }; function
greet(
greeting) { return
greeting; }; function log(arg) { console.log(arg) }; you can then cal...
...l these functions with the arguments you like: square(2); // 4
greet("howdy"); // "howdy" log({obj: "value"}); // object { obj: "value" } ...
SyntaxError: "x" is a reserved identifier - JavaScript
var enum = { red: 0,
green: 1, blue: 2 }; // syntaxerror: enum is a reserved identifier in strict mode code, more identifiers are reserved.
... var colorenum = { red: 0,
green: 1, blue: 2 }; var list = ["potatoes", "rice", "fries"]; update older browsers if you are using an older browser that does not yet implement let or class, for example, you should update to a more recent browser version that does support these new language features.
Array.prototype.indexOf() - JavaScript
if the index is
greater than or equal to the array's length, -1 is returned, which means the array will not be searched.
... not and updating the array function updatevegetablescollection (veggies, veggie) { if (veggies.indexof(veggie) === -1) { veggies.push(veggie); console.log('new veggies collection is : ' + veggies); } else if (veggies.indexof(veggie) > -1) { console.log(veggie + ' already exists in the veggies collection.'); } } var veggies = ['potato', 'tomato', 'chillies', '
green-pepper']; updatevegetablescollection(veggies, 'spinach'); // new veggies collection is : potato,tomato,chillies,
green-pepper,spinach updatevegetablescollection(veggies, 'spinach'); // spinach already exists in the veggies collection.
Array.prototype.length - JavaScript
the value is an unsigned, 32-bit integer that is always numerically
greater than the highest index in the array.
... var numbers = [1, 2, 3, 4, 5]; var length = numbers.length; for (var i = 0; i < length; i++) { numbers[i] *= 2; } // numbers is now [2, 4, 6, 8, 10] shortening an array the following example shortens the array numbers to a length of 3 if the current length is
greater than 3.
Array.prototype.slice() - JavaScript
if start is
greater than the index range of the sequence, an empty array is returned.
... if end is
greater than the length of the sequence, slice extracts through to the end of the sequence (arr.length).
Array.prototype.sort() - JavaScript
if comparefunction(a, b) returns
greater than 0, sort b to an index lower than a (i.e.
... so, the compare function has the following form: function compare(a, b) { if (a is less than b by some ordering criterion) { return -1; } if (a is
greater than b by the ordering criterion) { return 1; } // a must be equal to b return 0; } to compare numbers instead of strings, the compare function can simply subtract b from a.
Array.prototype.splice() - JavaScript
if
greater than the length of the array, start will be set to the length of the array.
... if deletecount is omitted, or if its value is equal to or larger than array.length - start (that is, if it is equal to or
greater than the number of elements left in the array, starting at start), then all the elements from start to the end of the array will be deleted.
Array - JavaScript
m // ["strawberry", "mango"] remove items from an index position let vegetables = ['cabbage', 'turnip', 'radish', 'carrot'] console.log(vegetables) // ["cabbage", "turnip", "radish", "carrot"] let pos = 1 let n = 2 let removeditems = vegetables.splice(pos, n) // this is how to remove items, n defines the number of items to be removed, // starting at the index position specified by pos and pro
gressing toward the end of array.
... array.prototype.lastindexof() returns the last (
greatest) index of an element within the array equal to an element, or -1 if none is found.
BigInt.prototype.toString() - JavaScript
exceptions rangeerror if tostring() is given a radix less than 2 or
greater than 36, a rangeerror is thrown.
...for radixes above 10, the letters of the alphabet indicate numerals
greater than 9.
Date.prototype.getYear() - JavaScript
description for years
greater than or equal to 2000, the value returned by getyear() is 100 or
greater.
... for years less than 1900 or
greater than 1999, the value returned by getyear() is the four-digit year.
Date.prototype.toGMTString() - JavaScript
the togmtstring() method converts a date to a string, using internet
greenwich mean time (gmt) conventions.
... syntax dateobj.togmtstring() return value a string representing the given date following the internet
greenwich mean time (gmt) convention.
Date - JavaScript
(this time is historically known as
greenwich mean time, as utc lies along the meridian that includes london—and nearby
greenwich—in the united kingdom.) the user's device provides the local time.
... due to the differing lengths of days (due to daylight saving changeover), months, and years, expressing elapsed time in units
greater than hours, minutes, and seconds requires addressing a number of issues, and should be thoroughly researched before being attempted.
Function.prototype.call() - JavaScript
lion', name: 'king' }, { species: 'whale', name: 'fail' } ]; for (let i = 0; i < animals.length; i++) { (function(i) { this.print = function() { console.log('#' + i + ' ' + this.species + ': ' + this.name); } this.print(); }).call(animals[i], i); } using call to invoke a function and specifying the context for 'this' in the example below, when we call
greet, the value of this will be bound to object obj.
... function
greet() { const reply = [this.animal, 'typically sleep between', this.sleepduration].join(' '); console.log(reply); } const obj = { animal: 'cats', sleepduration: '12 and 16 hours' };
greet.call(obj); // cats typically sleep between 12 and 16 hours using call to invoke a function and without specifying the first argument in the example below, we invoke the display function without passing the first argument.
Intl.DateTimeFormat() constructor - JavaScript
possible values include: "buddhist", "chinese", "coptic", "ethiopia", "ethiopic", "
gregory", "hebrew", "indian", "islamic", "iso8601", "japanese", "persian", "roc".
...possible values include: "buddhist", "chinese", " coptic", "ethiopia", "ethiopic", "
gregory", " hebrew", "indian", "islamic", "iso8601", " japanese", "persian", "roc".
Intl.DateTimeFormat.prototype.resolvedOptions() - JavaScript
"
gregory" numberingsystem the values requested using the unicode extension keys "ca" and "nu" or filled in as default values.
... examples using the resolvedoptions method var germanfakeregion = new intl.datetimeformat('de-xx', { timezone: 'utc' }); var usedoptions = germanfakeregion.resolvedoptions(); usedoptions.locale; // "de" usedoptions.calendar; // "
gregory" usedoptions.numberingsystem; // "latn" usedoptions.timezone; // "utc" usedoptions.month; // "numeric" specifications specification ecmascript internationalization api (ecma-402)the definition of 'intl.datetimeformat.prototype.resolvedoptions' in that specification.
Intl.Locale.prototype.maximize() - JavaScript
examples using maximize let mylocale = new intl.locale("fr", {hourcycle: "h24", calendar: "
gregory"}); console.log(mylocale.basename); // prints "fr" console.log(mylocale.tostring()); // prints "fr-u-ca-
gregory-hc-h24" let mylocmaximized = mylocale.maximize(); // prints "fr-latn-fr".
...console.log(mylocmaximized.basename); // prints "fr-latn-fr-u-ca-
gregory-hc-h24".
Intl.Locale.prototype.minimize() - JavaScript
examples using minimize let mylocale = new intl.locale("fr-latn-fr", {hourcycle: "h24", calendar: "
gregory"}); console.log(mylocale.basename); // prints "fr-latn-fr" console.log(mylocale.tostring()); // prints "fr-latn-fr-u-ca-
gregory-hc-h24" let mylocminimized = mylocale.minimize(); // prints "fr", since french is only written in the latin script // and is most likely to be spoken in france.
... console.log(mylocminimized.basename); // prints "fr-u-ca-
gregory-hc-h24".
Number.prototype.toString() - JavaScript
exceptions rangeerror if tostring() is given a radix less than 2 or
greater than 36, a rangeerror is thrown.
...for radices above 10, the letters of the alphabet indicate numerals
greater than 9.
Reflect - JavaScript
examples detecting whether an object contains certain properties const duck = { name: 'maurice', color: 'white',
greeting: function() { console.log(`quaaaack!
... my name is ${this.name}`); } } reflect.has(duck, 'color'); // true reflect.has(duck, 'haircut'); // false returning the object's own keys reflect.ownkeys(duck); // [ "name", "color", "
greeting" ] adding a new property to the object reflect.set(duck, 'eyes', 'black'); // returns "true" if successful // "duck" now contains the property "eyes: 'black'" specifications specification ecmascript (ecma-262)the definition of 'reflect' in that specification.
parseInt() - JavaScript
(for example, a radix of 10 converts from a decimal number, 8 converts from octal, 16 from hexadecimal, and so on.) for radices above 10, letters of the english alphabet indicate numerals
greater than 9.
... parseint(4.7, 10) parseint(4.7 * 1e22, 10) // very large number becomes 4 parseint(0.00000000000434, 10) // very small number becomes 4 if the number is
greater than 1e+21 (including) or less than 1e-7 (including), it will return 1.
Conditional (ternary) operator - JavaScript
"beer" : "juice"; console.log(beverage); // "beer" handling null values one common usage is to handle a value that may be null: let
greeting = person => { let name = person ?
... person.name : `stranger` return `howdy, ${name}` } console.log(
greeting({name: `alice`})); // "howdy, alice" console.log(
greeting(null)); // "howdy, stranger" conditional chains the ternary operator is right-associative, which means it can be "chained" in the following way, similar to an if … else if … else if … else chain: function example(…) { return condition1 ?
Strict mode - JavaScript
strict mode makes
great strides toward treating eval and arguments as keywords, although full fixes will not come until a future edition of ecmascript.
... two mozilla-specific caveats: first, if your code is javascript 1.7 or
greater (for example in chrome code or when using the right <script type="">) and is strict mode code, let and yield have the functionality they've had since those keywords were first introduced.
Authoring MathML - MathML
those of math search engines or feed ag
gregators).
...this is still a work-in-pro
gress, but could be improved in the future thanks to web components and shadow dom.
Critical rendering path - Web Performance
the
greater the number of nodes, the longer the following events in the critical rendering path will take.
... layout performance is impacted by the dom -- the
greater the number of nodes, the longer layout takes.
cx - SVG: Scalable Vector Graphics
value <length> default value 50% animatable yes example html,body,svg { height:100% } <svg viewbox="0 0 34 10" xmlns="http://www.w3.org/2000/svg"> <defs> <radialgradient cx="0" id="mygradient000"> <stop offset="0%" stop-color="gold" /> <stop offset="50%" stop-color="
green" /> <stop offset="100%" stop-color="white" /> </radialgradient> <radialgradient cx="50%" id="mygradient050"> <stop offset="0%" stop-color="gold" /> <stop offset="50%" stop-color="
green" /> <stop offset="100%" stop-color="white" /> </radialgradient> <radialgradient cx="100%" id="mygradient100"> <stop offset="0%" stop-color="gold" /> <sto...
...p offset="50%" stop-color="
green" /> <stop offset="100%" stop-color="white" /> </radialgradient> </defs> <rect x="1" y="1" width="8" height="8" fill="url(#mygradient000)" stroke="black" /> <rect x="13" y="1" width="8" height="8" fill="url(#mygradient050)" stroke="black" /> <rect x="25" y="1" width="8" height="8" fill="url(#mygradient100)" stroke="black" /> </svg> specifications specification status comment scalable vector graphics (svg) 2the definition of 'cx' in that specification.
cy - SVG: Scalable Vector Graphics
value <length> default value 50% animatable yes example html,body,svg { height:100% } <svg viewbox="0 0 34 10" xmlns="http://www.w3.org/2000/svg"> <defs> <radialgradient cy="0" id="mygradient000"> <stop offset="0%" stop-color="gold" /> <stop offset="50%" stop-color="
green" /> <stop offset="100%" stop-color="white" /> </radialgradient> <radialgradient cy="50%" id="mygradient050"> <stop offset="0%" stop-color="gold" /> <stop offset="50%" stop-color="
green" /> <stop offset="100%" stop-color="white" /> </radialgradient> <radialgradient cy="100%" id="mygradient100"> <stop offset="0%" stop-color="gold" /> <sto...
...p offset="50%" stop-color="
green" /> <stop offset="100%" stop-color="white" /> </radialgradient> </defs> <rect x="1" y="1" width="8" height="8" fill="url(#mygradient000)" stroke="black" /> <rect x="13" y="1" width="8" height="8" fill="url(#mygradient050)" stroke="black" /> <rect x="25" y="1" width="8" height="8" fill="url(#mygradient100)" stroke="black" /> </svg> specifications specification status comment scalable vector graphics (svg) 2the definition of 'cy' in that specification.
dominant-baseline - SVG: Scalable Vector Graphics
n attribute, it can be applied to any element but it only has effect on the text content elements, including: <altglyph>, <text>, <textpath>, <tref>, and <tspan> html, body, svg { height: 100%; } text { font: bold 14px verdana, helvetica, arial, sans-serif; } <svg viewbox="0 0 200 120" xmlns="http://www.w3.org/2000/svg"> <path d="m20,20 l180,20 m20,50 l180,50 m20,80 l180,80" stroke="
grey" /> <text dominant-baseline="baseline" x="30" y="20">baseline</text> <text dominant-baseline="middle" x="30" y="50">middle</text> <text dominant-baseline="hanging" x="30" y="80">hanging</text> </svg> usage notes value auto | text-bottom | alphabetic | ideographic | middle | central | mathematical | hanging | text-top default value auto animatabl...
... example svg <svg width="400" height="300" viewbox="0 0 300 300" xmlns="http://www.w3.org/2000/svg"> <!-- materialization of anchors --> <path d="m60,20 l60,270 m30,20 l400,20 m30,70 l400,70 m30,120 l400,120 m30,170 l400,170 m30,220 l400,220 m30,270 l400,270" stroke="
grey" /> <!-- anchors in action --> <text dominant-baseline="auto" x="70" y="20">auto</text> <text dominant-baseline="middle" x="70" y="70">middle</text> <text dominant-baseline="baseline" x="70" y="120">baseline</text> <text dominant-baseline="hanging" x="70" y="170">hanging</text> <text dominant-baseline="mathematical" x="70" y="220">mathematical</text> <text dominant-b...
externalResourcesRequired - SVG: Scalable Vector Graphics
because setting externalresourcesrequired="true" on a container element will have the effect of disabling pro
gressive display of the contents of that container, if that container includes elements that reference external resources, authors should avoid simply setting externalresourcesrequired="true" on the outermost <svg> element on a universal basis.
...if an external resource is not available, pro
gressive rendering is suspended, the document's svgload event is not fired and the animation timeline does not begin until that resource and all other required resources become available, have been parsed and are ready to be rendered.
keyPoints - SVG: Scalable Vector Graphics
five elements are using this attribute: <animate>, <animatecolor>, <animatemotion>, <animatetransform>, and <set> html, body, svg { height: 100%; } <svg viewbox="0 0 120 120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <path d="m10,110 a120,120 -45 0,1 110 10 a120,120 -45 0,1 10,110" stroke="light
grey" stroke-width="2" fill="none" id="motionpath"/> <circle cx="10" cy="110" r="3" fill="light
grey"/> <circle cx="110" cy="10" r="3" fill="light
grey"/> <circle r="5" fill="red"> <animatemotion dur="3s" repeatcount="indefinite" keypoints="0;0.5;1" keytimes="0;0.15;1" calcmode="linear"> <mpath xlink:href="#motionpath"/> </animatemotion> </circle> </svg> usage notes ...
...each pro
gress value in the list corresponds to a value in the keytimes attribute list.
opacity - SVG: Scalable Vector Graphics
the opacity attribute specifies the transparency of an object or of a group of objects, that is, the de
gree to which the background behind the element is overlaid.
...<polygon>, <polyline>, <rect>, <svg>, <switch>, <symbol>, <text>, <textpath>, <tspan>, <use>, <unknown>, and <video> html, body, svg { height: 100%; } <svg viewbox="0 0 200 100" xmlns="http://www.w3.org/2000/svg"> <defs> <lineargradient id="gradient" x1="0%" y1="0%" x2="0" y2="100%"> <stop offset="0%" style="stop-color:skyblue;" /> <stop offset="100%" style="stop-color:sea
green;" /> </lineargradient> </defs> <rect x="0" y="0" width="100%" height="100%" fill="url(#gradient)" /> <circle cx="50" cy="50" r="40" fill="black" /> <circle cx="150" cy="50" r="40" fill="black" opacity="0.3" /> </svg> usage notes default value 1 value <alpha-value> animatable yes <alpha-value> the uniform opacity setting to be applie...
orient - SVG: Scalable Vector Graphics
d="dataarrow" viewbox="0 0 10 10" refx="5" refy="5" markerwidth="6" markerheight="6" orient="-65deg"> <path d="m 0 0 l 10 5 l 0 10 z" fill="red" /> </marker> </defs> <polyline points="10,10 10,90 90,90" fill="none" stroke="black" marker-start="url(#arrow)" marker-end="url(#arrow)" /> <polyline points="15,80 29,50 43,60 57,30 71,40 85,15" fill="none" stroke="
grey" marker-start="url(#dataarrow)" marker-mid="url(#dataarrow)" marker-end="url(#dataarrow)" /> </svg> usage notes value auto | auto-start-reverse | <angle> | <number> default value 0 animatable yes (non-additive) auto this value indicates that the marker is oriented such that its positive x-axis is pointing in a direction relative to t...
... <number> this value indicates an angle in de
grees.
stroke-miterlimit - SVG: Scalable Vector Graphics
the ratio of miter length (distance between the outer tip and the inner corner of the miter) to stroke-width is directly related to the angle (theta) between the segments in user space by the formula: stroke-miterlimit = miterlength stroke-width = 1 sin ( θ 2 ) for example, a miter limit of 1.414 converts miters to bevels for theta less than 90 de
grees, a limit of 4.0 converts them for theta less than approximately 29 de
grees, and a limit of 10.0 converts them for theta less than approximately 11.5 de
grees.
... usage context value <number> default value 4 animatable yes the value of stroke-miterlimit must be
greater than or equal to 1.
writing-mode - SVG: Scalable Vector Graphics
the writing-mode attribute specifies whether the initial inline-pro
gression-direction for a <text> element shall be left-to-right, right-to-left, or top-to-bottom.
...(note that the inline-pro
gression-direction can change within a <text> element due to the unicode bidirectional algorithm and properties direction and unicode-bidi.) note: as a presentation attribute, writing-mode can be used as a css property.
x1 - SVG: Scalable Vector Graphics
two elements are using this attribute: <line>, and <lineargradient> html,body,svg { height:100% } <svg viewbox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"> <line x1="1" x2="5" y1="1" y2="9" stroke="red" /> <line x1="5" x2="5" y1="1" y2="9" stroke="
green" /> <line x1="9" x2="5" y1="1" y2="9" stroke="blue" /> </svg> line for <line>, x1 defines the x coordinate of the starting point of the line.
... value <length> | <percentage> default value 0 animatable yes example html,body,svg { height:100% } <svg viewbox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"> <line x1="1" x2="5" y1="1" y2="9" stroke="red" /> <line x1="5" x2="5" y1="1" y2="9" stroke="
green" /> <line x1="9" x2="5" y1="1" y2="9" stroke="blue" /> </svg> lineargradient for <lineargradient>, x1 defines the x coordinate of the starting point of the gradient vector used to map the gradient stop values.
x2 - SVG: Scalable Vector Graphics
two elements are using this attribute: <line>, and <lineargradient> html,body,svg { height:100% } <svg viewbox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"> <line x1="5" x2="1" y1="1" y2="9" stroke="red" /> <line x1="5" x2="5" y1="1" y2="9" stroke="
green" /> <line x1="5" x2="9" y1="1" y2="9" stroke="blue" /> </svg> line for <line>, x2 defines the x coordinate of the ending point of the line.
... value <length> | <percentage> default value 0 animatable yes example html,body,svg { height:100% } <svg viewbox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"> <line x1="5" x2="1" y1="1" y2="9" stroke="red" /> <line x1="5" x2="5" y1="1" y2="9" stroke="
green" /> <line x1="5" x2="9" y1="1" y2="9" stroke="blue" /> </svg> lineargradient for <lineargradient>, x2 defines the x coordinate of the ending point of the gradient vector used to map the gradient stop values.
y1 - SVG: Scalable Vector Graphics
two elements are using this attribute: <line>, and <lineargradient> html,body,svg { height:100% } <svg viewbox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"> <line x1="1" x2="9" y1="1" y2="5" stroke="red" /> <line x1="1" x2="9" y1="5" y2="5" stroke="
green" /> <line x1="1" x2="9" y1="9" y2="5" stroke="blue" /> </svg> line for <line>, y1 defines the y coordinate of the starting point of the line.
... value <length> | <percentage> default value 0 animatable yes example html,body,svg { height:100% } <svg viewbox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"> <line x1="1" x2="9" y1="1" y2="5" stroke="red" /> <line x1="1" x2="9" y1="5" y2="5" stroke="
green" /> <line x1="1" x2="9" y1="9" y2="5" stroke="blue" /> </svg> lineargradient for <lineargradient>, y1 defines the y coordinate of the starting point of the gradient vector used to map the gradient stop values.
y2 - SVG: Scalable Vector Graphics
two elements are using this attribute: <line>, and <lineargradient> html,body,svg { height:100% } <svg viewbox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"> <line x1="1" x2="9" y1="5" y2="1" stroke="red" /> <line x1="1" x2="9" y1="5" y2="5" stroke="
green" /> <line x1="1" x2="9" y1="5" y2="9" stroke="blue" /> </svg> line for <line>, y2 defines the y coordinate of the ending point of the line.
... value <length> | <percentage> default value 0 animatable yes example html,body,svg { height:100% } <svg viewbox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"> <line x1="1" x2="9" y1="5" y2="1" stroke="red" /> <line x1="1" x2="9" y1="5" y2="5" stroke="
green" /> <line x1="1" x2="9" y1="5" y2="9" stroke="blue" /> </svg> lineargradient for <lineargradient>, y2 defines the y coordinate of the ending point of the gradient vector used to map the gradient stop values.
<feGaussianBlur> - SVG: Scalable Vector Graphics
example simple example svg <svg width="230" height="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <filter id="blurme"> <fegaussianblur in="sourcegraphic" stddeviation="5" /> </filter> <circle cx="60" cy="60" r="50" fill="
green" /> <circle cx="170" cy="60" r="50" fill="
green" filter="url(#blurme)" /> </svg> result screenshotlive sample drop shadow example svg <svg width="120" height="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <filter id="dropshadow"> <fegaussianblur in="sourcealpha" stddeviation="3" /> <feoffset dx="2" dy="4" /> <femerge> ...
... <femergenode /> <femergenode in="sourcegraphic" /> </femerge> </filter> <circle cx="60" cy="60" r="50" fill="
green" filter="url(#dropshadow)" /> </svg> result screenshotlive sample specifications specification status comment filter effects module level 1the definition of '<fegaussianblur>' in that specification.
SVG 2 support in Mozilla - SVG: Scalable Vector Graphics
allow overflow: auto; to clip and show scroll bars implementation status unknown allow overflow: scroll; to show scroll bars on <svg> elements implementation status unknown basic data types and interfaces change notes dommatrix or dommatrixreadonly instead of svgmatrix implementation status unknown domrect or domrectreadonly instead of sv
grect implementation status unknown dompoint or dompointreadonly instead of svgpoint implementation status unknown members of svgstylable and svglangspace available in svgelement implementation status unknown svggraphicselement instead of svglocatable and svgtransformable implementation status unknown svggeometryelement with svggeometryelement.ispointin...
... attribute implemented (bug 778654) bounding-box on pointer-events not implemented (bug 945187) load, abort, error, and unload instead of svgload, svgabort, svgerror, and svgunload not implemented (bug 620002) only structurally external elements and outermost <svg> element fire load events implementation status unknown resize and scroll instead of sv
gresize and svgscroll implementation status unknown domactivate removed implementation status unknown focusin and focusout instead of domfocusin and domfocusout implementation status unknown keyboard events implementation status unknown mutation events removed implementation status unknown svgzoomevent removed implementation status unknow...
SVG and CSS - SVG: Scalable Vector Graphics
ill: none; stroke: deepskyblue; stroke-width: 3; } #outer-petals .segment:hover > .segment-fill { fill: plum; stroke: none; } #outer-petals .segment:hover > .segment-edge { stroke: slateblue; } /* inner petals */ #inner-petals { --segment-fill-fill: yellow; --segment-fill-stroke: yellow; --segment-fill-stroke-width: 1; --segment-edge-fill: none; --segment-edge-stroke: yellow
green; --segment-edge-stroke-width: 9; --segment-fill-fill-hover: darksea
green; --segment-fill-stroke-hover: none; --segment-edge-stroke-hover:
green; } /* non-standard way of styling elements referenced via <use> elements, supported by some older browsers */ #inner-petals .segment-fill { fill: yellow; stroke: yellow; stroke-width: 1; } #inner-petals .segment-edge { fill: none; ...
...stroke: yellow
green; stroke-width: 9; } #inner-petals .segment:hover > .segment-fill { fill: darksea
green; stroke: none; } #inner-petals .segment:hover > .segment-edge { stroke:
green; } open the document in your svg-enabled browser.
How to turn off form autocompletion - Web security
for this reason, many modern browsers do not support autocomplete="off" for login fields: if a site sets autocomplete="off" for a <form>, and the form includes username and password input fields, then the browser still offers to remember this login, and if the user a
grees, the browser will autofill those fields the next time the user visits the page.
... if a site sets autocomplete="off" for username and password <input> fields, then the browser still offers to remember this login, and if the user a
grees, the browser will autofill those fields the next time the user visits the page.
Transport Layer Security - Web security
a tls connection starts with a handshake phase where a client and server a
gree on a shared secret and important parameters, like cipher suites, are negotiated.
... the cipher suite in tls 1.3 primarily governs the encryption of data, separate negotiation methods are used for key a
greement and authentication.
XML introduction - XML: Extensible Markup Language
entities like html, xml offers methods (called entities) for referring to some special reserved characters (such as a
greater than sign which is used for tags).
... there are five of these characters that you should know: entity character description < < less than sign > >
greater than sign & & ampersand " " one double-quotation mark ' ' one apostrophe (or single-quotation mark) even though there are only 5 declared entities, more can be added using the document's document type definition.
ceiling - XPath
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the ceiling function evaluates a decimal number and returns the smallest integer
greater than or equal to the decimal number.
... returns the nearest integer
greater than or equal to number.
Common XSLT Errors - XSLT: Extensible Stylesheet Language Transformations
often times stylesheets contain code like <xsl:text disable-output-escaping="yes"> </xsl:text>, this is equivalent to simply putting   in the stylesheet which will work
great in all xslt engines.
... if you'd like to help out with any of the above features, help would be
greatly appreciated.
Modules - Archive of obsolete content
the use of modules
greatly improves the maintainability of code, by splitting it up into independent components, and enforcing logical boundaries between them.
page-mod - Archive of obsolete content
for example: var data = require("sdk/self").data; var pagemod = require("sdk/page-mod"); pagemod.pagemod({ include: "*", contentscriptfile: data.url("show.js"), contentscriptoptions: { showoptions: true, numbers: [1, 2],
greeting: "hello!" } }); the values are accessible to content scripts via the self.options property: // show.js if (self.options.showoptions) { window.alert(self.options.
greeting); var sum = self.options.numbers[0] + self.options.numbers[1]; window.alert(sum); } the values can be any json-serializable value: a string, number, boolean, null, array of json-serializable values, or...
lang/functional - Archive of obsolete content
let { compose } = require("sdk/lang/functional"); let welcome = compose(exclaim,
greet); welcome('moe'); // "hi: moe!"; function
greet (name) { return "hi: " + name; } function exclaim (statement) { return statement + "!"; } parameters fn...
places/history - Archive of obsolete content
data events are emitted for every individual search result found, whereas end events are emitted as an ag
gregate of an entire search, passing in an array of all results into the handler.
system/child_process - Archive of obsolete content
const { emit } = require('sdk/event/core'); const { spawn } = require('sdk/system/child_process'); var proc = spawn("/bin/cat"); emit(proc.stdin, 'data', "hello from add-on code"); emit(proc.stdin, 'end'); using child_process in non-jpm extensions // import sdk stuff const commonjs_uri = 'resource://
gre/modules/commonjs'; const { require } = cu.import(commonjs_uri + '/toolkit/require.js', {}); var child_process = require('sdk/system/child_process'); // use it in the same way as in the example above ...
Developing for Firefox Mobile - Archive of obsolete content
for example, on mac os x or linux you can use a command like the one below to filter only the lines of console output: adb logcat |
grep console you can experiment with different filter strings on adb logcat to focus in on the lines relevant to you.
Modifying Web Pages Based on URL - Archive of obsolete content
var pagemod = require("sdk/page-mod").pagemod({ include: "*", contentstyle: "body {" + " border: 5px solid
green;" + "}" }); as with contentscript, there's a corresponding contentstylefile option that takes the url of a css file in your "data" directory; it's a good practice to use this option in preference to contentstyle if the css is even marginally complex.
Unit Testing - Archive of obsolete content
now create a new file called "base64.js", and give it the following contents: const { atob, btoa } = require("resource://
gre/modules/services.jsm"); exports.atob = a => atob(a); exports.btoa = b => btoa(b); this code exports two functions, which just call the platform's btoa() and atob() functions.
Using XPCOM without chrome - Archive of obsolete content
// this removes the need to import ci and the xpcomutils const { class } = require("sdk/core/heritage"); const { unknown } = require('sdk/platform/xpcom'); const { placesutils } = require("resource://
gre/modules/placesutils.jsm"); let bmlistener = class({ extends: unknown, interfaces: [ "nsinavbookmarkobserver" ], //this event most often handles all events onitemchanged: function(bid, prop, an, nv, lm, type, parentid, aguid, aparentguid) { console.log("onitemchanged", "bid: "+bid, "property: "+prop, "isanno: "+an, "new value: "+nv, "lastmod: "+lm, "type: "+type, "parentid:"+parentid, "agui...
Bootstrapped extensions - Archive of obsolete content
for example if you had a subfolder of en-us in locale folder your chrome.manifest file will have to contain: locale name_of_your_addon en-us locale/ here is an example: github :: l10n-properties - on startup of this add-on it will show a prompt saying usa or
great britain, which ever it deems closest to your locale.
HTML in XUL for rich tooltips - Archive of obsolete content
var htmltip = { onload: function() { //at any point you can save an html string to a xul attribute for later injection into the tooltip document.getelementbyid("htmltip1").setattribute("tooltiphtml", "<font color='red'>red foo</font>") document.getelementbyid("htmltip2").setattribute("tooltiphtml", "<font color='
green'>
green foo</font>") }, onmousetooltip: function(event) { //get the html tooltip string assigned to the element that the mouse is over (which will soon launch the tooltip) var txt = event.target.getattribute("tooltiphtml"); // get the html div element that is inside the custom xul tooltip var div = document.getelementbyid("myhtmltipdiv"); //clear the html div element of any prior shown cu...
JS XPCOM - Archive of obsolete content
components.utils.import("resource://
gre/modules/services.jsm"); components.utils.import("resource://
gre/modules/xpcomutils.jsm"); const cc = components.classes; const ci = components.interfaces; function abouthandler() {} abouthandler.prototype = { newchannel: function(uri) { var channel = services.io.newchannel("chrome://mystuff/content/mystuff.xul", null, null); channel.originaluri = uri; return channel; ...
Page Loading - Archive of obsolete content
page loading on page load how to execute code each time a new page is loaded in browser/mail pro
gress listeners pro
gress listeners allow extensions to be notified of events associated with documents loading in the browser and with tab switching events.
User Notifications and Alerts - Archive of obsolete content
on the other hand, alerts are displayed only temporarily using the alerts service is similar to using notification boxes: let alertsservice = cc["@mozilla.org/alerts-service;1"].getservice(ci.nsialertsservice); let title = this._bundle.getstring("xulschoolhello.
greeting.title"); let message = this._bundle.getstring("xulschoolhello.
greeting.label"); alertsservice.showalertnotification( "chrome://xulschoolhello/skin/hello-notification.png", title, message, true, "", this, "xulschool hello message"); we pass this as an argument, assuming that this is an object that implements nsiobserver.
Add-ons - Archive of obsolete content
ion for legacy technology for add-on development, including: legacy extensions for firefox for android add-ons that work with desktop firefox do not automatically work in firefox for android: overlay extensions this page contains links to documentation for the approach to developing extensions for gecko-based applications which uses: performance best practices in extensions one of firefox's
great advantages is its extreme extensibility.
Events - Archive of obsolete content
archived event pages domsubtreemodifiedmozaudioavailablemozbeforeresizemozorientationcachedchargingchangechargingtimechangecheckingdischargingtimechangedownloadingerrorlevelchangenoupdateobsoletepro
gressupdateready ...
List of Former Mozilla-Based Applications - Archive of obsolete content
tched from gecko to webkit flock social browsing flock switched from being firefox-based to chromium-based when it released a new beta on june 16, 2010 jolicloud web operating system as of march 2010, rw/w reports jolicloud is on chrome/chrome os joost tv over internet switched from xulrunner-based client to a web application liferea news ag
gregator switched to webkit in version 1.6 manyone browser browser originally mozilla-based but now i believe the have a web-based tool (need reference for that) miro (formerly democracy player) video switched from xulrunner to webkit in version 3.0.2 moblin browser browser when moblin became meego it switched from a custom gecko-based browser to chrome...
Locked config settings - Archive of obsolete content
this file also needs to be "called" from c:\program files\mozilla.org\mozilla\defaults\pref\all.js by appending the following line at the end: pref("general.config.filename", "mozilla.cfg"); note: newer versions of mozilla or firefox store the all.js file in
greprefs rather than defaults\pref the moz-byteshift.pl script allows to encode...: moz-byteshift.pl -s 13 <mozilla.cfg.txt >mozilla.cfg ...
Adding the structure - Archive of obsolete content
<statusbar id="status-bar" class="chromeclass-status" ondragdrop="nsdraganddrop.drop(event, contentareadndobserver);"> <statusbarpanel id="component-bar"/> <statusbarpanel id="statusbar-display" label="&statustext.label;" flex="1"/> <statusbarpanel class="statusbarpanel-pro
gress"> <pro
gressmeter class="pro
gressmeter-statusbar" id="statusbar-icon" mode="normal" value="0"/> </statusbarpanel> <statusbarpanel class="statusbarpanel-iconic" id="tinderbox-status" status="none"/> <statusbarpanel class="statusbarpanel-iconic" id="offline-status"/> <statusbarpanel class="statusbarpanel-iconic" id="security-button" onclick="browserpageinfo(nu...
Making it into a static overlay - Archive of obsolete content
<statusbar id="status-bar" class="chromeclass-status" ondragdrop="nsdraganddrop.drop(event, contentareadndobserver);"> <statusbarpanel id="component-bar"/> <statusbarpanel id="statusbar-display" label="&statustext.label;" flex="1"/> <statusbarpanel class="statusbarpanel-pro
gress"> <pro
gressmeter class="pro
gressmeter-statusbar" id="statusbar-icon" mode="normal" value="0"/> </statusbarpanel> <statusbarpanel class="statusbarpanel-iconic" id="tinderbox-status" status="none"/> <statusbarpanel class="statusbarpanel-iconic" id="offline-status"/> <statusbarpanel class="statusbarpanel-iconic" id="security-button" onclick="br...
In-Depth - Archive of obsolete content
button, checkbox-container, checkbox, dialog, dualbutton, dualbutton-dropdown, listbox, menu, menulist-textfield, menulist-button, menulist, menulist-text, pro
gressbar, pro
gresschunk, radio-container, radio, resizer, resizerpanel, separator, scrollbar, statusbar, statusbarpanel, toolbarbutton, toolbox, toolbar, treeheadercell, treeheadersortarrow, treeview, treeitem, treetwisty, treetwistyopen, tooltip, textfield, tabpanels, tab, tab-left-edge, tab-right-edge, scrollbartrack-horizontal, scrollbartrack-vertical, scrollbarthumb-vertical, scrollbarthumb-horiz...
Using microformats - Archive of obsolete content
to use the api, you need to first load the object: components.utils.import("resource://
gre/modules/microformats.js"); once you've loaded the microformats api, you can manage microformats using the methods listed here; for information about parsing microformats, see parsing microformats in javascript.
JavaScript Client API - Archive of obsolete content
further, you a
gree (a) to maintain and link to (including on websites from which your third party client may be downloaded) a separate, conspicuous, and reasonably detailed privacy policy detailing how data collected or transmitted by your third party client is managed and protected; (b) that your third party client will only store data in encrypted form on the firefox sync servers operated by mozilla; (c) that yo...
panel.flip - Archive of obsolete content
in this image, the panel has flip="slide" and has a width which is
greater than the distance from the anchor to the right of the screen (or window), so the panel extends past the left of the anchor, and the arrow slides towards the middle of the panel such that it is still aligned with the anchor.
rel - Archive of obsolete content
less the numeric value of the subject must be less than the value
greater the numeric value of the subject must be
greater than the value before the string value of subject must come before value alphabetically after the string value of subject must come after value alphabetically startswith the value of subject must start with the value endswith the value of subject must end with the value contains the value of subject must contain the value as a substring ...
textbox.type - Archive of obsolete content
you may specify
grey text to appear when the search box is empty using the emptytext attribute, and a timeout may be set for the command event using the timeout attribute (defaults to 500).
XUL Events - Archive of obsolete content
the default action of the event can be prevented to prevent the popup to appear.popupshownthe popupshown event is executed when a <menupopup>, <panel> or <tooltip> has become visible.radiostatechangethe radiostatechange event is executed when the state of a <radio> element has changed.valuechangethe valuechange event is executed when the value of an element, <pro
gress> for example, has changed.
MenuItems - Archive of obsolete content
disabling a menuitem to have an item initially disabled, set the disabled attribute to true as in the following example: <menuitem label="undo" accesskey="u" disabled="true"/> when disabled, the item will appear
greyed out and the action associated with the item cannot be carried out.
accessibleType - Archive of obsolete content
xullisthead 1024 xullistheader 1025 xullistitem 100c xulmenubar 100d xulmenuitem 100e xulmenupopup 100f xulmenuseparator 1010 xulpane 1011 xulpro
gressmeter 1012 xulscale 1013 xulstatusbar 1014 xulradiobutton 1015 xulradiogroup 1016 xultab 1017 xultabbox 1018 xultabs 1019 xultext 101a ...
Property - Archive of obsolete content
croll spinbuttons src state statusbar statustext stringbundle strings style subject suppressonselect tabcontainer tabindex tabs tabscrolling tabpanels tag textlength textvalue timeout title toolbarname toolbarset tooltip tooltiptext top treeboxobject type uri useraction value valuenumber view webbrowserefind webnavigation webpro
gress width wizardpages wraparound year yearleadingzero related dom element properties dom:element.attributes dom:element.baseuri dom:element.childelementcount dom:element.childnodes dom:element.children dom:element.clientheight dom:element.clientleft dom:element.clienttop dom:element.clientwidth dom:element.clonenode dom:element.firstchild dom:element.firstelement...
Providing Command-Line Options - Archive of obsolete content
t {2991c315-b871-42cd-b33f-bfee4fcbf682} components/commandline.js contract @mozilla.org/commandlinehandler/general-startup;1?type=myapp {2991c315-b871-42cd-b33f-bfee4fcbf682} category command-line-handler m-myapp @mozilla.org/commandlinehandler/general-startup;1?type=myapp the javascript code const cc = components.classes; const ci = components.interfaces; components.utils.import("resource://
gre/modules/xpcomutils.jsm"); components.utils.import("resource://
gre/modules/services.jsm"); // changeme: to the chrome uri of your extension or application const chrome_uri = "chrome://myapp/content/"; /** * utility functions */ /** * opens a chrome window.
Tree Widget Changes - Archive of obsolete content
the constants below have been changed, and their integer values are different: nsitreeview.indropbefore -> nsitreeview.drop_before (-1) nsitreeview.indropon -> nsitreeview.drop_on (0) nsitreeview.indropafter -> nsitreeview.drop_after (1) nsitreeview.pro
gressnormal -> nsitreeview.pro
gress_normal (1) nsitreeview.pro
gressundetermined -> nsitreeview.pro
gress_undetermined (2) nsitreeview.pro
gressnode -> nsitreeview.pro
gress_none (3) as well, the drag and drop methods candropon and candropbeforeafter have been replaced with a single method candrop(idx,orientation) which handles both.
Scrolling Menus - Archive of obsolete content
example - scrolling list of buttons the following 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="yellow"/> <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> if you try this example, it will first open at full size.
Tree View Details - Archive of obsolete content
item[2] = true; var label = this.visibledata[idx][0]; var toinsert = this.childdata[label]; for (var i = 0; i < toinsert.length; i++) { this.visibledata.splice(idx + i + 1, 0, [toinsert[i], false]); } this.treebox.rowcountchanged(idx + 1, toinsert.length); } this.treebox.invalidaterow(idx); }, getimagesrc: function(idx, column) {}, getpro
gressmode : function(idx,column) {}, getcellvalue: function(idx, column) {}, cycleheader: function(col, elem) {}, selectionchanged: function() {}, cyclecell: function(idx, column) {}, performaction: function(action) {}, performactiononcell: function(action, index, column) {}, getrowproperties: function(idx, prop) {}, getcellproperties: function(idx, column, prop) {}, getcolumnproper...
Trees - Archive of obsolete content
(using advanced features, pro
gress meters or checkboxes also can be added to the tree) a tree consists of two parts, the set of columns, and the tree body.
XUL Tutorial - Archive of obsolete content
introduction introduction xul structure the chrome url manifest files simple elements creating a window adding buttons adding labels and images input controls numeric controls list controls pro
gress meters adding html elements using spacers more button features the box model the box model element positioning box model details groupboxes adding more elements more layout elements stacks and decks stack positioning tabboxes grids content panels splitters toolbars and menus toolbars simple menu bars more menu features popup menus scrolling menus events and scripts adding event h...
XUL Parser in Python/source - Archive of obsolete content
pass p = xulparser() cmd = 'dir /s /b *.xul' chrome_dir = 'c:\program files\netscape\netscape 6\chrome' os.chdir(chrome_dir) files = os.popen(cmd).readlines() for file in files: file = file.strip() print '** ' + file + ' **' data = open(file).read() p.feed(data) w.write('<html><h3>periodic table of xul elements</h3>') w.write('<table><style>.head {font-weight: bold; background-color: light
grey;}</style>') elements = el_list.keys() elements.sort() for item in elements: w.write('<tr><td class="head">' + item + '</td></tr>\n') for a in el_list[item]: w.write('<tr><td class="at">' + a + '</td>') w.write('</table></html>\n') w.close() ...
XULBrowserWindow - Archive of obsolete content
in order to do so it implements the following interfaces: nsisupports nsixulbrowserwindow nsiwebpro
gresslistener nsiwebpro
gresslistener2 nsisupportsweakreference note: this page is not complete at this time.
Accessibility/XUL Accessibility Reference - Archive of obsolete content
pro
gressmeter <pro
gressmeter mode="determined" value="10" /> as pro
gress advances, jaws indicates percentage to the user radio see radiogroup radiogroup <label value='<!--radio group-->' control='radioid' /> <radiogroup id='radioid'> <radio selected="true" label='<!--option1-->' /> <radio label='<!--option2-->' /> </radiogroup> row...
XUL Event Propagation - Archive of obsolete content
the widget hierarchy consider the following xul file: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="events" xmlns:html="http://www.w3.org/1999/xhtml" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" oncommand="alert('window handler')"> <vbox> <vbox style="background-color: light
grey;" oncommand="alert('box handler')"> <menu class="menu" label="file" oncommand="alert('menu handler')"> <menupopup> <menuitem oncommand="alert('new item alert')" label="new" /> <menuitem label="open" /> <menuitem oncommand="alert('close handler')" label="close" /> </menupopup> </menu> <menu class="menu" label="edit"> <menupopup> <menuitem oncomm...
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="yellow"/> <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, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, c...
dialog - Archive of obsolete content
obal.css" type="text/css"?> <dialog id="donothing" title="dialog example" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" buttons="accept,cancel" buttonlabelcancel="cancel" buttonlabelaccept="save"> <dialogheader title="options" description="my preferences"/> <groupbox> <caption label="colour"/> <radiogroup> <radio label="red"/> <radio label="
green" selected="true"/> <radio label="blue"/> </radiogroup> <label value="nickname"/> <textbox/> </groupbox> </dialog> attributes activetitlebarcolor type: color string specify background color of the window's titlebar when it is active (foreground).
elements - Archive of obsolete content
tion dialog dialogheader e editor grid grippy groupbox h hbox i iframe image k key keyset l label listbox listcell listcol listcols listhead listheader listitem m member menu menubar menuitem menulist menupopup menuseparator o observes overlay p page popup popupset preference preferences prefpane prefwindow pro
gressmeter r radio radiogroup resizer richlistbox richlistitem resizer row rows rule s script scrollbar scrollbox scrollcorner separator spacer splitter stack statusbar statusbarpanel stringbundle stringbundleset t tab tabbrowser tabbox tabpanel tabpanels tabs template textnode textbox titlebar toolbar toolbarbutton toolbargrip...
panel - Archive of obsolete content
in this image, the panel has flip="slide" and has a width which is
greater than the distance from the anchor to the right of the screen (or window), so the panel extends past the left of the anchor, and the arrow slides towards the middle of the panel such that it is still aligned with the anchor.
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="yellow" label="blue" accesskey="b" disabled="true"/> </radiogroup> attributes accesskey type: character this should be set to a character that is used as a shortcut key.
radiogroup - Archive of obsolete content
attributes disabled, focused, preference, tabindex, value properties accessibletype, disabled, focuseditem, itemcount, selectedindex, selecteditem, tabindex, value methods appenditem, checkadjacentelement, getindexofitem, getitematindex, insertitemat, removeitemat examples <radiogroup> <radio id="orange" label="red"/> <radio id="violet" label="
green" selected="true"/> <radio id="yellow" label="blue"/> </radiogroup> attributes disabled type: boolean indicates whether the element is disabled or not.
splitter - Archive of obsolete content
="tree1" flex="1" height="300" enablecolumndrag="true"> <treecols> <treecol id="name" label="name" flex="1"/> <splitter class="tree-splitter"/> <treecol id="id" label="id" flex="1"/> <splitter class="tree-splitter"/> <treecol id="date" label="date" flex="1"/> <splitter class="tree-splitter"/> </treecols> <treechildren/> </tree> splitter resizing and overflow the de
gree to which a splitter will resize a box, and what happens during the resize and after the limit is reached, depends on the height (or width) specified for the box as an attribute or in css, the min-height (or min-width), the intrinsic height of the box contents, and the presence or absence of a collapse attribute on the splitter.
statusbar - Archive of obsolete content
properties accessibletype examples <statusbar> <statusbarpanel label="left panel"/> <spacer flex="1"/> <pro
gressmeter mode="determined" value="82"/> <statusbarpanel label="right panel"/> </statusbar> attributes inherited from xul element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, min...
<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"/> <pro
gressmeter mode="determined" value="82"/> <statusbarpanel label="right panel"/> </statusbar> attributes crop type: one of the values below 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.
textbox - Archive of obsolete content
you may specify
grey text to appear when the search box is empty using the emptytext attribute, and a timeout may be set for the command event using the timeout attribute (defaults to 500).
where - Archive of obsolete content
less the numeric value of the subject must be less than the value
greater the numeric value of the subject must be
greater than the value before the string value of subject must come before value alphabetically after the string value of subject must come after value alphabetically startswith the value of subject must start with the value endswith the value of subject must end with the value contains the value of subject must contain the value ...
window - Archive of obsolete content
this value may be -1 to use the default margin for that side on the current platform, 0 to have no system border (that is, to extend the client area to the edge of the window), or a value
greater than zero to indicate how much less than the default default width you wish the margin on that side to be.
CommandLine - Archive of obsolete content
bserver-service;1"] .getservice(components.interfaces.nsiobserverservice); observerservice.notifyobservers(acmdline, "commandline-args-changed", null); }, helpinfo : " -test <value> a test attribute\n", /* nsifactory */ createinstance : function mdh_ci(aouter, aiid) { if (aouter != null) { throw components.results.ns_error_no_ag
gregation; } return this.queryinterface(aiid); }, lockfactory : function mdh_lock(alock) { /* no-op */ } }; var apphandlermodule = { /* nsisupports */ queryinterface : function mod_qi(aiid) { if (aiid.equals(nsimodule) || aiid.equals(nsisupports)) return this; throw components.results.ns_error_no_interface; }, /* nsimodule */ getclassobject :...
Getting started with XULRunner - Archive of obsolete content
one way to achieve this is to run the following script everytime you want to install a new version: firefox_version=`
grep -po "\d{2}\.\d+" /usr/lib/firefox/platform.ini` arch=`uname -p` xurl=https://ftp.mozilla.org/pub/mozilla.org/xulrunner/releases/$firefox_version/runtimes/xulrunner-$firefox_version.en-us.linux-$arch.tar.bz2 cd /opt sudo sh -c "wget -o- $xurl | tar -xj" sudo ln -s /opt/xulrunner/xulrunner /usr/bin/xulrunner sudo ln -s /opt/xulrunner/xpcshell /usr/bin/xpcshell you could also save this script to...
2006-10-06 - Archive of obsolete content
summary: mozilla.dev.apps.thunderbird - september 30-october 06, 2006 announcements mac user needed scott mac
gregor announced that .mac support and a dynamically add isp account feature has been added to the thunderbird account manager, however, testing is required before release can be issued.
2006-09-22 - Archive of obsolete content
summary: mozilla.dev.i18n - feb 2nd - sep 22nd, 2006 announcements testing a dummy
greek bon echo nsis installer bug #69230: accelerators should not be affected by keyboard group/level proposal of code changes for l10n in firefox 3 discussions thai language support: how can we add thai as an official localized build?
2006-10-27 - Archive of obsolete content
discussions removal of the nn4.6 table border color quirk discussion on removing the nn 4.6 table boarder color quirk, which currently causes a specific markup to produce a
green boarder instead of a gray one.
New in JavaScript 1.6 - Archive of obsolete content
array.prototype.indexof() array.prototype.lastindexof() array.prototype.every() array.prototype.filter() array.prototype.foreach() array.prototype.map() array.prototype.some() array generics string generics for each...in changed functionality in javascript 1.6 a bug in which arguments[n] cannot be set if n is
greater than the number of formal or actual parameters has been fixed.
Object.observe() - Archive of obsolete content
typeof(obj, {}); // [{name: '__proto__', object: <obj>, type: 'setprototype', oldvalue: <prototype>}] object.seal(obj); // [ // {name: 'foo', object: <obj>, type: 'reconfigure'}, // {name: 'bar', object: <obj>, type: 'reconfigure'}, // {object: <obj>, type: 'preventextensions'} // ] data binding // a user model var user = { id: 0, name: 'brendan eich', title: 'mr.' }; // create a
greeting for the user function update
greeting() { user.
greeting = 'hello, ' + user.title + ' ' + user.name + '!'; } update
greeting(); object.observe(user, function(changes) { changes.foreach(function(change) { // any time name or title change, update the
greeting if (change.name === 'name' || change.name === 'title') { update
greeting(); } }); }); custom change type // a po...
Server-Side JavaScript - Archive of obsolete content
sounds obvious, but for at least the first twelve years of the web's evolution, developers have pretty much had to use different languages on the server from those available in the browser, leading to se
gregated teams, disparate and inconsistent know-how, and plenty of server-side string manipulation gymnastics to generate html or ajax pages.
XForms Select Element - Archive of obsolete content
ue full there are no analogue widgets in xhtml or in xul visual grouping by choices element is supported if incremental attribute value is false then bound node is updated when item is blurred examples <xf:model> <xf:instance> <data xmlns=""> <values>g</values> </data> </xf:instance> </xf:model> <xf:select ref="/data/values" appearance="full"> <xf:choices> <xf:label>
green colors</xf:label> <xf:item> <xf:label>pale
green</xf:label> <xf:value>pg</xf:value> </xf:item> <xf:item> <xf:label>
green</xf:label> <xf:value>g</xf:value> </xf:item> </xf:choices> <xf:choices> <xf:label>red colors</xf:label> <xf:item> <xf:label>red</xf:label> <xf:value>r</xf:value> </xf:item> <xf:item> <xf:label>magen...
XForms Select1 Element - Archive of obsolete content
gue widgets in xhtml or in xul visual grouping by choices element is supported selection="open" attribute isn't supported if incremental attribute value is false then bound node is updated when item is blurred examples <xf:model> <xf:instance> <data xmlns=""> <values>g</values> </data> </xf:instance> </xf:model> <xf:select1 ref="/data/values"> <xf:choices> <xf:label>
green colors</xf:label> <xf:item> <xf:label>pale
green</xf:label> <xf:value>pg</xf:value> </xf:item> <xf:item> <xf:label>
green</xf:label> <xf:value>g</xf:value> </xf:item> </xf:choices> <xf:choices> <xf:label>red colors</xf:label> <xf:item> <xf:label>red</xf:label> <xf:value>r</xf:value> </xf:item> <xf:item> <xf:label>magen...
Issues Arising From Arbitrary-Element hover - Archive of obsolete content
this innovation, first introduced by microsoft® internet explorer and later adopted into the css specification, is very popular for the styling of text links, particularly those that are supposed to look and act like javascript-driven "rollovers." however, advancing css support in browsers has caused some unexpectedly ag
gressive hovering behavior on some pages.
RDF in Fifty Words or Less - Archive of obsolete content
#"> <rdf:description about="http://www.mozilla.org/smart-mail/get-mail.cgi?user=waterson&folder=inbox"> <sm:message id="4025293"> <sm:recipient> chris waterson "waterson@netscape.com" </sm:recipient> <sm:sender> aunt helga "helga@netcenter.net" </sm:sender> <sm:received-by>x-wing.mcom.com</sm:received-by> <sm:subject>
great recipe for yam soup!</sm:subject> <sm:body> http://www.mozilla.org/smart-mail/get-body.cgi?id=4025293 </sm:body> </sm:message> <sm:message id="4025294"> <sm:recipient> chris waterson "waterson@netscape.com" </sm:recipient> <sm:sender> sarah waterson "waterson.2@postbox.acs.ohio-state.edu" </sm:sender> ...
Styling Abbreviations and Acronyms - Archive of obsolete content
f the web content accessibility guidelines, both elements should be given a title attribute to improve "readability of the web for all people, including those with learning disabilities, cognitive disabilities, or people who are deaf." the problem authors have discovered that any abbr or acronym that has a title attribute is rendered with a dotted underline, per the following rule in resource://
gre-resources/html.css abbr[title], acronym[title] { text-decoration: dotted underline; } the solution if authors wish to remove the underline from abbr and acronym elements, this can be done with the following rule: abbr[title], acronym[title] { text-decoration: none; } it may be better to lessen the visual weight of the border without actually removing it.
Web Standards - Archive of obsolete content
web standards are carefully designed to deliver the
greatest benefits to the
greatest number of web users while ensuring the long-term viability of any document published on the web.
Getting started with Ember - Learn web development
use cases generally, emberjs works well for building apps that desire either or both of the following traits: single page applications, including native-like web apps, and pro
gressive web apps (pwas) ember works best when it is the entire front end of your application.
Beginning our React todo list - Learn web development
{ padding: 0.8rem 1rem 0.7rem; border: 0.2rem solid #4d4d4d; cursor: pointer; text-transform: capitalize; } .btn.toggle-btn { border-width: 1px; border-color: #d3d3d3; } .btn.toggle-btn[aria-pressed="true"] { text-decoration: underline; border-color: #4d4d4d; } .btn__danger { color: #fff; background-color: #ca3c3c; border-color: #bd2130; } .btn__filter { border-color: light
grey; } .btn__primary { color: #fff; background-color: #000; } .btn-group { display: flex; justify-content: space-between; } .btn-group > * { flex: 1 1 49%; } .btn-group > * + * { margin-left: 0.8rem; } .label-wrapper { margin: 0; flex: 0 0 100%; text-align: center; } .visually-hidden { position: absolute !important; height: 1px; width: 1px; overflow: hidden; clip: rect(1p...
Starting our Svelte Todo list app - Learn web development
{ padding: 0.8rem 1rem 0.7rem; border: 0.2rem solid #4d4d4d; cursor: pointer; text-transform: capitalize; } .btn.toggle-btn { border-width: 1px; border-color: #d3d3d3; } .btn.toggle-btn[aria-pressed="true"] { text-decoration: underline; border-color: #4d4d4d; } .btn__danger { color: #fff; background-color: #ca3c3c; border-color: #bd2130; } .btn__filter { border-color: light
grey; } .btn__primary { color: #fff; background-color: #000; } .btn__primary:disabled { color: dark
grey; background-color:#565656; } .btn-group { display: flex; justify-content: space-between; } .btn-group > * { flex: 1 1 49%; } .btn-group > * + * { margin-left: 0.8rem; } .label-wrapper { margin: 0; flex: 0 0 100%; text-align: center; } .visually-hidden { position: absolute !i...
Advanced Svelte: Reactivity, lifecycle, accessibility - Learn web development
first three declarations are props, and the rest are exported values: <script> export let bar = 'optional default initial value' // prop export let baz = undefined // prop export let format = n => n.tofixed(2) // prop // these are readonly export const thisis = 'readonly' // read-only export export function
greet(name) { // read-only export alert(`hello ${name}!`) } export const
greet = (name) => alert(`hello ${name}!`) // read-only export </script> with this in mind, let's go back to our use case.
Styling Vue components with CSS - Learn web development
update your app.vue file’s <style> element so it looks like so: <style> /* global styles */ .btn { padding: 0.8rem 1rem 0.7rem; border: 0.2rem solid #4d4d4d; cursor: pointer; text-transform: capitalize; } .btn__danger { color: #fff; background-color: #ca3c3c; border-color: #bd2130; } .btn__filter { border-color: light
grey; } .btn__danger:focus { outline-color: #c82333; } .btn__primary { color: #fff; background-color: #000; } .btn-group { display: flex; justify-content: space-between; } .btn-group > * { flex: 1 1 auto; } .btn-group > * + * { margin-left: 0.8rem; } .label-wrapper { margin: 0; flex: 0 0 100%; text-align: center; } [class*="__lg"] { display: inline-block; width: 100%; font-s...
Embedding API for Accessibility
be aware that in debug builds, this can cause a
great number of assertions (bug 71598) to use prefs in embedding, use something like the following code: #include "nsipref.h"; nsresult rv; nscomptr<nsipref> prefs(do_getservice(ns_pref_contractid, &rv)); prefs->setboolpref("bool.pref.name", pr_true /* or pr_false */); prefs->setintpref("int.pref.name", newvalue); prefs->setcharpref("string.pref.name", newcharstarvalue); to manually add a pre...
Multiprocess on Windows
this is
great for system interfaces, but for interfaces that are specific to gecko, it is better to register them at runtime.
Accessible Toolkit Checklist
e value that holds text, protected for password fields and readonly for read-only fields checkboxes space bar to toggle msaa support, including checkbox state and statechange event sliders keyboard support for moving slider: arrow keys, home, end, pgup, pgdn msaa support including role_slider, accessible value, value change events pro
gress bars msaa support including accessible name, value, name and value change events grouped navigation widgets menus arrow keys, enter, escape alt alone enters main menu after leaving menus, focus is restored to where it was modified and unmodified mnemonics msaa support (including focus events, menu start and end events, radio and checkbox...
ZoomText
instructions for testers we've made a lot of pro
gress with mozilla/zoomtext compatibility.
Accessibility and Mozilla
this article reviews the pro
gress and technology as it has developed.zoomtextwe've made a lot of pro
gress with mozilla/zoomtext compatibility.
Index
679 promoting your extension or theme add-ons, extensions, promotion, themes, webextensions, distribution so you’ve written a
great extension, but only a few people have found and installed it from addons.mozilla.org—despite your efforts to create an appealing listing.
Chrome registration
toolbars, menu bars, pro
gress bars, and window title bars are all examples of elements that are typically part of the chrome.
Command line options
note: on mac os x specifying a relative path is not supported anymore from firefox 4.0 and up due to a re
gression, see bug 673955.
Creating a Language Pack
it is likely that you will continue to generate language packs as your pro
gress just to test your work.
Creating a Login Manager storage module
const cc = components.classes; const ci = components.interfaces; components.utils.import("resource://
gre/modules/xpcomutils.jsm"); function sampleloginmanagerstorage() {} sampleloginmanagerstorage.prototype = { classdescription: "sample nsiloginmanagerstorage implementation", contractid: "@example.com/login-manager/storage/sample;1", classid: components.id("{364a118c-747a-4f6d-ac63-2d2998e5a5c1}"), queryinterface: xpcomutils.generateqi([ci.nsiloginmanagerstorage]), // this registers the ...
Debugging on Windows
al strings nsastring_internal=<mdata,su>, length=<mlength,u> nsacstring_internal=<mdata,s>, length=<mlength,u> ; xpcom strings nsastring=<nsstringcontainer.v,su>, length=<nsstringcontainer.d1,u> nsacstring=<nscstringcontainer.v,s>, length=<nscstringcontainer.d1,u> nsstringcontainer=<v,su>, length=<d1,u> nscstringcontainer=<v,s>, length=<d1,u> there is a more extensive version of this file in pro
gress in autoexpforvc8.
Old Thunderbird build
for hg tip, you should see
green bs on https://treeherder.mozilla.org/#/jobs?repo=comm-central to start the build, cd into the comm-central subdirectory, and run: ./mozilla/mach build mach is our command-line tool to streamline common developer tasks.
Simple Thunderbird build
for hg tip, you should see
green bs on https://treeherder.mozilla.org/#/jobs?repo=comm-central to start the build, cd into the source directory, and run: ./mach build mach is our command-line tool to streamline common developer tasks.
Windows SDK versions
windows 7 sdk features that depend on this sdk include: windows 7 taskbar previews windows 7 download taskbar pro
gress windows 7 jump lists you can download the sdk (v7.0 [web setup or iso image] or unsupported v7.1 [web setup or iso image]) from the microsoft download center.
Callgraph
the callgraph project uses gcc and treehydra to generate information about function and method calls at compile time, and ag
gregates it into a sqlite database.
Inner and outer windows
the
grey circles represent the more abstract inner and outer windows, which are real objects that you don't directly interact with when working with the dom.
mach
however, its potential beyond just build system interaction was quickly realized and mach
grew to fit those needs.
Developer guide
perfherder perfherder is used to ag
gregate the results of automated performance tests against the tree.
Linux compatibility matrix
yellow backgrounds denote compatibility with esr78
green backgrounds denote compatibility with the current release (as of writing, 78)
greener backgrounds denote compatibility with the current mozilla-central (as of writing, 80).
Security best practices for Firefox front-end engineers
we use our built-in sanitizer with the following flags: sanitizerallowstyle sanitizerallowcomments sanitizerdropforms sanitizerlo
gremovals the sanitizer removes all scripts (script tags, event handlers) and form elements (form, input, keygen, option, optgroup, select, button, datalist).
Site Identity Button
if the site identity button on your site shows something you do not expect (for example, an orange warning triangle when you expect a
green padlock) you can find out the cause of the problem by looking in the web console in the firefox developer tools: ensure your web console is displaying messages in the 'security' category force-refresh the page on your site that is causing problems watch for any security messages that may appear a downgraded security ui will be due to one of these three problems: mixed content - while your page has been served over tls, but su...
Firefox
with broad compatibility, the latest in web technologies, and powerful development tools, firefox is a
great choice for both web developers and end users.
mozbrowserasyncscroll
similarly, left + width may be
greater than scrollwidth, and both left and top may be negative.
Chrome-only CSS reference
-class will match an element if the mouse cursor is presently hovering over text in a tree cell.::-moz-tree-columnactivated by the properties attribute.::-moz-tree-drop-feedbackactivated by the properties attribute.::-moz-tree-imageactivated by the properties attribute.::-moz-tree-indentationactivated by the properties attribute.::-moz-tree-lineactivated by the properties attribute.::-moz-tree-pro
gressmeteractivated when the type attribute is set to pro
gressmeter.
MozBeforePaint
<!doctype html> <html> <body> <div id="d" style="width:100px; height:100px; background:lime; position:relative;"></div> <script> var d = document.getelementbyid("d"); var start = window.mozanimationstarttime; function step(event) { var pro
gress = event.timestamp - start; d.style.left = math.min(pro
gress/10, 200) + "px"; if (pro
gress < 2000) { window.mozrequestanimationframe(); } else { window.removeeventlistener("mozbeforepaint", step, false); } } window.addeventlistener("mozbeforepaint", step, false); window.mozrequestanimationframe(); </script> </body> </html> as you can see, each time the mozbeforepaint event fire...
Gecko Keypress Event
if gecko doesn't replace the charcode with an ascii character, the web application developers would need to consider all non-latin keyboard layouts (arabic,
greek, hebrew, russian, etc.).
Getting from Content to Layout
elements that need to be restyled are marked with flags (e.g element_has_pending_restyle) and are stored in the mpendin
grestyles hashtable.
Getting Started with Chat
general rules and etiquette once you have your client set up (see software below) and are connected, there are some basic rules you should follow to ensure the most enjoyable and productive experience: as with all mozilla forums and events, a
greeing to our community participation guidelines is a requirement for participation.
How to Report a Hung Firefox
entwindow("navigator:browser"); let browser = win.gbrowser.selectedbrowser; if (browser.isremotebrowser) { browser.messagemanager.loadframescript('data:,let appinfo = components.classes["@mozilla.org/xre/app-info;1"];if (appinfo && appinfo.getservice(components.interfaces.nsixulruntime).processtype != components.interfaces.nsixulruntime.process_type_default) {components.utils.import("resource://
gre/modules/ctypes.jsm");var zero = new ctypes.intptr_t(8);var badptr = ctypes.cast(zero, ctypes.pointertype(ctypes.int32_t));var crash = badptr.contents;}', true); } other techniques on os x if you use a nightly build (>= firefox 16), you can use activity monitor's "sample process" feature to generate a sample.
Extending a Protocol
we should see ./mach build make significant pro
gress now, but obviously, wihtout a backing cpp implementation, it's not going to do much.
PBackground
for most purposes this is
great, because the dom is already bound to the main thread.
Implementing Download Resuming
you may want to use nsisimplestreamlistener to simplify this task; to get pro
gress notifications, you can implement nsipro
gresseventsink and set an interface requester as the notificationcallbacks of the channel that gives out such an event sink (this needs to be done before calling asyncopen).
Addon
operationsrequirin
grestart read only integer a bitfield holding all of the operations that will require a restart to complete for this add-on.
AddonManager
to import the addonmanager object in the add-on sdk, use: const { addonmanager } = require("resource://
gre/modules/addonmanager.jsm"); to import it in a normal bootstrapped extension or similar, use: cu.import("resource://
gre/modules/addonmanager.jsm"); method overview promise?
AddonUpdateChecker
to import the addonupdatechecker, use: components.utils.import("resource://
gre/modules/addonupdatechecker.jsm"); method overview updateinfo getcompatibilityupdate(in updateinfo updates[], in string version, in boolean ignorecompatibility, in string appversion, in string platformversion) updateinfo getnewestcompatibleupdate(in updateinfo updates[], in string appversion, in string platformversion) void checkforupdates(in string id, in string type, in string updatekey, string url, in updatechecklistener listener) constants cons...
AsyncShutdown.jsm
please make sure that the name respects the following model: "some service: some action in pro
gress" - for instance "os.file: flushing all pending i/o".
Dict.jsm
to use it, you first need to import the code module into your javascript scope: components.utils.import("resource://
gre/modules/dict.jsm"); creating a dictionary you can create a new, empty dictionary by simply calling the dict() constructor: var newdict = new dict(); if you wish, you may also pass in an object literal of key/value pairs with which to initialize the dictionary: var someobj = {}; var newdict = new dict({key1: "foo", key2: someobj}); note that values may be any javascript object type.
DownloadLastDir.jsm
to use this, you first need to import the code module into your javascript scope: components.utils.import("resource://
gre/modules/downloadlastdir.jsm"); if you are using addon sdk, you can import the code module as: let { cu } = require("chrome"); let downloadlastdir = cu.import("resource://
gre/modules/downloadlastdir.jsm").downloadlastdir; once you've imported the module, you can then use the downloadlastdir object it exports.
DownloadTarget
if the download is in pro
gress or has been finalized, this method does nothing and returns a resolved promise.
FileUtils.jsm
to use it, you first need to import the code module into your javascript scope: components.utils.import("resource://
gre/modules/fileutils.jsm"); the file constructor if you have a path to a file (or directory) you want to obtain an nsifile for, you can do so using the file constructor, like this: var f = new fileutils.file(mypath); method overview nsifile getfile(string key, array patharray, bool followlinks); nsifile getdir(string key, array patharray, bool shouldcreate, bool followlinks); nsifileoutputstream openfileoutputstream(nsifile file, int modeflags); nsifileoutputstream openatomicfileoutputstream(nsifile file, int modeflags); nsifileoutput...
FxAccountsOAuthClient.jsm
components.utils.import("resource://
gre/modules/fxaccountsoauthclient.jsm"); creating a new fxaccountsoauthclient new fxaccountsoauthclient(object options); method overview launchwebflow(); teardown(); attributes parameters object returns the set of parameters that initialized the firefox accounts oauth flow.
FxAccountsProfileClient.jsm
components.utils.import("resource://
gre/modules/fxaccountsprofileclient.jsm"); creating a new fxaccountsprofileclient new fxaccountsprofileclient(object options); method overview fetchprofile(); attributes serverurl url profiler server url.
Geometry.jsm
to use these routines, you first need to import the code module into your javascript scope: components.utils.import("resource://
gre/modules/geometry.jsm"); once you've imported the module, you can then use the point and rect classes.
ISO8601DateUtils.jsm
to use this, you first need to import the code module into your javascript scope: components.utils.import("resource://
gre/modules/iso8601dateutils.jsm"); once you've imported the module, you can then use the iso8601dateutils object it exports.
NetUtil.jsm
to use these utilities, you first need to import the code module into your javascript scope: components.utils.import("resource://
gre/modules/netutil.jsm"); once you've imported the module, you can then use its methods.
OS.File for the main thread
using os.file from a jsm to import os.file into your chrome code, add the following line at the start of your script: components.utils.import("resource://
gre/modules/osfile.jsm") promises before using os.file from the main thread, you need some understanding of the promise library.
PerfMeasurement.jsm
before you can use this module, you need to import it into your scope: components.utils.import("resource://
gre/modules/perfmeasurement.jsm") see measuring performance using the perfmeasurement.jsm code module for details on how to use this api.
PopupNotifications.jsm
to use this, you first need to import the code module into your javascript scope: components.utils.import("resource://
gre/modules/popupnotifications.jsm"); once you've imported the module, you can then use the popupnotifications object it exports; this object provides methods for creating and displaying popup notification panels.
Deferred
function deferred() { // update 062115 for typeof if (typeof(promise) != 'undefined' && promise.defer) { //need import of promise.jsm for example: cu.import('resource:/
gree/modules/promise.jsm'); return promise.defer(); } else if (typeof(promiseutils) != 'undefined' && promiseutils.defer) { //need import of promiseutils.jsm for example: cu.import('resource:/
gree/modules/promiseutils.jsm'); return promiseutils.defer(); } else { /* a method to resolve the associated promise with the value passed.
Promise.jsm
to use it, you first need to import the code module into your javascript scope: components.utils.import("resource://
gre/modules/promise.jsm"); note: a preliminary promise module is also available starting from gecko 17, though it didn't conform to the promises/a+ proposal until gecko 25: components.utils.import("resource://
gre/modules/commonjs/promise/core.js"); // gecko 17 to 20 components.utils.import("resource://
gre/modules/commonjs/sdk/core/promise.js"); // gecko 21 to 24 this implementation also inc...
PromiseUtils.jsm
to use it, you first need to import the code module into your javascript scope: components.utils.import("resource://
gre/modules/promiseutils.jsm"); method overview deferred defer(); methods defer() creates a new pending promise and provides methods to resolve or reject this promise.
Services.jsm
to use it, you first need to import the code module into your javascript scope: const {services} = chromeutils.import("resource://
gre/modules/services.jsm"); then you can obtain references to services by simply accessing them from the services object exported by the code module.
Timer.jsm
to use timer.jsm, first import it: components.utils.import("resource://
gre/modules/timer.jsm"); then call settimeout and cleartimeout just as you would in a dom window, for example: let timeoutid = settimeout(function() { console.log("hello!"); }, 500); cleartimeout(timeoutid); similarly, you can use setinterval and clearinterval like so: let intervalid = setinterval(function() { console.log("happening every 500ms!"); }, 500); clearinterval(intervalid); ...
Encodings for localization files
s native windows encodings, and the win_installer_charset and charset= values for each: encoding name win_installer_charset (charset.mk) charset= (windows/install.it) ansi_charset cp1252 0 baltic_charset cp1257 186 chinesebig5_charset cp950 136 easteurope_charset cp1250 238 gb2312_charset cp936 134
greek_charset cp1253 161 hangul_charset cp949 129 russian_charset cp1251 204 shiftjis_charset cp932 128 turkish_charset cp1254 162 vietnamese_charset cp1258 163 middle east language editions of windows: arabic_charset cp1256 178 hebrew_charset cp1255 177 thai language editi...
NSS 3.44.1 release notes
the nss team would like to recognize first-time contributors:
greg rubin distribution information the hg tag is nss_3_44_1_rtm.
NSS 3.47 release notes
gcm bug 1576295 - check all bounds when encrypting with seed_cbc bug 1580286 - nss rejects tls 1.2 records with large padding with sha384 hmac bug 1577448 - create additional nested s/mime test messages for thunderbird bug 1399095 - allow nss-try to be used to test nspr changes bug 1267894 - libssl should allow selecting the order of cipher suites in clienthello bug 1581507 - fix unportable
grep expression in test scripts bug 1234830 - [cid 1242894][cid 1242852] unused values bug 1580126 - fix build failure on aarch64_be while building freebl/gcm bug 1385039 - build nspr tests as part of nss continuous integration bug 1581391 - fix build on openbsd/arm64 after bug #1559012 bug 1581041 - mach-commands -> mach-completion bug 1558313 - code bugs found by clang scanners.
NSS API Guidelines
ed.) the arena_destructor_list preprocessor definition, and the code it encloses, are an effort to make the following work together: arenas, letting you allocate stuff and then removing them all at once lazy creation of pure-memory objects from asn.1 blobs, for example use of nsspkixcertificate doesn't drag all the code in for all constituent objects, unless they're actually being used our a
gressive pointer-tracking facility all these are useful, but they don't combine well.
NSS Sample Code Utilities_1
char meter[] = { "\r| |" }; int fd, count; int c; secstatus rv = secsuccess; cc_t orig_cc_min; cc_t orig_cc_time; tcflag_t orig_lflag; struct termios tio; fprintf(stderr, "to generate random numbers, " "continue typing until the pro
gress meter is full:\n\n"); fprintf(stderr, "%s", meter); fprintf(stderr, "\r|"); /* turn off echo on stdin & return on 1 char instead of nl */ fd = fileno(stdin); tcgetattr(fd, &tio); orig_lflag = tio.c_lflag; orig_cc_min = tio.c_cc[vmin]; orig_cc_time = tio.c_cc[vtime]; tio.c_lflag &= ~echo; tio.c_lflag &= ~icanon; tio.c_cc[vmin] = 1; tio.c_cc[vtime...
Utilities for nss samples
char meter[] = { "\r| |" }; int fd, count; int c; secstatus rv = secsuccess; cc_t orig_cc_min; cc_t orig_cc_time; tcflag_t orig_lflag; struct termios tio; fprintf(stderr, "to generate random numbers, " "continue typing until the pro
gress meter is full:\n\n"); fprintf(stderr, "%s", meter); fprintf(stderr, "\r|"); /* turn off echo on stdin & return on 1 char instead of nl */ fd = fileno(stdin); tcgetattr(fd, &tio); orig_lflag = tio.c_lflag; orig_cc_min = tio.c_cc[vmin]; orig_cc_time = tio.c_cc[vtime]; tio.c_lflag &= ~echo; tio.c_lflag &= ~icanon; tio.c_cc[vmin] = 1; tio.c_cc[vtime...
nss tech note7
to prevent denial-of-service attacks with huge public keys, nss disallows modulus size
greater than 8192 bits.
Overview of NSS
rsa standard that governs implementation of diffie-hellman key a
greement.
FC_Login
ckr_pin_len_range: the pin is too long (ulpinlen is
greater than 255).
NSC_Login
ckr_pin_len_range: the pin is too long (ulpinlen is
greater than 255).the function should return ckr_pin_incorrect in this case.
NSS tools : certutil
there are several available keywords: + digital signature + nonrepudiation + keyencipherment + dataencipherment + keya
greement + certsigning + crlsigning + critical -2 add a basic constraint extension to a certificate that is being created or added to a database.
JS_Enumerate
therefore a program that loops over the property ids must either root them all, ensure that the properties are not deleted (in a multithreaded program this requires even
greater care), or ensure that garbage collection does not occur.
JS_GetPositiveInfinityValue
infinities are typically used to represent numbers that are
greater in magnitude than the
greatest representable finite values.
JS_SetArrayLength
if you call js_setarraylength on an existing array, and length is less than the highest index number for previously defined elements, all elements
greater than or equal to length are automatically deleted.
JS_SetErrorReporter
eport) { auto rt = js_getruntime(ctx); auto rt_userdata = js_getruntimeprivate(rt); if (rt_userdata) { auto req = static_cast<myrequest*>(rt_userdata); req->onerror(message); } } }; see also mxr id search for js_geterrorreporter mxr id search for js_seterrorreporter bug 1277278 - js_seterrorreporter is renamed to js::setwarnin
greporter ...
JS_ValueToBoolean
for versions
greater than jsversion_1_2, all objects convert to js_true, even boolean wrapper objects like the one produced by new boolean(false).
Parser API
example: > var expr = reflect.parse("obj.foo + 42").body[0].expression > expr.left.property ({loc:null, type:"identifier", name:"foo"}) > expr.right ({loc:{source:null, start:{line:1, column:10}, end:{line:1, column:12}}, type:"literal", value:42}) it is also available since firefox 7; it can be imported into the global object via: components.utils.import("resource://
gre/modules/reflect.jsm") or into a specified object via: components.utils.import("resource://
gre/modules/reflect.jsm", obj) built-in objects whether in spidermonkey shell or firefox (after importing), the global singleton object reflect currently contains just the parse method.
SpiderMonkey 1.8.7
draft in pro
gress - this is a draft, and right now it's mostly just a copy of the 1.8.5 release notes.
SpiderMonkey 1.8
—9 march 2009 known issues spidermonkey 1.8 has one known significant re
gression from 1.7.
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 allow 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 pro
gress bar, change the timeout, run skipped tests, print output in tinderbox format, run a test in the debugger, or run tests in valgrind.
Shell global objects
dumpstrin
grepresentation(str) print a human-readable description of how the string str is represented.
Zest usecase: Reporting Security Vulnerabilities to Developers
ent they run the script and see the vulnerability they fix the vulnerability they rerun the script to check that the vulnerability is fixed the fix is applied to the system that the security team is testing the security team rerun the script as an initial check they then perform any manual testing they think is necessary note that the developers could also include the script in the re
gression tests to make sure that it doesnt reoccur.
Redis Tips
lists and queues lists make
great queues.
Setting up an update server
you can use this command with firefox's browser console to determine the update directory: const {fileutils} = chromeutils.import("resource://
gre/modules/fileutils.jsm"); fileutils.getdir("updrootd", [], false).path once you have determined the update directory, close firefox, browse to the directory and remove the subdirectory called updates.
Animated PNG graphics
fully transparent black means red,
green, blue and alpha components are all set to zero.
Gecko Roles
role_pro
gressbar represents a pro
gress bar, dynamically showing the user the percent complete of an operation in pro
gress.
AT Development
this article (from 2007) reviews the pro
gress and technology as it has developed.
Feed content access API
nsifeedpro
gresslistener implemented by the program that wants to parse an rss or atom feed to receive messages during the parsing process.
Places Developer Guide
var ci = components.interfaces; var cc = components.classes; var cu = components.utils; // import placesutils cu.import("resource://
gre/modules/placesutils.jsm"); cu.import("resource://
gre/modules/services.jsm"); // create the backup file var jsonfile = services.dirsvc.get("profd", ci.nsilocalfile); jsonfile.append("bookmarks.json"); jsonfile.create(ci.nsilocalfile.normal_file_type, 0600); // export bookmarks in json format to file placesutils.backupbookmarkstofile(jsonfile); // restore bookmarks from the json file // note: th...
Places Expiration
this means on mobile and old systems expiration will be more ag
gressive than on high-end hardware, to try keep the database size at a reasonable (and performant) value.
Querying Places
the defaults for these objects will result in a query that returns all of your browser history in a flat list: chromeutils.definemodulegetter(this, "placesutils", "resource://
gre/modules/placesutils.jsm"); // no query options set will get all history, sorted in database order, // which is nsinavhistoryqueryoptions.sort_by_none.
Using the Places keywords API
using the keywords api the keywords api is a promise-based api available through the placesutils module: components.utils.import("resource://
gre/modules/xpcomutils.jsm"); xpcomutils.definelazymodulegetter(this, "placesutils", "resource://
gre/modules/placesutils.jsm"); setting a keyword for an url the insert() method accepts a keyword entry object describing the keyword to insert.
XML Extras
the qa owner will manage the tests associated with their component, act as qa contact for related bugs and help with re
gression testing.
Fun With XBL and XPConnect
<handlers> <handler type="keypress" keycode="vk_return" value="autocomplete(anonymouscontent[0].value, this.autocompletelistener);"/> </handlers> </implementation> </binding> original document information author(s): scott mac
gregor last updated date: april 13, 2000 copyright information: copyright (c) scott mac
gregor ...
XPCOM changes in Gecko 2.0
for example, in your component's javascript code : components.utils.import("resource://
gre/modules/xpcomutils.jsm"); function mycomponent() { } mycomponent.prototype = { // this must match whatever is in chrome.manifest!
Building the WebLock UI
the xpcom interfaces and tools you've used have been general, cross-platform, and available in the gecko runtime environment or in any gecko-based application after mozilla 1.2 (when the
gre began to be used).
Finishing the Component
you build your component using this interface, and it works
great with the version of gecko that you have tested against.
Starting WebLock
this process is similar to using createinstance from the nsicomponentmanager, but there is no ag
gregation parameter since the object has already been constructed.
Mozilla internal string guide
you must not access the string except via the handle until you call finish() on the handle in the success case or you let the handle go out of scope without calling finish() in the failure case, in which case the destructor of the handle puts the string in a mostly harmless but consistent state (containing a single replacement character if a capacity
greater than 0 was requested, or in the char case if the three-byte utf-8 representation of the replacement character doesn't fit, an ascii substitute).
Receiving startup notifications
sometimes it's necessary for xpcom components to receive notifications as to the pro
gress of the application's startup process, so they can start new services at appropriate times, for example.
XPCOM Stream Guide
"nsistringinputstream", "setdata"); var inputstream = components.constructor("@mozilla.org/scriptableinputstream;1", "nsiscriptableinputstream", "init"); function buildstream(data) { return new stringstream(data, data.length); } components.utils.import("resource://
gre/modules/netutil.jsm"); function run_test() { var check = "we will rock you!"; var baseinputstream = buildstream(check); var store = components.classes["@mozilla.org/storagestream;1"] .createinstance(components.interfaces.nsistoragestream); /* in practice, your storage streams shouldn't be this small.
XPCOM guide
mozilla::services namespacethe services c++ namespace offers an easy and efficient alternative for obtaining a service as compared to the indirect xpcom approach: getservice(), callgetservice(), etc methods are expensive and should be avoided when possible.receiving startup notificationssometimes it's necessary for xpcom components to receive notifications as to the pro
gress of the application's startup process, so they can start new services at appropriate times, for example.xpcom array guidemozilla has many array classes because each array is optimized for a particular usage pattern.
Interfacing with the XPCOM cycle collector
if your class has tearoffs or is being ag
gregated by other classes it is important to make the tearoff classes or the outer classes participate in cycle collection too, not doing so could lead to the cycle collector trying to collect the objects too soon.
Introduction to XPCOM for the DOM
it simplifies
greatly the task of defining interfaces, and offers some interesting features, like automatic generation of documentation, and xpt generation.
Components.isSuccessCode
const cc = components.classes; const ci = components.interfaces; const cr = components.results; // global flags polled externally var copyfailed = false; var copyinpro
gress = false; function copybufferedstream(instream, outstream) { var copyobserver = { onstartrequest: function(request, context) { copyinpro
gress = true; }, onstoprequest: function(request, context, statuscode) { copyinpro
gress = false; // did the copy fail?
Components.utils.unload
you should not unload modules that are part of the application (anything under resource://
gre/ or resource:/// or resource://app/) as these may be in use by other extensions and the application.
XPCShell Reference
-g this option specifies which gecko runtime environment directory (
gredir) to use for xpcom.
IAccessibleHyperlink
iaccessibleaction.nactions() is one
greater than the maximum value for the indices used with the methods of this interface.
IAccessibleHypertext
if iaccessibletext is used to represent the text containing the link, then the character index is only valid if it is
greater than or equal to zero and lower than the number of characters in the text.
imgIContainer
flag_sync_decode: forces synchronous/non-pro
gressive decode of all available data before the call returns.
mozIRegistry
these components will, to various de
grees, need to use other components to do their thing.
GetChildAt
if child index is
greater than children count then returns null.
nsIDragSession
if numdropitems is
greater than one, there is no indication as to which of the items matches the data flavor.
nsIEffectiveTLDService
the tld space is currently expanding at a fairly
great rate, and the copy of the psl firefox has may not be totally up to date (because it's not dynamically updated data).
nsIFrameLoader
attributes attribute type description delayremotedialogs boolean depthtoo
great boolean find out whether the loader's frame is at too
great a depth in the frame tree.
nsIHttpServer
an example : https://github.com/laurentj/slimerjs/blob/master/src/modules/webserver.jsm var exported_symbols = ["create"]; components.utils.import("resource://
gre/modules/services.jsm"); function create() { var server = components.classes["@mozilla.org/server/jshttp;1"] .createinstance(components.interfaces.nsihttpserver); return { get objectname () { return "webserver"; }, /** * @param integer|string port port or "host:port" * @param object opt optional options.
nsIMessenger
sendingunsentmsgs boolean indicates if sending messages is in pro
gress.
Building an Account Manager Extension
components.utils.import("resource://
gre/modules/xpcomutils.jsm"); //class constructor function devmoaccountmanagerextension() {}; // class definition devmoaccountmanagerextension.prototype = { name : "devmo-account", chromepackagename : "example@mozilla.org", showpanel: function(server) { //this panel is only shown for imap accounts...
nsIMsgCompFields
subject astring templatename astring temporaryfiles char * obsolete temporaryfiles obsolete, do not use anymore to astring usemultipartalternative prbool uuencodeattachments prbool methods utility methods prbool checkcharsetconversion ( out char * fallbackcharset ); nsims
grecipientarray splitrecipients ( in prunichar * recipients, in prbool emailaddressonly ); void convertbodytoplaintext ( ); attachment handling methods void addattachment ( in nsimsgattachment attachment ); void removeattachment ( in nsimsgattachment attachment ); void removeattachments ( ); header methods void setheader(char* name, char*...
nsIMsgFolder
am(in nsimsgdbhdr amsghdr, in nsiinputstream astream, in long abytestoread, in long amaxoutputlen, in boolean acompressquotes); attributes attribute type description supportsoffline boolean readonly offlinestoreoutputstream nsioutputstream readonly offlinestoreinputstream nsiinputstream readonly retentionsettings nsims
gretentionsettings downloadsettings nsimsgdownloadsettings sortorder long used for order in the folder pane, folder pickers, etc.
nsIMsgIncomingServer
realhostname acstring real hostname of the server (if server name is changed it is stored here) realusername acstring real username of the server (if username is changed it is stored here) redirectortype string obsolete since gecko 1.9 rememberpassword boolean retentionsettings nsims
gretentionsettings rootfolder nsimsgfolder rootmsgfolder nsimsgfolder read only.
nsIParserUtils
sanitizerlo
gremovals (1 << 6) flag for sanitizer: log messages to the console for everything that gets sanitized.
nsIPromptService
var prompts = components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getservice(components.interfaces.nsipromptservice); var items = ["hello", "welcome", "howdy", "hi", ":)"]; // list items var selected = {}; var result = prompts.select(null, "title", "what
greeting do you want?", items.length, items, selected); // result is true if ok was pressed, false if cancel.
nsIRequest
load_background 1 << 0 do not deliver status notifications to the nsipro
gresseventsink, or keep this load from completing the nsiloadgroup it may belong to.
nsIStreamListener
if that number is
greater than or equal to 2^32, this parameter will be pr_uint32_max (2^32 - 1).
nsIStringBundleService
typically used to format a message received by a nsipro
gresseventsink's onstatus method.
nsISupports proxies
now xpinstall can do its installations while the product renders, but now xpinstall can not access ui elements such as a pro
gress meter or a confirmation dialog.
nsITraceableChannel
/////// start - do not edit var {classes: cc, interfaces: ci, results: cr, constructor: cc, utils: cu} = components; cu.import('resource://
gre/modules/services.jsm'); var binaryinputstream = cc('@mozilla.org/binaryinputstream;1', 'nsibinaryinputstream', 'setinputstream'); var binaryoutputstream = cc('@mozilla.org/binaryoutputstream;1', 'nsibinaryoutputstream', 'setoutputstream'); var storagestream = cc('@mozilla.org/storagestream;1', 'nsistoragestream', 'init'); function tracinglistener() { this.receivedchunks = []; // array for inco...
nsIUpdate
if this is specified, the user is shown the license file after they choose to install the update, and they must a
gree to it before the download begins.
nsIVariant
note that this will do strange things with negative numbers, and float and double values
greater than the numeric limits of a print64 will not convert correctly.
nsIXMLHttpRequest
opening a simple http request from a xul application (like a mozilla extension) without using observers: var req = components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"].createinstance(); req.open('post', "http://www.foo.bar:8080/nietzsche.do", true); req.send('your=data&and=more&stuff=here'); example 2 var {cu: utils, cc: classes, ci: instances} = components; cu.import('resource://
gre/modules/services.jsm'); function xhr(url, cb) { let xhr = cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createinstance(ci.nsixmlhttprequest); let handler = ev => { evf(m => xhr.removeeventlistener(m, handler, !1)); switch (ev.type) { case 'load': if (xhr.status == 200) { cb(xhr.response); break; ...
nsIXMLHttpRequestUpload
t last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) attributes attribute type description onabort nsidomeventlistener onerror nsidomeventlistener onload nsidomeventlistener onloadstart nsidomeventlistener onpro
gress nsidomeventlistener see also nsixmlhttprequest nsixmlhttprequesteventtarget xmlhttprequest using xmlhttprequest ...
nsIXULBrowserWindow
note: the xulbrowserwindow object offered to javascript code provides a
great many more methods and attributes than those listed here, which are only the ones available to c++ code.
nsIXULTemplateQueryProcessor
this method should return -1 when the left result is less than the right, 0 if both are equivalent, and 1 if the left is
greater than the right.
nsIXmlRpcClient
in string password); void setencoding(in string encoding); void setencoding(in unsigned long type, out nsiidref uuid, out nsqiresult result); void asynccall (in nsixmlrpcclientlistener listener, in nsisupports ctxt, in string methodname, in nsisupports arguments, in pruint32 count); attributes attribute type description serverurl readonly nsiurl the url of the xml-rpc server inpro
gress readonly boolean whether or not a call is in pro
gress fault readonly nsixmlrpcfault the most recent xml-rpc fault from returned from this server.
nsIZipReader
var zr = cc["@mozilla.org/libjar/zip-reader;1"].createinstance(ci.nsizipreader); cu.import('resource://
gre/modules/osfile.jsm'); cu.import('resource://
gre/modules/fileutils.jsm'); var reusablestreaminstance = cc['@mozilla.org/scriptableinputstream;1'].createinstance(ci.nsiscriptableinputstream); var pathtoxpitoread = os.path.join(os.constants.path.profiledir, 'extensions', 'portabletester@jetpack.xpi'); var nsifilexpi = new fileutils.file(pathtoxpitoread); //services...
nsIZipReaderCache
the number of outstanding entries can be much
greater than this number, this is the count for those otherwise unused entries.
nsMsgSearchOp
is also applies */ const nsmsgsearchopvalue islowerthan = 8; const nsmsgsearchopvalue beginswith = 9; const nsmsgsearchopvalue endswith = 10; const nsmsgsearchopvalue soundslike = 11; /* for ldap phoenetic matching */ const nsmsgsearchopvalue ldapdwim = 12; /* do what i mean for simple search */ const nsmsgsearchopvalue is
greaterthan = 13; const nsmsgsearchopvalue islessthan = 14; const nsmsgsearchopvalue namecompletion = 15; /* name completion operator...as the name implies =) */ const nsmsgsearchopvalue isinab = 16; const nsmsgsearchopvalue isntinab = 17; const nsmsgsearchopvalue isntempty = 18; /* primarily for tags */ const nsmsgsearchopvalue matches = 19; /* generic term for use by...
nsMsgSearchOpValue
is also applies */ 160 const nsmsgsearchopvalue islowerthan = 8; 161 162 const nsmsgsearchopvalue beginswith = 9; 163 const nsmsgsearchopvalue endswith = 10; 164 165 const nsmsgsearchopvalue soundslike = 11; /* for ldap phoenetic matching */ 166 const nsmsgsearchopvalue ldapdwim = 12; /* do what i mean for simple search */ 167 168 const nsmsgsearchopvalue is
greaterthan = 13; 169 const nsmsgsearchopvalue islessthan = 14; 170 171 const nsmsgsearchopvalue namecompletion = 15; /* name completion operator...as the name implies =) */ 172 const nsmsgsearchopvalue isinab = 16; 173 const nsmsgsearchopvalue isntinab = 17; 174 const nsmsgsearchopvalue isntempty = 18; /* primarily for tags */ 175 const nsmsgsearchopvalue matches = 19; /* gen...
XPCOM reference
(i'm fully aware that this will be a
great point of discussion and probably will end in tears, but since i'm the first person to apparently take a swing at this, i get first dibs.)xpcom primitivean xpcom primitive is an xpcom object that "boxes" a value of a primitive type.
Using the clipboard
components.utils.import('resource://
gre/modules/services.jsm'); // create a constructor for the built-in supports-string class.
Xptcall Porting Status
<font color="white">done</font> linux arm stefan hanske<sh990154@mail.uni-
greifswald.de> <font color="red">?</font> matthew wilcox <willy@bofh.ai> stefan's code is checked in and he says it is working.
XPCOM
this article will show you how to use the available interfaces in several mozilla products.ag
gregating the in-memory datasourcealready_addrefedalready_addrefed in association with nscomptr allows you to assign in a pointer without addrefing it.binary compatibilityif mozilla decides to upgrade to a compiler that does not have the same abi as the current version, any built component may fail.
Address Book examples
use the address book manager to get an nsisimpleenumerator, then pro
gress through the enumerator, looking for nsiabitem, nsiabcollection or nsiabdirectory interfaces as you require.
Autoconfiguration in Thunderbird
author: ben bucksch please do not change this document without consulting the author thunderbird 3.1 and later (and 3.0 to some de
gree) includes mail account autoconfiguration functionality.
Filelink Providers
the hightail implementation is a
great place to look for examples and inspiration.
Index
35 mail client architecture overview sections in
grey refer to modules outside of mail/news 36 mail composition back end by richard h.
LDAP Support
original document information author(s): scott mac
gregor copyright information: portions of this content are © 1998–2010 by individual mozilla.org contributors; content available under a creative commons license | details.
MailNews fakeserver
to enable/disable debugging, call setdebuglevel on your nsmailserver instance with one of the following options: const fsdebugnone = 0; // dump nothing const fsdebu
grecv = 1; // dump just the received commands const fsdebu
grecvsend = 2; // dump received + sent commands, no data const fsdebugall = 3; // dump everything debugging is set to "none" by default.
Activity Manager examples
on is omitted, initiator is not provided process.init("processing folder: " + folder.prettiestname, null); // note that we don't define a custom icon, default process icon // will be used process.contexttype = "account"; // group this activity by account process.contextobj = folder.server; // account in question gactivitymanager.addactivity(process); // step 2: showing some pro
gress let percent = 50; process.setpro
gress(percent, "junk processing 25 of 50 messages", 25, 50); // step 3: removing the process and adding an event using process' attributes process.state = components.interfaces.nsiactivityprocess.state_completed; gactivitymanager.removeactivity(process.id); let event = components.classes["@mozilla.org/activity-event;1"].createinstance(nsiae); // localization ...
Toolkit version format
if at some point a version part of one version string is
greater than the corresponding version part of another version string, then the first version string is
greater than the other one.
Using popup notifications
components.utils.import('resource://
gre/modules/popupnotifications.jsm'); var notify = new popupnotifications(gbrowser, document.getelementbyid("notification-popup"), document.getelementbyid("notification-popup-box")); var notification = notify.show( // browser gbrowser.selectedbrowser, // popup id "pdes-popup", // message "hi, there!, i'm gonna show you something today!!", // anchor id null, ...
Using COM from js-ctypes
let { ctypes } = components.utils.import("resource://
gre/modules/ctypes.jsm", {}); // some groundwork let is64bit; if (ctypes.voidptr_t.size == 4 /* 32-bit */) { is64bit = false; } else if (ctypes.voidptr_t.size == 8 /* 64-bit */) { is64bit = true; } let winabi = is64bit ?
Using Objective-C from js-ctypes
let { ctypes } = components.utils.import("resource://
gre/modules/ctypes.jsm", {}); let id = ctypes.structtype("objc_object").ptr; let sel = ctypes.structtype("objc_selector").ptr; let bool = ctypes.signed_char; let lib = ctypes.open(ctypes.libraryname("objc")); let objc_getclass = lib.declare("objc_getclass", ctypes.default_abi, id, ctypes.char.ptr); let sel_registername = lib.declare("sel_registername", ctypes.defaul...
Working with data
as review, making a null-terminated string happens like this: var cstr_nullterminated = ctypes.jschar.array()('rawr'); console.log(cstr_nullterminated); // outputs to browserconsole: `cdata { length: 5 }` console.log(cstr_nullterminated.tostring()); // outputs to browser console: `"ctypes.char16_t.array(5)(["r", "a", "w", "r", "\x00"])"` the console.log shows that the length is
greater then the length of "rawr" which is 4, doing a .tostring on it shows there is a null terminator of \x00 on the end.
ctypes.open
if the native file is located at chrome://youraddon/content/mysubfolder/mycfunctionsforunix.so then it is converted to a file uri like this: components.utils.import("resource://
gre/modules/services.jsm"); var cr = components.classes['@mozilla.org/chrome/chrome-registry;1'].getservice(components.interfaces.nsichromeregistry); var chromeuri_mylib = services.io.newuri('chrome://youraddon/content/mysubfolder/mycfunctionsforunix.so', 'utf-8', null); var localfile_mylib = cr.convertchromeurl(chromeuri_mylib); var jarpath_mylib = localfile_mylib.spec; // "jar:file:///c:/users/vay...
ctypes
credit for this example is to nmaier (stackoverflow :: getting tb_button is crashing and not working) example of cast and functiontype on windows components.utils.import("resource://
gre/modules/ctypes.jsm"); var kernel = ctypes.open("kernel32.dll"); var hmodule = ctypes.uint32_t; var hwnd = ctypes.uint32_t; var lpctstr = ctypes.jschar.ptr; var lpcstr = ctypes.char.ptr; var loadlibrary = kernel.declare("loadlibraryw", ctypes.winapi_abi, hmodule, lpctstr); var getprocaddress = kernel.declare("getprocaddress", ctypes.winapi_abi, ctypes.void_t.ptr, hmodule, lpcstr); var huser = lo...
Scripting plugins - Plugins
in addition to this, a further extension to this api is being discussed that would give a plugin
greater flexibility by letting the plugin control the origin of the calling code, so that the plugin can specify the origin of calls that come from internally loaded code from other origins.
Version, UI, and Status Information - Plugins
displaying a status line message users are accustomed to checking the ui status line at the bottom of the browser window for updates on the pro
gress of an operation or the url of a link on the page.
Browser Console - Firefox Developer Tools
components.utils.import("resource://
gre/modules/console.jsm"); console.log("hello from firefox code"); //output messages to the console learn more: console api reference console.jsm source code in the mozilla dxr hudservice there is also the hudservice which allows access to the browse console.
Debugger.Object - Firefox Developer Tools
for example, in firefox, a metadata object for a javascript module's global object might look like this: { "type":"jsm", "uri":"resource:://
gre/modules/xpcomutils.jsm" } firefox provides [debuggerhostannotationsforfirefox annotations] for its host objects.
CSS Flexbox Inspector: Examine Flexbox layouts - Firefox Developer Tools
if you click on the item, the display shifts to show details about that element: this view shows information about the calculations for the size of the selected flex item: a diagram visualizing the sizing of the flex item content size - the size of the component without any restraints imposed on it by its parent flexibility - how much a flex item
grew or shrunk based on its flex-grow value when there is extra free space or its flex-shrink value when there is not enough space minimum size (only appears when an item is clamped to its minimum size) - the minimum content size of a flex item when there is no more free space in the flex container final size - the size of the flex item after all sizing constraints imposed on it have been applied (...
Call Tree - Firefox Developer Tools
by default, the call tree doesn't split platform data out into separate functions, because they add a
great deal of noise, and the details are not likely to be useful to people not working on firefox.
Frame rate - Firefox Developer Tools
using the frame rate graph the
great value of the frame rate graph is that, like the web console, it gives you a quick indication of where your site might be having problems, enabling you to use the other tools for more in-depth analysis.
UI Tour - Firefox Developer Tools
for example, in the screenshot below a long-running paint operation (shown as a
green bar in the waterfall overview) corresponds to a drop in the frame rate: zooming in you can use the overview to select a slice of the recording to examine in more detail.
Rich output - Firefox Developer Tools
for example, by expanding the array in the above list, i get the following: console.log(todolist) (4) […] 0: object { status: "done", description: "morning pages", datecreated: 1552404478137 } 1: object { status: "in pro
gress", description: "refactor styles", datecreated: 1552404493169 } 2: object { status: "to do", description: "create feedback form", datecreated: 1552404512630 } 3: object { status: "to do", description: "normalize table", datecreated: 1552404533790 } length: 4 <prototype>: array [] debugger eval code:1:9 undefined highlighting and inspecting dom nodes if you hover the mouse over ...
Web Console remoting - Firefox Developer Tools
ta packet: { "to": "conn0.netevent15", "type": "getrequestpostdata" } { "from": "conn0.netevent15", "postdata": { text: "foobar" }, "postdatadiscarded": false } the getresponsecontent packet: { "to": "conn0.netevent15", "type": "getresponsecontent" } { "from": "conn0.netevent15", "content": { "mimetype": "text/css", "text": "\n@import \"test.css\";\n\n.foobar { color:
green }\n\n" }, "contentdiscarded": false } the request and response content text value is most commonly sent using a longstringactor grip.
Firefox Developer Tools
application panel provides tools for inspecting and debugging modern web apps (also known as pro
gressive web apps).
AbstractRange - Web APIs
e way to the forum...</p> <aside class="callout"> <h2>aside</h2> <p>an interesting aside to share with you...</p> </aside> </section> </article> <pre id="log"></pre> </div> after loading the html and constructing the dom representation of the document, the resulting dom tree looks like this: in this diagram, the nodes representing html elements are shown in
green.
Animation.finish() - Web APIs
exceptions invalidstate the player's playback rate is 0 or the animation's playback rate is
greater than 0 and the end time of the animation is infinity.
CanvasGradient.addColorStop() - Web APIs
html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); let gradient = ctx.createlineargradient(0, 0, 200, 0); gradient.addcolorstop(0, '
green'); gradient.addcolorstop(.7, 'white'); gradient.addcolorstop(1, 'pink'); ctx.fillstyle = gradient; ctx.fillrect(10, 10, 200, 100); result specifications specification status comment html living standardthe definition of 'canvasgradient.addcolorstop' in that specification.
CanvasRenderingContext2D.beginPath() - Web APIs
const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // first path ctx.beginpath(); ctx.strokestyle = 'blue'; ctx.moveto(20, 20); ctx.lineto(200, 20); ctx.stroke(); // second path ctx.beginpath(); ctx.strokestyle = '
green'; ctx.moveto(20, 20); ctx.lineto(120, 120); ctx.stroke(); result specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.beginpath' in that specification.
CanvasRenderingContext2D.createLinearGradient() - Web APIs
html <canvas id="canvas"></canvas> javascript var canvas = document.getelementbyid('canvas'); var ctx = canvas.getcontext('2d'); // create a linear gradient // the start gradient point is at x=20, y=0 // the end gradient point is at x=220, y=0 var gradient = ctx.createlineargradient(20,0, 220,0); // add three color stops gradient.addcolorstop(0, '
green'); gradient.addcolorstop(.5, 'cyan'); gradient.addcolorstop(1, '
green'); // set the fill style and draw a rectangle ctx.fillstyle = gradient; ctx.fillrect(20, 20, 200, 100); result specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.createlineargradient' in that specification.
CanvasRenderingContext2D.createRadialGradient() - Web APIs
vas = document.getelementbyid('canvas'); var ctx = canvas.getcontext('2d'); // create a radial gradient // the inner circle is at x=110, y=90, with radius=30 // the outer circle is at x=100, y=100, with radius=70 var gradient = ctx.createradialgradient(110,90,30, 100,100,70); // add three color stops gradient.addcolorstop(0, 'pink'); gradient.addcolorstop(.9, 'white'); gradient.addcolorstop(1, '
green'); // set the fill style and draw a rectangle ctx.fillstyle = gradient; ctx.fillrect(20, 20, 160, 160); result specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.createradialgradient' in that specification.
CanvasRenderingContext2D.ellipse() - Web APIs
html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.fillstyle = 'red'; ctx.beginpath(); ctx.ellipse(60, 75, 50, 30, math.pi * .25, 0, math.pi * 1.5); ctx.fill(); ctx.fillstyle = 'blue'; ctx.beginpath(); ctx.ellipse(150, 75, 50, 30, math.pi * .25, 0, math.pi); ctx.fill(); ctx.fillstyle = '
green'; ctx.beginpath(); ctx.ellipse(240, 75, 50, 30, math.pi * .25, 0, math.pi, true); ctx.fill(); result specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.ellipse' in that specification.
CanvasRenderingContext2D.fill() - Web APIs
html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // create path let region = new path2d(); region.moveto(30, 90); region.lineto(110, 20); region.lineto(240, 130); region.lineto(60, 130); region.lineto(190, 20); region.lineto(270, 90); region.closepath(); // fill path ctx.fillstyle = '
green'; ctx.fill(region, 'evenodd'); result specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.fill' in that specification.
CanvasRenderingContext2D.restore() - Web APIs
html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // save the default state ctx.save(); ctx.fillstyle = '
green'; ctx.fillrect(10, 10, 100, 100); // restore the default state ctx.restore(); ctx.fillrect(150, 40, 100, 100); result specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.restore' in that specification.
CanvasRenderingContext2D.save() - Web APIs
html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // save the default state ctx.save(); ctx.fillstyle = '
green'; ctx.fillrect(10, 10, 100, 100); // restore the default state ctx.restore(); ctx.fillrect(150, 40, 100, 100); result specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.save' in that specification.
CanvasRenderingContext2D.stroke() - Web APIs
const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // first sub-path ctx.linewidth = 26; ctx.strokestyle = 'orange'; ctx.moveto(20, 20); ctx.lineto(160, 20); ctx.stroke(); // second sub-path ctx.linewidth = 14; ctx.strokestyle = '
green'; ctx.moveto(20, 80); ctx.lineto(220, 80); ctx.stroke(); // third sub-path ctx.linewidth = 4; ctx.strokestyle = 'pink'; ctx.moveto(20, 140); ctx.lineto(280, 140); ctx.stroke(); result stroking and filling if you want to both stroke and fill a path, the order in which you perform these actions will determine the result.
A basic ray-caster - Web APIs
the canvas overview and tutorial i found here at mdn are
great, but nobody had written about animation yet, so i thought i'd try a port of a basic raycaster i'd worked on a while ago, and see what sort of performance we can expect from a javascript-controlled pixel buffer.
Basic animations - Web APIs
color = gc(), this.renew = function () { this.x = math.floor(math.random() * (w - 200) + 10), this.y = math.floor(math.random() * (h - 200) + 30), this.color = gc() }, this.renew(), this.put = (() => { c.fillstyle = this.color, c.arc(this.x, this.y, this.b - 5, 0, 2 * math.pi), c.fill(), c.beginpath(), c.arc(this.x, this.y, this.b - 5, 0, math.pi), c.strokestyle = "
green", c.linewidth = 10, c.stroke(), c.beginpath(), c.linewidth = 1 }) } function init() { cc.height = h, cc.width = w, c.fillrect(0, 0, w, innerheight); for (var t = 0; t < 10; t++) fa.push(new food); s = new snake(w / 2, h / 2, 400, 4, 4), anima() } function anima() { c.fillstyle = "rgba(0,0,0,0.11)", c.fillrect(0, 0, cc.width, cc.height), ...
Compositing example - Web APIs
ctx.fillstyle = "rgba(0,255,0,1)"; ctx.arc(160, 100, 100, math.pi*2, 0, false); ctx.fill(); ctx.restore(); ctx.beginpath(); ctx.fillstyle = "#f00"; ctx.fillrect(0,0,30,30) ctx.fill(); }; var colorsphere = function(element) { var ctx = canvas1.getcontext("2d"); var width = 360; var halfwidth = width / 2; var rotate = (1 / 360) * math.pi * 2; // per de
gree var offset = 0; // scrollbar offset var oleft = -20; var otop = -20; for (var n = 0; n <= 359; n ++) { var gradient = ctx.createlineargradient(oleft + halfwidth, otop, oleft + halfwidth, otop + halfwidth); var color = color.hsv_rgb({ h: (n + 300) % 360, s: 100, v: 100 }); gradient.addcolorstop(0, "rgba(0,0,0,0)"); gradient.addcolorstop(0.7, "rgba("...
Hit regions and accessibility - Web APIs
partially overlaying the circle is a
green <a href="http://en.wikipedia.org/wiki/square" onfocus="drawsquare();" onblur="drawpicture();">square</a> and a purple <a href="http://en.wikipedia.org/wiki/triangle" onfocus="drawtriangle();" onblur="drawpicture();">triangle</a>, both of which are semi-opaque, so the full circle can be seen underneath.</p> </canvas> see the video how nvda reads this example by steve faulkner.
DOMMatrix - Web APIs
dommatrix.rotateself() modifies the matrix by rotating itself around each axis by the specified number of de
grees.
DOMMatrixReadOnly - Web APIs
dommatrixreadonly.rotate() returns a new dommatrix created by rotating the source matrix around each of its axes by the specified number of de
grees.
DOMParser - Web APIs
domparser html extension /* * domparser html extension * 2012-09-04 * * by eli
grey, http://eli
grey.com * public domain.
Binary strings - Web APIs
however at least one native function requires binary strings as its input, btoa(): invoking it on a string that contains codepoints
greater than 255 will cause a character out of range error.
DOMTokenList - Web APIs
methods domtokenlist.item(index) returns the item in the list by its index, or undefined if index is
greater than or equal to the list's length.
DataTransfer.getData() - Web APIs
t)"></div> css content #div1, #div2 { width:100px; height:50px; padding:10px; border:1px solid #aaaaaa; } javascript content function allowdrop(allowdropevent) { allowdropevent.target.style.color = 'blue'; allowdropevent.preventdefault(); } function drag(dragevent) { dragevent.datatransfer.setdata("text", dragevent.target.id); dragevent.target.style.color = '
green'; } function drop(dropevent) { dropevent.preventdefault(); var data = dropevent.datatransfer.getdata("text"); dropevent.target.appendchild(document.getelementbyid(data)); document.getelementbyid("drag").style.color = 'black'; } result specifications specification status comment html living standardthe definition of 'getdata()' in that specification...
Using light sensors - Web APIs
you are working in a dark environment'); bodybg.backgroundcolor="light
grey"; } else { bodybg.backgroundcolor="#fff"; } }); this example shows how the api can actually be used in the wild.
DeviceOrientationEvent.beta - Web APIs
returns the rotation of the device around the x axis; that is, the number of de
grees, ranged between -180 and 180, by which the device is tipped forward or backward.
DeviceOrientationEvent.gamma - Web APIs
returns the rotation of the device around the y axis; that is, the number of de
grees, ranged between -90 and 90, by which the device is tilted left or right.
DirectoryEntrySync - Web APIs
if you delete a directory that contains a file that cannot be removed or if an error occurs while the deletion is in pro
gress, some of the contents might not be deleted.
Document.caretRangeFromPoint() - Web APIs
stet clita kasd guber
gren, no sea takimata sanctus est lorem ipsum dolor sit amet.</p> javascript function insertbreakatpoint(e) { let range; let textnode; let offset; if (document.caretpositionfrompoint) { range = document.caretpositionfrompoint(e.clientx, e.clienty); textnode = range.offsetnode; offset = range.offset; } else if (document.caretrangefrompoint) { range = document.caretrangefro...
Document.createElement() - Web APIs
<html> <head> <title>||working with elements||</title> </head> <body> <div id="div1">the text above has been created dynamically.</div> </body> </html> javascript document.body.onload = addelement; function addelement () { // create a new div element const newdiv = document.createelement("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 following example snippet is taken from our expanding-list-web-component example (see it live also).
Document.getElementsByTagName() - Web APIs
lementsbytagname('p'); var num = div1paras.length; alert('there are ' + num + ' paragraph in #div1'); } function div2paraelems() { var div2 = document.getelementbyid('div2'); var div2paras = div2.getelementsbytagname('p'); var num = div2paras.length; alert('there are ' + num + ' paragraph in #div2'); } </script> </head> <body style="border: solid
green 3px"> <p>some outer text</p> <p>some outer text</p> <div id="div1" style="border: solid blue 3px"> <p>some div1 text</p> <p>some div1 text</p> <p>some div1 text</p> <div id="div2" style="border: solid red 3px"> <p>some div2 text</p> <p>some div2 text</p> </div> </div> <p>some outer text</p> <p>some outer text</p> <button onclick="getallparaelems...
Document.getElementsByTagNameNS() - Web APIs
= div1paras.length; alert("there are " + num + " <p> elements in div1 element"); } function div2paraelems() { var div2 = document.getelementbyid("div2") var div2paras = div2.getelementsbytagnamens("http://www.w3.org/1999/xhtml", "p"); var num = div2paras.length; alert("there are " + num + " <p> elements in div2 element"); } </script> </head> <body style="border: solid
green 3px"> <p>some outer text</p> <p>some outer text</p> <div id="div1" style="border: solid blue 3px"> <p>some div1 text</p> <p>some div1 text</p> <p>some div1 text</p> <div id="div2" style="border: solid red 3px"> <p>some div2 text</p> <p>some div2 text</p> </div> </div> <p>some outer text</p> <p>some outer text</p> <button onclick="getallparaelems();"> show al...
DocumentFragment - Web APIs
this interface is also of
great use with web components: <template> elements contain a documentfragment in their htmltemplateelement.content property.
DocumentOrShadowRoot.caretPositionFromPoint() - Web APIs
stet clita kasd guber
gren, no sea takimata sanctus est lorem ipsum dolor sit amet.</p> javascript content function insertbreakatpoint(e) { var range; var textnode; var offset; if (document.caretpositionfrompoint) { range = document.caretpositionfrompoint(e.clientx, e.clienty); textnode = range.offsetnode; offset = range.offset; } else if (document.caretrangefrompoint) { range = document.caret...
Events and the DOM - Web APIs
eventtarget.addeventlistener // assuming mybutton is a button element mybutton.addeventlistener('click',
greet, false) function
greet(event){ // print and have a look at the event object // always print arguments in case of overlooking any other arguments console.log('
greet:', arguments) alert('hello world') } this is the method you should use in modern web pages.
EffectTiming.direction - Web APIs
the value of direction corresponds directly to animationeffecttimin
greadonly.direction in timing objects returned by animationeffectreadonly, keyframeeffectreadonly, and keyframeeffect.
EffectTiming.duration - Web APIs
the value of duration corresponds directly to animationeffecttimin
greadonly.duration in timing objects returned by animationeffectreadonly, keyframeeffectreadonly, and keyframeeffect.
EffectTiming.fill - Web APIs
</div> css content .main { width: 300px; height:300px; border: 1px solid black; } .button { cursor: pointer; width: 300px; border: 1px solid black; font-size: 16px; text-align: center; margin-top: 0px; padding-top: 2px; padding-bottom: 4px; color: white; background-color: dark
green; font: 14px "open sans", "arial", sans-serif; } #text { width: 160px; padding: 10px; position: relative; text-align: center; align-self: center; color: white; font: bold 2em "lucida grande", "open sans", sans-serif; } while there's other css involved in this example, the part that really matters for our purposes is the css that styles the "box" element that we'll be animating...
EffectTiming.iterations - Web APIs
the value of iterations corresponds directly to animationeffecttimin
greadonly.iterations in timing objects returned by animationeffectreadonly, keyframeeffectreadonly, and keyframeeffect.
Element.attributes - Web APIs
e attributes if (paragraph.hasattributes()) { var attrs = paragraph.attributes; var output = ""; for(var i = attrs.length - 1; i >= 0; i--) { output += attrs[i].name + "->" + attrs[i].value; } result.value = output; } else { result.value = "no attributes to show"; } } </script> </head> <body> <p id="paragraph" style="color:
green;">sample paragraph</p> <form action=""> <p> <input type="button" value="show first attribute name and value" onclick="listattributes();"> <input id="result" type="text" value=""> </p> </form> </body> </html> specifications specification status comment domthe definition of 'element.attributes' in that specification.
Element.getClientRects() - Web APIs
strong { text-align: center; } div { display: inline-block; width: 150px; } div p, ol, table { border: 1px solid blue; } span, li, th, td { border: 1px solid
green; } javascript the javascript code draws the client rects for all html elements that have css class withclientrectsoverlay assigned.
Element.matches() - Web APIs
example <ul id="birds"> <li>orange-winged parrot</li> <li class="endangered">philippine eagle</li> <li>
great white pelican</li> </ul> <script type="text/javascript"> var birds = document.getelementsbytagname('li'); for (var i = 0; i < birds.length; i++) { if (birds[i].matches('.endangered')) { console.log('the ' + birds[i].textcontent + ' is endangered!'); } } </script> this will log "the philippine eagle is endangered!" to the console, since the element has indeed a class attr...
Element: overflow event - Web APIs
interface uievent event handler property unknown examples <div id="wrapper"> <div id="child"></div> </div> <br/> <label><input type="checkbox" id="toggle" checked/> overflow</label> <style> #wrapper { width: 20px; height: 20px; background: #000; padding: 5px; overflow: 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("overflow", function( event ) { console.log( event ); }, false); wrapper.addeventlistener("underflow", function( event ) { console.log( event ); }, false);...
Element.scrollHeight - Web APIs
</textarea> </p> <p> <input type="checkbox" id="a
gree" name="accept" /> <label for="a
gree">i a
gree</label> <input type="submit" id="nextstep" value="next" /> </p> </form> css #notice { display: inline-block; margin-bottom: 12px; border-radius: 5px; width: 600px; padding: 5px; border: 2px #7fdf55 solid; } #rules { width: 600px; height: 130px; padding: 5px; border: #2a9f00 solid 2px; border-radius: 5px; } javascrip...
Element.scrollTop - Web APIs
if set to a value
greater than the maximum available for the element, scrolltop settles itself to the maximum value.
Element: underflow event - Web APIs
interface uievent event handler property unknown examples <div id="wrapper"> <div id="child"></div> </div> <br/> <label><input type="checkbox" id="toggle" checked/> overflow</label> <style> #wrapper { width: 20px; height: 20px; background: #000; padding: 5px; overflow: 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("overflow", function( event ) { console.log( event ); }, false); wrapper.addeventlistener("underflow", function( event ) { console.log( event ); }, false);...
EventTarget.addEventListener() - Web APIs
wed) </a> <a class="inner2" href="https://developer.mozilla.org/" target="_blank"> inner2, none-passive & preventdefault(not open new page) </a> </div> </div> css .outer, .middle, .inner1, .inner2 { display: block; width: 520px; padding: 15px; margin: 15px; text-decoration: none; } .outer { border: 1px solid red; color: red; } .middle { border: 1px solid
green; color:
green; width: 460px; } .inner1, .inner2 { border: 1px solid purple; color: purple; width: 400px; } javascript const outer = document.queryselector('.outer'); const middle = document.queryselector('.middle'); const inner1 = document.queryselector('.inner1'); const inner2 = document.queryselector('.inner2'); const capture = { capture : true }; const nonecapture = { ...
Cross-global fetch usage - Web APIs
so in the case described above, it is resolved against the iframe's location: let absolute = new url(relative, frame.contentwindow.location.href) there is a lot of discussion in pro
gress about getting new specs to align with this behavior change, to mitigate potential problems going forward.
FileReader.abort() - Web APIs
syntax instanceoffilereader.abort(); exceptions dom_file_abort_err thrown when abort is called while no read operation is in pro
gress (that is, the state isn't loading).
FileReader: error event - Web APIs
bubbles no cancelable no interface pro
gressevent event handler property filereader.onerror examples const fileinput = document.queryselector('input[type="file"]'); const reader = new filereader(); function handleselected(e) { const selectedfile = fileinput.files[0]; if (selectedfile) { reader.addeventlistener('error', () => { console.error(`error occurred reading file: ${selectedfile.name}`); }); reader.addeventlistener('load', () => { console.error(`file: ${selectedfile.name} read successfully`); }); reader.readasdataurl(selectedfile); ...
FileRequest - Web APIs
filerequest.onpro
gress a callback handler called repeatedly while the operation represented by the filerequest is in pro
gress.
Frame Timing API - Web APIs
if this value is
greater than the time needed to provide a good user experience, further analysis might be warranted.
Gamepad.timestamp - Web APIs
values are monotonically increasing, meaning that they can be compared to determine the ordering of updates, as newer values will always be
greater than or equal to older values.
GestureEvent - Web APIs
gestureevent.rotation read only change in rotation (in de
grees) since the event's beginning.
GlobalEventHandlers.onanimationcancel - Web APIs
iv class="button" id="togglebox"> hide the box </div> <pre id="log"></pre> css :root { --boxwidth: 50px; } .main { width: 300px; height: 300px; border: 1px solid black; } .button { cursor: pointer; width: 300px; border: 1px solid black; font-size: 16px; text-align: center; margin-top: 0; padding-top: 2px; padding-bottom: 4px; color: white; background-color: dark
green; font: 14px "open sans", "arial", sans-serif; } #text { width: 46px; padding: 10px; position: relative; text-align: center; align-self: center; color: white; font: bold 1.4em "lucida grande", "open sans", sans-serif; } leaving out some bits of the css that don't matter for the discussion here, let's take a look at the styles for the box that we're animating.
GlobalEventHandlers.onanimationend - Web APIs
lass="button" id="play"> play animation </div> <pre id="log"></pre> css content :root { --boxwidth:50px; } .main { width: 300px; height:300px; border: 1px solid black; } .button { cursor: pointer; width: 300px; border: 1px solid black; font-size: 16px; text-align: center; margin-top: 0; padding-top: 2px; padding-bottom: 4px; color: white; background-color: dark
green; font: 14px "open sans", "arial", sans-serif; } #text { width: 46px; padding: 10px; position: relative; text-align: center; align-self: center; color: white; font: bold 1.4em "lucida grande", "open sans", sans-serif; } leaving out some bits of the css that don't matter for the discussion here, let's take a look at the styles for the box that we're animating.
GlobalEventHandlers.onanimationiteration - Web APIs
> </div> </div> <div class="button" id="play"> begin demonstration </div> css :root { --boxwidth:50px; } .main { width: 300px; height:300px; border: 1px solid black; } .button { cursor: pointer; width: 300px; border: 1px solid black; font-size: 16px; text-align: center; margin-top: 0; padding-top: 2px; padding-bottom: 4px; color: white; background-color: dark
green; font: 14px "open sans", "arial", sans-serif; } #text { width: 46px; padding: 10px; position: relative; text-align: center; align-self: center; color: white; font: bold 1.4em "lucida grande", "open sans", sans-serif; } leaving out some bits of the css that don't matter for the discussion here, let's take a look at the styles for the box that we're animating.
GlobalEventHandlers.onanimationstart - Web APIs
lass="button" id="play"> play animation </div> <pre id="log"></pre> css content :root { --boxwidth:50px; } .main { width: 300px; height:300px; border: 1px solid black; } .button { cursor: pointer; width: 300px; border: 1px solid black; font-size: 16px; text-align: center; margin-top: 0; padding-top: 2px; padding-bottom: 4px; color: white; background-color: dark
green; font: 14px "open sans", "arial", sans-serif; } #text { width: 46px; padding: 10px; position: relative; text-align: center; align-self: center; color: white; font: bold 1.4em "lucida grande", "open sans", sans-serif; } leaving out some bits of the css that don't matter for the discussion here, let's take a look at the styles for the box that we're animating.
GlobalEventHandlers.ondragend - Web APIs
var el=document.getelementbyid("target"); el.style.background = "pink"; } function dragexit_handler(ev) { console.log("dragexit"); // change the source element's border back to
green to signify a dragexit event ev.currenttarget.style.background = "
green"; } function init() { // set handlers for the source's enter/leave/end/exit events var el=document.getelementbyid("source"); el.ondragenter = dragenter_handler; el.ondragleave = dragleave_handler; el.ondragend = dragend_handler; el.ondragexit = dragexit_handler; } </script> <body onload="init();"> <h1>examples of <co...
GlobalEventHandlers.ondragenter - Web APIs
var el=document.getelementbyid("target"); el.style.background = "pink"; } function dragexit_handler(ev) { console.log("dragexit"); // change the source element's border back to
green to signify a dragexit event ev.currenttarget.style.background = "
green"; } function init() { // set handlers for the source's enter/leave/end/exit events var el=document.getelementbyid("source"); el.ondragenter = dragenter_handler; el.ondragleave = dragleave_handler; el.ondragend = dragend_handler; el.ondragexit = dragexit_handler; } </script> <body onload="init();"> <h1>examples of <co...
GlobalEventHandlers.ondragexit - Web APIs
var el=document.getelementbyid("target"); el.style.background = "pink"; } function dragexit_handler(ev) { console.log("dragexit"); // change the source element's border back to
green to signify a dragexit event ev.currenttarget.style.background = "
green"; } function init() { // set handlers for the source's enter/leave/end/exit events var el=document.getelementbyid("source"); el.ondragenter = dragenter_handler; el.ondragleave = dragleave_handler; el.ondragend = dragend_handler; el.ondragexit = dragexit_handler; } </script> <body onload="init();"> <h1>examples of <co...
GlobalEventHandlers.ondragleave - Web APIs
var el=document.getelementbyid("target"); el.style.background = "pink"; } function dragexit_handler(ev) { console.log("dragexit"); // change the source element's background color back to
green to signify a dragexit event ev.currenttarget.style.background = "
green"; } function init() { // set handlers for the source's enter/leave/end/exit events var el=document.getelementbyid("source"); el.ondragenter = dragenter_handler; el.ondragleave = dragleave_handler; el.ondragend = dragend_handler; el.ondragexit = dragexit_handler; } </script> <body onload="init();"> <h1>examples of <co...
GlobalEventHandlers.onloadend - Web APIs
the onloadend property of the globaleventhandlers mixin is an eventhandler representing the code to be called when the loadend event is raised (when pro
gress has stopped on the loading of a resource.) syntax img.onloadend = funcref; value funcref is the handler function to be called when the resource's loadend event fires.
GlobalEventHandlers.onloadstart - Web APIs
the onloadstart property of the globaleventhandlers mixin is an eventhandler representing the code to be called when the loadstart event is raised (when pro
gress has begun on the loading of a resource.) syntax img.onloadstart = funcref; value funcref is the handler function to be called when the resource's loadstart event fires.
HTMLCanvasElement.mozFetchAsStream() - Web APIs
esult) { if (!components.issuccesscode(result)) { alert('failed to create icon'); } else { alert('succesfully made'); } }; } var mfascallback = function(iconname) { return function(instream) { var file = fileutils.getfile('desk', [iconname + '.ico']); var outstream = fileutils.openfileoutputstream(file); cu.import('resource://
gre/modules/netutil.jsm'); netutil.asynccopy(instream, outstream, netutilcallback()); } } canvas.mozfetchasstream(mfascallback('myicon'), 'image/vnd.microsoft.icon'); specifications not part of any specification.
HTMLCanvasElement.toBlob() - Web APIs
cu.import('resource://
gre/modules/osfile.jsm'); var writepath = os.path.join(os.constants.path.desktopdir, iconname + '.ico'); var promise = os.file.writeatomic(writepath, new uint8array(r.result), {tmppath:writepath + '.tmp'}); promise.then( function() { console.log('successfully wrote file'); }, function() { ...
HTMLCollection.item - Web APIs
return value the node at the specified index, or null if index is less than zero or
greater than or equal to the length property.
HTMLFontElement.color - Web APIs
the format of the string must follow one of the following html microsyntaxes: microsyntax description examples valid name color string nameofcolor (case insensitive)
green
green
green valid hex color string in rgb format: #rrggbb #008000 rgb using decimal values rgb(x,x,x) (x in 0-255 range) rgb(0,128,0) syntax colorstring = fontobj.color; fontobj.color = colorstring; examples // assumes there is <font id="f"> element in the html var f = document.getelementbyid("f"); f.color = "
green"; specifications the <font...
HTMLIFrameElement.csp - Web APIs
the csp property of the htmliframeelement interface specifies the content security policy that an embedded document must a
gree to enforce upon itself.
HTMLIFrameElement - Web APIs
htmliframeelement.csp specifies the content security policy that an embedded document must a
gree to enforce upon itself.
HTMLMediaElement: loadstart event - Web APIs
og>label { display: block; } js const loadvideo = document.queryselector('button'); const video = document.queryselector('video'); const eventlog = document.queryselector('.event-log-contents'); let source = null; function handleevent(event) { eventlog.textcontent = eventlog.textcontent + `${event.type}\n`; } video.addeventlistener('loadstart', handleevent); video.addeventlistener('pro
gress', handleevent); video.addeventlistener('canplay', handleevent); video.addeventlistener('canplaythrough', handleevent); loadvideo.addeventlistener('click', () => { if (source) { document.location.reload(); } else { loadvideo.textcontent = "reset example"; source = document.createelement('source'); source.setattribute('src', 'https://interactive-examples.
HTMLMediaElement - Web APIs
play fired when the paused property is changed from true to false, as a result of the htmlmediaelement.play() method, or the autoplay attribute playing fired when playback is ready to start after having been paused or delayed due to lack of data pro
gress fired periodically as the browser loads a resource.
HTMLTableElement.deleteRow() - Web APIs
return value no return value errors thrown if the number of the row to delete, specified by the parameter, is
greater or equal to the number of available rows, or if it is negative and not equal to the special index -1, representing the last row of the table, the exception index_size_err is thrown.
IntersectionObserver - Web APIs
the configuration cannot be changed once the intersectionobserver is created, so a given observer object is only useful for watching for specific changes in de
gree of visibility; however, you can watch multiple target elements with the same observer.
Timing element visibility with the Intersection Observer API - Web APIs
function loadrandomad(replacebox) { let ads = [ { bgcolor: "#cec", title: "eat
green beans", body: "make your mother proud—they're good for you!" }, { bgcolor: "aquamarine", title: "millionsoffreebooks.whatever", body: "read classic literature online free!" }, { bgcolor: "light
grey", title: "3.14 shades of gray: a novel", body: "love really does make the world go round..." }, { bgcolor: "#fee", titl...
Keyboard API - Web APIs
blue keys are present on all standard keyboards while
green keys are only available on some keyboards.
MediaDevices.ondevicechange - Web APIs
<ul class="devicelist" id="videolist"></ul> </div> <div id="log"></div> css content body { font: 14px "open sans", "arial", sans-serif; } video { margin-top: 20px; border: 1px solid black; } .button { cursor: pointer; width: 160px; border: 1px solid black; font-size: 16px; text-align: center; padding-top: 2px; padding-bottom: 4px; color: white; background-color: dark
green; } h2 { margin-bottom: 4px; } .left { float:left; width: 48%; margin-right: 2% } .right { float:right; width: 48%; margin-left: 2% } .devicelist { border: 1px solid black; list-style-type: none; margin-top: 2px; padding: 6px; } javascript content other code below is other code which, while needed to make this example work, isn'tt related directly to ondevicechange, ...
MediaSource.MediaSource() - Web APIs
example the following snippet is taken from a simple example written by nick desaulniers (view the full demo live, or download the source for further investigation.) var video = document.queryselector('video'); var asseturl = 'frag_bunny.mp4'; // need to be specific for blink regarding codecs // ./mp4info frag_bunny.mp4 |
grep codec var mimecodec = 'video/mp4; codecs="avc1.42e01e, mp4a.40.2"'; if ('mediasource' in window && mediasource.istypesupported(mimecodec)) { var mediasource = new mediasource; //console.log(mediasource.readystate); // closed video.src = url.createobjecturl(mediasource); mediasource.addeventlistener('sourceopen', sourceopen); } else { console.error('unsupported mime type or codec: ', m...
MediaSource.addSourceBuffer() - Web APIs
example the following snippet is from a simple example written by nick desaulniers (view the full demo live, or download the source for further investigation.) var asseturl = 'frag_bunny.mp4'; // need to be specific for blink regarding codecs // ./mp4info frag_bunny.mp4 |
grep codec var mimecodec = 'video/mp4; codecs="avc1.42e01e, mp4a.40.2"'; if ('mediasource' in window && mediasource.istypesupported(mimecodec)) { var mediasource = new mediasource; //console.log(mediasource.readystate); // closed video.src = url.createobjecturl(mediasource); mediasource.addeventlistener('sourceopen', sourceopen); } else { console.error('unsupported mime type or codec: ', m...
MediaSource.endOfStream() - Web APIs
their sourcebuffer.updating property is true.) example the following snippet is from a simple example written by nick desaulniers (view the full demo live, or download the source for further investigation.) var asseturl = 'frag_bunny.mp4'; // need to be specific for blink regarding codecs // ./mp4info frag_bunny.mp4 |
grep codec var mimecodec = 'video/mp4; codecs="avc1.42e01e, mp4a.40.2"'; if ('mediasource' in window && mediasource.istypesupported(mimecodec)) { var mediasource = new mediasource; //console.log(mediasource.readystate); // closed video.src = url.createobjecturl(mediasource); mediasource.addeventlistener('sourceopen', sourceopen); } else { console.error('unsupported mime type or codec: ', m...
MediaSource.isTypeSupported() - Web APIs
example the following snippet is from an example written by nick desaulniers (view the full demo live, or download the source for further investigation.) var asseturl = 'frag_bunny.mp4'; // need to be specific for blink regarding codecs // ./mp4info frag_bunny.mp4 |
grep codec var mimecodec = 'video/mp4; codecs="avc1.42e01e, mp4a.40.2"'; if ('mediasource' in window && mediasource.istypesupported(mimecodec)) { var mediasource = new mediasource; //console.log(mediasource.readystate); // closed video.src = url.createobjecturl(mediasource); mediasource.addeventlistener('sourceopen', sourceopen); } else { console.error('unsupported mime type or codec: ', m...
MediaSource.setLiveSeekableRange() - Web APIs
if the duration of the media source is positive infinity, then the timeranges object returned by the htmlmediaelement.seekable property will have a start timestamp no
greater than this value.
MediaSource - Web APIs
this example was written by nick desaulniers and can be viewed live here (you can also download the source for further investigation.) var video = document.queryselector('video'); var asseturl = 'frag_bunny.mp4'; // need to be specific for blink regarding codecs // ./mp4info frag_bunny.mp4 |
grep codec var mimecodec = 'video/mp4; codecs="avc1.42e01e, mp4a.40.2"'; if ('mediasource' in window && mediasource.istypesupported(mimecodec)) { var mediasource = new mediasource(); //console.log(mediasource.readystate); // closed video.src = url.createobjecturl(mediasource); mediasource.addeventlistener('sourceopen', sourceopen); } else { console.error('unsupported mime type or codec: ',...
Recording a media element - Web APIs
<div class="bottom"> <pre id="log"></pre> </div> css content body { font: 14px "open sans", "arial", sans-serif; } video { margin-top: 2px; border: 1px solid black; } .button { cursor: pointer; display: block; width: 160px; border: 1px solid black; font-size: 16px; text-align: center; padding-top: 2px; padding-bottom: 4px; color: white; background-color: dark
green; text-decoration: none; } h2 { margin-bottom: 4px; } .left { margin-right: 10px; float: left; width: 160px; padding: 0px; } .right { margin-left: 10px; float: left; width: 160px; padding: 0px; } .bottom { clear: both; padding-top: 10px; } javascript content now let's have a look at the javascript code; this is where the majority of the action happens, after all!
Using the Media Capabilities API - Web APIs
they will be a useful feature of the api once available, but there is a high probability of the display capabilities functionality changing a
great deal before browser implementations arrive.
MouseEvent.mozInputSource - Web APIs
this lets you, for example, determine whether a mouse event was generated by an actual mouse or by a touch event (which might affect the de
gree of accuracy with which you interpret the coordinates associated with the event).
MouseEvent - Web APIs
this lets you, for example, determine whether a mouse event was generated by an actual mouse or by a touch event (which might affect the de
gree of accuracy with which you interpret the coordinates associated with the event).
Navigator.vibrate() - Web APIs
if a vibration pattern is already in pro
gress when this method is called, the previous pattern is halted and the new one begins instead.
Online and offline events - Web APIs
oreend", "event: " + event.type + "; status: " + condition); } window.addeventlistener('online', updateonlinestatus); window.addeventlistener('offline', updateonlinestatus); }); a touch of css #status { position: fixed; width: 100%; font: bold 1em sans-serif; color: #fff; padding: 0.5em; } #log { padding: 2.5em 0.5em 0.5em; font: 1em sans-serif; } .online { background:
green; } .offline { background: red; } and the corresponding htmlxxx when mochitests for this are created, point to those instead and update this example -nickolay <div id="status"></div> <div id="log"></div> <p>this is a test</p> here's the live result notes if the api isn't implemented in the browser, you can use other signals to detect if you are offline including using service workers...
Node.isConnected - Web APIs
transition: 0.6s all; positions: absolute; bottom: 20px; left: 10px; z-index: 3 } `; // attach the created style element to the shadow dom shadow.appendchild(style); console.log(style.isconnected); // returns true polyfill node.isconnected can be polyfilled with the following code for ie10 and edgehtml: /* * node.isconnected polyfill for ie and edgehtml * 2020-02-04 * * by eli
grey, https://eli
grey.com * public domain.
Notification.requestPermission() - Web APIs
this is not only best practice — you should not be spamming users with notifications they didn't a
gree to — but going forward browsers will explicitly disallow notifications not triggered in response to a user gesture.
Notification - Web APIs
this is not only best practice — you should not be spamming users with notifications they didn't a
gree to — but going forward browsers will explicitly disallow notifications not triggered in response to a user gesture.
Notifications API - Web APIs
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 a
gree to — but going forward browsers will explicitly disallow notifications not triggered in response to a user gesture.
PaintWorklet.registerPaint - Web APIs
/* checkboardworklet.js */ class checkerboardpainter { paint(ctx, geom, properties) { // use `ctx` as if it was a normal canvas const colors = ['red', '
green', 'blue']; const size = 32; for(let y = 0; y < geom.height/size; y++) { for(let x = 0; x < geom.width/size; x++) { const color = colors[(x + y) % colors.length]; ctx.beginpath(); ctx.fillstyle = color; ctx.rect(x * size, y * size, size, size); ctx.fill(); } } } } // register our class under a specific name registerpaint('checker...
PaintWorklet - Web APIs
class checkerboardpainter { paint(ctx, geom, properties) { // use `ctx` as if it was a normal canvas const colors = ['red', '
green', 'blue']; const size = 32; for(let y = 0; y < geom.height/size; y++) { for(let x = 0; x < geom.width/size; x++) { const color = colors[(x + y) % colors.length]; ctx.beginpath(); ctx.fillstyle = color; ctx.rect(x * size, y * size, size, size); ctx.fill(); } } } } // register our class under a specific name registerpaint('checker...
PaymentAddress.addressLine - Web APIs
for example, the addressline array for the mozilla space in london would have the following entries: example showing addressline entries for an address in london index addressline[] value 0 metal box factory 1 suite 441, 4th floor 2 30
great guildford street these, combined with additional values for other properties of the paymentaddress, would represent the full address, which is: mozilla metal box factory suite 441, 4th floor 30
great guildford street london se1 0hs united kingdom specifications specification status comment payment request apithe definition of 'paymentaddress.addressline' i...
Response() - Web APIs
examples in our fetch response example (see fetch response live) we create a new response object using the constructor, passing it a new blob as a body, and an init object containing a custom status and statustext: var myblob = new blob(); var init = { "status" : 200 , "statustext" : "supersmashing
great!" }; var myresponse = new response(myblob,init); specifications specification status comment fetchthe definition of 'response()' in that specification.
SVGAngle - Web APIs
svg_angletype_unspecified a unitless <number> interpreted as a value in de
grees.
SVGGeometryElement.isPointInFill() - Web APIs
example svg <svg viewbox="0 0 100 100" width="150" height="150" xmlns="http://www.w3.org/2000/svg"> <circle id="circle" cx="50" cy="50" r="45" fill="white" stroke="black" stroke-width="10"/> <circle cx="10" cy="10" r="5" fill="sea
green"/> <circle cx="40" cy="30" r="5" fill="sea
green"/> </svg> javascript var circle = document.getelementbyid('circle'); // point not in circle console.log('point at 10,10:', circle.ispointinfill(new dompoint(10, 10))); // point in circle console.log('point at 40,30:', circle.ispointinfill(new dompoint(40, 30))); result specifications specification status comment ...
SVGGeometryElement.isPointInStroke() - Web APIs
example svg <svg viewbox="0 0 100 100" width="150" height="150" xmlns="http://www.w3.org/2000/svg"> <circle id="circle" cx="50" cy="50" r="45" fill="white" stroke="black" stroke-width="10"/> <circle cx="10" cy="10" r="5" fill="sea
green"/> <circle cx="40" cy="30" r="5" fill="sea
green"/> <circle cx="83" cy="17" r="5" fill="sea
green"/> </svg> javascript var circle = document.getelementbyid('circle'); // point not in circle console.log('point at 10,10:', circle.ispointinstroke(new dompoint(10, 10))); // point in circle but not stroke console.log('point at 40,30:', circle.ispointinstroke(new dompoint(40, 30))); // point i...
SVGLength - Web APIs
ueasstring); // convert x = 20pt to inches and read out in pixel and inch units val.converttospecifiedunits(svglength.svg_lengthtype_in); console.log("value: " + val.value + ", valueinspecifiedunits " + val.unittype + ": " + val.valueinspecifiedunits + ", valueasstring: " + val.valueasstring); } ]]></script> <rect id="myrect" x="1cm" y="1cm" fill="
green" stroke="black" stroke-width="1" width="1cm" height="1cm" /> </svg> results on a desktop monitor (pixel units will be dpi-dependent): value: 37.7952766418457, valueinspecifiedunits: 6: 1, valueasstring: 1cm value: 26.66666603088379, valueinspecifiedunits 9: 20, valueasstring: 20pt value: 26.66666603088379, valueinspecifiedunits 8: 0.277777761220932, valueasstring: 0.277778in cons...
Using the Screen Capture API - Web APIs
#video { border: 1px solid #999; width: 98%; max-width: 860px; } .error { color: red; } .warn { color: orange; } .info { color: dark
green; } result the final product looks like this.
Sensor APIs - Web APIs
alternatively, the absoluteorientationsensor interface provides information that is algorithmically a
gregated from two or more device sensors.
ServiceWorkerGlobalScope - Web APIs
methods serviceworkerglobalscope.skipwaiting() allows the current service worker registration to pro
gress from waiting to active state while service worker clients are using it.
SharedWorker() - Web APIs
note: there is disa
greement among browser manufacturers about whether a data uri is of the same origin or not.
SourceBuffer.remove() - Web APIs
exceptions exception explanation invalidaccesserror the mediasource.duration property is equal to nan, the start parameter is negative or
greater than mediasource.duration, or the end parameter is less than or equal to start or equal to nan.
SourceBuffer.updating - Web APIs
whether an sourcebuffer.appendbuffer(), sourcebuffer.appendstream(), or sourcebuffer.remove() operation is currently in pro
gress.
SpeechGrammar.SpeechGrammar() - Web APIs
examples var grammar = '#jsgf v1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray |
green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar, 1); rec...
SpeechGrammar.src - Web APIs
examples var grammar = '#jsgf v1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray |
green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar,...
SpeechGrammar.weight - Web APIs
examples var grammar = '#jsgf v1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray |
green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar,...
SpeechGrammar - Web APIs
examples var grammar = '#jsgf v1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray |
green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar,...
SpeechGrammarList.SpeechGrammarList() - Web APIs
var grammar = '#jsgf v1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray |
green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar,...
SpeechGrammarList.addFromString() - Web APIs
examples var grammar = '#jsgf v1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray |
green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar,...
SpeechGrammarList.addFromURI() - Web APIs
examples var grammar = '#jsgf v1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray |
green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar,...
SpeechGrammarList.item() - Web APIs
examples var grammar = '#jsgf v1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray |
green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar,...
SpeechGrammarList.length - Web APIs
examples var grammar = '#jsgf v1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray |
green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar,...
SpeechGrammarList - Web APIs
var grammar = '#jsgf v1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray |
green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar,...
SpeechRecognition() - Web APIs
var grammar = '#jsgf v1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray |
green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar,...
SpeechRecognition.abort() - Web APIs
examples var grammar = '#jsgf v1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray |
green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar,...
SpeechRecognition.continuous - Web APIs
var grammar = '#jsgf v1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray |
green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar,...
SpeechRecognition.grammars - Web APIs
var grammar = '#jsgf v1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray |
green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar,...
SpeechRecognition.interimResults - Web APIs
var grammar = '#jsgf v1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray |
green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar,...
SpeechRecognition.lang - Web APIs
var grammar = '#jsgf v1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray |
green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar,...
SpeechRecognition.maxAlternatives - Web APIs
var grammar = '#jsgf v1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray |
green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar,...
SpeechRecognition.onnomatch - Web APIs
the onnomatch property of the speechrecognition interface represents an event handler that will run when the speech recognition service returns a final result with no significant recognition (when the nomatch event fires.) this may involve some de
gree of recognition, which doesn't meet or exceed the confidence threshold.
SpeechRecognition.start() - Web APIs
examples var grammar = '#jsgf v1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray |
green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar,...
SpeechRecognition.stop() - Web APIs
examples var grammar = '#jsgf v1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray |
green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar,...
StorageEstimate - Web APIs
all included members will have a usage
greater than 0 and any storage system with 0 usage will be excluded from the dictionary.
Storage Access API - Web APIs
as a consequence, users who wish to continue to interact with embedded content are forced to
greatly relax their blocking policy for resources loaded from all embedded origins and possibly across all websites.
Using readable streams - Web APIs
// fetch the original image fetch('png-logo.png') // retrieve its body as readablestream .then(response => response.body) // create a gray-scaled png stream out of the original .then(rs => lo
greadablestream('fetch response stream', rs)) .then(body => body.pipethrough(new pngtransformstream())) .then(rs => lo
greadablestream('png chunk stream', rs)) summary that explains the basics of “default” readable streams.
Streams API - Web APIs
examples from other developers: pro
gress indicators with streams, service workers, & fetch.
Text.splitText() - Web APIs
exceptions thrown a domexception with a value of index_size_err is thrown if the specified offset is negative or is
greater than the number of 16-bit units in the node's text; a domexception with a value of no_modification_allowed_err is thrown if the node is read-only.
TextDecoder() - Web APIs
iso-8859-4' "csisolatincyrillic", "cyrillic", "iso-8859-5", "iso-ir-144", "iso88595", "iso_8859-5", "iso_8859-5:1988" 'iso-8859-5' "arabic", "asmo-708", "csiso88596e", "csiso88596i", "csisolatinarabic", "ecma-114", "iso-8859-6", "iso-8859-6-e", "iso-8859-6-i", "iso-ir-127", "iso8859-6", "iso88596", "iso_8859-6", "iso_8859-6:1987" 'iso-8859-6' "csisolatin
greek", "ecma-118", "elot_928", "
greek", "
greek8", "iso-8859-7", "iso-ir-126", "iso8859-7", "iso88597", "iso_8859-7", "iso_8859-7:1987", "sun_eu_
greek" 'iso-8859-7' "csiso88598e", "csisolatinhebrew", "hebrew", "iso-8859-8", "iso-8859-8-e", "iso-ir-138", "iso8859-8", "iso88598", "iso_8859-8", "iso_8859-8:1988", "visual" 'iso-8859-8' "csiso88598i", "iso-8859-8-i", "logic...
TextDecoder - Web APIs
textdecoder.prototype.encodin
gread only is a domstring containing the name of the decoder, that is a string describing the method the textdecoder will use.
Touch.radiusX - Web APIs
the touch.rotationangle is the angle (in de
grees) that the ellipse described by radiusx and radiusy is rotated clockwise about its center.
Touch - Web APIs
touch.rotationangle read only returns the angle (in de
grees) that the ellipse described by radiusx and radiusy must be rotated, clockwise, to most accurately cover the area of contact between the user and the surface.
TouchEvent - Web APIs
touchevent.rotation read only change in rotation (in de
grees) since the event's beginning.
Multi-touch interaction - Web APIs
var diff1 = math.abs(tpcache[point1].clientx - ev.targettouches[0].clientx); var diff2 = math.abs(tpcache[point2].clientx - ev.targettouches[1].clientx); // this threshold is device dependent as well as application specific var pinch_threshhold = ev.target.clientwidth / 10; if (diff1 >= pinch_threshhold && diff2 >= pinch_threshhold) ev.target.style.background = "
green"; } else { // empty tpcache tpcache = new array(); } } } touch start handler the touchstart event handler caches touch points to support 2-touch gestures.
VideoPlaybackQuality.corruptedVideoFrames - Web APIs
example this example determines the percentage of frames which have been corrupted, and if the value is
greater than 5%, calls a funciton called downgradevideo() that would be implemented to switch to a different video that might tax the network less.
WaveShaperNode.curve - Web APIs
the mid-element of the array is applied to any signal value of 0, the first one to signal values of -1, and the last to signal values of 1; values lower than -1 or
greater than 1 are treated like -1 or 1 respectively.
WebGL2RenderingContext.getActiveUniforms() - Web APIs
examples var uniformindices = gl.getuniformindices(program, ['ubored', 'ubo
green', 'uboblue']); var uniformoffsets = gl.getactiveuniforms(program, uniformindices, gl.uniform_offset); specifications specification status comment webgl 2.0the definition of 'getactiveuniforms' in that specification.
WebGLRenderingContext.compressedTexImage[23]D() - Web APIs
when using the ext_texture_compression_bptc extension: ext.compressed_rgba_bptc_unorm_ext ext.compressed_srgb_alpha_bptc_unorm_ext ext.compressed_rgb_bptc_signed_float_ext ext.compressed_rgb_bptc_unsigned_float_ext when using the ext_texture_compression_rgtc extension: ext.compressed_red_rgtc1_ext ext.compressed_signed_red_rgtc1_ext ext.compressed_red_
green_rgtc2_ext ext.compressed_signed_red_
green_rgtc2_ext width a glsizei specifying the width of the texture.
WebGLRenderingContext.compressedTexSubImage2D() - Web APIs
when using the ext_texture_compression_bptc extension: ext.compressed_rgba_bptc_unorm_ext ext.compressed_srgb_alpha_bptc_unorm_ext ext.compressed_rgb_bptc_signed_float_ext ext.compressed_rgb_bptc_unsigned_float_ext when using the ext_texture_compression_rgtc extension: ext.compressed_red_rgtc1_ext ext.compressed_signed_red_rgtc1_ext ext.compressed_red_
green_rgtc2_ext ext.compressed_signed_red_
green_rgtc2_ext imagesize a glsizei specifying the number of bytes to read from the buffer bound to gl.pixel_unpack_buffer.
WebGLRenderingContext.depthFunc() - Web APIs
possible values are: gl.never (never pass) gl.less (pass if the incoming value is less than the depth buffer value) gl.equal (pass if the incoming value equals the the depth buffer value) gl.lequal (pass if the incoming value is less than or equal to the depth buffer value) gl.
greater (pass if the incoming value is
greater than the depth buffer value) gl.notequal (pass if the incoming value is not equal to the depth buffer value) gl.gequal (pass if the incoming value is
greater than or equal to the depth buffer value) gl.always (always pass) return value none.
WebGLRenderingContext.enableVertexAttribArray() - Web APIs
webglrenderingcontext.invalid_value the specified index is invalid; that is, it's
greater than or equal to the maximum number of entries permitted in the context's vertex attribute list, as indicated by the value of webglrenderingcontext.max_vertex_attribs.
WebGLRenderingContext.getParameter() - Web APIs
gl.
green_bits glint gl.implementation_color_read_format glenum gl.implementation_color_read_type glenum gl.line_width glfloat gl.max_combined_texture_image_units glint gl.max_cube_map_texture_size glint gl.max_fragment_uniform_vectors glint gl.max_renderbuffer_size glint gl.max...
WebGLRenderingContext.makeXRCompatible() - Web APIs
html the html for the buttons looks lke this: <button class="
green button" type="button">start game</button> <button class="blue button use-webxr" type="button">start game (vr mode)</button> the first button starts the game, continuing to present the game onscreen as usual.
Data in WebGL - Web APIs
//init colors var vertexcolors = [ vec4( 0.0, 0.0, 0.0, 1.0 ), // black vec4( 1.0, 0.0, 0.0, 1.0 ), // red vec4( 1.0, 1.0, 0.0, 1.0 ), // yellow vec4( 0.0, 1.0, 0.0, 1.0 ), //
green vec4( 0.0, 0.0, 0.0, 1.0 ), // black vec4( 1.0, 0.0, 0.0, 1.0 ), // red vec4( 1.0, 1.0, 0.0, 1.0 ), // yellow vec4( 0.0, 1.0, 0.0, 1.0 ), //
green ]; var cbuffer = gl.createbuffer(); //continued //create buffer to store colors and reference it to "vcolor" which is in glsl gl.bindbuffer( gl.array_buffer, cbuffer ); gl.bufferdata( gl.array_b...
Adding 2D content to a WebGL context - Web APIs
// our field of view is 45 de
grees, with a width/height // ratio that matches the display size of the canvas // and we only want to see objects between 0.1 units // and 100 units away from the camera.
Creating 3D objects using WebGL - Web APIs
const facecolors = [ [1.0, 1.0, 1.0, 1.0], // front face: white [1.0, 0.0, 0.0, 1.0], // back face: red [0.0, 1.0, 0.0, 1.0], // top face:
green [0.0, 0.0, 1.0, 1.0], // bottom face: blue [1.0, 1.0, 0.0, 1.0], // right face: yellow [1.0, 0.0, 1.0, 1.0], // left face: purple ]; // convert the array of colors into a table for all the vertices.
A simple RTCDataChannel sample - Web APIs
note: in a real-world scenario in which the two peers aren't running in the same context, the process is a bit more involved; each side provides, one at a time, a suggested way to connect (for example, udp, udp with a relay, tcp, etc.) by calling rtcpeerconnection.addicecandidate(), and they go back and forth until a
greement is reached.
Keyframe Formats - Web APIs
element.animate({ opacity: [ 0, 1 ], // offset: 0, 1 backgroundcolor: [ "red", "yellow", "
green" ], // offset: 0, 0.5, 1 }, 2000); the special keys offset, easing, and composite (described below) may be specified alongside the property values.
Using the Web Animations API - Web APIs
which vignette players are presented with depends on how far along alice was in her animation, whether she
grew too big and can't get in the tiny door anymore or too small and cannot reach the key to open the door.
Background audio processing using AudioWorklet - Web APIs
it's worth noting that because audio processing can often involve substantial computation, your processor may benefit
greatly from being built using webassembly, which brings near-native or fully native performance to web apps.
Web Locks API - Web APIs
}); deadlocks a deadlock occurs when a process can no longer make pro
gress because each part is waiting on a request that cannot be satisfied.
window.cancelAnimationFrame() - Web APIs
var myreq; function step(timestamp) { var pro
gress = timestamp - start; d.style.left = math.min(pro
gress / 10, 200) + 'px'; if (pro
gress < 2000) { // it's important to update the requestid each time you're calling requestanimationframe myreq = requestanimationframe(step); } } myreq = requestanimationframe(step); // the cancelation uses the last requestid cancelanimationframe(myreq); specifications specification stat...
Window: deviceorientation event - Web APIs
bubbles no cancelable no interface deviceorientationevent event handler property window.ondeviceorientation examples if (window.deviceorientationevent) { window.addeventlistener("deviceorientation", function(event) { // alpha: rotation around z-axis var rotatede
grees = event.alpha; // gamma: left to right var lefttoright = event.gamma; // beta: front back motion var fronttoback = event.beta; handleorientationevent(fronttoback, lefttoright, rotatede
grees); }, true); } var handleorientationevent = function(fronttoback, lefttoright, rotatede
grees) { // do something amazing }; specifications specific...
Window.onappinstalled - Web APIs
the onappinstalled attribute of the window object serves as an event handler for the appinstalled event, which is dispatched once the web application is successfully installed as a pro
gressive web app.
Window.orientation - Web APIs
summary returns the orientation in de
grees (in 90-de
gree increments) of the viewport relative to the device's natural orientation.
window.postMessage() - Web APIs
for idn host names only, the value of the origin property is not consistently unicode or punycode; for
greatest compatibility check for both the idn and punycode values when using this property if you expect messages from idn sites.
Window.requestAnimationFrame() - Web APIs
be sure to always use the first argument (or some other method for getting the current time) to calculate how much the animation will pro
gress in a frame, otherwise the animation will run faster on high refresh rate screens.
Worker() - Web APIs
note: that there is a disa
greement among browser manufacturers about whether a data uri is of the same origin or not.
XMLHttpRequest.readyState - Web APIs
example var xhr = new xmlhttprequest(); console.log('unsent', xhr.readystate); // readystate will be 0 xhr.open('get', '/api', true); console.log('opened', xhr.readystate); // readystate will be 1 xhr.onpro
gress = function () { console.log('loading', xhr.readystate); // readystate will be 3 }; xhr.onload = function () { console.log('done', xhr.readystate); // readystate will be 4 }; xhr.send(null); specifications specification status comment xmlhttprequest living standard whatwg living standard ...
XMLHttpRequest.status - Web APIs
example var xhr = new xmlhttprequest(); console.log('unsent: ', xhr.status); xhr.open('get', '/server'); console.log('opened: ', xhr.status); xhr.onpro
gress = function () { console.log('loading: ', xhr.status); }; xhr.onload = function () { console.log('done: ', xhr.status); }; xhr.send(); /** * outputs the following: * * unsent: 0 * opened: 0 * loading: 200 * done: 200 */ specifications specification status comment xmlhttprequest living standard whatwg living standard ...
XMLHttpRequest.statusText - Web APIs
example var xhr = new xmlhttprequest(); console.log('0 unsent', xhr.statustext); xhr.open('get', '/server', true); console.log('1 opened', xhr.statustext); xhr.onpro
gress = function () { console.log('3 loading', xhr.statustext); }; xhr.onload = function () { console.log('4 done', xhr.statustext); }; xhr.send(null); /** * outputs the following: * * 0 unsent * 1 opened * 3 loading ok * 4 done ok */ specifications specification status comment xmlhttprequest living standard whatwg living standard ...
XMLHttpRequestEventTarget - Web APIs
xmlhttprequesteventtarget.onpro
gress contains the function that is called periodically with information about the pro
gress of the request and the pro
gress event is received by this object.
XRHandedness - Web APIs
pdateinputsources(session, frame, refspace) { for (let source of session.inputsources) { if (source.gripspace) { let grippose = frame.getpose(source.gripspace, refspace); if (grippose) { myrenderhandobject(grippose, inputsource.handedness); } } } } this function, which would be called every animation frame (or possibly just periodically, depending on the de
gree of smoothness required and any performance constraints), scans the list of input sources looking for any which have a gripspace which isn't null.
XRInputSource.handedness - Web APIs
pdateinputsources(session, frame, refspace) { for (let source of session.inputsources) { if (source.gripspace) { let grippose = frame.getpose(source.gripspace, refspace); if (grippose) { myrenderhandobject(grippose, inputsource.handedness); } } } } this function, which would be called every animation frame (or possibly just periodically, depending on the de
gree of smoothness required and any performance constraints), scans the list of input sources looking for any which have a gripspace which isn't null.
XRInputSourceArray.forEach() - Web APIs
the xrinputsourcearray method foreach() executes the specified callback once for each input source in the array, starting at index 0 and pro
gressing until the end of the list.
XRPose - Web APIs
xrpose.emulatedposition read only a boolean value which is false if the position and orientation given by transform is obtained directly from a full six de
gree of freedom (6dof) xr device (that is, a device which tracks not only the pitch, yaw, and roll of the head but also the forward, backward, and side-to-side motion of the viewer).
XRReferenceSpace - Web APIs
for devices with six de
grees of freedom (6dof) tracking, the local reference space tries to keep the origin stable relative to the environment.
XRReferenceSpaceType - Web APIs
for devices with six de
grees of freedom (6dof) tracking, the local reference space tries to keep the origin stable relative to the environment.
XRView.eye - Web APIs
gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height); renderscene(gl, view); } } for each of the views, the value of eye is checked and if it's either left or right, we check to see if the body.lefteye.injured or body.righteye.injured property is true; if so, we call a function updateinjury() on that eye to do things such as allow a bit of healing to occur, track the pro
gress of a poison effect, or the like, as appropriate for the game's needs.
XRViewport.y - Web APIs
note: although other web apis typically consider the y axis to begin at the top and grow larger pro
gressing downward, webgl reverses this, with y growing larger as it goes upward on the screen.
Using the link role - Accessibility
opening a page using the open() method counts as being a popup, and certain browsers may issue a warning when you try to activate it, or make you explicitly a
gree to allowing popups form the domain it exists on.
Using the log role - Accessibility
to have announcements made as soon as possible and where the user may be interrupted, aria-live="assertive" can be set for more ag
gressive updates.
Using ARIA: Roles, states, and properties - Accessibility
roles widget roles button checkbox gridcell link menuitem menuitemcheckbox menuitemradio option pro
gressbar radio scrollbar searchbox separator (when focusable) slider spinbutton switch tab tabpanel textbox treeitem composite roles the techniques below describe each composite role as well as their required and optional child roles.
ARIA: cell role - Accessibility
if the rows that are visible are contiguous, and there are no cells with a colspan or rowspan
greater than one, this property can be added to the parent rows instead of all the rows' cells.
ARIA: feed role - Accessibility
the feed pattern enables reliable assistive technology reading mode interaction by establishing the following interoperability a
greement 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.
WAI-ARIA Roles - Accessibility
alertdialog banner combobox command columnheader (estelle) complementary composite definition directory feed gridcell (eric e) group input landmark link - old page listbox log - old page marquee math menu menubar menuitem menuitemcheckbox menuitemradio none note option presentation pro
gressbar - old page radio - old page radiogroup range region roletype rowheader(estelle) scrollbar searchbox section sectionhead select separator slider - old page spinbutton status - old page structure tab tablist (michiel) tabpanel (michiel) term timer toolbar tooltip tree treegrid treeitem widget window ...
::-moz-range-thumb - CSS: Cascading Style Sheets
syntax ::-moz-range-thumb examples html <input type="range" min="0" max="100" step="5" value="50"/> css input[type=range]::-moz-range-thumb { background-color:
green; } result a pro
gress bar using this style might look something like this: specifications not part of any standard.
::-moz-range-track - CSS: Cascading Style Sheets
syntax ::-moz-range-track examples html <input type="range" min="0" max="100" step="5" value="50"/> css input[type=range]::-moz-range-track { background-color:
green; } result a pro
gress bar using this style might look something like this: specifications not part of any standard.
::-webkit-file-upload-button - CSS: Cascading Style Sheets
syntax selector::-webkit-file-upload-button examples html <form> <label for="fileupload">upload file</label><br> <input type="file" id="fileupload"> </form> css input, label { display: block; } input[type=file]::-webkit-file-upload-button { border: 1px solid
grey; background: #fffaaa; } below is the example for you to try.
::after (:after) - CSS: Cascading Style Sheets
html <p class="boring-text">here is some plain old boring text.</p> <p>here is some normal text that is neither boring nor exciting.</p> <p class="exciting-text">contributing to mdn is easy and fun.</p> css .exciting-text::after { content: " <- exciting!"; color:
green; } .boring-text::after { content: " <- boring"; color: red; } result decorative example we can style text or images in the content property almost any way we want.
::first-letter (:first-letter) - CSS: Cascading Style Sheets
stet clita kasd guber
gren, no sea takimata sanctus est.</p> <p>duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat.</p> css p { width: 500px; line-height: 1.5; } h2 + p::first-letter { color: white; background-color: black; border-radius: 2px; box-shadow: 3px 3px 0 red; font-size: 250%; padding: 6px 3px; margin-right: 6px; float: left; } result effect on spec...
:any-link - CSS: Cascading Style Sheets
/* selects any element that would be matched by :link or :visited */ :any-link { color:
green; } syntax :any-link examples html <a href="https://example.com">external link</a><br> <a href="#">internal target link</a><br> <a>placeholder link (won't get styled)</a> css a:any-link { border: 1px solid blue; color: orange; } /* webkit browsers */ a:-webkit-any-link { border: 1px solid blue; color: orange; } result specifications specification status comment...
:enabled - CSS: Cascading Style Sheets
/* selects any enabled <input> */ input:enabled { color: blue; } syntax :enabled examples the following example makes the color of text and button <input>s
green when enabled, and gray when disabled.
:focus-visible - CSS: Cascading Style Sheets
<custom-button tabindex="0" role="button">click me</custom-button> custom-button { display: inline-block; margin: 10px; } custom-button:focus { /* provide a fallback style for browsers that don't support :focus-visible */ outline: none; background: light
grey; } custom-button:focus:not(:focus-visible) { /* remove the focus indicator on mouse-focus for browsers that do support :focus-visible */ background: transparent; } custom-button:focus-visible { /* draw a very noticeable focus style for keyboard-focus on browsers that do support :focus-visible */ outline: 4px dashed darkorange; background: transparent; } polyfill yo...
:fullscreen - CSS: Cascading Style Sheets
html the page's html looks like this: <h1>mdn web docs demo: :fullscreen pseudo-class</h1> <p>this demo uses the <code>:fullscreen</code> pseudo-class to automatically change the style of a button used to toggle full-screen mode on and off, entirely using css.</p> <button id="fs-toggle">toggle fullscreen</button> the <button> with the id "fs-toggle" will change between pale red and pale
green depending on whether or not the document is in full-screen mode.
:is() (:matches(), :any()) - CSS: Cascading Style Sheets
der, main, footer) p'); } catch(e) { console.log('your browser doesn\'t support :is(), :matches(), or :any()'); } } } } matcheditems.foreach(applyhandler); function applyhandler(elem) { elem.addeventlistener('click', function(e) { alert('this paragraph is inside a ' + e.target.parentnode.nodename); }); } simplifying list selectors the :is() pseudo-class can
greatly simplify your css selectors.
:link - CSS: Cascading Style Sheets
html <a href="#ordinary-target">this is an ordinary link.</a><br> <a href="">you've already visited this link.</a><br> <a>placeholder link (won't get styled)</a> css a:link { background-color: gold; color:
green; } result specifications specification status comment html living standardthe definition of ':link' in that specification.
:not() - CSS: Cascading Style Sheets
examples html <p>i am a paragraph.</p> <p class="fancy">i am so very fancy!</p> <div>i am not a paragraph.</div> css .fancy { text-shadow: 2px 2px 3px gold; } /* <p> elements that are not in the class `.fancy` */ p:not(.fancy) { color:
green; } /* elements that are not <p> elements */ body :not(p) { text-decoration: underline; } /* elements that are not <div> and not <span> elements */ body :not(div):not(span) { font-weight: bold; } /* elements that are not `.crazy` or `.fancy` */ /* note that this syntax is not well supported yet.
:nth-child() - CSS: Cascading Style Sheets
the <code><em></code> is completely skipped over and ignored.</p> <div class="third"> <span>span!</span> <span>span</span> <em>this is an `em`.</em> <span>span!</span> <span>span</span> <span>span!</span> <span>span</span> <span>span!</span> </div> css html { font-family: sans-serif; } span, div em { padding: 5px; border: 1px solid
green; display: inline-block; margin-bottom: 3px; } .first span:nth-child(2n+1), .second span:nth-child(2n+1), .third span:nth-of-type(2n+1) { background-color: lime; } result specifications specification status comment selectors level 4the definition of ':nth-child' in that specification.
:target - CSS: Cascading Style Sheets
isn't that delightful?</p> css p:target { background-color: gold; } /* add a pseudo-element inside the target element */ p:target::before { font: 70% sans-serif; content: "►"; color: lime
green; margin-right: .25em; } /* style italic elements within the target element */ p:target i { color: red; } result pure-css lightbox you can use the :target pseudo-class to create a lightbox without using any javascript.
:visited - CSS: Cascading Style Sheets
/* selects any <a> that has been visited */ a:visited { color:
green; } styles defined by the :visited pseudo-class will be overridden by any subsequent link-related pseudo-class (:link, :hover, or :active) that has at least equal specificity.
font-style - CSS: Cascading Style Sheets
mal 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 following 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 de
grees.
font-weight - CSS: Cascading Style Sheets
however some fonts, called variable fonts, can support a range of weights with more or less fine granularity, and this can give the designer a much closer de
gree of control over the chosen weight.
forced-colors - CSS: Cascading Style Sheets
html <div class="colors">weird color box</div> css .colors { background-color: red; color:
grey; } @media (forced-colors: active) { .colors { background-color: white; color: black; } } result specifications specification status comment media queries level 5the definition of 'forced-colors' in that specification.
@media - CSS: Cascading Style Sheets
security because media queries provide insights into the capabilities—and by extension, the features and design—of the device the user is working with, there is the potential that they could be abused to construct a "fingerprint" which identifies the device, or at least categorizes it to some de
gree of detail that may be undesirable to users.
@supports - CSS: Cascading Style Sheets
tive: 10px) or (-o-perspective: 10px)) { … /* css applied when 3d transforms, prefixed or not, are supported */ } testing for the non-support of a specific css property @supports not ((text-align-last: justify) or (-moz-text-align-last: justify)) { … /* css to provide fallback alternative for text-align-last: justify */ } testing for the support of custom properties @supports (--foo:
green) { body { color: var(--varname); } } testing for the support of a selector (eg.
CSS Animations tips and tricks - CSS: Cascading Style Sheets
.runbutton { cursor: pointer; width: 300px; border: 1px solid black; font-size: 16px; text-align: center; margin-top: 12px; padding-top: 2px; padding-bottom: 4px; color: white; background-color: dark
green; font: 14px "open sans", "arial", sans-serif; } @keyframes colorchange { 0% { background: yellow } 100% { background: blue } } .box { width: 100px; height: 100px; border: 1px solid black; } .changing { animation: colorchange 2s; } there are two classes here.
Resizing background images with background-size - CSS: Cascading Style Sheets
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; overflow: 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.
CSS Display - CSS: Cascading Style Sheets
out methods backwards compatibility of flexbox typical use cases of flexbox display: grid basic concepts of grid layout relationship to other layout methods line-based placement grid template areas layout using named grid lines auto-placement in grid layout box alignment in grid layout grids, logical values and writing modes css grid layout and accessibility css grid layout and pro
gressive enhancement realizing common layouts using grids specifications specification status comment css display module level 3the definition of 'display' in that specification.
Privacy and the :visited selector - CSS: Cascading Style Sheets
*/ } :visited { outline-color: orange; /* visited links have an orange outline */ background-color:
green; /* visited links have a
green background */ color: yellow; /* visited links have yellow colored text */ } impact on web developers overall, these restrictions shouldn't affect web developers too significantly.
Cubic Bezier Generator - CSS: Cascading Style Sheets
ineto(cx(1), cy(1)); ctx.stroke(); ctx.closepath(); ctx.beginpath(); ctx.moveto(cx(x2), cy(y2)); ctx.arc(cx(x2), cy(y2), radius, 0, 2 * math.pi); ctx.stroke(); ctx.fill(); ctx.closepath(); // draw the p1(1,1) point (with dashed hints) ctx.beginpath(); ctx.moveto(cx(1), cy(1)); ctx.strokestyle = 'light
grey'; ctx.lineto(cx(0), cy(1)); ctx.moveto(cx(1), cy(1)); ctx.lineto(cx(1), cy(0)); ctx.stroke(); ctx.closepath(); ctx.beginpath(); ctx.strokestyle = "black"; ctx.fillstyle = "black"; ctx.arc(cx(1), cy(1), radius, 0, 2 * math.pi); ctx.fill(); ctx.stroke(); ctx.closepath(); // draw the p0(0,0) p...
background-attachment - CSS: Cascading Style Sheets
however, on the second time round, she came upon a low curtain she had not noticed before, and behind it was a little door about fifteen inches high: she tried the little golden key in the lock, and to her
great delight it fitted!
background - CSS: Cascading Style Sheets
constituent properties this property is a shorthand for the following css properties: background-attachment background-clip background-color background-image background-origin background-position background-repeat background-size syntax /* using a <background-color> */ background:
green; /* using a <bg-image> and <repeat-style> */ background: url("test.jpg") repeat-y; /* using a <box> and <background-color> */ background: border-box red; /* a single image, centered and scaled */ background: no-repeat center/80% url("../img/image.png"); the background property is specified as one or more background layers, separated by commas.
border-collapse - CSS: Cascading Style Sheets
lapse; } .separate { border-collapse: separate; } table { display: inline-table; margin: 1em; border: dashed 5px; } table th, table td { border: solid 3px; } .fx { border-color: orange blue; } .gk { border-color: black red; } .ed { border-color: blue gold; } .tr { border-color: aqua; } .sa { border-color: silver blue; } .wk { border-color: gold blue; } .ch { border-color: red yellow
green blue; } .bk { border-color: navy blue teal aqua; } .op { border-color: red; } result specifications specification status comment css level 2 (revision 1)the definition of 'border-collapse' in that specification.
border-color - CSS: Cascading Style Sheets
constituent properties this property is a shorthand for the following css properties: border-bottom-color border-left-color border-right-color border-top-color syntax /* <color> values */ border-color: red; /* horizontal | vertical */ border-color: red #f015ca; /* top | vertical | bottom */ border-color: red rgb(240,30,50,.7)
green; /* top | right | bottom | left */ border-color: red yellow
green blue; /* global values */ border-color: inherit; border-color: initial; border-color: unset; the border-color property may be specified using one, two, three, or four values.
border-inline-start - CSS: Cascading Style Sheets
constituent properties this property is a shorthand for the following css properties: border-inline-start-color border-inline-start-style border-inline-start-width syntax border-inline-start: 1px; border-inline-start: 2px dotted; border-inline-start: medium dashed
green; the physical border to which border-inline-start maps depends on the element's writing mode, directionality, and text orientation.
border-width - CSS: Cascading Style Sheets
hree different values: 0.3em top, 9px bottom, and zero width right and left</p> <p id="fourval"> four different values: "thin" top, "medium" right, "thick" bottom, and 1em left</p> css #sval { border: ridge #ccc; border-width: 6px; } #bival { border: solid red; border-width: 2px 10px; } #treval { border: dotted orange; border-width: 0.3em 0 9px; } #fourval { border: solid light
green; border-width: thin medium thick 1em; } p { width: auto; margin: 0.25em; padding: 0.25em; } result specifications specification status comment css backgrounds and borders module level 3the definition of 'border-width' in that specification.
border - CSS: Cascading Style Sheets
constituent properties this property is a shorthand for the following css properties: border-color border-style border-width syntax /* style */ border: solid; /* width | style */ border: 2px dotted; /* style | color */ border: outset #f33; /* width | style | color */ border: medium dashed
green; /* global values */ border: inherit; border: initial; border: unset; the border property may be specified using one, two, or three of the values listed below.
box-decoration-break - CSS: Cascading Style Sheets
formal definition initial valuesliceapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax slice | clone examples inline box fragments an inline element that contains line breaks styled with: .example { background: linear-gradient(to bottom right, yellow,
green); box-shadow: 8px 8px 10px 0px deeppink, -5px -5px 5px 0px blue, 5px 5px 15px 0px yellow; padding: 0em 1em; border-radius: 16px; border-style: solid; margin-left: 10px; font: 24px sans-serif; line-height: 2; } ...
caret-color - CSS: Cascading Style Sheets
olor html <input value="this field uses a default caret." size="64"/> <input class="custom" value="i have a custom caret color!" size="64"/> <p contenteditable class="custom">this paragraph can be edited, and its caret has a custom color as well!</p> css input { caret-color: auto; display: block; margin-bottom: .5em; } input.custom { caret-color: red; } p.custom { caret-color:
green; } result specifications specification status comment css basic user interface module level 3the definition of 'caret-color' in that specification.
clip-path - CSS: Cascading Style Sheets
wrap; } .col { flex: 1 auto; } .cell { margin: .5em; padding: .5em; background-color: #fff; overflow: 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: 2px; font: italic .6em sans-serif; } .viewbox { box-shadow: 1rem 1rem 0 #efefef inset, -1rem -1rem 0 #efefef inset; } .container.viewbox:after { content: 'viewbox'; position: absolute; left: 1.1rem; top: 1.1rem; font: italic .6em sans-serif; } .cell span { display: block...
column-gap (grid-column-gap) - CSS: Cascading Style Sheets
omputing to zero except on multi-column elementsanimation typea length, percentage or calc(); formal syntax normal | <length-percentage>where <length-percentage> = <length> | <percentage> examples flex layout html <div id="flexbox"> <div></div> <div></div> <div></div> </div> css #flexbox { display: flex; height: 100px; column-gap: 20px; } #flexbox > div { border: 1px solid
green; background-color: lime; flex: auto; } result grid layout html <div id="grid"> <div></div> <div></div> <div></div> </div> css #grid { grid-column-gap: 20px; } #grid { display: grid; height: 100px; grid-template-columns: repeat(3, 1fr); grid-template-rows: 100px; column-gap: 20px; } #grid > div { border: 1px solid
green; background-color: lime; } result ...
<custom-ident> - CSS: Cascading Style Sheets
also, quite a few predefined values are implemented by the different browsers: disc, circle, square, decimal, cjk-decimal, decimal-leading-zero, lower-roman, upper-roman, lower-
greek, lower-alpha, lower-latin, upper-alpha, upper-latin, arabic-indic, armenian, bengali, cambodian, cjk-earthly-branch, cjk-heavenly-stem, cjk-ideographic, devanagari, ethiopic-numeric, georgian, gujarati, gurmukhi, hebrew, hiragana, hiragana-iroha, japanese-formal, japanese-informal, kannada, katakana, katakana-iroha, khmer, korean-hangul-formal, korean-hanja-formal, korean-hanja-informal, lao, l...
<display-box> - CSS: Cascading Style Sheets
html <div class="outer"> <div>inner div.</div> </div> css .outer { border: 2px solid red; width: 300px; display: contents; } .outer > div { border: 1px solid
green; } result specifications specification status css display module level 3the definition of 'display-box' in that specification.
display - CSS: Cascading Style Sheets
out methods backwards compatibility of flexbox typical use cases of flexbox display: grid basic concepts of grid layout relationship to other layout methods line-based placement grid template areas layout using named grid lines auto-placement in grid layout box alignment in grid layout grids, logical values and writing modes css grid layout and accessibility css grid layout and pro
gressive enhancement realizing common layouts using grids accessibility concerns display: none using a display value of none on an element will remove it from the accessibility tree.
fit-content() - CSS: Cascading Style Sheets
the function can be used as a track size in css grid properties, where the maximum size is defined by max-content and the minimum size by auto, which is calculated similar to auto (i.e., minmax(auto, max-content)), except that the track size is clamped at argument if it is
greater than the auto minimum.
flex-grow - CSS: Cascading Style Sheets
d and e are flex-grow:2 .</h5> <div id="content"> <div class="box" style="background-color:red;">a</div> <div class="box" style="background-color:lightblue;">b</div> <div class="box" style="background-color:yellow;">c</div> <div class="box1" style="background-color:brown;">d</div> <div class="box1" style="background-color:light
green;">e</div> <div class="box" style="background-color:brown;">f</div> </div> css #content { display: flex; justify-content: space-around; flex-flow: row wrap; align-items: stretch; } .box { flex-grow: 1; border: 3px solid rgba(0,0,0,.2); } .box1 { flex-grow: 2; border: 3px solid rgba(0,0,0,.2); } result specifications specification status comment ...
flex-shrink - CSS: Cascading Style Sheets
d and e have flex-shrink:2 set</p> <p>the width of d and e is less than the others.</p> <div id="content"> <div class="box" style="background-color:red;">a</div> <div class="box" style="background-color:lightblue;">b</div> <div class="box" style="background-color:yellow;">c</div> <div class="box1" style="background-color:brown;">d</div> <div class="box1" style="background-color:light
green;">e</div> </div> css #content { display: flex; width: 500px; } #content div { flex-basis: 120px; border: 3px solid rgba(0,0,0,.2); } .box { flex-shrink: 1; } .box1 { flex-shrink: 2; } result specifications specification status comment css flexible box layout modulethe definition of 'flex-shrink' in that specification.
font-stretch - CSS: Cascading Style Sheets
if the font does not provide a face that exactly matches the given value, then values less than 100% map to a narrower face, and values
greater than or equal to 100% map to a wider face.
font-variant-east-asian - CSS: Cascading Style Sheets
<th>normal/jis78:</th> <td>麹町</td> <td class="jis78">麹町</td> </tr> <tr> <th>normal/ruby:</th> <td>しんかんせん</td> <td class="ruby">しんかんせん</td> </tr> <tr> <th>normal/traditional:</th> <td>大学</td> <td class="traditional">大学</td> </tr> </tbody> </table> css td{ font-family:"yu gothic"; font-size:20px; } th{ color:
grey; padding-right:10px; } .ruby { font-variant-east-asian: ruby; } .jis78 { font-variant-east-asian: jis78; } .traditional{ font-variant-east-asian: traditional; } result specifications specification status comment css fonts module level 3the definition of 'font-variant-east-asian' in that specification.
image-rendering - CSS: Cascading Style Sheets
if system resources are constrained, images with high-quality should be prioritized over those with any other value, when considering which images to degrade the quality of and to what de
gree.
inherit - CSS: Cascading Style Sheets
examples exclude selected elements from a rule /* make second-level headers
green */ h2 { color:
green; } /* ...but leave those in the sidebar alone so they use their parent's color */ #sidebar h2 { color: inherit; } in this example the h2 elements inside the sidebar might be different colors.
offset-path - CSS: Cascading Style Sheets
0,0 584,423 h506 l900,190" fill="none" stroke="black" stroke-width="13" stroke-linejoin="round" stroke-linecap="round" /> <path id="firstscissorhalf" class="scissorhalf" d="m30,0 h-10 a10,10 0 0,0 -20,10 a20,20 0 1,1 -40,-10 h20 a10,10 0 0,1 30,0 m-40,20 a10,10 1 0,0 -40,0 a10,10 1 0,0 -40,20 m0,0" transform="translate(0,0)" fill="
green" stroke="black" stroke-width="5" stroke-linejoin="round" stroke-linecap="round" fill-rule="evenodd" /> <path id="secondscissorhalf" class="scissorhalf" d="m30,0 h-10 a10,10 0 0,1 -20,-10 a20,20 0 1,0 -40,10 h20 a10,10 0 0,0 30,0 m-40,-20 a10,10 1 0,0 -40,0 a10,10 1 0,0 -40,-20 m0,0" transform="translate(0,0)" fill="forest
green" ...
outline - CSS: Cascading Style Sheets
constituent properties this property is a shorthand for the following css properties: outline-color outline-style outline-width syntax /* style */ outline: solid; /* color | style */ outline: #f66 dashed; /* style | width */ outline: inset thick; /* color | style | width */ outline:
green solid 3px; /* global values */ outline: inherit; outline: initial; outline: unset; the outline property may be specified using one, two, or three of the values listed below.
row-gap (grid-row-gap) - CSS: Cascading Style Sheets
pea length, percentage or calc(); formal syntax normal | <length-percentage>where <length-percentage> = <length> | <percentage> examples flex layout html <div id="flexbox"> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> </div> css #flexbox { display: flex; flex-wrap: wrap; width: 300px; row-gap: 20px; } #flexbox > div { border: 1px solid
green; background-color: lime; flex: 1 1 auto; width: 100px; height: 50px; } result grid layout html <div id="grid"> <div></div> <div></div> <div></div> </div> css #grid { grid-row-gap: 20px; } #grid { display: grid; height: 200px; grid-template-columns: 200px; grid-template-rows: repeat(3, 1fr); row-gap: 20px; } #grid > div { border: 1px solid
green; backg...
Specified value - CSS: Cascading Style Sheets
however, the border is not an inheriting property.</p> </div> css .fun { border: 1px dotted pink; font-family: fantasy; } p { color:
green; } result specifications specification status comment css level 2 (revision 2)the definition of 'cascaded value' in that specification.
text-emphasis-color - CSS: Cascading Style Sheets
)where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> examples emphasis with a color and custom character css em { text-emphasis-color:
green; text-emphasis-style: "*"; } html <p>here's an example:</p> <em>this has emphasis marks!</em> result specifications specification status comment css text decoration module level 3the definition of 'text-emphasis' in that specification.
scaleZ() - CSS: Cascading Style Sheets
10001000s 1000010000s00001 examples html <div>normal</div> <div class="perspective">translated</div> <div class="scaled-translated">scaled</div> css div { width: 80px; height: 80px; background-color: skyblue; } .perspective { /* includes a perspective to create a 3d space */ transform: perspective(400px) translatez(-100px); background-color: lime
green; } .scaled-translated { /* includes a perspective to create a 3d space */ transform: perspective(400px) scalez(2) translatez(-100px); background-color: pink; } result specifications specification status comment css transforms level 2the definition of 'scalez()' in that specification.
skew() - CSS: Cascading Style Sheets
the coordinates of each point are modified by a value proportionate to the specified angle and the distance to the origin; thus, the farther from the origin a point is, the
greater will be the value added it.
skewX() - CSS: Cascading Style Sheets
the abscissa coordinate of each point is modified by a value proportionate to the specified angle and the distance to the origin; thus, the farther from the origin a point is, the
greater will be the value added it.
skewY() - CSS: Cascading Style Sheets
the ordinate coordinate of each point is modified by a value proportionate to the specified angle and the distance to the origin; thus, the farther from the origin a point is, the
greater will be the value added it.
unset - CSS: Cascading Style Sheets
examples color html <p>this text is red.</p> <div class="foo"> <p>this text is also red.</p> </div> <div class="bar"> <p>this text is
green (default inherited value).</p> </div> css .foo { color: blue; } .bar { color:
green; } p { color: red; } .bar p { color: unset; } result border html <p>this text has a red border.</p> <div> <p>this text has a red border.</p> </div> <div class="bar"> <p>this text has a black border (initial default, not inherited).</p> </div> css div { border: 1px solid
green; } p { ...
zoom - CSS: Cascading Style Sheets
ver { zoom: reset; } result second example html <div id="a" class="circle"></div> <div id="b" class="circle"></div> <div id="c" class="circle"></div> css div.circle { width: 25px; height: 25px; border-radius: 100%; text-align: center; vertical-align: middle; display: inline-block; zoom: 1.5; } div#a { background-color: gold; zoom: normal; } div#b { background-color:
green; zoom: 200%; } div#c { background-color: blue; zoom: 2.9; } result specifications not part of any standard.
CSS: Cascading Style Sheets
from css3, the scope of the specification increased significantly and the pro
gress on different css modules started to differ so much, that it became more effective to develop and release recommendations separately per module.
Ajax - Developer guides
this article will explain how to use some ajax techniques, like: analyzing and manipulating the response of the server monitoring the pro
gress of a request submitting forms and upload binary files – in pure ajax, or using formdata objects using ajax within web workers fetch api the fetch api provides an interface for fetching resources.
Adding captions and subtitles to HTML5 video - Developer guides
as a consequence, the video controls now look as follows: <div id="video-controls" class="controls" data-state="hidden"> <button id="playpause" type="button" data-state="play">play/pause</button> <button id="stop" type="button" data-state="stop">stop</button> <div class="pro
gress"> <pro
gress id="pro
gress" value="0" min="0"> <span id="pro
gress-bar"></span> </pro
gress> </div> <button id="mute" type="button" data-state="mute">mute/unmute</button> <button id="volinc" type="button" data-state="volup">vol+</button> <button id="voldec" type="button" data-state="voldown">vol-</button> <button id="fs" type="button" data-state="go-fullscreen">f...
DOM onevent handlers - Developer guides
for example, for the pro
gress event on instances of xmlhttprequest: const xhr = new xmlhttprequest(); xhr.onpro
gress = function() { … }; html onevent attributes html elements have attributes named onevent which can be used to register a handler for an event directly within the html code.
Rich-Text Editing in Mozilla - Developer guides
>normal</option> <option value="4">medium-large</option> <option value="5">big</option> <option value="6">very big</option> <option value="7">maximum</option> </select> <select onchange="formatdoc('forecolor',this[this.selectedindex].value);this.selectedindex=0;"> <option class="heading" selected>- color -</option> <option value="red">red</option> <option value="blue">blue</option> <option value="
green">
green</option> <option value="black">black</option> </select> <select onchange="formatdoc('backcolor',this[this.selectedindex].value);this.selectedindex=0;"> <option class="heading" selected>- background -</option> <option value="red">red</option> <option value="
green">
green</option> <option value="black">black</option> </select> </div> <div id="toolbar2"> <img class="intlink" title="clean" on...
Making content editable - Developer guides
>normal</option> <option value="4">medium-large</option> <option value="5">big</option> <option value="6">very big</option> <option value="7">maximum</option> </select> <select onchange="formatdoc('forecolor',this[this.selectedindex].value);this.selectedindex=0;"> <option class="heading" selected>- color -</option> <option value="red">red</option> <option value="blue">blue</option> <option value="
green">
green</option> <option value="black">black</option> </select> <select onchange="formatdoc('backcolor',this[this.selectedindex].value);this.selectedindex=0;"> <option class="heading" selected>- background -</option> <option value="red">red</option> <option value="
green">
green</option> <option value="black">black</option> </select> </div> <div id="toolbar2"> <img class="intlink" title="clean" on...
Introduction to HTML5 - Developer guides
keep in mind that it's still highly recommended that one writes valid mark-up, as such code is easier to read and maintain, and it
greatly decreases the prominence of incompatibilities that exists in various older browsers.
Index - Developer guides
11 media buffering, seeking, and time ranges apps, buffer, html5, timeranges, video, buffering, seeking sometimes it's useful to know how much <audio> or <video> has downloaded or is playable without delay — a good example of this is the buffered pro
gress bar of an audio or video player.
Developer guides
pro
gressive web apps pro
gressive web apps (pwas) use modern web apis along with traditional pro
gressive enhancement strategy to create cross-platform web applications.
HTML attribute: minlength - HTML: Hypertext Markup Language
input { border: 2px solid currentcolor; } input:invalid { border: 2px dashed red; } input:invalid:focus { background-image: linear-gradient(pink, light
green); } specifications specification status html living standardthe definition of 'minlength attribute' in that specification.
HTML attribute: size - HTML: Hypertext Markup Language
e">enter a vegetable</label> <input type="text" id="vegetable"> <select name="fruits" size="5"> <option>banana</option> <option>cherry</option> <option>strawberry</option> <option>durian</option> <option>blueberry</option> </select> <select name="vegetables" size="5"> <option>carrot</option> <option>cucumber</option> <option>cauliflower</option> <option>celery</option> <option>collard
greens</option> </select> specifications specification status html living standardthe definition of 'size attribute' in that specification.
<canvas>: The Graphics Canvas element - HTML: Hypertext Markup Language
</canvas> javascript then in the javascript code, call htmlcanvaselement.getcontext() to get a drawing context and start drawing onto the canvas: const canvas = document.queryselector('canvas'); const ctx = canvas.getcontext('2d'); ctx.fillstyle = '
green'; ctx.fillrect(10, 10, 100, 100); result accessibility concerns alternative content the <canvas> element on its own is just a bitmap and does not provide information about any drawn objects.
<figure>: The Figure with Optional Caption element - HTML: Hypertext Markup Language
gatorexample", txt); } </pre> </figure> quotations <figure> <figcaption><cite>edsger dijkstra:</cite></figcaption> <blockquote>if debugging is the process of removing software bugs, then programming must be the process of putting them in.</blockquote> </figure> poems <figure> <p style="white-space:pre"> bid me discourse, i will enchant thine ear, or like a fairy trip upon the
green, or, like a nymph, with long dishevell'd hair, dance on the sands, and yet no footing seen: love is a spirit all compact of fire, not gross to sink, but light, and will aspire.</p> <figcaption><cite>venus and adonis</cite>, by william shakespeare</figcaption> </figure> specifications specification status comment html living standardthe definition of '<f...
<header> - HTML: Hypertext Markup Language
examples page header <header> <h1>main page title</h1> <img src="mdn-logo-sm.png" alt="mdn logo"> </header> article header <article> <header> <h2>the planet earth</h2> <p>posted on wednesday, <time datetime="2017-10-04">4 october 2017</time> by jane smith</p> </header> <p>we live on a planet that's blue and
green, with so many things still unseen.</p> <p><a href="https://janesmith.com/the-planet-earth/">continue reading....</a></p> </article> specifications specification status comment html living standardthe definition of '<header>' in that specification.
<input type="button"> - HTML: Hypertext Markup Language
height = canvas.height = window.innerheight-85; var ctx = canvas.getcontext('2d'); ctx.fillstyle = 'rgb(0,0,0)'; ctx.fillrect(0,0,width,height); var colorpicker = document.queryselector('input[type="color"]'); var sizepicker = document.queryselector('input[type="range"]'); var output = document.queryselector('.output'); var clearbtn = document.queryselector('input[type="button"]'); // covert de
grees to radians function degtorad(de
grees) { return de
grees * math.pi / 180; }; // update sizepicker output value sizepicker.oninput = function() { output.textcontent = sizepicker.value; } // store mouse pointer coordinates, and whether the button is pressed var curx; var cury; var pressed = false; // update mouse pointer coordinates document.onmousemove = function(e) { curx = (window.even...
<select>: The HTML Select element - HTML: Hypertext Markup Language
implicit aria role combobox with no multiple attribute and no size attribute
greater than 1, otherwise listbox permitted aria roles menu with no multiple attribute and no size attribute
greater than 1, otherwise no role permitted dom interface htmlselectelement specifications specification status comments html living standardthe definition of '<select>' in that specification.
<table>: The Table element - HTML: Hypertext Markup Language
ngton, d.c.</td> <td>309 million</td> <td>english</td> </tr> <tr> <td>sweden</td> <td>stockholm</td> <td>9 million</td> <td>swedish</td> </tr> </table> <p>table with colgroup and col</p> <table> <colgroup> <col style="background-color: #0f0"> <col span="2"> </colgroup> <tr> <th>lime</th> <th>lemon</th> <th>orange</th> </tr> <tr> <td>
green</td> <td>yellow</td> <td>orange</td> </tr> </table> <p>simple table with caption</p> <table> <caption>awesome caption</caption> <tr> <td>awesome data</td> </tr> </table> table { border-collapse: collapse; border-spacing: 0px; } table, th, td { padding: 5px; border: 1px solid black; } accessibility concerns captions by supplying a <caption> element whose value clear...
<tfoot>: The Table Foot element - HTML: Hypertext Markup Language
one of the sixteen predefined color strings may be used: black = "#000000"
green = "#008000" silver = "#c0c0c0" lime = "#00ff00" gray = "#808080" olive = "#808000" white = "#ffffff" yellow = "#ffff00" maroon = "#800000" navy = "#000080" red = "#ff0000" blue = "#0000ff" purple = "#800080" teal = "#008080" ...
<th> - HTML: Hypertext Markup Language
this attribute may be used with one of sixteen predefined color strings: black = "#000000"
green = "#008000" silver = "#c0c0c0" lime = "#00ff00" gray = "#808080" olive = "#808000" white = "#ffffff" yellow = "#ffff00" maroon = "#800000" navy = "#000080" red = "#ff0000" blue = "#0000ff" purple = "#800080" teal = "#008080" ...
<thead>: The Table Head element - HTML: Hypertext Markup Language
one of the sixteen predefined color strings may be used: black = "#000000"
green = "#008000" silver = "#c0c0c0" lime = "#00ff00" gray = "#808080" olive = "#808000" white = "#ffffff" yellow = "#ffff00" maroon = "#800000" navy = "#000080" red = "#ff0000" blue = "#0000ff" purple = "#800080" teal = "#008080" ...
itemprop - HTML: Hypertext Markup Language
a meter element <div itemscope itemtype="http://schema.org/product"> <span itemprop="name">panasonic white 60l refrigerator</span> <img src="panasonic-fridge-60l-white.jpg" alt=""> <div itemprop="ag
gregaterating" itemscope itemtype="http://schema.org/ag
gregaterating"> <meter itemprop="ratingvalue" min=0 value=3.5 max=5>rated 3.5/5</meter> (based on <span itemprop="reviewcount">11</span> customer reviews) </div> </div> similarly, for date- and time-related data, the time element and its datetime attribute can be used.
Global attributes - HTML: Hypertext Markup Language
ondblclick, ondrag, ondragend, ondragenter, ondragexit, ondragleave, ondragover, ondragstart, ondrop, ondurationchange, onemptied, onended, onerror, onfocus, oninput, oninvalid, onkeydown, onkeypress, onkeyup, onload, onloadeddata, onloadedmetadata, onloadstart, onmousedown, onmouseenter, onmouseleave, onmousemove, onmouseout, onmouseover, onmouseup, onmousewheel, onpause, onplay, onplaying, onpro
gress, onratechange, onreset, onresize, onscroll, onseeked, onseeking, onselect, onshow, onsort, onstalled, onsubmit, onsuspend, ontimeupdate, ontoggle, onvolumechange, onwaiting.
Inline elements - HTML: Hypertext Markup Language
block and inline elements are no longer defined in html 5, use content categories instead): <a> <abbr> <acronym> <audio> (if it has visible controls) <b> <bdi> <bdo> <big> <br> <button> <canvas> <cite> <code> <data> <datalist> <del> <dfn> <em> <embed> <i> <iframe> <img> <input> <ins> <kbd> <label> <map> <mark> <meter> <noscript> <object> <output> <picture> <pro
gress> <q> <ruby> <s> <samp> <script> <select> <slot> <small> <span> <strong> <sub> <sup> <svg> <template> <textarea> <time> <u> <tt> <var> <video> <wbr> see also block-level elements html element reference display content categories block and inline layout in normal flow ...
HTML: Hypertext Markup Language
html markup includes special "elements" such as <head>, <title>, <body>, <header>, <footer>, <article>, <section>, <p>, <div>, <span>, <img>, <aside>, <audio>, <canvas>, <datalist>, <details>, <embed>, <nav>, <output>, <pro
gress>, <video>, <ul>, <ol>, <li> and many others.
Resource URLs - HTTP
syntax resource urls are composed of two parts: a prefix (resource:), and a url pointing to the resource you want to load: resource://<url> an example: resource://
gre/res/svg.css when arrows are found in the resource url's ('->'), it means that the first file loaded the next one: resource://<file-loader> -> <file-loaded> please refer to identifying resources on the web for more general details.
HTTP caching - HTTP
for the files in the application that will not change, you can usually add ag
gressive caching.
Configuring servers for Ogg media - HTTP
the ogg format doesn't encapsulate the duration of media, so for the pro
gress bar on the video controls to display the duration of the video, gecko needs to determine the length of the media using other means.
Cache-Control - HTTP
examples preventing caching to disable caching of a resource, you can send the following response header: good: cache-control: no-store bad: cache-control: private,no-cache,no-store,max-age=0,must-revalidate,pre-check=0,post-check=0 caching static assets for the files in the application that will not change, you can usually add ag
gressive caching by sending the response header below.
Expect-CT - HTTP
if a cache receives a value
greater than it can represent, or if any of its subsequent calculations overflows, the cache will consider this value to be either 2,147,483,648 (231) or the
greatest positive integer it can represent.
Warning - HTTP
113 heuristic expiration sent if a cache heuristically chose a freshness lifetime
greater than 24 hours and the response's age is
greater than 24 hours.
Proxy Auto-Configuration (PAC) file - HTTP
ue monday through friday (gmt timezone) weekdayrange("sat"); // returns true on saturdays local time weekdayrange("sat", "gmt"); // returns true on saturdays gmt time weekdayrange("fri", "mon"); // returns true friday and monday only (note, order does matter!) daterange() syntax daterange(<day> | <month> | <year>, [gmt]) // ambiguity is resolved by assuming year is
greater than 31 daterange(<day1>, <day2>, [gmt]) daterange(<month1>, <month2>, [gmt]) daterange(<year1>, <year2>, [gmt]) daterange(<day1>, <month1>, <day2>, <month2>, [gmt]) daterange(<month1>, <year1>, <month2>, <year2>, [gmt]) daterange(<day1>, <month1>, <year1>, <day2>, <month2>, <year2>, [gmt]) note: (before firefox 49) day1 must be less than day2, month1 must be less than month2, and year1 mus...
HTTP range requests - HTTP
in case of a range request that is out of bounds (none of the range values overlap the extent of the resource, i.e first-byte-pos of all ranges is
greater than the resource length), the server responds with a 416 requested range not satisfiable status.
303 See Other - HTTP
the hypertext transfer protocol (http) 303 see other redirect status response code indicates that the redirects don't link to the newly uploaded resources, but to another page (such as a confirmation page or an upload pro
gress page).
CSS Houdini
li { background-image: paint(mycomponent, stroke, 10px); --highlights: blue; --lowlights:
green; } note: with
great power comes
great responsibility!
Control flow and error handling - JavaScript
« previousnext » javascript supports a compact set of statements, specifically control flow statements, that you can use to incorporate a
great deal of interactivity in your application.
Loops and iteration - JavaScript
this expression usually initializes one or more loop counters, but the syntax allows an expression of any de
gree of complexity.
Text formatting - JavaScript
you can't change individual characters because strings are immutable array-like objects: const hello = 'hello, world!'; const hellolength = hello.length; hello[0] = 'l'; // this has no effect, because strings are immutable hello[0]; // this returns "h" characters whose unicode scalar values are
greater than u+ffff (such as some rare chinese/japanese/korean/vietnamese characters and some emoji) are stored in utf-16 with two surrogate code units each.
JavaScript Guide - JavaScript
model prototype-based oop creating object hierarchies inheritance promises guarantees chaining error propagation composition timing iterators and generators iterators iterables generators meta programming proxy handlers and traps revocable proxy reflect javascript modules exporting importing default exports renaming features ag
gregating modules dynamic module loading next » ...
Default parameters - JavaScript
nctions and variables: function callsomething(thing = something()) { return thing } let numberoftimescalled = 0 function something() { numberoftimescalled += 1 return numberoftimescalled } callsomething() // 1 callsomething() // 2 earlier parameters are available to later default parameters parameters defined earlier (to the left) are available to later default parameters: function
greet(name,
greeting, message =
greeting + ' ' + name) { return [name,
greeting, message] }
greet('david', 'hi') // ["david", "hi", "hi david"]
greet('david', 'hi', 'happy birthday!') // ["david", "hi", "happy birthday!"] this functionality can be approximated like this, which demonstrates how many edge cases are handled: function go() { return ':p' } function withdefaul...
Array.prototype.reduce() - JavaScript
input ) // composed functions for multiplication of specific values const multiply6 = pipe(double, triple) const multiply9 = pipe(triple, triple) const multiply16 = pipe(quadruple, quadruple) const multiply24 = pipe(double, triple, quadruple) // usage multiply6(6) // 36 multiply9(9) // 81 multiply16(16) // 256 multiply24(10) // 240 write map using reduce if (!array.prototype.mapusin
greduce) { array.prototype.mapusin
greduce = function(callback, thisarg) { return this.reduce(function(mappedarray, currentvalue, index, array) { mappedarray[index] = callback.call(thisarg, currentvalue, index, array) return mappedarray }, []) } } [1, 2, , 3].mapusin
greduce( (currentvalue, index, array) => currentvalue + index + array.length ) // [5, 7, , 10] specificatio...
Array.prototype.includes() - JavaScript
examples [1, 2, 3].includes(2) // true [1, 2, 3].includes(4) // false [1, 2, 3].includes(3, 3) // false [1, 2, 3].includes(3, -1) // true [1, 2, nan].includes(nan) // true fromindex is
greater than or equal to the array length if fromindex is
greater than or equal to the length of the array, false is returned.
BigInt - JavaScript
usage recommendations coercion because coercing between number and bigint can lead to loss of precision, it is recommended to only use bigint when values
greater than 253 are reasonably expected and not to coerce between the two types.
BigInt64Array - JavaScript
bigint64array.prototype.lastindexof() returns the last (
greatest) index of an element within the array equal to the specified value, or -1 if none is found.
BigUint64Array - JavaScript
biguint64array.prototype.lastindexof() returns the last (
greatest) index of an element within the array equal to the specified value, or -1 if none is found.
Date.prototype.toString() - JavaScript
"26" space the string "gmt" timezone offset sign, either: "+" for positive offsets (0 or
greater) "-" for negative offsets (less than zero) two digit hour offset, e.g.
Float32Array - JavaScript
float32array.prototype.lastindexof() returns the last (
greatest) index of an element within the array equal to the specified value, or -1 if none is found.
Float64Array - JavaScript
float64array.prototype.lastindexof() returns the last (
greatest) index of an element within the array equal to the specified value, or -1 if none is found.
Function.arguments - JavaScript
the value of the arguments property is normally null if there is no outstanding invocation of the function in pro
gress (that is, the function has been called but has not yet returned.
Function.prototype.bind() - JavaScript
(proper bound functions have none.) the partial implementation creates bound functions whose length property does not a
gree with that mandated by ecma-262: it creates functions with length of 0.
Int16Array - JavaScript
int16array.prototype.lastindexof() returns the last (
greatest) index of an element within the array equal to the specified value, or -1 if none is found.
Int32Array - JavaScript
int32array.prototype.lastindexof() returns the last (
greatest) index of an element within the array equal to the specified value, or -1 if none is found.
Int8Array - JavaScript
int8array.prototype.lastindexof() returns the last (
greatest) index of an element within the array equal to the specified value, or -1 if none is found.
Intl.Collator.prototype.compare() - JavaScript
var a = ['offenbach', 'Österreich', 'odenwald']; var collator = new intl.collator('de-u-co-phonebk'); a.sort(collator.compare); console.log(a.join(', ')); // → "odenwald, Österreich, offenbach" using compare for array search use the compare getter function for finding matching strings in arrays: var a = ['congrès', 'con
gres', 'assemblée', 'poisson']; var collator = new intl.collator('fr', { usage: 'search', sensitivity: 'base' }); var s = 'con
gres'; var matches = a.filter(v => collator.compare(v, s) === 0); console.log(matches.join(', ')); // → "congrès, con
gres" specifications specification ecmascript internationalization api (ecma-402)the definition of 'intl.collator.prototype.compare' in...
Intl.Locale.prototype.baseName - JavaScript
examples basic example let myloc = new intl.locale("fr-latn-ca"); // sets locale to canadian french console.log(myloc.tostring()); // prints out "fr-latn-ca-u-ca-
gregory" console.log(myloc.basename); // prints out "fr-latn-ca" example with options in the input string // sets language to japanese, region to japan, // calendar to
gregorian, hour cycle to 24 hours let japan = new intl.locale("ja-jp-u-ca-
gregory-hc-24"); console.log(japan.tostring()); // prints out "ja-jp-u-ca-
gregory-hc-h24" console.log(japan.basename); // prints out "ja-jp" example with opt...
Intl.Locale.prototype.numberingSystem - JavaScript
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 gunjala gondi digits gonm masaram gondi digits
grek
greek upper case numerals — algorithmic
greklow
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 numer...
Intl.Locale.prototype.toString() - JavaScript
examples using tostring let mylocale = new intl.locale("fr-latn-fr", {hourcycle: "h24", calendar: "
gregory"}); console.log(mylocale.basename); // prints "fr-latn-fr" console.log(mylocale.tostring()); // prints "fr-latn-fr-u-ca-
gregory-hc-h24" specifications specification ecmascript internationalization api (ecma-402) ...
Intl - JavaScript
"en-gb-u-ca-islamic": use british english with the islamic (hijri) calendar, where the
gregorian date 14 october, 2017 is the hijri date 24 muharram, 1439.
JSON.stringify() - JavaScript
if this is a number, it indicates the number of space characters to use as white space; this number is capped at 10 (if it is
greater, the value is just 10).
eval() - JavaScript
log(loosejsonparse( "{a:(4-1), b:function(){}, c:new date()}" )) better code without eval(): function loosejsonparse(obj){ return function('"use strict";return (' + obj + ')')(); } console.log(loosejsonparse( "{a:(4-1), b:function(){}, c:new date()}" )) comparing the two code snippets above, the two code snippets might seem to work the same way, but think again: the eval() one is a
great deal slower.
Standard built-in objects - JavaScript
error ag
gregateerror evalerror internalerror rangeerror referenceerror syntaxerror typeerror urierror numbers and dates these are the base objects representing numbers, dates, and mathematical calculations.
Destructuring assignment - JavaScript
examples array destructuring basic variable assignment const foo = ['one', 'two', 'three']; const [red, yellow,
green] = foo; console.log(red); // "one" console.log(yellow); // "two" console.log(
green); // "three" assignment separate from declaration a variable can be assigned its value via destructuring separate from the variable's declaration.
Operator precedence - JavaScript
… / … remainder … % … 14 addition left-to-right … + … subtraction … - … 13 bitwise left shift left-to-right … << … bitwise right shift … >> … bitwise unsigned right shift … >>> … 12 less than left-to-right … < … less than or equal … <= …
greater than … > …
greater than or equal … >= … in … in … instanceof … instanceof … 11 equality left-to-right … == … inequality … != … strict equality … === … strict inequality … !== … 10 bitwise and left-to-right … & … 9 bitwise xor left-to...
in operator - JavaScript
let color1 = new string('
green') 'length' in color1 // returns true let color2 = 'coral' // generates an error (color2 is not a string object) 'length' in color2 using in with deleted or undefined properties if you delete a property with the delete operator, the in operator returns false for that property.
void operator - JavaScript
for example: <a href="javascript:void(0);"> click here to do nothing </a> <a href="javascript:void(document.body.style.backgroundcolor='
green');"> click here for
green background </a> note: javascript: pseudo protocol is discouraged over other alternatives, such as unobtrusive event handlers.
JavaScript reference - JavaScript
value properties infinity nan undefined globalthis function properties eval() isfinite() isnan() parsefloat() parseint() decodeuri() decodeuricomponent() encodeuri() encodeuricomponent() fundamental objects object function boolean symbol error objects error ag
gregateerror evalerror internalerror rangeerror referenceerror syntaxerror typeerror urierror numbers & dates number bigint math date text processing string regexp indexed collections array int8array uint8array uint8clampedarray int16array uint16array int32array uint32array float32array float64array bigint64array biguint64array ...
background_color - Web app manifests
note: the background_color member is only meant to improve the user experience while the main stylesheet is loading from the network or the storage media; it is not used by the user agent as the background-color css property when the pro
gressive web app stylesheet is available.
Web app manifests
web app manifests are part of a collection of web technologies called pro
gressive web apps (pwas), which are websites that can be installed to a device’s homescreen without an app store.
MathML
to force mathjax to use native mathml, try this mozilla add-on, this safari extension or this
greasemonkey script.
OpenSearch description format
(see image, the
green plus sign.) thus if a search box is not shown in the user's ui, they will receive no indication.
Web Performance
that means not running all your startup code in a single event handler on the app's main thread.performance budgetsa performance budget is a limit to prevent re
gressions.
SVG Event Attributes - SVG: Scalable Vector Graphics
ondblclick, ondrag, ondragend, ondragenter, ondragexit, ondragleave, ondragover, ondragstart, ondrop, ondurationchange, onemptied, onended, onerror, onfocus, oninput, oninvalid, onkeydown, onkeypress, onkeyup, onload, onloadeddata, onloadedmetadata, onloadstart, onmousedown, onmouseenter, onmouseleave, onmousemove, onmouseout, onmouseover, onmouseup, onmousewheel, onpause, onplay, onplaying, onpro
gress, onratechange, onreset, onresize, onscroll, onseeked, onseeking, onselect, onshow, onstalled, onsubmit, onsuspend, ontimeupdate, ontoggle, onvolumechange, onwaiting graphical event attributes onactivate, onfocusin, onfocusout ...
alignment-baseline - SVG: Scalable Vector Graphics
example <svg width="300" height="120" viewbox="0 0 300 120" xmlns="http://www.w3.org/2000/svg"> <!-- materialisation of anchors --> <path d="m60,10 l60,110 m30,10 l300,10 m30,65 l300,65 m30,110 l300,110 " stroke="
grey" /> <!-- anchors in action --> <text alignment-baseline="hanging" x="60" y="10">a hanging</text> <text alignment-baseline="middle" x="60" y="65">a middle</text> <text alignment-baseline="baseline" x="60" y="110">a baseline</text> <!-- materialisation of anchors --> <circle cx="60" cy="10" r="3" fill="red" /> <circle cx="60" cy="65...
clip - SVG: Scalable Vector Graphics
as a presentation attribute, it can be applied to any element but it has effect only on the following six elements: <svg>, <symbol>, <image>, <foreignobject>, <pattern>, <marker> html,body,svg { height:100% } <svg viewbox="0 0 20 10" xmlns="http://www.w3.org/2000/svg"> <!-- auto clipping --> <svg x="0" width="10" height="10" clip="auto"> <circle cx="5" cy="5" r="4" stroke="
green" /> </svg> <!-- rect(top, right, bottom, left) clipping --> <svg x="10" width="10" height="10" clip="rect(1, 9, 8, 2)"> <circle cx="5" cy="5" r="4" stroke="
green" /> </svg> </svg> usage notes warning: this property is deprecated.
color-rendering - SVG: Scalable Vector Graphics
n>, <polyline>, <radialgradient>, <rect>, <svg>, <switch>, <symbol>, <text>, <textpath>, <tspan>, and <use> html, body, svg { height: 100%; } <svg viewbox="0 0 480 200" xmlns="http://www.w3.org/2000/svg"> <defs> <radialgradient id="gradient" cx="0.5" cy="0.5" r="0.5" fx="0.35" fy="0.35" fr="5%"> <stop offset="0%" stop-color="white"/> <stop offset="100%" stop-color="darksea
green"/> </radialgradient> </defs> <circle cx="100" cy="100" r="100" fill="url(#gradient)" color-rendering="optimizequality" /> <text x="45" y="50%" color-rendering="optimizequality">quality-optimized</text> <circle cx="100" cy="100" r="100" color-rendering="optimizespeed" fill="url(#gradient)" style="transform: translatex(240px);" /> <text x="290" y="50%" color-rendering="optim...
color - SVG: Scalable Vector Graphics
usage notes value <color> | inherit default value depends on user agent animatable yes example html, body, svg { height: 100%; } <svg viewbox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <g color="
green"> <rect width="50" height="50" fill="currentcolor" /> <circle r="25" cx="70" cy="70" stroke="currentcolor" fill="none" stroke-width="5" /> </g> </svg> specifications specification status comment scalable vector graphics (svg) 2the definition of 'color' in that specification.
direction - SVG: Scalable Vector Graphics
it applies only to glyphs oriented perpendicular to the inline-base direction, which includes the usual case of horizontally-oriented latin or arabic text and the case of narrow-cell latin or arabic characters rotated 90 de
grees clockwise relative to a top-to-bottom inline-base direction.
dx - SVG: Scalable Vector Graphics
<glyphref>, <text>, <tref>, and <tspan> html,body,svg { height:100% } <svg viewbox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <!-- lines materialized the position of the glyphs --> <line x1="0" x2="100%" y1="50%" y2="50%" /> <line x1="10%" x2="10%" y1="0" y2="100%" /> <line x1="60%" x2="60%" y1="0" y2="100%" /> <!-- some reference text --> <text x="10%" y="50%" fill="
grey">svg</text> <!-- the same text with a shift along the x-axis --> <text dx="50%" x="10%" y="50%">svg</text> </svg> line { stroke: red; stroke-width: .5px; stroke-dasharray: 3px; } altglyph warning: as of svg2 <altglyph> is deprecated and shouldn't be used.
dy - SVG: Scalable Vector Graphics
phref>, <text>, <tref>, and <tspan> html,body,svg { height:100% } <svg viewbox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <!-- lines materialized the position of the glyphs --> <line x1="10%" x2="10%" y1="0" y2="100%" /> <line x1="0" x2="100%" y1="30%" y2="30%" /> <line x1="0" x2="100%" y1="80%" y2="80%" /> <!-- some reference text --> <text x="10%" y="30%" fill="
grey">svg</text> <!-- the same text with a shift along the y-axis --> <text dy="50%" x="10%" y="30%">svg</text> </svg> line { stroke: red; stroke-width: .5px; stroke-dasharray: 3px; } altglyph warning: as of svg2 <altglyph> is deprecated and shouldn't be used.
flood-color - SVG: Scalable Vector Graphics
ntation attribute, it can be applied to any element but it has effect only on the following two elements: <feflood> and <fedropshadow> html, body, svg { height: 100%; } <svg viewbox="0 0 420 200" xmlns="http://www.w3.org/2000/svg"> <filter id="flood1"> <feflood flood-color="skyblue" x="0" y="0" width="200" height="200"/> </filter> <filter id="flood2"> <feflood flood-color="sea
green" x="0" y="0" width="200" height="200"/> </filter> <rect x="0" y="0" width="200" height="200" style="filter: url(#flood1);" /> <rect x="0" y="0" width="200" height="200" style="filter: url(#flood2); transform: translatex(220px);" /> </svg> usage notes value color initial value black animatable yes specifications specification st...
flood-opacity - SVG: Scalable Vector Graphics
as a presentation attribute, it can be applied to any element but it has effect only on the following two elements: <feflood> and <fedropshadow> html, body, svg { height: 100%; } <svg viewbox="0 0 420 200" xmlns="http://www.w3.org/2000/svg"> <filter id="flood1"> <feflood flood-color="sea
green" flood-opacity="1" x="0" y="0" width="200" height="200"/> </filter> <filter id="flood2"> <feflood flood-color="sea
green" flood-opacity="0.3" x="0" y="0" width="200" height="200"/> </filter> <rect x="0" y="0" width="200" height="200" style="filter: url(#flood1);" /> <rect x="0" y="0" width="200" height="200" style="filter: url(#flood2); transform: translatex(220px);" /> </svg> ...
fr - SVG: Scalable Vector Graphics
only one element is using this attribute: <radialgradient> html, body, svg { height: 100%; } <svg viewbox="0 0 480 200" xmlns="http://www.w3.org/2000/svg"> <defs> <radialgradient id="gradient1" cx="0.5" cy="0.5" r="0.5" fx="0.35" fy="0.35" fr="5%"> <stop offset="0%" stop-color="white"/> <stop offset="100%" stop-color="darksea
green"/> </radialgradient> <radialgradient id="gradient2" cx="0.5" cy="0.5" r="0.5" fx="0.35" fy="0.35" fr="25%"> <stop offset="0%" stop-color="white"/> <stop offset="100%" stop-color="darksea
green"/> </radialgradient> </defs> <circle cx="100" cy="100" r="100" fill="url(#gradient1)" /> <circle cx="100" cy="100" r="100" fill="url(#gradient2)" style="transform: tr...
fx - SVG: Scalable Vector Graphics
only one element is using this attribute: <radialgradient> html, body, svg { height: 100%; } <svg viewbox="0 0 480 200" xmlns="http://www.w3.org/2000/svg"> <defs> <radialgradient id="gradient1" cx="0.5" cy="0.5" r="0.5" fx="0.35" fy="0.35" fr="5%"> <stop offset="0%" stop-color="white"/> <stop offset="100%" stop-color="darksea
green"/> </radialgradient> <radialgradient id="gradient2" cx="0.5" cy="0.5" r="0.5" fx="0.75" fy="0.35" fr="5%"> <stop offset="0%" stop-color="white"/> <stop offset="100%" stop-color="darksea
green"/> </radialgradient> </defs> <circle cx="100" cy="100" r="100" fill="url(#gradient1)" /> <circle cx="100" cy="100" r="100" fill="url(#gradient2)" style="transform: tra...
fy - SVG: Scalable Vector Graphics
only one element is using this attribute: <radialgradient> html, body, svg { height: 100%; } <svg viewbox="0 0 480 200" xmlns="http://www.w3.org/2000/svg"> <defs> <radialgradient id="gradient1" cx="0.5" cy="0.5" r="0.5" fx="0.35" fy="0.35" fr="5%"> <stop offset="0%" stop-color="white"/> <stop offset="100%" stop-color="darksea
green"/> </radialgradient> <radialgradient id="gradient2" cx="0.5" cy="0.5" r="0.5" fx="0.35" fy="0.75" fr="5%"> <stop offset="0%" stop-color="white"/> <stop offset="100%" stop-color="darksea
green"/> </radialgradient> </defs> <circle cx="100" cy="100" r="100" fill="url(#gradient1)" /> <circle cx="100" cy="100" r="100" fill="url(#gradient2)" style="transform: tra...
media - SVG: Scalable Vector Graphics
only one element is using this attribute: <style> html, body, svg { height: 100%; } <svg viewbox="0 0 240 220" xmlns="http://www.w3.org/2000/svg"> <style> rect { fill: black; } </style> <style media="all and (min-width: 600px)"> rect { fill: sea
green; } </style> <text y="15">resize the window to see the effect</text> <rect y="20" width="200" height="200" /> </svg> usage notes value <media-query-list> default value all animatable yes <media-query-list> this value holds a media query that needs to match in order for the style sheet to be applied.
mode - SVG: Scalable Vector Graphics
only one element is using this attribute: <feblend> html, body, svg { height: 100%; } <svg viewbox="0 0 480 200" xmlns="http://www.w3.org/2000/svg"> <filter id="blending1" x="0" y="0" width="100%" height="100%"> <feflood result="floodfill" x="0" y="0" width="100%" height="100%" flood-color="sea
green" flood-opacity="1"/> <feblend in="sourcegraphic" in2="floodfill" mode="multiply"/> </filter> <filter id="blending2" x="0" y="0" width="100%" height="100%"> <feflood result="floodfill" x="0" y="0" width="100%" height="100%" flood-color="sea
green" flood-opacity="1"/> <feblend in="sourcegraphic" in2="floodfill" mode="color-dodge"/> </filter> <image xlink:href="//develope...
requiredFeatures - SVG: Scalable Vector Graphics
otion>, <animatetransform>, <circle>, <clippath>, <cursor>, <defs>, <ellipse>, <foreignobject>, <g>, <image>, <line>, <mask>, <path>, <pattern>, <polygon>, <polyline>, <rect>, <set>, <svg>, <switch>, <text>, <textpath>, <tref>, <tspan>, <use> html, body, svg { height: 100%; } text { fill: white; } <svg viewbox="0 0 250 45" xmlns="http://www.w3.org/2000/svg"> <g> <rect fill="forest
green" x="10" y="10" height="25" width="230" /> <text x="20" y="27">requiredfeatures supported</text> </g> <g requiredfeatures=""> <rect fill="crimson" x="10" y="10" height="25" width="230" /> <text x="20" y="27">requiredfeatures not supported</text> </g> </svg> usage notes value <list-of-features> default value true if not defined, false if null or empt...
rx - SVG: Scalable Vector Graphics
if rx is
greater than half of the width of the rectangle, then the browser will consider the value for rx as half of the width of the rectangle.
ry - SVG: Scalable Vector Graphics
if ry is
greater than half of the width of the rectangle, then the browser will consider the value for ry as half of the width of the rectangle.
stroke-opacity - SVG: Scalable Vector Graphics
ntation attribute, it can be applied to any element but it has effect only on the following 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 opacity as a percentage --> <circle cx="25" cy="5" r="4" stroke="
green" stroke-opacity="50%" /> <!-- stroke opacity as a css property --> <circle cx="35" cy="5" r="4" stroke="
green" style="stroke-opacity: .3;" /> </svg> usage no...
stroke-width - SVG: Scalable Vector Graphics
ibute, it can be applied to any element but it only has effect on shapes and text context elements, including: <altglyph>, <circle>, <ellipse>, <line>, <path>, <polygon>, <polyline>, <rect>, <text>, <textpath>, <tref>, and <tspan> html,body,svg { height:100% } <svg viewbox="0 0 30 10" xmlns="http://www.w3.org/2000/svg"> <!-- default stroke width: 1 --> <circle cx="5" cy="5" r="3" stroke="
green" /> <!-- stroke width as a number --> <circle cx="15" cy="5" r="3" stroke="
green" stroke-width="3" /> <!-- stroke width as a percentage --> <circle cx="25" cy="5" r="3" stroke="
green" stroke-width="2%" /> </svg> usage notes value <length> | <percentage> default value 1px animatable yes note: a percentage value is alwa...
stroke - SVG: Scalable Vector Graphics
e, it can be applied to any element but it has effect only on the following twelve elements: <altglyph>, <circle>, <ellipse>, <line>, <path>, <polygon>, <polyline>, <rect>, <text>, <textpath>, <tref>, and <tspan> html,body,svg { height:100% } <svg viewbox="0 0 20 10" xmlns="http://www.w3.org/2000/svg"> <!-- simple color stroke --> <circle cx="5" cy="5" r="4" fill="none" stroke="
green" /> <!-- stroke a circle with a gradient --> <defs> <lineargradient id="mygradient"> <stop offset="0%" stop-color="
green" /> <stop offset="100%" stop-color="white" /> </lineargradient> </defs> <circle cx="15" cy="5" r="4" fill="none" stroke="url(#mygradient)" /> </svg> usage notes value <paint> default value none ...
text-anchor - SVG: Scalable Vector Graphics
as a presentation attribute, it can be applied to any element but it has effect only on the following five elements: <altglyph>, <text>, <textpath>, <tref>, and <tspan> html, body, svg { height: 100%; } <svg viewbox="0 0 120 120" xmlns="http://www.w3.org/2000/svg"> <!-- materialisation of anchors --> <path d="m60,15 l60,110 m30,40 l90,40 m30,75 l90,75 m30,110 l90,110" stroke="
grey" /> <!-- anchors in action --> <text text-anchor="start" x="60" y="40">a</text> <text text-anchor="middle" x="60" y="75">a</text> <text text-anchor="end" x="60" y="110">a</text> <!-- materialisation of anchors --> <circle cx="60" cy="40" r="3" fill="red" /> <circle cx="60" cy="75" r="3" fill="red" /> <circle cx="60" cy="110" r="3" fill="red" /> <style><![cdata[ text { ...
textLength - SVG: Scalable Vector Graphics
<svg width="10cm" height="3cm" viewbox="0 0 1000 300" xmlns="http://www.w3.org/2000/svg"> <rect x="1" y="1" width="998" height="298" fill="none" stroke="
green" stroke-width="2"/> <text id="hello" x="10" y="150" font-family="sans-serif" font-size="60" fill="
green"> hello world!
visibility - SVG: Scalable Vector Graphics
ph>, <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" fill="transparent" /> <g stroke="sea
green" stroke-width="5" fill="skyblue"> <rect x="20" y="20" width="80" height="80" visibility="visible" /> <rect x="120" y="20" width="80" height="80" visibility="hidden"/> </g> </svg> usage notes value visible | hidden | collapse default value visible animatable yes visible this value indicates that the element will be painted.
SVG Attribute reference - SVG: Scalable Vector Graphics
ondblclick, ondrag, ondragend, ondragenter, ondragexit, ondragleave, ondragover, ondragstart, ondrop, ondurationchange, onemptied, onended, onerror, onfocus, oninput, oninvalid, onkeydown, onkeypress, onkeyup, onload, onloadeddata, onloadedmetadata, onloadstart, onmousedown, onmouseenter, onmouseleave, onmousemove, onmouseout, onmouseover, onmouseup, onmousewheel, onpause, onplay, onplaying, onpro
gress, onratechange, onreset, onresize, onscroll, onseeked, onseeking, onselect, onshow, onstalled, onsubmit, onsuspend, ontimeupdate, ontoggle, onvolumechange, onwaiting graphical event attributes onactivate, onfocusin, onfocusout ...
<animateMotion> - SVG: Scalable Vector Graphics
html,body,svg { height:100%; margin: 0; padding: 0; display:block; } <svg viewbox="0 0 200 100" xmlns="http://www.w3.org/2000/svg"> <path fill="none" stroke="light
grey" d="m20,50 c20,-50 180,150 180,50 c180-50 20,150 20,50 z" /> <circle r="5" fill="red"> <animatemotion dur="10s" repeatcount="indefinite" path="m20,50 c20,-50 180,150 180,50 c180-50 20,150 20,50 z" /> </circle> </svg> usage context categoriesanimation elementpermitted contentany number of the following elements, in any order:descriptive elements<mpath> attributes keypo...
<ellipse> - SVG: Scalable Vector Graphics
note: ellipses are unable to specify the exact orientation of the ellipse (if, for example, you wanted to draw an ellipse tilted at a 45 de
gree angle), but it can be rotated by using the transform attribute.
<feBlend> - SVG: Scalable Vector Graphics
example svg <svg width="200" height="200" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <filter id="spotlight"> <feflood result="floodfill" x="0" y="0" width="100%" height="100%" flood-color="
green" flood-opacity="1"/> <feblend in="sourcegraphic" in2="floodfill" mode="multiply"/> </filter> </defs> <image xlink:href="//developer.mozilla.org/files/6457/mdn_logo_only_color.png" x="10%" y="10%" width="80%" height="80%" style="filter:url(#spotlight);"/> </svg> result specifications specification status comment filter effects module le...
<feConvolveMatrix> - SVG: Scalable Vector Graphics
note in the above formulas that the values in the kernel matrix are applied such that the kernel matrix is rotated 180 de
grees relative to the source and destination images in order to match convolution theory as described in many computer graphics textbooks.
<feFlood> - SVG: Scalable Vector Graphics
example html content <svg xmlns="http://www.w3.org/2000/svg" width="200" height="200"> <defs> <filter id="floodfilter" filterunits="userspaceonuse"> <feflood x="50" y="50" width="100" height="100" flood-color="
green" flood-opacity="0.5"/> </filter> </defs> <use style="filter: url(#floodfilter);"/> </svg> result specifications specification status comment filter effects module level 1the definition of '<feflood>' in that specification.
<feMerge> - SVG: Scalable Vector Graphics
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 core attributes presentation attributes filter primitive attributes class style specific attributes none dom interface this element implements the svgfemergeelement interface.
<feMergeNode> - SVG: Scalable Vector Graphics
x="-40" y="-20" width="100" height="200"> <feoffset in="sourcegraphic" dx="60" dy="60" /> <fegaussianblur in="sourcegraphic" 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);" /> <rect x="40" y="40" width="100" height="100" style="stroke: #000000; fill:
green;" /> </svg> result attributes global attributes core attributes » specific attributes in dom interface this element implements the svgfemergenodeelement interface.
<feOffset> - SVG: Scalable Vector Graphics
example svg <svg width="200" height="200" xmlns="http://www.w3.org/2000/svg"> <defs> <filter id="offset" width="180" height="180"> <feoffset in="sourcegraphic" dx="60" dy="60" /> </filter> </defs> <rect x="0" y="0" width="100" height="100" stroke="black" fill="
green"/> <rect x="0" y="0" width="100" height="100" stroke="black" fill="
green" filter="url(#offset)"/> </svg> result specifications specification status comment filter effects module level 1the definition of '<feoffset>' in that specification.
<filter> - SVG: Scalable Vector Graphics
example svg <svg width="230" height="120" xmlns="http://www.w3.org/2000/svg"> <filter id="blurme"> <fegaussianblur stddeviation="5"/> </filter> <circle cx="60" cy="60" r="50" fill="
green" /> <circle cx="170" cy="60" r="50" fill="
green" filter="url(#blurme)" /> </svg> result screenshotlive sample specifications specification status comment filter effects module level 1the definition of '<filter>' in that specification.
<g> - SVG: Scalable Vector Graphics
html,body,svg { height:100% } <svg viewbox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <!-- using g to inherit presentation attributes --> <g fill="white" stroke="
green" stroke-width="5"> <circle cx="40" cy="40" r="25" /> <circle cx="60" cy="60" r="25" /> </g> </svg> attributes this element only includes global attributes global attributes core attributes most notably: id, tabindex styling attributes class, style conditional processing attributes most notably: requiredextensions, systemlanguage event attributes global event attributes...
<marker> - SVG: Scalable Vector Graphics
h="5" markerheight="5"> <circle cx="5" cy="5" r="5" fill="red" /> </marker> </defs> <!-- coordinate axes with a arrowhead in both direction --> <polyline points="10,10 10,90 90,90" fill="none" stroke="black" marker-start="url(#arrow)" marker-end="url(#arrow)" /> <!-- data line with polymarkers --> <polyline points="15,80 29,50 43,60 57,30 71,40 85,15" fill="none" stroke="
grey" marker-start="url(#dot)" marker-mid="url(#dot)" marker-end="url(#dot)" /> </svg> attributes markerheight this attribute defines the height of the marker viewport.
<metadata> - SVG: Scalable Vector Graphics
<desc>one of those cool swivelling monitor stands that sit under the monitor</desc> <path d="m0,0 s 10 10 40 12"/> <path d="m80,0 s 70 10 40 12"/> <path d="m0,20 l 10 10 s 40 12 70 10 l 80 20z"/> </g> <g id="monitor"> <title>monitor</title> <desc>a very fancy monitor</desc> <rect width="160" height="120"/> <rect fill="light
grey" width="138" height="95" x="11" y="12"/> </g> <g id="processor" transform="translate(0 142)"> <title>the computer</title> <desc>a desktop computer - broad flat box style</desc> <rect width="160" height="60"/> <g id="discdrive" transform="translate(70 8)"> <title>disc drive</title> <desc>a built-in disc drive</desc> <rect w...
<set> - SVG: Scalable Vector Graphics
html,body,svg { height:100%; margin:0; padding:0; } <svg viewbox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"> <style> rect { cursor: pointer } .round { rx: 5px; fill:
green; } </style> <rect id="me" width="10" height="10"> <set attributename="class" to="round" begin="me.click" dur="2s" /> </rect> </svg> attributes to this attribute defines the value to be applied to the target attribute for the duration of the animation.
<solidcolor> - SVG: Scalable Vector Graphics
--> <lineargradient id="mygradient"> <stop offset="0" stop-color="
green" /> </lineargradient> </defs> <text x="10" y="20">circles colored with solidcolor</text> <circle cx="150" cy="65" r="35" stroke-width="2" stroke="url(#mycolor)" fill="white"/> <circle cx="50" cy="65" r="35" fill="url(#mycolor)"/> <text x="10" y="120">circles colored with lineargradient</text> <circle cx="150" cy="165" r="35" stroke-width="2" stroke="url(#mygradient)" ...
<svg> - SVG: Scalable Vector Graphics
html,body,svg { height:100% } <svg viewbox="0 0 300 100" xmlns="http://www.w3.org/2000/svg" stroke="red" fill="
grey"> <circle cx="50" cy="50" r="40" /> <circle cx="150" cy="50" r="4" /> <svg viewbox="0 0 10 10" x="200" width="100"> <circle cx="5" cy="5" r="4" /> </svg> </svg> attributes baseprofile deprecated since svg 2 the minimum svg language profile that the document requires.
Example - SVG: Scalable Vector Graphics
if( this.elt === null ) { var svg = 'http://www.w3.org/2000/svg'; this.elt = document.createelementns(svg,'line'); this.elt.setattributens(null,'stroke','
green'); this.elt.setattributens(null,'stroke-width','3'); this.elt.setattributens(null,'stroke-opacity','0.5'); display().appendchild( this.elt ); } this.elt.setattributens(null,'x1',old_x); this.elt.setattributens(null,'y1',old_y); this.elt.setattributens(null,'x2',this.x); this.elt.setattributens(null,'y2',this.y); } function update() { // first call?
Basic shapes - SVG: Scalable Vector Graphics
="75" rx="20" ry="5" stroke="red" fill="transparent" stroke-width="5"/> <line x1="10" x2="50" y1="110" y2="150" stroke="orange" stroke-width="5"/> <polyline points="60 110 65 120 70 115 75 130 80 125 85 140 90 135 95 150 100 145" stroke="orange" fill="transparent" stroke-width="5"/> <polygon points="50 160 55 180 70 180 60 190 65 205 50 195 35 205 40 190 30 180 45 180" stroke="
green" fill="transparent" stroke-width="5"/> <path d="m20,230 q40,205 50,230 t90,230" fill="none" stroke="blue" stroke-width="5"/> </svg> note: the stroke, stroke-width, and fill attributes are explained later in the tutorial.
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:yellow; } stop.end { stop-color:
green; } body.invalid stop.end { stop-color:red; } #err { display:none; } body.invalid #err { display:inline; } </style> <script> function signalerror() { document.getelementbyid('body').setattribute("class", "invalid"); } </script> </head> <body id="body" style="position:absolute; z-index:0; border:1px solid black; left:5%; top:5%; width:90%; height:90%;"> <form> <fieldset> <le...
Insecure passwords - Web security
hence, even if access to the username and password to your site doesn't seem like a huge risk to you, it is a
great risk to users who have used the same username and password to log in to their bank accounts.
Securing your site - Web security
note: this article is a work in pro
gress, and is neither complete nor does following its suggestions guarantee your site will be fully secure.
Axes - XPath
the following is an extremely brief description of the thirteen available axes and the de
gree of support available in gecko.
round - XPath
returns the nearest integer less then,
greater than, or equal todecimal.
Functions - XPath
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the following is an annotated list of core xpath functions and xslt-specific additions to xpath, including a description, syntax, a list of arguments, result-type, source in the appropriate w3c recommendation, and de
gree of present gecko support.
Index - XPath
19 ceiling xslt, xslt_reference the ceiling function evaluates a decimal number and returns the smallest integer
greater than or equal to the decimal number.
XSLT elements reference - XSLT: Extensible Stylesheet Language Transformations
he expression to be evaluated is placed inside curly brackets: <img src="{$image-dir}/mygraphic.jpg"/> this would result in the following: <img src="/images/mygraphic.jpg"/> the element annotations that follow include a description, a syntax listing, a list of required and optional attributes, a description of type and position, its source in the w3c recommendation and an explanation of the de
gree of present gecko support.
Web technology for developers
accessibilitycss houdinicss: cascading style sheetsdemos of open web technologiesdeveloper guidesexsltevent referencehtml: hypertext markup languagehttpjavascriptmathmlopensearch description formatprivacy, permissions, and information securitypro
gressive web apps (pwas)svg: scalable vector graphicstutorialsweb apisweb componentsweb performanceweb app manifestsweb media technologiesweb securityweb technology referencexml: extensible markup languagexpathxslt: extensible stylesheet language transformations ...
WebAssembly Concepts - WebAssembly
there are a number of online wasm assembler choices, such as: wasmfiddle wasmfiddle++ wasmexplorer these are
great resources for people who are trying to figure out where to start, but they lack some of the tooling and optimizations of emscripten.