Search completed in 0.97 seconds.
6565 results for "when":
Your results are loading. Please wait...
CustomElementRegistry.whenDefined() - Web APIs
the whendefined() method of the customelementregistry interface returns a promise that resolves when the named element is defined.
... syntax promise<> customelements.whendefined(name); parameters name custom element name.
... return value a promise that resolves to undefined when the custom element is defined.
...And 3 more matches
Checking when a deadline is due - Web APIs
the main example application we will be referring to in this article is to-do list notifications, a simple to-do list application that stores task titles and deadline times and dates via indexeddb, and then provides users with notifications when deadline dates are reached, via the notification, and vibration apis.
... the basic problem in the to-do app, we wanted to first record time and date information in a format that is both machine readable and human understandable when displayed, and then check whether each time and date is occurring at the current moment.
... when the form's submit button is pressed, we run the adddata() function, which starts like this: function adddata(e) { e.preventdefault(); if(title.value == '' || hours.value == null || minutes.value == null || day.value == '' || month.value == '' || year.value == null) { note.innerhtml += '<li>data not submitted — form incomplete.</li>'; return; } in this segment, we check to see ...
...And 2 more matches
When To Use ifdefs - Archive of obsolete content
when are ifdefs used?
...the only time when they might be a problem is in cross-platform extension code and locales: since this code is downloaded on multiple platforms, platform-specific ifdefs are generally out of the question.
...for instance, it is possible to disable most of the xul rendering engine by specifying --disable-xul when configuring the build.
... when adding ifdefs that implement these configure flags, care must be taken to obey the build dependencies.
<xsl:when> - XSLT: Extensible Stylesheet Language Transformations
WebXSLTElementwhen
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the <xsl:when> element always appears within an <xsl:choose> element, acting like a case statement.
... syntax <xsl:when test=expression> template </xsl:when> required attributes test specifies a boolean expression to be evaluated.
PRSeekWhence
syntax #include <prio.h> typedef prseekwhence { pr_seek_set = 0, pr_seek_cur = 1, pr_seek_end = 2 } prseekwhence; enumerators the enumeration has the following enumerators: pr_seek_set sets the file pointer to the value of the offset parameter.
Index - Web APIs
WebAPIIndex
found 5328 pages: # page tags and summary 1 web apis api, dom, landing, reference, web when writing code for the web, there are a large number of web apis available.
... 5 angle_instanced_arrays.vertexattribdivisorangle() angle_instanced_arrays, api, method, reference, webgl, webgl extension the angle_instanced_arrays.vertexattribdivisorangle() method of the webgl api modifies the rate at which generic vertex attributes advance when rendering multiple instances of primitives with ext.drawarraysinstancedangle() and ext.drawelementsinstancedangle().
... 6 abortcontroller api, abortcontroller, experimental, interface, reference the abortcontroller interface represents a controller object that allows you to abort one or more dom requests as and when desired.
...And 892 more matches
Document - Web APIs
WebAPIDocument
document.onfullscreenchange is an eventhandler representing the code to be called when the fullscreenchange event is raised.
... document.onfullscreenerror is an eventhandler representing the code to be called when the fullscreenerror event is raised.
... document.onselectionchange is an eventhandler representing the code to be called when the selectionchange event is raised.
...And 136 more matches
Index - Archive of obsolete content
7 window: deviceproximity event sensors, events the deviceproximity event is fired when fresh data is available from a proximity sensor.
... 110 system/unload register callbacks that are called when a module is unloaded.
... 175 boxes code snippets make the box style="display: block" and the wrapping behavior will occur when the box is resized: 176 canvas code snippets canvas, code snippets, graphics no summary!
...And 118 more matches
Index
MozillaTechXPCOMIndex
2 accessing the windows registry using xpcom add-ons, code snippets, extensions, needsclassification, windows registry when implementing windows-specific functionality, it is often useful to access the windows registry for information about the environment or other installed programs.
...it is a possiblity that is introduced when upgrading to a new compiler without recompiling everything.
...these exception objects may be thrown when implementing xpcom interfaces in javascript, and they can provide better diagnostics in the error console if not caught than simply throwing an nsresult's value will.
...And 94 more matches
GlobalEventHandlers - Web APIs
globaleventhandlers.onabort is an eventhandler representing the code to be called when the abort event is raised.
... globaleventhandlers.onanimationcancel an eventhandler called when an animationcancel event is sent, indicating that a running css animation has been canceled.
... globaleventhandlers.onanimationend an eventhandler called when an animationend event is sent, indicating that a css animation has stopped playing.
...And 86 more matches
IME handling guide
"closed" is also called "inactive" or "turned off") so, this document is useful when you're try to fix a bug for text input in gecko.
...when a user converts from hiragana characters to chinese characters the composition string, japanese ime separates the composition string into multiple clauses.
... when a user presses convert key, japanese ime separates the composition string as "わたしの" (my), "なまえは" (name is) and "なかのです" (nakano).
...And 82 more matches
Window - Web APIs
WebAPIWindow
the event object passed directly to event handlers should be used instead whenever possible.
... window.onappinstalled called when the page is installed as a webapp.
... window.ondevicelight an event handler property for any ambient light levels changes window.ondevicemotion called if accelerometer detects a change (for mobile devices) window.ondeviceorientation called when the orientation is changed (for mobile devices) window.ondeviceorientationabsolute an event handler property for any device orientation changes.
...And 64 more matches
Observer Notifications
called when xpcom is initialized.
... topic description browser:purge-session-history sent when the sanitizer runs to purge all history and other information.
... browser-lastwindow-close-requested sent when the browser wishes to close the last open browser window.
...And 60 more matches
XUL Events - Archive of obsolete content
when attaching event listeners using attributes, be aware that only one listener can be attached at a time.
... xul event reference subpages broadcastthe broadcast event is executed when the attributes of the element (such as a broadcaster) being listened to are changed.
... the event handler should be placed on an observer.checkboxstatechangethe checkboxstatechange event is executed when the state of a <checkbox> element has changed.closethe close event is executed when a request has been made to close the window when the user presses the close button.commandthe command event is executed when an element is activated.commandupdatethe commandupdate event is executed when a command update occurs on a <commandset>.
...And 53 more matches
Index - Archive of obsolete content
ArchiveMozillaXULIndex
when those elements have reached their maximum sizes, the elements with the next higher flexgroup are flexed.
...the same process occurs when decreasing the size, except in the other direction.
...custom query processors are xpcom components, must implement the nsixultemplatequeryprocessor interface and follow some conventions for when registering the component.
...And 52 more matches
Index - MDN Web Docs Glossary: Definitions of Web-related terms
even when both directionalities occur in the same paragraph, the text in each language must appear in its proper directionality.
... 49 cors-safelisted request header cors, fetch a cors-safelisted request header is one of the following http headers: 50 cors-safelisted response header cors, fetch, glossary, http a cors-safelisted response header is an http header which has been safelisted so that it will not be filtered when responses are processed by cors, since they're considered safe (as the headers listed in access-control-expose-headers).
... 84 compile time codingscripting, glossary, javascript the compile time is the time from when the program is first loaded until the program is parsed.
...And 52 more matches
Index
multiple elements of nss's own modules have been implemented with this interface, and nss makes use of this interface when talking to those modules.
... when checking whether a certificate is trusted or not, it's necessary to find a relevant trust anchor (root certificate) that represents the signing capability of a trusted third party, usually called a certificate authority (ca).
...when working with handles to private keys it's usually difficult (and undesired) that an application gets access to the raw key data; therefore it may be difficult to extract such data from nss.
...And 52 more matches
ARIA Test Cases - Accessibility
when documenting an issue, please also list it in the relevant compatibility table below.
... when possible provide a link to the bug in the database so that its status can be reviewed.
... widget test cases alert simple alert complex alert real alert example with aria-required and aria-invalid -- type in a email address without an at sign to test the alert expected at behavior: a screen reader or screen magnifier must speak an alert when it becomes visible.
...And 46 more matches
sslfnc.html
when this socket's session is finished, no other socket will be able to resume the session begun by this socket.
... keep the following in mind when deciding on the operating parameters you want to use with a particular socket: enabling the ssl_require_certificate option is not recommended.
... as mentioned in communication, when an application imports a socket into ssl after the tcp connection on that socket has already been established, it must call ssl_resethandshake to determine whether the socket is for a client or server.
...And 44 more matches
Event reference
most common categories resource events event name fired when error a resource failed to load.
... network events event name fired when online the browser has gained access to the network.
... focus events event name fired when focus an element has received focus (does not bubble).
...And 44 more matches
nsITextInputProcessor
this means that even when gecko changes the dom event behavior, it may not be necessary that the users of this interface need to be updated, i.e., the implementation of this class can be a cushion from the impact of gecko's change.
... finally, when you commit the composition with the last composition string, just do this: tip.commitcomposition(); when you commit composition with specific string, specify commit string with its argument: tip.commitcompositionwith("foo-bar-buzz"); when you cancel composition, just do this: tip.cancelcomposition(); when you dispatch keydown event (and one or more keypress events), just do this: var keye...
...var dodefault = tip.keydown(keyevent); when you dispatch keyup event, just do this: var keyevent = new keyboardevent("", { key: "a", code: "keya", keycode: keyboardevent.dom_vk_a }); var dodefault = tip.keyup(keyevent); startcomposition(), flushpendingcomposition(), commitcomposition(), commitcompositionwith(), and cancelcomposition() can take a keyboardevent which causes modifying the composition state.
...And 41 more matches
source-editor.jsm
umn, [optional] number aalign); void setselection(number astart, number aend); breakpoint management void addbreakpoint(number alineindex, [optional] string acondition); array getbreakpoints(); boolean removebreakpoint(number alineindex); properties attribute type description dirty boolean set this value to false whenever you save the text; the editor will update it to true when the content is changed.
... you can then use this value to detect when the contents of the text are different from your most recent save.
... in addition, when this value changes, the "dirtychanged" event is sent.
...And 40 more matches
MMgc - Archive of obsolete content
the garbage collector is "managing" it, detecting when the memory is no longer reachable from anywhere in the application and reclaiming it at that time.
...there is no need to delete instances of myobject, because the gc will clean them up automatically when they are unreachable.
...the finalizer (c++ destructor) of a gcfinalizedobject will be invoked when mmgc collects the object.
...And 39 more matches
Web Replay
the button will be colored blue when the tab is being recorded.
... this has the same effect as above but can be used when the developer tools are not open.
... live rewinding at any time while recording, the tab can be rewound to replay earlier behavior, all the way back to when the tab was opened or to the last time it navigated.
...And 39 more matches
Element - Web APIs
WebAPIElement
when used as a setter, replaces the element with nodes parsed from the given string.
... event handlers element.onfullscreenchange an event handler for the fullscreenchange event, which is sent when the element enters or exits full-screen mode.
... this can be used to watch both for successful expected transitions, but also to watch for unexpected changes, such as when your app is running in the background.
...And 38 more matches
Client-side storage - Learn web development
previous overview: client-side web apis modern web browsers support a number of ways for web sites to store data on the user's computer — with the user's permission — then retrieve it when necessary.
...on the user's machine) and then retrieve it when needed.
...this is useful when you just need to store some simple data, like the user's name, whether they are logged in, what color to use for the background of the screen, etc.
...And 37 more matches
<input>: The Input (Form Input) element - HTML: Hypertext Markup Language
WebHTMLElementinput
<input type="checkbox" name="checkbox"/> color a control for specifying a color; opening a color picker when active in supporting browsers.
...opens a date picker or numeric wheels for year, month, day when active in supporting browsers.
...opens a date picker or numeric wheels for date- and time-components when active in supporting browsers.
...And 37 more matches
context-menu - Archive of obsolete content
usage instead of manually adding items when particular contexts occur and then removing them when those contexts go away, you bind items to contexts, and the adding and removing is automatically handled for you.
...when the user invokes the context menu, all of the items bound to the current context are automatically added to the menu.
... for example, if your add-on needs to add a context menu item whenever the user visits a certain page, don't create the item when that page loads, and don't remove it when the page unloads.
...And 36 more matches
Advanced Svelte: Reactivity, lifecycle, accessibility - Learn web development
we also need to learn a bit about component lifecycle, to understand when these dom nodes get mounted and and unmounted from the dom and how we can access them.
... when the first button is clicked, we'll emit a checkall event to signal that all the todos should be checked/unchecked.
... when the second button is clicked, we'll emit a removecompleted event to signal that all of the completed todos should be removed.
...And 36 more matches
An Overview of XPCOM
when two or more related components are grouped together in a binary library, the library is referred to as a module.
... performance when code is modularized, modules that are not necessary right away can be "lazy loaded", or not loaded at all, which can improve the performance of your application.
... maintenance even when you are not updating a component, designing your application in a modular way can make it easier for you to find and maintain the parts of the application that you are interested in.
...And 36 more matches
Gecko info for Windows accessibility vendors
when you see the content window receive focus, first check the role.
... gecko also helps determine when to load a new window by firing two event_state_change's on the root role_document accessible -- the first state change indicates the document pane is now busy loading.
...when handling the event, use get_accstate() to check the state_busy flag.
...And 34 more matches
Signaling and video calling - Web APIs
what does matter is when the ice subsystem instructs you to send signaling data to the other peer, you do so, and the other peer knows how to receive this information and deliver it to its own ice subsystem.
... exchanging session descriptions when starting the signaling process, an offer is created by the user initiating the call.
... note: the important thing to note is this: the only thing your code is responsible for during ice negotiation is accepting outgoing candidates from the ice layer and sending them across the signaling connection to the other peer when your onicecandidate handler is executed, and receiving ice candidate messages from the signaling server (when the "new-ice-candidate" message is received) and delivering them to your ice layer by calling rtcpeerconnection.addicecandidate().
...And 33 more matches
Implementing a Microsoft Active Accessibility (MSAA) Server - Accessibility
when to use msaa, and when not to it's a common mistake to say that msaa is not worth using, for a number of reasons.
... msaa decision-making guide use msaa whenever you have created custom controls where you're handling the drawing, mouse and keyboard accessibility in your own code.
...when your application closes, different signals are typically broadcast.
...And 32 more matches
Handling common accessibility problems - Learn web development
when we say accessibility in the context of web technology, most people immediately think of making sure websites/apps are usable by people with disabilities, for example: visually impaired people using screen readers or magnification/zoom to access text people with motor function impairments using the keyboard (or other non-mouse features) to activate website functionality.
... another tip — as shown in our example, you can control how your focusable elements look when focused, using the :focus pseudo-class.
... it is a good idea to double up focus and hover styles, so your users get that visual clue that a control will do something when activated, whether they are using mouse or keyboard: a:hover, input:hover, button:hover, select:hover, a:focus, input:focus, button:focus, select:focus { font-weight: bold; } note: if you do decide to remove the default focus styling using css, make sure you replace it with something else that fits in with your design better — it is a very valuable accessiblity tool, and should not be removed.
...And 31 more matches
UI pseudo-classes - Learn web development
this included some usage of pseudo-classes, for example using :checked to target a checkbox only when it is selected.
... the original pseudo-classes available to us (as of css 2.1) that are relevant to forms are: :hover: selects an element only when it is being hovered over by a mouse pointer.
... :focus: selects an element only when it is focused (i.e.
...And 30 more matches
SVG documentation index - SVG: Scalable Vector Graphics
WebSVGIndex
when svg documents are embedded within a parent html document using the tag: 6 namespaces crash course svg, xml as an xml dialect, svg is namespaced.
...they specifies some script to run when the event of the given type is dispatched to the element on which the attributes are specified.
... 24 amplitude needscompattable, svg, svg attribute the amplitude attribute controls the amplitude of the gamma function of a component transfer element when its type attribute is gamma.
...And 30 more matches
Introduction to events - Learn web development
a series of fortunate events as mentioned above, events are actions or occurrences that happen in the system you are programming — the system produces (or "fires") a signal of some kind when an event occurs, and provides a mechanism by which an action can be automatically taken (that is, some code running) when the event occurs.
... for example, in an airport, when the runway is clear for take off, a signal is communicated to the pilot.
... each available event has an event handler, which is a block of code (usually a javascript function that you as a programmer create) that runs when the event fires.
...And 29 more matches
Bytecode Descriptions
implements: propertydefinitionevaluation for methods, steps 3 and 4, when enumerable is false.
...implements: makeconstructor, step 8, when writableprototype is false.
...this instruction is used when an array literal contains a spreadelement.
...And 29 more matches
Index - Learn web development
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 progress in your work.
... accessibility, beginner, design, example, intro, mobile, needsactivelearning when you're building a website, one top issue to consider is universal design: accommodating all users regardless of disability, technical constraints, culture, location, and so on.
... beginner, composing, needsactivelearning, needsschema when starting with a web project, many people focus on the technical side.
...And 28 more matches
CustomizableUI.jsm
when a customizable toolbar's xbl binding is constructed (generally, that is when a <toolbar customizable="true"/> node is appended to the document and isn't invisible), the binding will call into customizableui and register the toolbar's node as being one of the concrete instances of its area.
...these come in 3 types themselves: button which are simple toolbar buttons which do something when clicked view which are toolbar buttons with a 'view' of further options.
... the view can be shown as its own panel when such a widget is in the toolbar, or as a sliding 'subview' of the menu panel when such a widget is in the menu panel.
...And 28 more matches
HTTP Index - HTTP
WebHTTPIndex
19 cross-origin resource policy (corp) http, reference, security cross-origin resource policy is an opt-in mechanism that allows web applications to protect against certain cross-origin requests, such as those issued by the browser when resources are embedded using elements such as <script> and <img>.
...when this happens, the user needs to turn cors back on in their browser.
...this header specifies a comma-delineated list of the http methods which may be used when using cors to access the url specified in the request; if the request is using any other method, this error occurs.
...And 28 more matches
Starting WebLock
in order to be started up or notified when some event happens, the sample component has to hook into mozilla, which it can do either by overriding an existing component or by registering for some event that will cause it to start up.
... weblock does the latter and gets called when a gecko profile startup occurs.
... when a gecko application starts up, registered components are created and notified via the general-purpose observer interface nsiobserver.
...And 27 more matches
Mozilla internal string guide
nsliteral[c]string is trivially constructible and destructible, and therefore does not emit construction/destruction code when stored in statics, as opposed to the other string classes.
...once you are familiar with them, see the appendix describing what class to use when.
...for example: // when passing a string to a method, use const nsastring& nsfoo::printstring(const nsastring &str); // when getting a string from a method, use nsastring& nsfoo::getstring(nsastring &result); the abstract classes are also sometimes used to store temporary references to objects.
...And 26 more matches
Error codes returned by Mozilla APIs
the following tables list errors that can occur when calling various mozilla apis.
...for example, by using components.results.ns_error_not_initialized general errors the following errors are general and can occur when using any component.
... ns_error_null_pointer (0x80004003) an error occurred because a value was set to null when this was not expected.
...And 25 more matches
WebIDL bindings
it is a good fit for when the specification allows a usvstring, but you want to process the string as utf-8 rather than utf-16.
...if areportexceptions is set to erethrowexceptions, js exceptions will be stashed in the errorresult and will be reported when the stack unwinds to wherever the errorresult was set up.
...when this is done, passing in a null jscontext* is allowed if the passed-in js::value is js::nullvalue().
...And 25 more matches
Index - Firefox Developer Tools
2 3d view html, tools, web development, web development:tools when you click on the 3d view button, the page goes into 3d view mode; in this mode, you can see your page presented in a 3d view in which nested blocks of html are increasingly "tall," projecting outward from the bottom of the page.
...this is the two-pane inspector that appears when ctrl+shift+i (or cmd+shift+i) is pressed from one of the applications for which dom inspector has explicit support (i.e., menuitems placed via overlay).
... 18 debugger when called as a constructor, the debugger object creates a new debugger instance.
...And 25 more matches
RTCPeerConnection - Web APIs
this lets you detect, for example, when collection of ice candidates has finished.localdescription read only the read-only property rtcpeerconnection.localdescription returns an rtcsessiondescription describing the session for the local end of the connection.
...see signaling in lifetime of a webrtc session for more details about the signaling process.event handlersalso inherits event handlers from: eventtargetonaddstream the rtcpeerconnection.onaddstream event handler is a property containing the code to execute when the addstream event, of type mediastreamevent, is received by this rtcpeerconnection.
... such an event is sent when a mediastream is added to this connection by the remote peer.
...And 25 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 progress through this article.
... zero or more values that represent any parameters you want to pass to the function when it is run.
... settimeout() returns an identifier value that can be used to refer to the timeout later, such as when you want to stop it.
...And 24 more matches
Working with Svelte stores - Learn web development
components can subscribe to stores and receive notifications when their values change.
... moreover, when your app becomes complicated and your component hierarchy gets complex, it might become too difficult for components to relay data between each other.
... a store is simply an object with a subscribe() method that allows interested parties to be notified whenever the store value changes, and an optional set() method that allows you to set new values for the store.
...And 24 more matches
Focus management with Vue refs - Learn web development
specifically, when a user activates the "edit" button, we remove the "edit" button from the dom, but we don't move the user's focus anywhere, so in effect it just disappears.
...in addition, what happens when you press tab again varies depending on the browser you're using.
... to give users a better experience, we'll add code to control the focus so that it gets set to the edit field when the edit form is shown.
...And 24 more matches
LiveConnect Overview - Archive of obsolete content
when programming in javascript, you can use a wrapper object to access methods and fields of the java object; calling a method or accessing a property on the wrapper results in a call on the java object.
...when a javascript object is sent to java, the runtime engine creates a java wrapper of type jsobject; when a jsobject is sent from java to javascript, the runtime engine unwraps it to its original javascript object type.
...javascript to java communication when you refer to a java package or class, or work with a java object or array, you use one of the special liveconnect objects.
...And 23 more matches
Browser API
the following new events can be listened for: mozbrowseractivitydone sent when something inside the browser <iframe> triggers a web activity, and that web activity's message is consumed by the receiving app.
... mozbrowserasyncscroll sent when the browser <iframe> content scrolls (the apcz version.) see also mozbrowserscroll.
... mozbrowseraudioplaybackchange sent when audio starts or stops playing within the browser <iframe> content.
...And 23 more matches
Using IndexedDB - Web APIs
console.error("database error: " + event.target.errorcode); }; one of the common possible errors when opening a database is ver_err.
... creating or updating the version of the database when you create a new database or increase the version number of an existing database (by specifying a higher version number than you did previously, when opening a database), the onupgradeneeded event will be triggered and an idbversionchangeevent object will be passed to any onversionchange event handler set up on request.result (i.e., db in the example).
...whenever a value is stored in an object store, it is associated with a key.
...And 23 more matches
widget - Archive of obsolete content
you can attach panels to them that open when they're clicked, or you can define a custom click handler to perform some other action, like opening a web page in a tab.
...turl: data.url("buttons.html") }); player.port.emit("init"); player.port.on("play", function() { console.log("playing"); }); player.port.on("pause", function() { console.log("pausing"); }); player.port.on("stop", function() { console.log("stopping"); }); attaching panels to widgets you can supply a panel to the widget's constructor: if you do this, the panel is automatically displayed when the user clicks the widget.
...widgets.widget({ id: "auto-update-widget", label: "widget that updates content on a timer", content: "0", contentscript: 'settimeout(function() {' + ' document.body.innerhtml++;' + '}, 2000)', contentscriptwhen: "ready" }); // a widget created with a specified width, that grows.
...And 22 more matches
Migrate apps from Internet Explorer to Mozilla - Archive of obsolete content
introduction when netscape started the mozilla browser, it made the conscious decision to support w3c standards.
...browser sniffing is usually done through the useragent, such as: mozilla/5.0 (x11; u; linux i686; en-us; rv:1.5) gecko/20031016 while using the useragent to sniff the browser provides detailed information on the browser in use, code that handles useragents often can make mistakes when new browser versions arrive, thus requiring code changes.
... useragent sniffing makes sense in very limited cases where you really do want to know the exact browser in use, such as when you need to work around a bug in a specific version of a specific browser.
...And 22 more matches
Graceful asynchronous programming with Promises - Learn web development
there is no guarantee of exactly when the operation will complete and the result will be returned, but there is a guarantee that when the result is available, or the promise fails, the code you provide will be executed in order to do something else with a successful result, or to gracefully handle a failure case.
... generally, you are less interested in the amount of time an async operation will take to return its result (unless of course, it takes far too long!), and more interested in being able to respond to it being returned, whenever that is.
...even if the handlecallbutton() function has already returned to the code that called it, when getusermedia() has finished working, it calls the handler you provide.
...And 22 more matches
HTMLMediaElement - Web APIs
note: automatically playing audio when the user doesn't expect or desire it is a poor user experience and should be avoided in most cases, though there are exceptions.
... htmlmediaelement.controlslist read only returns a domtokenlist that helps the user agent select what controls to show on the media element whenever the user agent shows its own set of controls.
... htmlmediaelement.loop a boolean that reflects the loop html attribute, which indicates whether the media element should start over when it reaches the end.
...And 22 more matches
RDF Modifications - Archive of obsolete content
« previousnext » one of the most useful aspects of using templates with rdf datasources is that when the rdf datasource changes, for instance a new triple is added, or a triple is removed, the template updates accordingly, adding or removing result output as needed.
...when the datasource is modified, the datasource will notify any observers of the change.
...you don't need to implement this observer yourself, although you may add an observer to the datasource if you want to be notified when the data changes.
...And 21 more matches
How to build custom form controls - Learn web development
we will also discuss how, when, and whether building your own control makes sense, and what to consider when building a control is a requirement.
...let's start by defining how the control reaches each state: the control is in its normal state when: the page loads.
... the control is in its active state when: the user clicks on it or touches it on a touch screen.
...And 21 more matches
Componentizing our Svelte app - Learn web development
first of all, we need to import it — add the following line at the top of the todos.svelte <script> section: import filterbutton from './filterbutton.svelte' now, replace the filters <div> with a call to the filterbutton component, which takes the current filter as a prop — the below line is all you need: <filterbutton {filter} /> note: remember that when the html attribute name and variable matches, they can be replaced with {variable}, that's why we could replace <filterbutton filter={filter} /> with <filterbutton {filter} />.
...you'll notice that when you click on the filter buttons, they are selected and the style updates appropriately.
...whenever the user clicks on any filter button, the child will call the onclick handler, passing the selected filter as a parameter, back up to its parent.
...And 21 more matches
Handling common JavaScript problems - Learn web development
these days, most cross-browser javascript problems are seen: when poor-quality browser-sniffing code, feature-detection code, and vendor prefix usage block browsers from running code they could otherwise use just fine.
... when developers make use of new/nascent javascript features (for example ecmascript 6 / ecmascript next features, modern web apis...) in their code, and find that such features don't work in older browsers.
...when clicked, each one should alert a message containing its number (the value of i at the time it was created), however each one reports i as 11, because for loops do all their iterating before nested functions are invoked.
...And 21 more matches
Navigation and resource timings - Web Performance
the order is: performance timings details navigationstart when the prompt for unload terminates on the previous document in the same browsing context.
... secureconnectionstart when the secure connection handshake starts.
... redirectstart when the first http redirect starts.
...And 21 more matches
XForms Input Element - Archive of obsolete content
representations the xforms input element can be represented by the following widgets for the spcified data types (or types derived from these data types): text field - the default widget when no type is specified or the data is of type xsd:string (xhtml/xul) checkbox - used for xsd:boolean instance data.
... (xhtml/xul) datepicker - used to represent data of type xsd:date (xhtml/xul) calendar - used to represent data of type xsd:date when appearance attribute also has the value 'full' (xhtml/xul) month list - used to represent data of type xsd:gmonth (xhtml only) days list - used to represent data of type xsd:gday (xhtml only) number field - used to represent data of numeric type (fx 3.0 only, xul only) more detail about each of these widgets follows below.
...xforms inputs are most often used when a form author needs to allow for the input/output of simple text into an instance node.
...And 20 more matches
CSS and JavaScript accessibility best practices - Learn web development
previous overview: accessibility next css and javascript, when used properly, also have the potential to allow for accessible web experiences ...
...as we frequently mentioned in our html: a good basis for accessibility article, you should use the appropriate semantic element for the job, whenever possible.
... href="https://www.mozilla.org">mozilla homepage</a>.</p> some very simple link styling is shown below: a { color: #ff0000; } a:hover, a:visited, a:focus { color: #a60000; text-decoration: none; } a:active { color: #000000; background-color: #a60000; } the standard link conventions are underlined and a different color (default: blue) in their standard state, another color variation when the link has previously been visited (default: purple), and yet another color when the link is activated (default: red).
...And 20 more matches
WAI-ARIA basics - Learn web development
the initial solution was to add one or more hidden links at the top of the page to link to the navigation (or whatever else), for example: <a href="#hidden" class="hidden">skip to navigation</a> but this is still not very precise, and can only be used when the screenreader is reading from the top of the page.
... note: some javascript libraries support wai-aria, meaning that when they generate ui features like complex form controls, they add aria attributes to improve the accessibility of those features.
... if you are looking for a 3rd party javascript solution for rapid ui development, you should definitely consider the accessibility of its ui widgets as an important factor when making your choice.
...And 20 more matches
Download
method overview promise start(); promise launch(); promise showcontainingdirectory(); promise cancel(); promise removepartialdata(); promise whensucceeded(); promise finalize([optional] boolean aremovepartialdata); properties attribute type description canceled read only boolean indicates that the download has been canceled.
... this property can become true, then it can be reset to false when a canceled download is restarted.
... error read only downloaderror when the download fails, this is set to a downloaderror instance indicating the cause of the failure.
...And 20 more matches
Plug-in Basics - Plugins
like a plug-in, the browser starts a helper application when the browser encounters a mime type that is mapped to it.
... when the browser encounters a mime type, it always searches for a registered plug-in first.
... when gecko starts, it looks for plugin modules in particular places on the system.
...And 20 more matches
HTMLElement - Web APIs
htmlelement.title is a domstring containing the text that appears in a popup box when mouse is over the element.
... invalid fired when an element does not satisfy its constraints during constraint validation.
... animation events animationcancel fired when an animation unexpectedly aborts.
...And 20 more matches
Starting up and shutting down a WebXR session - Web APIs
your document needs to either have been loaded from the local drive (such as by using an url such as http://localhost/...), or using https when loading the page.
...setting it to null signals that the polyfill can be garbage collected when no objects depending on it are using it anymore.
...when you're ready to create your reference space, you can try for a local space, and if that fails, fall back to a viewer reference space, which all devices are required to support.
...And 20 more matches
panel - Archive of obsolete content
a panel's content is loaded as soon as it is created, before the panel is shown, and the content remains loaded when a panel is hidden, so it is possible to keep a panel around in the background, updating its content as appropriate in preparation for the next time it is shown.
... your add-on can receive notifications when a panel is shown or hidden by listening to its show and hide events.
... the following add-on adds a button which displays a panel when clicked.
...And 19 more matches
Anonymous Content - Archive of obsolete content
scoping and access using the dom when a binding is attached and certain conditions are met, the children of the binding's content element are cloned.
...when anonymous content elements are built above the bound element, the topmost elements' parentnode pointers are set to the bound element's parentnode.
... content generation rules for generation whenever bindings are attached to an element, anonymous content will potentially be generated or destroyed.
...And 19 more matches
Dynamic behavior in Svelte: working with variables and props - Learn web development
svelte will use it to diff the list when data changes, rather than adding or removing items at the end, and it's a good practice to always specify one.
... finally, an :else block can be provided, which will be rendered when the list is empty.
...this will be used if the component's consumer doesn't specify the prop on the component — or if its initial value is undefined — when instantiating the component.
...And 19 more matches
Using Service Workers - Web APIs
however, it made many assumptions about what you were trying to do and then broke horribly when your app didn’t follow those assumptions exactly.
... note: as of firefox 44, when appcache is used to provide offline support for a page a warning message is now displayed in the console advising developers to use service workers instead (bug 1204581.) service workers should finally fix these issues.
...using a service worker you can easily set an app up to use cached assets first, thus providing a default experience even when offline, before then getting more data from the network (commonly known as offline first).
...And 19 more matches
Using DTMF with WebRTC - Web APIs
when you wish to transmit dtmf signals, you first need to decide which track to send them on, since dtmf is sent as a series of out-of-band payloads on the rtcrtpsender responsible for transmitting that track's data to the other peer.
...when the tone buffer is empty, indicating that all the tones have been sent, a tonechange event with its tone property set to "" (an empty string) is delivered to the connection object.
...when the button is clicked, a dtmf string is sent over the connection using rtcdtmfsender.insertdtmf().
...And 19 more matches
Inputs and input sources - Web APIs
when the targeting ray mode is gaze, the ray's origin is at the viewer and simply aims in the direction the user is facing.
... mapping a grip space to the world origin when the controller is positioned below and to the left of the world origin, and closer to us than the world origin is.
... managing input sources when multiple input sources are available, you need to be able to obtain information about each one, including its position and orientation, its targeting ray (if applicable to your needs), and details that can help you decide how to present the input source visually, if at all.
...And 19 more matches
Media events - Developer guides
various events are sent when handling media that are embedded in html documents using the <audio> and <video> elements; this section lists them and provides some helpful information about using them.
... event name description abort sent when playback is aborted; for example, if the media is playing and is restarted from the beginning, this event is sent.
... canplay sent when enough data is available that the media can be played, at least for a couple of frames.
...And 19 more matches
Index - HTTP
WebHTTPHeadersIndex
browsers set adequate values for this header depending on the context where the request is done: when fetching a css stylesheet a different value is set for the request than when fetching an image, video or a script.
... 7 access-control-allow-credentials cors, http, reference, header the access-control-allow-credentials response header tells browsers whether to expose the response to frontend javascript code when the request's credentials mode (request.credentials) is "include".
... 9 access-control-allow-methods cors, http, reference, header the access-control-allow-methods response header specifies the method or methods allowed when accessing the resource in response to a preflight request.
...And 19 more matches
tabs - Archive of obsolete content
usage open a tab you can open a new tab, specifying various properties including location: var tabs = require("sdk/tabs"); tabs.open("http://www.example.com"); track tabs you can register event listeners to be notified when tabs open, close, finish loading dom content, or are made active or inactive: var tabs = require("sdk/tabs"); // listen for tab openings.
...s = require('sdk/tabs'); tabs.on('ready', function () { console.log('first: ' + tabs[0].title); console.log('last: ' + tabs[tabs.length-1].title); }); you can access the currently active tab: var tabs = require('sdk/tabs'); tabs.on('activate', function () { console.log('active: ' + tabs.activetab.url); }); track a single tab given a tab, you can register event listeners to be notified when the tab is closed, activated or deactivated, or when the page hosted by the tab is loaded or retrieved from the "back-forward cache": var tabs = require("sdk/tabs"); function onopen(tab) { console.log(tab.url + " is open"); tab.on("pageshow", logshow); tab.on("activate", logactivate); tab.on("deactivate", logdeactivate); tab.on("close", logclose); } function logshow(tab) { console.
... events open this event is emitted when a new tab is opened.
...And 18 more matches
Listening to events in Firefox extensions - Archive of obsolete content
some of the more interesting dom events you may wish to monitor are listed here: event description domlinkadded dispatched when a new html <link> element is detected in the document.
... domtitlechanged dispatched when the title of the page changes.
... domcontentloaded dispatched when the initial dom for the page is completely loaded.
...And 18 more matches
Textbox (XPFE autocomplete) - Archive of obsolete content
alwaysopenpopup obsolete since gecko 1.9.1 type: boolean note: applies to: thunderbird and seamonkeyif true, the autocomplete popup will be displayed even when there are no matches.
... enablehistory new in thunderbird 1requires seamonkey 2.0 type: boolean if true, an arrow button will appear on the end of the textbox which, when pressed, will open a dropdown menu of all available results.
... forcecomplete obsolete since gecko 1.9.1 type: boolean if true, the textbox will be filled in with the best match when it loses the focus.
...And 18 more matches
HTML parser threading
it also has another lazily initialized tokenizer/tree builder for speculatively scanning the tail of document.write() data when the parser blocks without parsing the document.write() data to completion.
...it's more efficient to obtain a mutex only every once in a while when a whole bunch of tree ops is moved to or from the staging queue.
...(the same runnable is used repeatedly in order to avoid cross-thread refcounting issues.) memory management when crossing the thread boundary the tree ops hold various heap-allocated objects that end up crossing the thread boundary.
...And 18 more matches
HTTP Cache
when there is no profile the new http cache works, but everything is stored only in memory not obeying any particular limits.
... currently we have 3 types of storages, all the access methods return an nsicachestorage object: memory-only (memorycachestorage): stores data only in a memory cache, data in this storage are never put to disk disk (diskcachestorage): stores data on disk, but for existing entries also looks into the memory-only storage; when instructed via a special argument also primarily looks into application caches application cache (appcachestorage): when a consumer has a specific nsiapplicationcache (i.e.
... a particular app cache version in a group) in hands, this storage will provide read and write access to entries in that application cache; when the app cache is not specified, this storage will operate over all existing app caches the service also provides methods to clear the whole disk and memory cache content or purge any intermediate memory structures: clear – after it returns, all entries are no longer accessible through the cache apis; the method is fast to execute and non-blocking in any way; the actual erase happens in background purgefrommemory – removes (schedules to remove) any intermediate cache data held in memory for faster access (more about the intermediate cache below) nsiloadcontextinfo distinguishes the scope of the ...
...And 18 more matches
Using microtasks in JavaScript with queueMicrotask() - Web APIs
javascript promises and the mutation observer api both use the microtask queue to run their callbacks, but there are other times when the ability to defer work until the current event loop pass is wrapping up.
... tasks get added to the task queue when: a new javascript program or subprogram is executed (such as from a console, or by running the code in a <script> element) directly.
...only tasks which were already in the task queue when the event loop pass began will be executed during the current iteration.
...And 18 more matches
Pointer events - Web APIs
however, for scenarios when device-specific handling is desired, pointer events defines a pointertype property to inspect the device type which produced the event.
... terminology active buttons state the condition when a pointer has a non-zero value for the buttons property.
... for example, in the case of a pen, when the pen has physical contact with the digitizer, or at least one button is depressed while hovering.
...And 18 more matches
XUL element attributes - Archive of obsolete content
« xul reference home the following attributes are common to all xul elements: align type: one of the values below the align attribute specifies how child elements of the box are aligned, when the size of the box is larger than the total size of the children.
...when multiple datasources are used, one may override an assertion from another.
...when multiple datasources are used, one may override an assertion from another.
...And 17 more matches
XPCOM array guide
MozillaTechXPCOMGuideArrays
when holding pointers, doesn't own the pointer.
...when holding pointers, doesn't own the pointer.
... when the array can or should be modified, then use nsimutablearray: // array is read-only because it uses nsiarray void printsize(nsiarray* elements) { pruint32 count; elements->getlength(&count); printf("there are %d elements.\n", count); } // using nsimutablearray, so callee may modify void tweakarray(nsimutablearray* elements) { elements->removeelementat(0); elements->appendelement(newe...
...And 17 more matches
Getting Started Guide
when that count goes to zero, the interface may delete itself.
... clients are expected to keep this reference count accurate by incrementing it when they acquire a reference to the interface, and decrementing it before they let go.
...the caller can then hold onto the reference indefinitely, calling release when it no longer needs it.
...And 17 more matches
Migrating from Firebug - Firefox Developer Tools
when migrating from firebug to the firefox developer tools, you may wonder where the features you loved in firebug are available in the developer tools.
...that means that when you open a page on the same origin in a different tab, firebug gets opened automatically.
... and when you open a page of a different origin in the same tab, it closes automatically.
...And 17 more matches
PerformanceTiming - Web APIs
performancetiming.navigationstart read only when the prompt for unload terminates on the previous document in the same browsing context.
... performancetiming.unloadeventstart read only when the unload event has been thrown, indicating the time at which the previous document in the window began to unload.
... performancetiming.unloadeventend read only when the unload event handler finishes.
...And 17 more matches
Appendix: What you should know about open-source software licenses - Archive of obsolete content
in this chapter, i’ll explain some of the basics: what open-source software (oss) licenses are, what types of licenses exist, and when they’re appropriate.
... the different meanings of the word “use” when we talk about the ways an author uses a work, we mean printing or recording and distributing it.
...when we talk about a driver’s license, we mean a permit to drive a car.
...And 16 more matches
Menu - Archive of obsolete content
ArchiveMozillaJetpackUIMenu
beforeshow may modify the menu, and when the menu is shown, it will reflect the changes.
...if the menu is hidden, it will reflect the changes when it is next shown.
...the menu will be shown when the node is left-clicked.
...And 16 more matches
Menus - Archive of obsolete content
when the menu or button is clicked the menu is opened, listing the commands that are available.
... menu the menu tag is used when placing menus on a menu bar.
...this type of menu would be used when you want to have a set of commands yet don't want to use a menu bar, for example in a dialog box.
...And 16 more matches
textbox - Archive of obsolete content
emptytext deprecated since gecko 2 type: string a string that appears in the textbox when it has no value.
... increment type: integer the amount by which the curpos (for scroll bars) or value (for number boxes and scale) attribute changes when the arrows are clicked(or scales are dragged).
... to the first newline, dropping the rest of the text replacewithcommas pastes the text with the newlines replaced with commas replacewithspaces pastes the text with newlines replaced with spaces strip pastes the text with the newlines removed stripsurroundingwhitespace pastes the text with newlines and adjacent whitespace removed onblur type: script code this event is sent when a textbox loses keyboard focus.
...And 16 more matches
Application cache implementation overview
when aentrystatus is a success code, entry has been found and we are loading it from the cache.
...when aentrystatus is a failure code, entry has not been found, but the url is falling under one of the network or fallback namespaces.
... when matching fallback namespace, the associated fallback entry for it is remembered.
...And 16 more matches
Eclipse CDT
when eclipse's indexer tries to process the mozilla source, eclipse will need considerably more memory than the limits imposed by its default configuration.
...set an initial heap space of 1 gb and max heap space of 5 gb, say, by modifying the values of the following two lines in eclipse.ini: -xms1g -xmx5g if you fail to increase these limits, then you will likely find that eclipse either hangs when it tries to index the mozilla source or else that the code intelligence is very broken after the indexing "completes".
...rerun it (and then rebuild the index) once a week or so, or as necessary when you start to notice unusual code assistance issues that aren't fixed by rebuilding the index alone.
...And 16 more matches
PKCS11 Implement
general-purpose functions c_initialize the nss calls c_initialize on startup or when it loads a new module.
... c_finalize the nss calls c_finalize on shutdown and whenever it unloads a module.
... c_getfunctionlist the nss calls c_getfunctionlist on startup or when it loads a new module.
...And 16 more matches
Index
whenever practical, new code and changes should move code closer to the ideal future.
... 67 js::setlargeallocationfailurecallback jsapi reference, reference, référence(2), spidermonkey if a large allocation fails when calling pod_{calloc,realloc}cangc, the js engine may call the large-allocation- failure callback, if set, to allow the embedding to flush caches, possibly perform shrinking gcs, etc.
... 91 jsclass.call jsapi reference, spidermonkey note that when a custom object is called, a this argument is calculated for it just as if it were a function.
...And 16 more matches
EventTarget.addEventListener() - Web APIs
the eventtarget method addeventlistener() sets up a function that will be called whenever the specified event is delivered to the target.
... listener the object that receives a notification (an object that implements the event interface) when an event of the specified type occurs.
...if true, the listener would be automatically removed when invoked.
...And 16 more matches
Intersection Observer API - Web APIs
when a site is loaded with these tests, things can get downright ugly.
... the intersection observer api lets code register a callback function that is executed whenever an element they wish to monitor enters or exits another element (or the viewport), or when the amount by which the two intersect changes by a requested amount.
... one thing the intersection observer api can't tell you: the exact number of pixels that overlap or specifically which ones they are; however, it covers the much more common use case of "if they intersect by somewhere around n%, i need to do something." intersection observer concepts and usage the intersection observer api allows you to configure a callback that is called: (1) whenever one element, called the target, intersects either the device viewport or a specified element; for the purpose of this api, this is called the root element or root (2) and whenever the observer is asked to watch a target for the very first time typically, you'll want to watch for intersection changes with regard to the element's closest scrollable ancestor, or, if the element isn't a descend...
...And 16 more matches
Advanced techniques: Creating and sequencing audio - Web APIs
when they are enabled the note will sound.
... when the instrument plays, it will move across this set of beats and loop the bar.
... creating an audio context as you should be used to by now, each web audio api app starts with an audio context: // for cross browser compatibility const audiocontext = window.audiocontext || window.webkitaudiocontext; const audioctx = new audiocontext(); the "sweep" — oscillators, periodic waves, and envelopes for what we will call the "sweep" sound, that first noise you hear when you dial up, we're going to create an oscillator to generate the sound.
...And 16 more matches
Applying color to HTML elements using CSS - HTML: Hypertext Markup Language
maybe that's why color is one of the first things people often want to experiment with when learning to develop websites.
... we're going to touch on most of what you'll need to know when using color, including a list of what you can color and what css properties are involved, how you describe colors, and how to actually use colors both in stylesheets and in scripts.
... text whenever an element is rendered, these properties are used to determine the color of the text, its background, and any decorations on the text.
...And 16 more matches
Chapter 3: Introduction to XUL—How to build a more intuitive UI - Archive of obsolete content
when this file is opened in firefox, it is displayed as shown in figure 1.
...so when changing the attribute’s value using a dom function for example, do not use setattribute('disabled', false) — instead, use removeattribute('disabled').
... root elements for dialog windows dialog use the dialog element when creating options dialogs, confirmation dialogs, etc.
...And 15 more matches
Block and Line Layout Cheat Sheet - Archive of obsolete content
ns_frame_in_reflow this bit is set when the frame is being actively being reflowed.
... ns_frame_first_reflow this flag is set on a newly created frame, and later cleared by the frame's reflow() method when the frame has had its initial reflow.
...this is set by default for document frames, area frames, table cell inner frames, absolutely positioned wrapper frames, and floated frames when the frame is created.
...And 15 more matches
Venkman Introduction - Archive of obsolete content
when the download is complete, restart your browser (some windows users may also need to restart their computer as well).
... (note that venkman displays usage data when it starts up: "recorded local startup x, global yyy." this data comes from a counter built in to the application.
... for more information about this counter and the data, see item 2.2 in the venkman faq.) when you first start venkman, the basic views are arranged as in the screenshot above—though you can customize the layout and presence of the different views however you want, as we describe in the view customization section below.
...And 15 more matches
PopupEvents - Archive of obsolete content
an overview of these is listed below: contextmenu this event is fired when a request is made to open a context menu, whether by the keyboard or mouse.
...for examples of the use of the popupshowing event when used with context menus, see hiding and showing menu items based on context.
...when using nested submenus, make sure to check in the popupshowing event that the event corresponds to the right popup.
...And 15 more matches
prefwindow - Archive of obsolete content
normally, you would not set this attribute as it will be set automatically such that the default pane is the same as the one showing when the preferences dialog was last closed.
...pe="bool"/> <preference id="pref-backupduration" name="myapp.mybackups.duration" type="int"/> </preferences> <checkbox label="automatically save backups" preference="pref-backup"/> <textbox label="duration:" preference="pref-backupduration"/> </prefpane> </prefwindow> attributes activetitlebarcolor type: color string specify background color of the window's titlebar when it is active (foreground).
...the following values can be used in the list: accept: the ok button, which will accept the changes when pressed.
...And 15 more matches
Mozilla accessibility architecture
however, because this would have caused a lot of difficulty when implementing the accessibility cache, the code was moved in to the "wrap" classes in a source directory specific to each toolkit.
...when the doc accessible is asked for, an event is fired which reaches the presshell, which then uses the accessibility service singleton (nsiaccessibilityservice) to create the doc accessible and return it back to the widget code.
...when there is no dom node for each accessible, as is the case for nshtmlcomboboxaccessible and nsxultreeitemaccessible, we also need to override the shutdown() method, so that the children get removed from memory when the parent is shutdown.
...And 15 more matches
Performance best practices for Firefox front-end engineers
use requestidlecallback() if you simply cannot avoid doing some kind of long job on the main thread, try to break it up into smaller pieces that you can run when the browser has a free moment to spare, and the user isn't doing anything.
... you can do that using requestidlecallback() and the cooperative scheduling of background tasks api, and doing it only when we have a free second where presumably the user isn’t doing something.
... when css is applied to a document (html or xul, it doesn’t matter), the browser does calculations to figure out which css styles will apply to each element.
...And 15 more matches
L20n Javascript API
l20n javascript api var ctx = l20n.getcontext(); ctx.linkresource('./locales/strings.l20n'); ctx.requestlocales(); when you freeze the context by calling requestlocales, the resource files will be retrieved, parsed and compiled.
... you can listen to the ready event (emitted by the context instance when all the resources have been compiled) and use ctx.getsync and ctx.getentitysync to get translations synchronously.
... alternatively, you can register callbacks to execute when the context is ready (or when globals change and translations need to be updated) with ctx.localize.
...And 15 more matches
PKCS11 FAQ
MozillaProjectsNSSPKCS11FAQ
nss searches all the installed pkcs #11 modules when looking for certificates.
...this value is set when the key is generated, so that nss will be able to find the key when the certificate for that key is loaded.
...if you do, your token must be able to generate random numbers even when it is not logged in.
...And 15 more matches
certutil
when you delete keys, be sure to also remove any certificates associated with those keys from the certificate database, by using -d.
...use when checking certificate validity with the -v option.
...when specifying an explicit time, use a z at the end of the term, yymmddhhmmssz, to close it.
...And 15 more matches
Using the Places history service
the places history service ("navhistory") implements these history interfaces: nsiglobalhistory2: basic add page, is visited functionality used by the docshell when visiting and rendering pages.
...when the user starts browsing (for example, by typing in a link or following a bookmark), a new session id is created.
...a session is ended when a new url is typed in or selected from bookmarks.
...And 15 more matches
Drag Operations - Web APIs
when an image or link is dragged, the url of the image or link is set as the drag data, and a drag begins.
... note: when an element is made draggable, text or other elements within it can no longer be selected in the normal way by clicking and dragging with the mouse.
...</p> when a user begins to drag, the dragstart event is fired.
...And 15 more matches
Cognitive accessibility - Accessibility
another form it can take is depression, such as when mourning the loss of a loved one, or being momentarily saddened by a tweet or video they just saw online.
... it may seem like an overwhelming challenge to address the wide range of cognitive differences, especially when solutions for two different people may be conflicting.
...ntent in more than one way, such as by text-to-speech or by video; providing easily-understood content, 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 progress 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.
...And 15 more matches
<body>: The Document Body element - HTML: Hypertext Markup Language
WebHTMLElementbody
alink color of text for hyperlinks when selected.
... onbeforeprint function to call when the user requests printing of the document.
... onbeforeunload function to call when the document is about to be unloaded.
...And 15 more matches
Panels - Archive of obsolete content
it is used when supporting temporary popup displays for selecting or entering data.
...when the button is pressed, the panel is opened.
...when you want to associate a panel with a button, place the <panel> element directly inside the button element.
...And 14 more matches
Anatomy of a video game - Game development
it helps beginners to the modern game development arena understand what is required when building a game and how web standards like javascript lend themselves as tools.
...this is more of a turn-based approach that doesn't demand a constant update every frame, only when the player reacts.
...being more specific with the browser about when your function needs to be called allows the browser to optimize when it is called.
...And 14 more matches
Client-side form validation - Learn web development
go to any popular site with a registration form, and you will notice that they provide feedback when you don't enter your data in the format they are expecting.
...when you enter data, the browser and/or the web server will check to see that the data is in the correct format and within the constraints set by the application.
... when an element is valid, the following things are true: the element matches the :valid css pseudo-class, which lets you apply a specific style to valid elements.
...And 14 more matches
Client-Server Overview - Learn web development
previous overview: first steps next now that you know the purpose and potential benefits of server-side programming we're going to examine in detail what happens when a server receives a "dynamic request" from a browser.
... as most website server-side code handles requests and responses in similar ways, this will help you understand what you need to do when writing most of your own code.
...when you click a link on a web page, submit a form, or run a search, the browser sends an http request to the server.
...And 14 more matches
Accessibility in React - Learn web development
when we switch between templates in our <todo /> component, we completely remove the elements that were there before to replace them with something else.
... focusing between templates when a user toggles a <todo/> template from viewing to editing, we should focus on the <input> used to rename it; when they toggle back from editing to viewing, we should move focus back to the "edit" button.
...as a reminder, we want to focus on the editing field when we switch to the editing template.
...And 14 more matches
NSS tools : certutil
when you delete keys, be sure to also remove any certificates associated with those keys from the certificate database, by using -d.
...use when checking certificate validity with the -v option.
...when specifying an explicit time, use a z at the end of the term, yymmddhhmmssz, to close it.
...And 14 more matches
JSAPI User Guide
note: the foss wiki page contains a few links to other libraries and programs that can make life easier when using spidermonkey and jsapi.
...whenever javascript code does something like window.open("http://www.mozilla.org/"), it is accessing a global property, in this case window.
... a minimal example each of the three key elements described in the previous section requires a few jsapi calls: the runtime: use js_newruntime to create it and js_destroyruntime to clean it up when you're done.
...And 14 more matches
Finishing the Component
the component will be recognized by xpcom and registered with the category manager so that it starts up when xpcom initializes.
... when the component starts up, it populates a list of urls read in from a file stored next to the gecko binary on the local system.
... * when they are finished they can ns_release() the service as usual.
...And 14 more matches
Drawing and Event Handling - Plugins
when it comes to determining the way a plug-in instance appears in a web page, you (and the web page author) have many options.
...this type of plug-in determines when it draws itself.
... the npwindow structure when a plug-in is loaded, it is drawn into a target area.
...And 14 more matches
Debugger.Frame - Firefox Developer Tools
this allows the code using each debugger instance to place whatever properties it likes on its debugger.frame instances, without worrying about interfering with other debuggers.) when the debuggee pops a stack frame (say, because a function call has returned or an exception has been thrown from it), the debugger.frame instance referring to that frame becomes inactive: its live property becomes false, and accessing its other properties or calling its methods throws an exception.
... note that frames only become inactive at times that are predictable for the debugger: when the debuggee runs, or when the debugger removes frames from the stack itself.
... visible frames when inspecting the call stack, debugger does not reveal all the frames that are actually present on the stack: while it does reveal all frames running debuggee code, it omits frames running the debugger’s own code, and omits most frames running non-debuggee code.
...And 14 more matches
HTMLBodyElement - Web APIs
windoweventhandlers.onafterprint is an eventhandler representing the code to be called when the afterprint event is raised.
... windoweventhandlers.onbeforeprint is an eventhandler representing the code to be called when the beforeprint event is raised.
... windoweventhandlers.onbeforeunload is an eventhandler representing the code to be called when the beforeunload event is raised.
...And 14 more matches
In depth: Microtasks and the JavaScript runtime environment - Web APIs
when debugging or, possibly, when trying to decide upon the best approach to solving a problem around timing and scheduling of tasks and microtasks, there are things about how the javascript runtime operates under the hood that may be useful to understand.
...to understand where queuemicrotask() comes into play here, it's helpful to understand how the javascript runtime operates when scheduling and running code.
... when a fragment of javascript code runs, it runs inside an execution context.
...And 14 more matches
Timing element visibility with the Intersection Observer API - Web APIs
the intersection observer api makes it easy to be asynchronously notified when elements of interest become more or less obscured by a shared ancestor node or element, including the document itself.
...when an ad exceeds one minute of visible time, it will be replaced with a new one.
... the wrapper's width is fixed at 700px so that it will fit in the available space when presented inline on mdn below.
...And 14 more matches
Using Web Workers - Web APIs
when you want to send a message to the worker, you post messages to it like this (main.js): first.onchange = function() { myworker.postmessage([first.value,second.value]); console.log('message posted to worker'); } second.onchange = function() { myworker.postmessage([first.value,second.value]); console.log('message posted to worker'); } so here we have two <input> elements represented by th...
...e variables first and second; when the value of either is changed, myworker.postmessage([first.value,second.value]) is used to send the value inside both to the worker, as an array.
... in the worker, we can respond when the message is received by writing an event handler block like this (worker.js): onmessage = function(e) { console.log('message received from main script'); var workerresult = 'result: ' + (e.data[0] * e.data[1]); console.log('posting message back to main script'); postmessage(workerresult); } the onmessage handler allows us to run some code whenever a message is received, with the message itself being available in the message event's data attribute.
...And 14 more matches
Understandable - Accessibility
your site should provide a glossary that contains definitions of such words/terms that you can then link to when they appear, or at the very least provide definitions somewhere in the surrounding text, or in a description list at the bottom of the page.
... the <abbr> element is often thought of as the preferred way to provide an expansion for an abbreviation — it takes a title attribute that contains the expansion, and this appears when the acronym is moused over.
... success criteria how to conform to the criteria practical resource 3.2.1 on focus (a) when a control or other page feature receives focus, it should not change the context in a way that may confuse or disorientate the user.
...And 14 more matches
HTML documentation index - HTML: Hypertext Markup Language
WebHTMLIndex
its purpose is to identify the element when linking (using a fragment identifier), scripting, or styling (with css).
... 33 translate experimental, global attributes, html, reference the translate global attribute is an enumerated attribute that is used to specify whether an element's translateable attribute values and its text node children should be translated when the page is localized, or whether to leave them unchanged.
... 34 x-ms-acceleratorkey attribute, html, html:microsoft extensions, non-standard, reference, x-ms-acceleratorkey the x-ms-acceleratorkey attribute accessibly declares that an accelerator key has been assigned to an element: the element is activated via javascript when the key(s) are pressed on a keyboard.
...And 14 more matches
Details of the object model - JavaScript
any object can specify its own properties, either when you create it or at run time.
...then, when you create a new manager, it inherits the name and dept properties from the employee object.
...in these definitions, you cannot specify any property values when you create an object.
...And 14 more matches
Inheritance and the prototype chain - JavaScript
when it comes to inheritance, javascript only has one construct: objects.
...when trying to access a property of an object, the property will not only be sought on the object but on the prototype of the object, the prototype of the prototype, and so on until either a property with a matching name is found or the end of the prototype chain is reached.
... it should not be confused with the func.prototype property of functions, which instead specifies the [[prototype]] to be assigned to all instances of objects created by the given function when used as a constructor.
...And 14 more matches
Autoplay guide for media and Web Audio APIs - Web media technologies
while autoplay of media serves a useful purpose, it should be used carefully and only when needed.
... autoplay blocking is not applied to <video> elements when the source media does not have an audio track, or if the audio track is muted.
... autoplay of media elements now that we've covered what autoplay is and what can prevent autoplay from being allowed, we'll look at how your web site or app can automatically play media upon page load, how to detect when autoplay fails to occur, and tips for coping when autoplay is denied by the browser.
...And 14 more matches
Chapter 5: Let's build a Firefox extension - Archive of obsolete content
lines 1–3 define the icon image to use with full-sized icons, and lines 4–6 define the icon image to use when small toolbar icons have been selected.
...check to make sure that, when you click on the “customize toolbar” button at the top-right of the window that the new toolbar icon appears in the resulting window.
...take note that when using an extension to create an overlay on the browser window, any global variables and functions defined within javascript that get opened as overlays on top of browser.xul all become properties of the browser.xul window object.
...And 13 more matches
Elements - Archive of obsolete content
constructor the code inside the constructor is called when a binding has just been attached to an element.
... note: prior to firefox 3, the constructor could be called at a time when reflow of the document layout was locked down, so that attempting to get layout information from within the constructor could return out of date information.
... in firefox 3 and later, the constructor is called when reflow can take place, which results in up-to-date information being returned.
...And 13 more matches
OpenClose - Archive of obsolete content
opening menus menus will display themselves automatically when needed without extra work.
... for instance, a menu's popup will open when the menu label is clicked, and a submenu will open when the mouse is hovered over the parent menu element.
... however, there may be situations when you wish to open a menu manually.
...And 13 more matches
Focus and Selection - Archive of obsolete content
when the tab key is pressed, the next element is given the focus.
...rearranging the tab order you can change the order in which elements are focused when the user presses the tab key by adding a tabindex attribute to an element.
...when the user presses tab, the focus will shift to the element with the next highest tab index.
...And 13 more matches
XUL accessibility guidelines - Archive of obsolete content
it can also be set programmatically with the tabindex attribute if needed, but this should be done sparingly and thoroughly tested whenever it is used.
... careful attention should be taken when setting keyboard shortcuts.
... when creating an extension (for firefox or another xul application), make sure the keyboard shortcuts you assign do not interfere with those already defined by the base application.
...And 13 more matches
Practical positioning examples - Learn web development
prerequisites: html basics (study introduction to html), and an idea of how css works (study introduction to css.) objective: to get an idea of the practicalities of positioning a tabbed info-box the first example we'll look at is a classic tabbed info box — a very common feature used when you want to pack a lot of information into a small area.
...we'll also give you a bit of javascript to include on your page to display the corresponding panel when a tab is pressed, and style the tab itself.
... styling our tabs now we want to style tabs to look like tabs — basically, these are a horizontal navigation menu, but instead of loading different web pages when they are clicked on like we've seen previously in the course, they cause different panels to be displayed on the same page.
...And 13 more matches
Responsive images - Learn web development
however, issues arise when you start to view the site on a narrow screen device.
... an improvement would be to display a cropped version of the image which displays the important details of the image when the site is viewed on a narrow screen.
...and conversely, a small raster image starts to look grainy when displayed larger than its original size (a raster image is a set number of pixels wide and a set number of pixels tall, as we saw when we looked at vector graphics).
...And 13 more matches
What is JavaScript? - Learn web development
we used a click event in our example above to detect when the button is clicked and then run the code that updates the text label.
... note: many of the above demos won't work in an older browser — when experimenting, it's a good idea to use a modern browser like firefox, chrome, edge or opera to run your code in.
... you will need to consider cross browser testing in more detail when you get closer to delivering production code (i.e.
...And 13 more matches
Storage access policy: Block cookies from trackers
when the list is applied in firefox, we make two important changes: first, we only use the "basic protection" version of the list, which excludes some categories of trackers.
... second, firefox uses an additional "entity list", which prevents domains from being classified as trackers when they are loaded on a top-level site owned by the same organization.
... the storage access policy blocks resources identified as trackers from accessing their cookies and other site storage when they are loaded in a third-party context.
...And 13 more matches
Mozilla DOM Hacking Guide
class info and helper classes introduction to class info class info is what gives the dom classes their correct behavior when used through xpconnect.
...this means that when we use the dom from javascript, we pass arguments that have no type.
... when, in javascript, a client tries to access a dom object or a dom method on a dom object, the js engine asks xpconnect to search for the relevant c++ method to call.
...And 13 more matches
An overview of NSS Internals
multiple elements of nss's own modules have been implemented with this interface, and nss makes use of this interface when talking to those modules.
... when checking whether a certificate is trusted or not, it's necessary to find a relevant trust anchor (root certificate) that represents the signing capability of a trusted third party, usually called a certificate authority (ca).
...when working with handles to private keys it's usually difficult (and undesired) that an application gets access to the raw key data; therefore it may be difficult to extract such data from nss.
...And 13 more matches
Background Tasks API - Web APIs
the cooperative scheduling of background tasks api (also referred to as the background tasks api or simply the requestidlecallback() api) provides the ability to queue tasks to be executed automatically by the user agent when it determines that there is free time to do so.
... use timeouts when you need to, but only when you need to.
... using timeouts can ensure that your code runs in a timely manner, but it can also allow you to cause lag or animation stutters by mandating that the browser call you when there's not enough time left for you to run without disrupting performance.
...And 13 more matches
HTMLInputElement - Web APIs
formnovalidate boolean: returns / sets the element's formnovalidate attribute, indicating that the form is not to be validated when it is submitted.
... properties that apply to any type of input element that is not hidden name string: returns / sets the element's name attribute, containing a name that identifies the element when submitting the form.
...see also readonly autofocus boolean: returns / sets the element's autofocus attribute, which specifies that a form control should have input focus when the page loads, unless the user overrides it, for example by typing in a different control.
...And 13 more matches
WindowEventHandlers - Web APIs
windoweventhandlers.onafterprint is an eventhandler representing the code to be called when the afterprint event is raised.
... windoweventhandlers.onbeforeprint is an eventhandler representing the code to be called when the beforeprint event is raised.
... windoweventhandlers.onbeforeunload is an eventhandler representing the code to be called when the beforeunload event is raised.
...And 13 more matches
ARIA: button role - Accessibility
the button role should be used for clickable elements that trigger a response when activated by the user.
... in addition to the ordinary button widget, role="button" should be included when creating a toggle button or menu button using a non button element.
...the values include aria-pressed="false" when a button is not currently pressed, aria-pressed="true" to indicate a button is currently pressed, and aria-pressed="mixed" if the button is considered to be partially pressed.
...And 13 more matches
<input type="email"> - HTML: Hypertext Markup Language
WebHTMLElementinputemail
the input should accept minlength the minimum number of characters long the input can be and still be considered valid multiple whether or not to allow multiple, comma-separated, e-mail addresses to be entered pattern a regular expression the input's contents must match in order to be valid placeholder an exemplar value to display in the input field whenever it is empty readonly a boolean attribute indicating whether or not the contents of the input should be read-only size a number indicating how many characters wide the input field should be list the values of the list attribute is the id of a <datalist> element located in the same document.
...constraint validation is only applied when the value is changed by the user.
...constraint validation is only applied when the value is changed by the user.
...And 13 more matches
Web audio codec guide - Web media technologies
in this article, we look at audio codecs used on the web to compress and decompress audio, what their capabilities and use cases are, and offer guidance when choosing audio codecs to use for your content.
...-rate 3gp flac free lossless audio codec mp4, ogg, flac g.711 pulse code modulation (pcm) of voice frequencies rtp / webrtc g.722 7 khz audio coding within 64 kbps (for telephony/voip) rtp / webrtc mp3 mpeg-1 audio layer iii mp4, adts, mpeg1, 3gp opus opus webm, mp4, ogg vorbis vorbis webm, ogg [1] when mpeg-1 audio layer iii codec data is stored in an mpeg file, and there is no video track on the file, the file is typically referred to as an mp3 file, even though it's still an mpeg format file.
...the specific codec used—and the compression configuration selected—determine how close to the original, uncompressed audio signal the output seems to be when heard by the human ear.
...And 13 more matches
page-mod - Archive of obsolete content
for example, the following add-on displays an alert whenever the user visits any page hosted at "mozilla.org": var pagemod = require("sdk/page-mod"); pagemod.pagemod({ include: "*.mozilla.org", contentscript: 'window.alert("page matches ruleset");' }); you can modify the document in your script: var pagemod = require("sdk/page-mod"); pagemod.pagemod({ include: "*.mozilla.org", contentscript: 'document.body.innerhtml = ' + ' "<h1>page matches ruleset</h1>";' }); you can sup...
... attachto controls whether to attach scripts to tabs that were already open when the page-mod was created, and whether to attach scripts to iframes as well as the topmost document.
... contentscriptwhen controls the point during document load at which content scripts are attached.
...And 12 more matches
ui/button/toggle - Archive of obsolete content
toggle buttons have two extra features: they emit a change event when clicked, as well as a click event.
... they have an extra attribute checked that is automatically toggled when the button is clicked.
... when a button is checked it gets a "pressed" look in the user interface (note that the "pressed" look currently does not work in mac os x).
...And 12 more matches
jpm - Archive of obsolete content
installing jpm globally npm install jpm --global depending on your setup, you might need to run this as an administrator: sudo npm install jpm --global installing jpm locally if you do not wish to, or are unable to, install jpm globally, you may instead install it locally: cd $home && npm install jpm to run jpm from a terminal when installed locally, you must add the directory "$home/node_modules/.bin/" to your terminal's path first.
... when testing your add-on, you will need to use the -b option to jpm run.
... jpm watchpost package your add-on as an xpi file whenever there is a file change and post that to some url.
...And 12 more matches
Enhanced Extension Installation - Archive of obsolete content
when a newer version fo an existing extension is installed, files for the newer version are copied into the folder used by the older version, and obsolete files are not cleaned up.
... when changes are made to the extensions datasource - new items are installed, old items uninstalled, enabled or disabled, a .autoreg file is written to the profile directory as well, which tells the startup code that the system has been modified, so that it destroys the component registries, finishes pending transactions and regenerates metadata appropriately.
...the composite datasource handles all read-only information requests, and when data must be written the extension manager determines the appropriate datasource to write and flush to.
...And 12 more matches
Appendix F: Monitoring DOM changes - Archive of obsolete content
their major advantage is in their performance and their ease of use, especially when combined with simple libraries.
... non-mutation triggers it is usually possible to tell when a mutation has occurred or is about to occur without resorting to mutation events or observers.
... hashchange and popstate events most ajax-heavy sites update the url when they significantly change their content, either via a change to the fragment identifier (hash) or more recently via the history.pushstate method.
...And 12 more matches
textbox (Toolkit autocomplete) - Archive of obsolete content
enablehistory new in thunderbird 1requires seamonkey 2.0 type: boolean if true, an arrow button will appear on the end of the textbox which, when pressed, will open a dropdown menu of all available results.
... forcecomplete new in thunderbird 3requires seamonkey 2.0 type: boolean if true, the textbox will be filled in with the best match when it loses the focus.
... if false, it will only be filled in when the user selects an item.
...And 12 more matches
The Implementation of the Application Object Model - Archive of obsolete content
the second section describes the xul/rdf architecture itself and outlines enhancements to the xul language in order to allow the markup language to reference local data and to indicate how and when it would like to be annotatable with local data.
...because the file lives remotely, it can be updated whenever the owner of the web site sees fit.
...when the remote file is subsequently downloaded, these local annotations are sucked in and superimposed on top of the structure described by the file.
...And 12 more matches
Mozilla XForms User Interface - Archive of obsolete content
we use the data type of the instance node that the form control is bound to as a clue when making a rendering decision.
...when a xf:output binds to a node that has a type of xsd:date, we output the date value as plain text.
...for instance, when the spec reaches 'recommendation'-level status.
...And 12 more matches
Sending form data - Learn web development
this article looks at what happens when a user submits a form — where does the data go, and how do we handle it when it gets there?
... objective: to understand what happens when form data is submitted, including getting a basic idea of how data is processed on the server first we'll discuss what happens to the data when a form is submitted.
...all of its attributes are designed to let you configure the request to be sent when a user hits a submit button.
...And 12 more matches
Introducing asynchronous JavaScript - Learn web development
we add a click event listener to it so that when the button is clicked: an alert() message appears.
...when you fetch an image from a server, you can't return the result immediately.
... that means that the following (pseudocode) wouldn't work: let response = fetch('myimage.png'); let blob = response.blob(); // display your image blob in the ui somehow that's because you don't know how long the image will take to download, so when you come to run the second line it will throw an error (possibly intermittently, possibly every time) because the response is not yet available.
...And 12 more matches
Drawing graphics - Learn web development
the situation started to improve when browsers began to support the <canvas> element and associated canvas api — apple invented it in around 2004, and other browsers followed by implementing it in the years that followed.
... as you'll see below, canvas provides many useful tools for creating 2d animations, games, data visualizations, and other types of app, especially when combined with some of the other apis the web platform provides.
...this converts degree 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 degrees.
...And 12 more matches
Accessible Toolkit Checklist
the work when implementing a new toolkit it's important to: implement standard keyboard behavior, which can vary from platform to platform.
... the approaches there are two basic kinds of toolkits, which each provide different challenges when implementing accessibility: native widget toolkits , like eclipse and wxwidgets, already have some accessibility built-in.
...in this case, adding a complete or even a partial accessibility solution is major work, and will require more than one full time person as well as cooperation from windows assistive technology vendors when parts of your msaa solution isn't working.
...And 12 more matches
The Firefox codebase: CSS Guidelines
only use generic selectors such as :last-child, when it is what you mean semantically.
...so, when possible, always prefer editing common components to writing your own.
... also, it is good practice to introduce a common class when the new element you are styling reuses some styles from another element, this allows the maintenance cost and the amount of code duplication to be reduced.
...And 12 more matches
Using the Browser API
MozillaGeckoChromeAPIBrowser APIUsing
the javascript implementation to wire up the functionality required by our simple browser, we've written some basic javascript (see the full javascript listing.) wiring up the back and forward buttons early on in the code we implement two simple event listeners to move the browser back and forward in history when the relevant buttons are pressed: back.addeventlistener('touchend',function() { browser.goback(); }); fwd.addeventlistener('touchend',function() { browser.goforward(); }); the functions can be handled using the browser api htmliframeelement.goback() and htmliframeelement.goforward() methods.
... enabling/disabling the back and forward buttons you will also notice after a bit of surfing that the back and forward buttons are disabled when you cannot move backwards/forwards, and enabled when you can.
...when you tap the url bar, you can enter a url using the built-in firefox os keyboard (although note that we haven't implemented anything sophisticated in this app, like autofilling the http://, etc.).
...And 12 more matches
Mozilla Web Developer FAQ
the consequence is that xhtml 1.0 transitional documents are rendered in the almost standards mode when served as text/html under pretext of the appendix c but in the standards mode when served as application/xhtml+xml.
... why are there gaps between image rows in tables when the layout engine is in the standards mode?
... if the table cells that contain only an image are marked with <td class="imgcell">, the required css rule is: .imgcell img, .imgcell a { display: block; } longer explanation… why are there still gaps even between text rows in tables when the layout engine is in the standards mode or in the almost standards mode?
...And 12 more matches
Introduction to NSPR
pr_cleanup waits for the last user thread to exit before returning, whereas it ignores system threads when determining when a process should exit.
...each thread has a built-in per-thread error number and error string that are updated when nspr operations fail.
...when the target is interrupted, it is rescheduled from the point at which it was blocked, with a status error indicating that it was interrupted.
...And 12 more matches
Hacking Tips
0007ffff7f42223 in <<jitframe_baselinestub>> () #6 0x00007ffff7f4423d in <<jitframe_baselinejs>> () #7 0x00007ffff7f4222e in <<jitframe_baselinestub>> () #8 0x00007ffff7f4326a in <<jitframe_baselinejs>> () #9 0x00007ffff7f38d5f in <<jitframe_entry>> () #10 0x00000000006a86de in enterbaseline(jscontext*, js::jit::enterjitdata&) (cx=0x14f2640, data=...) at js/src/jit/baselinejit.cpp:150 note, when you enable the unwinder, the current version of gdb (7.10.1) does not flush the backtrace.
... finding the script of ion generated assembly (from gdb) when facing a bug in which you are in the middle of ionmonkey generated code, first thing to note, is that gdb's backtrace is not reliable, because the generated code does not keep a frame pointer.
...thus when dumping the assembly under gdb, this kind of instructions would be easily noticeable.
...And 12 more matches
Property cache
when executing certain property-accessing bytecode instructions, the interpreter populates the cache to speed future execution of the same instruction.
... the jit reads the property cache too, as it needs the same information when recording such an instruction.
...when recording a getprop, the jit needs to know the result type before the interpreter executes the instruction.
...And 12 more matches
Using XPCOM Utilities to Make Things Easier
since these macros expand into "generic" implementations, they may not offer as much flexibility as you have when you are writing your own implementation.
...some differ only in whether or not a method is called when the module is created and/or destroyed.
... ns_impl_nsgetmodule_with_ctor(name, components, ctor) same as above but allows for a special function to be called when the module is created.
...And 12 more matches
nsIDocShell
called by the focus manager when the user tabs to the frame rather than an element.
... charset string the converter to use when reading the document's data.
...when reading a document, a converter is used to translate the text from its original format into unicode.
...And 12 more matches
nsIFaviconService
note: this is an asynchronous operation; when it completes, a "places-favicons-expired" notification is dispatched through the observer's service.
... exceptions thrown ns_error_not_available thrown when we have never heard of this favicon url.
...exceptions thrown ns_error_not_available thrown when we have never heard of this favicon url.
...And 12 more matches
Accessibility Inspector - Firefox Developer Tools
accessing the accessibility inspector when you first open any of the other developer tools, the accessibility features are turned off (unless you've already got them turned on in another browser tab, or got the firefox accessibility engine started already, e.g., you might be a screenreader user or tester).
... this is because the accessibility engine runs in the background when the accessibility features are turned on.
...for this reason, you should keep it turned off when you aren't specifically using it.
...And 12 more matches
<video>: The Video Embed element - HTML: Hypertext Markup Language
WebHTMLElementvideo
note: sites that automatically play audio (or videos with an audio track) can be an unpleasant experience for users, so should be avoided when possible.
...however, this can be useful when creating media elements whose source will be set at a later time, under user control.
... autopictureinpicture a boolean attribute which if true indicates that the element should automatically toggle picture-in-picture mode when the user switches back and forth between this document and another document or application.
...And 12 more matches
Web video codec guide - Web media technologies
e higher the quality configuration, the more like the original media the encoded video will look in general, higher quality settings will result in larger encoded video files; the degree to which this is true varies depending on the codec bit rate quality generally improves with higher bit rates higher bit rates inherently lead to larger output files the options available when encoding video, and the values to be assigned to those options, will vary not only from one codec to another but depending on the encoding software you use.
...is a large-scale spatial interference pattern produced when a pattern in the source image and the manner in which the encoder operates are slightly out of alignment spatially.
... staircase effect the staircase effect is a spatial artifact that occurs when diagonal straight or curved edges that should be smooth take on a jagged appearance, looking somewhat like a set of stair steps.
...And 12 more matches
Tabbed browser - Archive of obsolete content
reusing by url/uri a common feature found in many extensions is to point the user to chrome:// uris in a browser window (for example, help or about information) or external (on-line http(s)://) html documents when the user clicks an extension's button or link.
...we can do re-use an arbitrary tab by attaching a custom attribute to it when we first open it.
... later, when we want to re-use that tab, we iterate over all open tabs looking for one which has our custom attribute.
...And 11 more matches
Notes on HTML Reflow - Archive of obsolete content
reflow may have the side-effect of creating new continuation frames, for example, for a text frame when the text must be wrapped.
...other reflows are incremental and are dealt with asynchronously; for example, when content streams in from the network.
...when reflow begins, the root reflow state is initialized with information about the top-level container for the document's presentation; e.g., the width and height of the application window.
...And 11 more matches
Updating Commands - Archive of obsolete content
you will need to use these extra steps when invoking commands implemented by a controller.
... in addition, you will need to do this when creating your own menu commands, for instance to implement the edit menu commands in your own application.
...it is attached to the command which will invoke the command on the necessary controller when called.
...And 11 more matches
panel - Archive of obsolete content
ArchiveMozillaXULpanel
when open, it floats above the window and may extend outside the border of the main window.
... typically, it will be attached to a button using the button's type attribute so that when the button is pressed, the panel will be displayed.
... the panel is closed when the user clicks outside the panel, presses escape or when the panel's hidepopup method is called.
...And 11 more matches
toolbarbutton - Archive of obsolete content
when autocheck is true, the button type should be "checkbox" or "radio".
...when in state 0 or 1, pressing the button will switch to the opposite state.
... when in state 2, pressing the button will switch to state 0.
...And 11 more matches
Backgrounds and borders - Learn web development
remove the length units and see what happens when you use background-size: cover or background-size: contain.
... gradient backgrounds a gradient — when used for a background — acts just like an image and is also set by using the background-image property.
... when you do this you may end up with background images overlapping each other.
...And 11 more matches
JavaScript basics - Learn web development
this happens in games, in the behavior of responses when buttons are pressed or with data entry on forms; with dynamic styling; with animation, etc.
...when you want to do something to an element, you need to select it first.
...it is only required when you need to separate statements on a single line.
...And 11 more matches
Video and Audio APIs - Learn web development
the contents of aria-label attributes are read out by screenreaders when their users focus on the elements that contain them.
... there is also a timer <div>, which will report the elapsed time when the video is playing.
... we give the controls an opacity of 0.5 by default, so that they are less distracting when you are trying to watch the video.
...And 11 more matches
Vue conditional rendering: editing existing todos - Learn web development
there is a "save" button and a "cancel" button: when the "save" button is clicked, the component emits the new label via an item-edited event.
... when the "cancel" button is clicked, the component signals this by emitting an edit-cancelled event.
... we've also added "edit" and "delete" buttons: the "edit" button, when clicked, will toggle displaying the todoitemeditform component so we can use it to edit our todo item, via an event handler function called toggletoitemeditform().
...And 11 more matches
Sqlite.jsm
you don't need to worry about caching created statement instances, destroying them when you are done, etc.
...the connection is idle when no statements are executing.
... this function returns a promise that will be resolved when the database has closed.
...And 11 more matches
Tracing JIT
when the monitor determines that the interpreter has entered a region of code that would benefit from native compilation, the monitor activates the recorder.
...later, when the fragment is assembled, it will allocate pages for the native code (nins values) produced by the assembler.
... when the fragment is destroyed, it returns its pages to the fragmento for reuse.
...And 11 more matches
nsIDOMWindowUtils
keep in mind that during a restyle operation, an element may be restyled multiple times (for example, when an inline element contains blocks).
...this attribute only works when imestatus is ime_status_enabled.
...when this is set (or not set query_content_flag_use_xp_line_break), the aoffset and alength are offset and length in/of the content generated with native line breaks (e.g., "\r\n" on windows).
...And 11 more matches
nsITreeView
inherits from: nsisupports last changed in gecko 22 (firefox 22 / thunderbird 22 / seamonkey 2.19) implementing a nsitreeview in lieu of dom methods for tree creation can improve performance dramatically, and removes the need to make changes to the tree manually when changes to the database occur.
...to get the behavior where drops are only allowed on items, such as the mailnews folder pane, always return false when the orientation is not drop_on.
... cyclecell() called on the view when a cell in a non-selectable cycling column (for example, unread/flag/and so on.) is clicked.
...And 11 more matches
nsIXPConnect
newscope); obsolete since gecko 1.9.1 nsixpconnectjsobjectholder reparentwrappednativeiffound(in jscontextptr ajscontext, in jsobjectptr ascope, in jsobjectptr anewparent, in nsisupports acomobj); void restorewrappednativeprototype(in jscontextptr ajscontext, in jsobjectptr ascope, in nsiclassinfo aclassinfo, in nsixpconnectjsobjectholder aprototype); void setdebugmodewhenpossible(in prbool mode); native code only!
... nsixpconnectjsobjectholder createsandbox( in jscontextptr cx, in nsiprincipal principal ); parameters cx a context to use when creating the sandbox object.
... principal the principal (or null to use the null principal) to use when evaluating code in this sandbox.
...And 11 more matches
nsIXULTemplateQueryProcessor
the query is expected to consist of either text or dom nodes that, when executed by a call to the generateresults() method, will allow the generation of a list of results.
...the reference point is important when generating output recursively, as the query will be the same for each iteration, however, the reference point will differ.
... for instance, when examining an xml source, an xml query processor might begin at the node referred by the reference variable and end at a list of that node's children.
...And 11 more matches
Streams - Plugins
in normal-mode streams, the browser calls the plug-in to tell it when a stream is created and to push more data.
... receiving a stream sending a stream receiving a stream when the browser sends a data stream to the plug-in, it has several tasks to perform: telling the plug-in when a stream is created telling the plug-in when a stream is deleted finding out how much data the plug-in can accept writing the stream to the plug-in sending the stream in random-access mode sending the stream in file mode telling the plug-in when a stream is created to tell the plug-in instance when a new stream is created, the browser calls the npp_newstream method.
...the browser saves stream data to a local file, and, when the stream is complete, delivers the path of the file through a call to npp_streamasfile.
...And 11 more matches
Examine and edit HTML - Firefox Developer Tools
there is an ellipsis shown between the opening and closing tag of an element when the node is collapsed if it has larger contents.
... ::before and ::after you can inspect pseudo-elements added using ::before and ::after: custom element definition when you open the inspector on a page that includes custom elements, you can view the class definition for the custom element in the debugger: inspect the element click on the word custom the source for the element's class will be displayed in the debugger.
... usually this white space seems to have no effect and no visual output, but in fact, when a browser parses html it will automatically generate anonymous text nodes for elements not contained in a node.
...And 11 more matches
HTMLFrameSetElement - Web APIs
windoweventhandlers.onafterprint is an eventhandler representing the code to be called when the afterprint event is raised.
... windoweventhandlers.onbeforeprint is an eventhandler representing the code to be called when the beforeprint event is raised.
... windoweventhandlers.onbeforeunload is an eventhandler representing the code to be called when the beforeunload event is raised.
...And 11 more matches
USBDevice - Web APIs
WebAPIUSBDevice
methods usbdevice.claiminterface() returns a promise that resolves when the requested interface is claimed for exclusive access.
... usbdevice.clearhalt() returns a promise that resolves when a halt condition is cleared.
... usbdevice.controltransferin() returns a promise that resolves with a usbtransferinresult when a command or status operation has been transmitted to the usb device.
...And 11 more matches
Cross-browser audio basics - Developer guides
the controls attribute on the <audio> element is specified when we require the browser to provide us with default playback controls.
... preload the preload attribute allows you to specify a preference for how the browser preloads the audio, in other words, which part of the file it downloads when the <audio> element is initialized, and before the play button is pressed.
...</audio> controls we specify the controls attribute when we require the browser to provide us with its default playback controls.
...And 11 more matches
Cross-Origin Resource Sharing (CORS) - HTTP
WebHTTPCORS
a web application executes a cross-origin http request when it requests a resource that has a different origin (domain, protocol, or port) from its own.
...note that along with the options request, two other request headers are sent (lines 9 and 10 respectively): access-control-request-method: post access-control-request-headers: x-pingother, content-type the access-control-request-method header notifies the server as part of a preflight request that when the actual request is sent, it will be sent with a post request method.
... the access-control-request-headers header notifies the server that when the actual request is sent, it will be sent with a x-pingother and content-type custom headers.
...And 11 more matches
HTTP caching - HTTP
WebHTTPCaching
different kinds of caches caching is a technique that stores a copy of a given resource and serves it back when requested.
... when a web cache has a requested resource in its store, it intercepts the request and returns its copy instead of re-downloading from the originating server.
... cache-control: max-age=31536000 validation when using the "must-revalidate" directive, the cache must verify the status of the stale resources before using it and expired ones should not be used.
...And 11 more matches
this - JavaScript
function f1() { return this; } // in a browser: f1() === window; // true // in node: f1() === globalthis; // true in strict mode, however, if the value of this is not set when entering an execution context, it remains as undefined, as shown in the following example: function f2() { 'use strict'; // see strict mode return this; } f2() === undefined; // true in the second example, this should be undefined, because f2 was called directly and not as a method or property of an object (e.g.
...this feature wasn't implemented in some browsers when they first started to support strict mode.
... to set the value of this to a particular value when calling a function, use call(), or apply() as in the examples below.
...And 11 more matches
Performance fundamentals - Web Performance
all other things being equal, code optimized for some target besides user-perceived performance (hereafter upp) loses when competing against code optimized for upp.
...for example, when a user taps the screen, they expect the pixels to change in a certain way.
... responsiveness is important simply because people get frustrated and angry when they're ignored.
...And 11 more matches
Web Performance
if your animations are really complex, you may have to rely on javascript-based animations instead.lazy loadinglazy loading is a strategy to identify resources as non-blocking (non-critical) and load these only when needed.
...instead, we're going to look at a more important issue when building web apps: starting up as asynchronously as possible.
...to understand how to improve performance and perceived performance, it helps to understand how the browser works.recommended web performance timings: how long is too long?there are no clear set rules as to what constitutes a slow pace when loading pages, but there are specific guidelines for indicating content will load (1 second), idling (50ms), animating (16.7s) and responding to user input (50 to 200ms).the business case for web performanceyou know web performance is important, but how do you convince clients and management to invest in performance and make it a priority.
...And 11 more matches
Bootstrapped extensions - Archive of obsolete content
when the extension's startup() function is called, it must manually inject its user interface and other behavior into the application.
... similarly, when its shutdown() function is called, it must remove anything that it has added to the application, as well as all references to any of its objects.
... there are several scenarios in which the startup() function may be called; for example: when the extension is first installed, assuming that it's both compatible with the application and is enabled.
...And 10 more matches
Autodial for Windows NT - Archive of obsolete content
if you turn on the autodial feature, windows will automatically dial whenever any application tries to access a network address that can't be reached.
...if this service is running, and control panel | network connections | advanced | dialup preferences is set to enable autodial, then any application trying to access the internet will trigger the autodial feature whenever an internet address cannot be reached.
...whenever an internet address cannot be reached, because of a dns lookup failure for example, the system will try to dial.
...And 10 more matches
Actionscript Acceptance Tests - Archive of obsolete content
testing versioned bug fixes when testing versioned bug fixes (using avmplus.system.swfversion) there are a couple of requirements: you must use system.swfversion when looking up the swfversion.
... the test file can not be wrapped in a package or define classes as the file will be wrapped in a function when used in the ats.
...testname.as.asc_args this file specifies additional arguments to pass to asc when compiling the test: # asc args for file # two modes are available: # override| all command line arguments (except builtin.py) are ignored and replaced by these # merge| merge these args in with the current args # specifiy an arg that starts with -no will disable the arg...
...And 10 more matches
Using Breakpoints in Venkman - Archive of obsolete content
when you set a breakpoint in a debugging application such as venkman, you can take advantage of the suspension to examine variables, objects, and other featues of the execution.
...basic breakpoints the stop button and debugger keyword are useful features of the javascript debugger, but when you are debugging deep in code—especially code you have authored yourself and are responsible for troubleshooting—you're going to need breakpoints.
...future breakpoints are used when you want to stop in a script that has not yet been compiled.
...And 10 more matches
A XUL Bestiary - Archive of obsolete content
in the example above, the chrome is simply a skin file to be loaded into the xul file, but the chrome can also be used to load whole chromes, as when a <menuitem> in one window brings up a new chrome: <menuitem value="mozilla help" oncommand="window.opendialog('chrome://help/content/help.xul', '_blank', 'chrome,all,dialog=no')" /> in this example, the chrome url is being used to point to a chrome within the package hierarchy of the mozilla application.
...note that when no file name is specified after the chrome directory path, a file name with the same name as the package is assumed.
...when you invoke mozilla from the command line with the -chrome flag, you can specify a chrome just as you would in the previous example: mozilla -chrome chrome://help/content/help.xul brings up the help package mentioned in the previous example as a "stand-alone" chrome.
...And 10 more matches
ContextMenus - Archive of obsolete content
when using the mouse to open a context menu, the context is the element that was clicked.
... when using the keyboard, the context is the element in the window that is currently focused.
...however, the event will also fire when the label is right-clicked for instance, so the event handler should check to make sure that the target of the contextmenu event is what is desired.
...And 10 more matches
Broadcasters and Observers - Archive of obsolete content
« previousnext » there may be times when you want several elements to respond to events or changes of state easily.
...in the former case, menu items and toolbar buttons would need to be disabled when there was no page to go back to, or no text to cut or delete.
... in the latter case, various user interface elements might need to update when the user switches from offline mode to online mode.
...And 10 more matches
Splitters - Archive of obsolete content
splitting a box there may be times when you want to have two sections of a window where the user can resize the sections.
... when a splitter is placed inside a horizontal box, it will allow resizing horizontally.
... when a splitter is placed inside a vertical box, it will allow resizing vertically.
...And 10 more matches
Extentsions FAQ - Archive of obsolete content
just drag them there from the toolbar customisation window, like you would when adding buttons to the toolbars." option #4 install toolbar control <http://webdesigns.ms11.net/chromeditp.html> asking for help with getting an extension to process windows messages.
... these two links should give you a starting point: http://www..xulplanet.com/tutorials/...u/advmenu.html http://www.xulplanet.com/tutorials/x...dommodify.html request for a thunderbird extension that can automatically detect the default domain when composing e-mails via autodetect.
... how to get the value of a text box when a button is clicked?
...And 10 more matches
Choosing Standards Compliance Over Proprietary Practices - Archive of obsolete content
with processes, organizations can make release schedules, implement marketing plans, analyze resource allocations, and make adjustments when needed.
...when projects are proposed, they are evaluated to ensure compatibility with the overall business strategy.
...when this happens, a development standard is created and is expected to be followed.
...And 10 more matches
2D maze game with device orientation - Game development
the create function holds some basic configuration: we're setting up the scaling and alignment of the canvas, and moving on to the preload state when everything's ready.
... function that will be executed when someone clicks the button.
... when the start button is pressed, instead of jumping directly into the action the game will show the screen with the information on how to play the game.
...And 10 more matches
Creating hyperlinks - Learn web development
almost any web content can be converted to a link so that when clicked or otherwise activated the web browser goes to another web address (url).
...when working locally with a web site, you'll have one directory that contains the entire site.
... link best practices there are some best practices to follow when writing links.
...And 10 more matches
Inheritance in JavaScript - Learn web development
in addition, we present some advice on when and where you might use oojs, and look at how classes are dealt with in modern ecmascript syntax.
...the first parameter specifies the value of this that you want to use when running the function, and the other parameters are those that should be passed to the function when it is invoked.
...the new object has person.prototype as its prototype and will therefore inherit, if and when needed, all the methods available on person.prototype.
...And 10 more matches
Adding a new todo form: Vue events, methods, and models - Learn web development
what we really need next is the ability to allow our users to enter their own todo items into the app, and for that we'll need a text <input>, an event to fire when the data is submitted, a method to fire upon submission to add the data and rerender the list, and a model to control the data.
... </label> <input type="text" id="new-todo-input" name="new-todo" autocomplete="off" /> <button type="submit"> add </button> </form> </template> so we now have a form component into which we can enter the title of a new todo item (which will become a label for the corresponding todoitem when it is eventually rendered).
...ur todoform component inside your app by adding the <to-do-form /> element inside your app's <template>, like so: <template> <div id="app"> <h1>my to-do list</h1> <to-do-form></to-do-form> <ul> <li v-for="item in todoitems" :key="item.id"> <to-do-item :label="item.label" :done="item.done" :id="item.id"></to-do-item> </li> </ul> </div> </template> now when you view your running site, you should see the new form displayed.
...And 10 more matches
Introduction to automated testing - Learn web development
gulp comes with a watch() function that you can use to watch your files and run tests whenever you save a file.
...gulp will now watch your directory, and run the appropriate tasks whenever you save a change to an html, css, or javascript file.
... note: the * character is a wildcard character — here we're saying "run these tasks when any files of these types are saved.
...And 10 more matches
Gecko Keypress Event
that is, when the currently selected keyboard layout produces a unicode character (according to the current state of capslock and numlock), the charcode property contains that character.
... when the keypress event includes modifier keys, sometimes the charcode value is replaced with an ascii character according to the following rules.
... when the accel key is down, the charcode of a keypress event may be replaced with a character from a latin keyboard layout only when the original character is not an ascii character.
...And 10 more matches
Python binding for NSS
thus when deciding if the nss/nspr api should be rigidly followed or a more pythonic api provided the pythonic implementation wins because python programmers do not want to write c programs in python, rather they want their python code to feel like python code with the richness of full python.
... many methods/functions provide sane default (keyword) parameters freeing the python programmer from having to specify all parameters yet allowing them to be overriden when necessary.
... python-nss tries to be flexible when generating a print representation of complex objects.
...And 10 more matches
NSS Tools certutil
when you delete keys, be sure to also remove any certificates associated with those keys from the certificate database, by using -d.
...use when checking certificate validity with the -v option.
...when specifying an explicit time, use "yymmddhhmmssz".
...And 10 more matches
Shell global objects
these are the global objects that are set up automatically by the spidermonkey js command-line interpreter when you start the program.
...if a second argument is provided, it will be invoked when the timer elapses.
...when enabled, at every instruction a backtrace will be recorded and stored in an array.
...And 10 more matches
Component Internals
a component in the xpcom framework when you build a component or module and compile it into a library, it must export a single method named nsgetmodule.
...it gets called during registration and unregistration of the component, and when xpcom wants to discover what interfaces or classes the module/library implements.
... xpcom initialization to understand why and when your component library gets called, it is important to understand the xpcom initalization process.
...And 10 more matches
Creating the Component Code
as in grade school when you learned long division, better tools like calculators come after you figure out what's actually happening.
...we suggest that when you are testing your component in the mozilla or netscape client, you copy your component into the components directory in the client's installation folder.
... when it is copied there, run regxpcom from the command line to register that component and all the others in that directory.
...And 10 more matches
IAccessible2
refer to @ref _arrayconsideration "special consideration when using arrays" for more details.
...refer to @ref _arrayconsideration "special consideration when using arrays" for more details.
...note that this array is to be allocated by the client and freed when no longer needed.
...And 10 more matches
nsINavHistoryResultObserver
methods batching() lets the observer know when a batch operation in places is about to start or end.
...this is especially useful when updating user interfaces, to avoid flicker or continuous selection changes, which may result in performance degradation (for example, if updating a view for each update).
... containerclosed() obsolete since gecko 11.0 (firefox 11.0 / thunderbird 11.0 / seamonkey 2.8) called when a container node's state changes from opened to closed.
...And 10 more matches
nsIWebProgressListener
this flag is set when a request is initiated.
... the request is complete when onstatechange() is called for the same request with the state_stop flag set.
...when a redirect occurs, a new request is generated automatically to process the new request.
...And 10 more matches
Index
2 account provisioner the account provisioner is the dialog that first comes up when starting thunderbird.
... 4 account interfaces code snippets, extension development, thunderbird this page contains a list of the interfaces that you'll will most likely use when writing extensions that work with email or other accounts.
... 7 address book interfaces mailnews, mozilla, seamonkey, thunderbird this page contains a list of the interfaces that you'll will most likely hit when writing patches for the address book or writing extensions.
...And 10 more matches
Working with windows in chrome code
from xpcom components and modules if the window object is unavailable (for example, when opening a window from xpcom component code), you might want to use nsiwindowwatcher interface.
... content windows when a xul window contains a widget capable of displaying a page, such as <browser> or <iframe>, the document in that widget is, naturally, separate from the document of the chrome window itself.
... you should be aware of xpcnativewrappers when working with untrusted content.
...And 10 more matches
Initialization and Destruction - Plugins
initialization: the browser calls the plug-in api function np_initialize when the plug-in code is first loaded.
... instance creation: the browser calls the plug-in api function npp_new when the instance is created.
... instance destruction: the plug-in instance is deleted when the user leaves the instance page or closes the instance window; the browser calls the function npp_destroy to tell the plug-in that the instance is being deleted.
...And 10 more matches
Web Console remoting - Firefox Developer Tools
the webconsoleclient lives in webconsoleclient.jsm (in toolkit/devtools/webconsole) and it is used by the web console when working with the web console actor.
...the client has the option to start each listener when needed.
...when you attach to the global consoleactor you receive all of the network requests, page errors, and the other events from all of the tabs and windows, including chrome errors and network events.
...And 10 more matches
PointerEvent - Web APIs
pointerover this event is fired when a pointing device is moved into an element's hit test boundaries.
... pointerenter this event is fired when a pointing device is moved into the hit test boundaries of an element or one of its descendants, including as a result of a pointerdown event from a device that does not support hover (see pointerdown).
... pointerdown the event is fired when a pointer becomes active.
...And 10 more matches
RTCDataChannel - Web APIs
these labels are not required to be unique.maxpacketlifetime read only the read-only rtcdatachannel property maxpacketlifetime returns the amount of time, in milliseconds, the browser is allowed to take to attempt to transmit a message, as set when the data channel was created, or null.maxretransmits read only the read-only rtcdatachannel property maxretransmits returns the maximum number of times the browser should try to retransmit a message before giving up, as set when the data channel was created, or null, which indicates that there is no maximum.negotiated read only the read-only rtcdatachannel property negotiated indicates whether ...
...if no protocol was specified when the data channel was created, then this property's value is "" (the empty string).readystate read only the read-only rtcdatachannel property readystate returns an enum of type rtcdatachannelstate which indicates the state of the data channel's underlying data connection.reliable read only the read-only rtcdatachannel property reliable indicates whether or not the data channel is reliable.st...
... read only the deprecated (and never part of the official specification) read-only rtcdatachannel property stream returns an id number (between 0 and 65,535) which uniquely identifies the rtcdatachannel.event handlersalso inherits event handlers from: eventtargetonbufferedamountlow the rtcdatachannel.onbufferedamountlow property is an eventhandler which specifies a function the browser calls when the bufferedamountlow event is sent to the rtcdatachannel.
...And 10 more matches
ServiceWorkerGlobalScope - Web APIs
once successfully registered, a service worker can and will be terminated when idle to conserve memory and processor power.
... events activate occurs when a serviceworkerregistration acquires a new serviceworkerregistration.active worker.
... contentdelete occurs when an item is removed from the content index.
...And 10 more matches
A simple RTCDataChannel sample - Web APIs
starting up when the script is run, we set up an load event listener, so that once the page is fully loaded, our startup() function is called.
... establishing a connection when the user clicks the "connect" button, the connectpeers() method is called.
... the next step is to create the rtcdatachannel by calling rtcpeerconnection.createdatachannel() and set up event listeners to monitor the channel so that we know when it's opened and closed (that is, when the channel is connected or disconnected within that peer connection).
...And 10 more matches
Viewpoints and viewers: Simulating cameras in WebXR - Web APIs
the first and most important thing to understand when considering the code to manage point-of-view and cameras in your application is this: webxr does not have cameras.
... cameras and relative movement when a classic live-action movie is filmed, the actors are on a set and move about the set as they perform, with one or more cameras watching their moves.
...some examples of ways 3d cameras are used: when rendering animation—whether for filmmaking or for use within the context of a presentation or game—the virtual camera is used just like a real-world film camera.
...And 10 more matches
Spaces and reference spaces: Spatial tracking in WebXR - Web APIs
other hardware elements can be used similarly to represent other parts of the body, providing additional data to use when simulating the user's actions in their environment.
... poses once your reference space or spaces are established for the various key objects in the scene, you will have times when you need to describe another position relative to the origin of a particular reference space.
...you can then apply controlpose's transform to the vertices in the object model representing the controller to calculate the webgl coordinates to use when rendering the controller's representation to the framebuffer.
...And 10 more matches
Web Accessibility: Understanding Colors and Luminance - Accessibility
when speaking of color contrast, w3c formulas are actually incorporating luminance, not just the colors ("hues") themselves.
... for the purposes of this document, we'll use terminlogy as it is defined in the w3c, in the css color module level 3 when working with color, it's important to know which "color space" you are working in, as different color spaces map to different measurement systems.
... here is the definition of relative luminance as defined by the w3c: "the relative brightness of any point in a colorspace, normalized to 0 for darkest black and 1 for lightest white" this statement is of course accurate, but may be confusing when used in reference to the rgb color space, which is an integer between 0 and 255.
...And 10 more matches
pointer-events - CSS: Cascading Style Sheets
the element can only be the target of a pointer event when the visibility property is set to visible and e.g.
... when a mouse cursor is over the interior (i.e., 'fill') of the element and the fill property is set to a value other than none, or when a mouse cursor is over the perimeter (i.e., 'stroke') of the element and the stroke property is set to a value other than none.
...the element can only be the target of a pointer event when the visibility property is set to visible and when e.g.
...And 10 more matches
<link>: The External Resource Link element - HTML: Hypertext Markup Language
WebHTMLElementlink
when using <link> to establish a favicon for a site, and your site uses a content security policy (csp) to enhance its security, the policy applies to the favicon.
... as this attribute is only used when rel="preload" or rel="prefetch" has been set on the <link> element.
...s, css *-image rules object <object> elements script <script> elements, worker importscripts style <link rel=stylesheet> elements, css @import track <track> elements video <video> elements worker worker, sharedworker crossorigin this enumerated attribute indicates whether cors must be used when fetching the resource.
...And 10 more matches
Expressions and operators - JavaScript
when chaining these expressions, each assignment is evaluated right-to-left.
...these operators work as they do in most other programming languages when used with floating point numbers (in particular, note that division by zero produces infinity).
...so, when the bitwise operators are applied to these values, the results are as follows: bitwise operator examples expression result binary description 15 & 9 9 1111 & 1001 = 1001 15 | 9 15 1111 | 1001 = 1111 15 ^ 9 6 1111 ^ 1001 = 0110 ~15 -16 ~ 0000 0000 ... 0000 1111 = 1111 1111 ... 1111 0000 ~9 ...
...And 10 more matches
Codecs used by WebRTC - Web media technologies
while compression is always a necessity when dealing with media on the web, it's of additional importance when videoconferencing in order to ensure that the participants are able to communicate without lag or interruptions.
... other video codecs codec name profile(s) browser compatibility vp9 — chrome (48+), firefox vp8 vp8, which we describe in general in the main guide to video codecs used on the web, has some specific requirements that must be followed when using it to encode or decode a video track on a webrtc connection.
... other notes the network payload format for sharing vp8 using rtp (such as when using webrtc) is described in rfc 7741: rtp payload format for vp8 video.
...And 10 more matches
Drag and Drop - Archive of obsolete content
mozilla and xul provide a number of events that can handle when the user attempts to drag objects around.
...the drag stops when the user releases the mouse.
... event handlers are called when the user starts and ends dragging, and at various points in-between.
...And 9 more matches
MenuButtons - Archive of obsolete content
a button or toolbarbutton with a type attribute set to 'menu' creates a button that will open a menu when pressed.
...however a segment of the button displays an arrow which, when pressed, opens a menu.
... the 'menu' button the 'menu' type of button is used when pressing the button alone should just open the menu and not execute a command directly.
...And 9 more matches
MenuItems - Archive of obsolete content
when the user activates the menuitem, the command event gets fired.
...<menuitem label="show toolbar" accesskey="t" type="checkbox" oncommand="changetoolbarstate();"/> in this example, we show the toolbar when the menuitem is checked and hide the toolbar otherwise.
... there may be times when you do not want the checkbox state to be updated automatically when the menuitem is activated.
...And 9 more matches
Keyboard Shortcuts - Archive of obsolete content
however, it would be tedious to do that for every button and menu item (though it could be necessary when one's key commands are only triggered when the user is focused on a particular element).
...when the key is pressed in this case, the button is selected.
...for example, copying text to the clipboard should only work when some text is selected.
...And 9 more matches
Skinning XUL Files by Hand - Archive of obsolete content
when this day comes, skins defined in a global skin file will be applied to a whole application -- like the mozilla browser -- so that all the various windows and parts will look consistent.
...a button is styled by the global skin when its class attribute is set to a class which is defined in the global skin.
... for example, when a button is defined as follows: <button class="plain" label="push me" /> then the following very simple style definition applies to that button.
...And 9 more matches
Using the Editor from XUL - Archive of obsolete content
overview the editor in xul lives on top of a xul <iframe> element; it observes document loading in this <iframe>, and, when document loading is complete, it instantiates an editor on the loaded document.
... editor creation so let's trace through the process of editor creation when bringing up the composer window.
...that causes the editoronload() javascript function to get executed when the xul is done loading.
...And 9 more matches
Theme changes in Firefox 2 - Archive of obsolete content
safebrowsing/warning-overlay.xul safebrowsing/browser-protection.css new file containing the overlay that's drawn over the browser when you browse to a suspected phishing site.
... browser/dropmark-nav-small.png new file; used as the drop-down menu arrow on the navigation buttons, when using small icons.
... browser/safebrowsing/dim.png new file; this is a graphic overlaid on top of the contents of the window to "dim" it when the safe browsing warning window is displayed.
...And 9 more matches
Properly Using CSS and JavaScript in XHTML Documents - Archive of obsolete content
when an xhtml page is served with mime type text/html it is treated by all browsers as if it were nothing more than html.
... however when an xhtml page is served with mime type text/xml or application/xhtml+xml, then it should be treated as an xml document which must conform to the strict rules for authoring and displaying xml.
... proper xhtml is an application of xml and as such requires that authors follow strict rules when authoring xhtml.
...And 9 more matches
Common causes of memory leaks in extensions - Extensions
all zombie compartments in extensions are caused by a failure to release resources appropriately in certain circumstances, such as when a window is closed, a page unloads, or an extension is disabled or removed.
... while bug 695480 should prevent most of these compartment leaks, add-ons still need to be aware of the practices that caused these leaks, as the fix causes many add-ons which would have otherwise caused a leak to instead throw errors when attempting to access nodes from documents which no longer exist.
... to avoid these issues, references to dom nodes in foreign document should instead be stored in an object which is specific to that document, and cleaned up when the document is unloaded, or stored as weak references.
...And 9 more matches
Efficient animation for web games - Game development
because of this, the browser can make some assumptions that it can’t easily make when you’re manually tweaking values in javascript.
...when you animate position with javascript, the browser cannot easily make that same assumption, and so you might end up causing it to draw only the newly-exposed region of content, which may introduce slow-down.
... use requestanimationframe when you are animating <canvas> content, or when your dom animations absolutely must synchronise with canvas content animations, do make sure to use window.requestanimationframe, and not older methods such as window.settimeout.
...And 9 more matches
HTML: A good basis for accessibility - Learn web development
table layouts are a relic of the past — they made sense back when css support was not widespread in browsers, but now they just create confusion for screen reader users.
... another consideration when creating layouts is using html5 semantic elements as seen in the above example (see content sectioning) — you can create a layout using only nested <div> elements, but it is better to use appropriate sectioning elements to wrap your main navigation (<nav>), footer (<footer>), repeating content units (<article>), etc.
...in this section, we'll look at the basic accessibility concerns to be aware of when creating such controls.
...And 9 more matches
HTML: A good basis for accessibility - Learn web development
table layouts are a relic of the past — they made sense back when css support was not widespread in browsers, but now they just create confusion for screen reader users.
... another consideration when creating layouts is using html5 semantic elements as seen in the above example (see content sectioning) — you can create a layout using only nested <div> elements, but it is better to use appropriate sectioning elements to wrap your main navigation (<nav>), footer (<footer>), repeating content units (<article>), etc.
...in this section, we'll look at the basic accessibility concerns to be aware of when creating such controls.
...And 9 more matches
HTML text fundamentals - Learn web development
the rain lashed down on the ...</p> <h2>chapter 2: the eternal silence</h2> <p>our protagonist could not so much as a whisper out of the shadowy figure ...</p> <h3>the specter speaks</h3> <p>several more hours had passed, when all of a sudden the specter sat bolt upright and exclaimed, "please have mercy on my soul!"</p> it's really up to you what the elements involved represent, as long as the hierarchy makes sense.
... however, when you open the document in your browser, you'll see that the text appears as a big chunk!
...(textarea.selectionend, textarea.value.length); textarea.value = front + text + back; caretpos = caretpos + text.length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to save the state when the user code is being shown, // not the solution, so that solution is not saved over the user code if(solution.value === 'show solution') { userentry = textarea.value; } else { solutionentry = textarea.value; } updatecode(); }; why do we need semantics?
...And 9 more matches
Fetching data from the server - Learn web development
the trouble with this model is that whenever you want to update any part of the page, for example, to display a new set of products or load a new page, you've got to load the entire page again.
... enter ajax this led to the creation of technologies that allow web pages to request small chunks of data (such as html, xml, json, or plain text) and display them only when needed, helping to solve the problem described above.
... to speed things up even further, some sites also store assets and data on the user's computer when they are first requested, meaning that on subsequent visits they use the local versions instead of downloading fresh copies when the page is first loaded.
...And 9 more matches
Perceived performance - Learn web development
first paint is reported by the browser and provides the time, in ms, of when the page starts changing; but this change can be a simple background color update or something even less noticable.
... it doesn’t indicate completeness and may report a time when nothing visible is painted.
... first contentful paint (fcp) reports the time when the browser first rendered anything of signifigance, be that text, foreground or background image, or a canvas or svg; capturing the very beginning of the loading experience.
...And 9 more matches
Introduction to client-side frameworks - Learn web development
a brief history when javascript debuted in 1996, it added occasional interactivity and excitement to a web that was, up until then, composed of static documents.
...when we remember that the application has to let the user to do all of these things through the browser, however, some cracks start to show.
...when you follow a link on this very website, your browser communicates with a server and fetches new content to display for you.
...And 9 more matches
Getting started with React - Learn web development
when we refer to react as a "framework", we’re working with that colloquial understanding.
... react's primary goal is to minimize the bugs that occur when developers are building uis.
... while react can be used for small pieces of an interface, it's not as easy to "drop into" an application as a library like jquery, or even a framework like vue — it is more approachable when you build your entire app with react.
...And 9 more matches
Getting started with Vue - Learn web development
this allows you to create markup managed entirely by vue, which can improve developer experience and performance when dealing with complex applications.
... it also allows you to take advantage of libraries for client-side routing and state management when you need to.
...when you need more control than the html syntax allows, you can write jsx or plain javascript functions to define your components.
...And 9 more matches
Localizing with Koala
there is also a tooltip that appears when you hover over the magnifying glass icon on the right side of the bar.
... restart komodo when the installation is complete.
... note that you don't have to edit the location field, it automatically fills in when you check the "mercurial" checkbox: "c:\mozilla\l10n\application\firefox\3.6".
...And 9 more matches
Profiling with the Firefox Profiler
reporting a performance problem has a step-by-step guide for obtaining a profile when requested by firefox developers.
...so, for example, when a thread is blocked, like 'geckomain [tab]', on a thread like 'geckomain [default]', we can see what's occurring on the latter thread that is preventing it from responding to the former.
... note: because this is a sampling profiler, be cautious when examining running time that is equal to the sampling interval.
...And 9 more matches
WebReplayRoadmap
this is time consuming, especially when the bug only reproduces intermittently.
... in a non-recording tab this will update the console whenever the log point's location executes in the future.
... dom/css integration (partially implemented) when paused, the inspector panel can be used to inspect the dom and css state of the page.
...And 9 more matches
Gecko object attributes
this is useful when combined with the posinset object attribute.
... applied to: listitem, option exposed in aria: aria-setsize live region attribues atomic true when the entire region should be presented as a whole, when changes within it are considered important enough to automatically present.
...other possible values are "polite", "assertive", and "rude", which is a suggestion for the policy when interrupting the user for changes to this region.
...And 9 more matches
nsIContentPrefService2
ver observer); void set(in astring domain, in astring name, in nsivariant value, in nsiloadcontext context, [optional] in nsicontentprefcallback2 callback); void setglobal(in astring name, in nsivariant value, in nsiloadcontext context, [optional] in nsicontentprefcallback2 callback); methods addobserverforname() registers an observer that will be notified whenever a preference with the given name is set() or removed.
... when a set() or remove method is called, observers are notified after the set() or removal completes but before method's callback is called.
... callback optional handlecompletion is called when the operation completes.
...And 9 more matches
nsINavHistoryResultViewObserver
to provide behavior similar to the folder pane in thunderbird, where drops are only permitted on items themselves instead of on the pane as a whole, always return false when the orientation isn't drop_on.
...ondrop() called when the user drops something onto the view being observed.
... ontoggleopenstate() called when an item is opened or closed.
...And 9 more matches
The JavaScript input interpreter - Firefox Developer Tools
if your input does not appear to be complete when you press enter, then the console treats this as shift+enter , enabling you to finish your input.
... you can open files when in multi-line mode, and save the current contents of the editing pane to a file.
...the menuitem enable autocompletion has a checkmark next to it when the feature is enabled, which is missing when it is disabled.
...And 9 more matches
Online and offline events - Web APIs
overview in order to build a good offline-capable web application, you need to know when your application is actually offline.
... you also need to know when your application has returned to an 'online' status again.
... effectively, the requirements break down as such: you need to know when the user comes back online, so that you can re-synchronize with the server.
...And 9 more matches
Page Visibility API - Web APIs
the page visibility api provides events you can watch for to know when a document becomes visible or hidden, as well as features to look at the current visibility state of the page.
... notes: the page visibility api is especially useful for saving resources and improving performance by letting a page avoid performing unnecessary tasks when the document isn't visible.
... when the user minimizes the window or switches to another tab, the api sends a visibilitychange event to let listeners know the state of the page has changed.
...And 9 more matches
SpeechRecognition - Web APIs
audiostart fired when the user agent has started to capture audio.
... audioend fired when the user agent has finished capturing audio.
... end fired when the speech recognition service has disconnected.
...And 9 more matches
Using readable streams - Web APIs
return new readablestream({ start(controller) { return pump(); function pump() { return reader.read().then(({ done, value }) => { // when no more data needs to be consumed, close the stream if (done) { controller.close(); return; } // enqueue the next data chunk into our target stream controller.enqueue(value); return pump(); }); } } }) }) .then(stream => new response(stream)) .then(response => response.blob()) .then(blob => url.create...
... // enqueue the next data chunk into our target stream controller.enqueue(value); return pump(); this is the standard pattern you’ll see when using stream readers: you write a function that starts off by reading the stream.
... the readablestream() constructor it is easy to read from a stream when the browser provides it for you as in the case of fetch, but sometimes you need to create a custom stream and populate it with your own chunks.
...And 9 more matches
Rendering and the WebXR frame animation callback - Web APIs
hardare vertical refresh rate when the browser is ready to refresh the <canvas> within which your webxr content is displayed, it calls your frame rendering callback, which uses the specified timestamp and any other relevant data, such as models and textures, as well as application state, to render the scene—as it should appear at the specified time—into the webgl backbuffer.
... when your callback returns, the browser transfers that backbuffer to the display or xr device, along with anything else that's changed since the last time the screen was refreshed.
...this happens when the amount of time it takes to render a frame exceeds the time available between frames, whether because rendering was delayed or because rendering itself took more time than was available.
...And 9 more matches
WindowOrWorkerGlobalScope.setTimeout() - Web APIs
code an alternative syntax that allows you to include a string instead of a function, which is compiled and executed when the timer expires.
...for clarity, however, you should try to always match them to avoid confusion when maintaining your code.
...example: settimeout(function(arg1){}.bind(undefined, 10), 1000); the "this" problem when you pass a method to settimeout() (or any other function, for that matter), it will be invoked with a this value that may differ from your expectation.
...And 9 more matches
Variable fonts guide - CSS: Cascading Style Sheets
in order to most accurately reflect the typeface design and avoid differences between browsers and how they may or may not synthesize the different styles, it's more accurate to load the specific font files where needed when using a non-variable font.
...however, the w3c’s intent was for this syntax not to be used when other attributes are available.
... notes when using font-variation-settings it is important to note that axis names are case-sensitive.
...And 9 more matches
HTML attribute reference - HTML: Hypertext Markup Language
autocapitalize global attribute sets whether input is automatically capitalized when entered by user autocomplete <form>, <input>, <select>, <textarea> indicates whether controls in this form can by default have their values automatically completed by the browser.
... enctype <form> defines the content type of the form data when the method is post.
... formnovalidate <button>, <input> if the button/input is a submit button (type="submit"), this boolean attribute specifies that the form is not to be validated when it is submitted.
...And 9 more matches
<img>: The Image Embed element - HTML: Hypertext Markup Language
WebHTMLElementimg
for these reasons and others, provide a useful value for alt whenever possible.
... this attribute is also used when copying and pasting the image to text, or saving a linked image to a bookmark.
... note: loading is only deferred when javascript is enabled.
...And 9 more matches
Feature-Policy - HTTP
be wary of this when implementing it on your website.
...when this policy is disabled and there were no user gestures, the promise returned by htmlmediaelement.play() will reject with a domexception.
...when this policy is disabled, the promise returned by navigator.getbattery() will reject with a notallowederror domexception.
...And 9 more matches
Referrer-Policy - HTTP
referrer-policy: no-referrer referrer-policy: no-referrer-when-downgrade referrer-policy: origin referrer-policy: origin-when-cross-origin referrer-policy: same-origin referrer-policy: strict-origin referrer-policy: strict-origin-when-cross-origin referrer-policy: unsafe-url directives no-referrer the referer header will be omitted entirely.
... no-referrer-when-downgrade (default) this is the default behavior if no policy is specified, or if the provided value is invalid.
... the origin, path, and querystring of the url are sent as a referrer when the protocol security level stays the same (http→http, https→https) or improves (http→https), but isn't sent to less secure destinations (https→http).
...And 9 more matches
HTTP headers - HTTP
WebHTTPHeaders
custom proprietary headers have historically been used with an x- prefix, but this convention was deprecated in june 2012 because of the inconveniences it caused when nonstandard fields became standard in rfc 6648; others are listed in an iana registry, whose original content was defined in rfc 4229.
...this is used to update caches (for safe requests), or to prevent to upload a new resource when one already exists.
...this is used to transmit data only when the cache is out of date.
...And 9 more matches
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, progress pages when uploading a file, etc.
... when browsers receive a redirect, they immediately load the new url provided in the location header.
...308 was created to remove the ambiguity of the behavior when using non-get methods.
...And 9 more matches
A re-introduction to JavaScript (JS tutorial) - JavaScript
you can perform this conversion explicitly using the boolean() function: boolean(''); // false boolean(234); // true however, this is rarely necessary, as javascript will silently perform this conversion when it expects a boolean, such as in an if statement (see below).
... for this reason, we sometimes speak simply of "true values" and "false values," meaning values that become true and false, respectively, when converted to booleans.
...this is useful for checking for null objects before accessing their attributes: var name = o && o.getname(); or for caching values (when falsy values are invalid): var name = cachedname || (cachedname = getname()); javascript has a ternary operator for conditional expressions: var allowed = (age > 18) ?
...And 9 more matches
Using Promises - JavaScript
chaining a common need is to execute two or more asynchronous operations back to back, where each subsequent operation starts when the previous operation succeeds, with the result from the previous step.
...when that's the case, any callbacks added to promise2 get queued behind the promise returned by either successcallback or failurecallback.
... promise rejection events whenever a promise is rejected, one of two events is sent to the global scope (generally, this is either the window or, if being used in a web worker, it's the worker or other worker-based interface).
...And 9 more matches
Digital audio concepts - Web media technologies
when it comes time to play back that sound later, these amplitudes are used to generate an approximation of the original waveform; instead of playing back an exact duplicate of the original, smooth wave, the rougher, blue wave is played.
...special low frequency enhancement (lfe) channels provide the signal for special speakers designed to produce the low frequency sounds and vibration to create a visceral sensation when listening to the audio.
... the number of frames that comprise a single second of audio varies depending on the sample rate used when recording the sound.
...And 9 more matches
The building blocks of responsive design - Progressive web apps (PWAs)
for a start, let's have a look at what happens when we include the <video> and <img> elements inside our first two columns, naked and unstyled.
...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.
...when you click on an image in the gallery it brings up options to delete or cancel deletion of the card, and you don't want two buttons on top of one another.
...And 9 more matches
Session store API - Archive of obsolete content
in order to properly restore your extension's state when a tab is restored, it needs to use the session store api's settabvalue() method to save any data it will need in order to restore its state, and then call gettabvalue() to retrieve the previous setting when the tab is restored.
... knowing when to restore each time firefox is about to restore a tab, an event of type sstabrestoring is sent.
... if your extension wants to be able to restore data when tabs are restored, you can install a listener like this: function myextensionhandlerestore(aevent) { var tab = event.originaltarget; /* the tab being restored */ var uri = tab.linkedbrowser.contentdocument.location; /* the tab's uri */ components.classes["@mozilla.org/consoleservice;1"] .getservice(components.interfaces.nsiconsoleservice) .logstringmessage("restoring tab: " + uri); }; document.addeventlistener("sstabrestoring", myextensionhandlerestore, false); simply replace the contents of the function myextensionhandlerestore() with whatever you need to do when the tab is restored.
...And 8 more matches
Creating a Help Content Pack - Archive of obsolete content
later, when we get to actually writing content, you'll need to know xhtml, but for now knowledge of the syntax should be enough.
... nc:defaulttopic will hold the rdf:id of the topic you want displayed when the viewer first loads if none has been specified.
... this attribute also specifies what topic is loaded when the user hits the home button in the viewer.
...And 8 more matches
New Skin Notes - Archive of obsolete content
-- dria when will these fixes be on the live site?
...when the skin is updated on test/docs, editform textarea should be resizeable in all browsers.
...-- dria when a page is redirected, need to say-so and what it was redirected from, (see document for an example of such.) this is only an issue in mw1.5 so far.
...And 8 more matches
Sorting Results - Archive of obsolete content
« previousnext » when results are generated from a query, content is generated in the same order as the results.
...when the reference node is an rdf seq container and the results are in that container, however, the template builder orders the results in the order the items appear in the seq.
...when using a tree, sorting may be performed on each column of the tree.
...And 8 more matches
Complete - Archive of obsolete content
when it is finished, it will get a category and links from other pages.
...the problem with this approach is that when changes in an application do make the extension fail, users might have bad experiences ranging from error messages that they cannot understand to crashes and data loss.
...how a text sting gets localized when you press button 1 you see an message in english or french, depending on your application's locale.
...And 8 more matches
Browser Detection and Cross Browser Support - Archive of obsolete content
rethinking the basics of when and how to detect user agents is crucial to creating maintainable, cross browser web content.
... these strategies of classifying browsers by vendor/version, assuming that the only browsers being used where either netscape navigator 4 or internet explorer 4 failed when alternative browsers such as those based upon gecko were introduced.
...this is a common source of problems when using browsers based upon gecko as well as opera.
...And 8 more matches
Mobile accessibility - Learn web development
long gone are the days when mobile devices ran completely different web technologies to desktop browsers, forcing developers to use browser sniffing and serve them completely separate sites (although quite a few companies still detect usage of mobile devices and serve them a separate mobile domain).
... when you've found the talkback menu, press the slider switch to turn talkback on.
... when talkback is turned on, your android device's basic controls will be a bit different.
...And 8 more matches
Overflowing content - Learn web development
previous overview: building blocks next overflow is what happens when there is too much content to fit in a container.
...overflow happens when there is too much content to fit in a box.
... css tries to avoid "data loss" let's consider two examples that demonstrate the default behavior of css when there is overflow.
...And 8 more matches
Pseudo-classes and pseudo-elements - Learn web development
user-action pseudo classes some pseudo-classes only apply when the user interacts with the document in some way.
... these user-action pseudo-classes, sometimes referred to as dynamic pseudo-classes, act as if a class had been added to the element when the user interacts with it.
...whenever you see these selectors, look at the content property to see what is being added to the document.
...And 8 more matches
Making asynchronous programming easier with async and await - Learn web development
to actually consume the value returned when the promise fulfills, since it is returning a promise, we could use a .then() block: hello().then((value) => console.log(value)) or even just shorthand such as hello().then(console.log) like we saw in the last article.
...by only adding the necessary handling when the function is declared async, the javascript engine can optimize your program for you.
... the await keyword the real advantage of async functions becomes apparent when you combine it with the await keyword — in fact, await only works inside async functions.
...And 8 more matches
Functions — reusable blocks of code - Learn web development
previous overview: building blocks next another essential concept in coding is functions, which allow you to store a piece of code that does a single task inside a defined block, and then call that code whenever you need it using a single short command — rather than having to type out the same code multiple times.
...in fact, some of the code you are calling when you invoke (a fancy word for run, or execute) a built in browser function couldn't be written in javascript — many of these functions are calling parts of the background browser code, which is written largely in low-level system languages like c++, not web languages like javascript.
...you generally use an anonymous function along with an event handler, for example the following would run the code inside the function whenever the associated button is clicked: const mybutton = document.queryselector('button'); mybutton.onclick = function() { alert('hello'); } the above example would require there to be a <button> element available on the page to select and click.
...And 8 more matches
A first splash into JavaScript - Learn web development
when the game ends, the player should be given an option to start playing again.
... the first three constants are each made to store a reference to the results paragraphs in our html, and are used to insert values into the paragraphs later on in the code (note how they are inside a <div> element, which is itself used to select all three later on for resetting, when we restart the game): <div class="resultparas"> <p class="guesses"></p> <p class="lastresult"></p> <p class="loworhi"></p> </div> the next two constants store references to the form text input and submit button and are used to control submitting the guess later on.
...inside the curly braces goes all the code that we want to run whenever we call the function.
...And 8 more matches
Website security - Learn web development
as you read, note how threats are most successful when the web application either trusts, or is not paranoid enough about the data coming from the browser.
...when the attacker has the cookie, they can log into a site as though they were the user and do anything the user can, such as access their credit card details, see contact details, or change passwords.
... a reflected xss vulnerability occurs when user content that is passed to the server is returned immediately and unmodified for display in the browser.
...And 8 more matches
Ember interactivity: Events, classes and state - Learn web development
when beginning to think about interactivity, it's good to declare what each component's goals and responsibilities are.
... creating todos for our card-header / todo input, we'll want to be able to submit our typed in todo task when we press the enter key and have it appear in the todos list.
...for example, the @tracked decorator (see slightly later on) runs code it is applied to, but additionally tracks it and automatically updates the app when values change.
...And 8 more matches
Displaying Places information using views
when a view's underlying data changes, the view will automatically update itself so that it displays the new data.
...this is useful when you need the id for another purpose or when a treecol is contained in anonymous content, as in xbl.
... second, know this: when it comes to trees, "view" is an overloaded word.
...And 8 more matches
Leak-hunting strategies and tips
strategy for finding leaks when trying to make a particular testcase not leak, i recommend focusing first on the largest object graphs (since these entrain many smaller objects), then on smaller reference-counted object graphs, and then on any remaining individual objects or small object graphs that don't entrain other objects.
...(when i refer to the size of a graph of objects, i'm referring to the number of objects, not the size in bytes.
... build with --enable-trace-malloc common leak patterns when trying to find a leak of reference-counted objects, there are a number of patterns that could cause the leak: ownership cycles.
...And 8 more matches
nsIDOMSimpleGestureEvent
the following events are generated: mozswipegesture - generated when the user completes a swipe across across the input device.
... mozmagnifygesturestart - generated when the user begins the magnify ("pinch") gesture.
... mozmagnifygesture - generated when the user has completed the magnify ("pinch") gesture.
...And 8 more matches
nsIFocusManager
this flag would normally be passed when movefocus_forward or movefocus_backward is used.
...this flag will be implied when movefocus() is called except when one of the other mechanisms (mouse or key) is specified, or when the type is movefocus_root or movefocus_caret.
... movefocus_forward 1 move focus forward one element, used when pressing tab.
...And 8 more matches
nsINavBookmarksService
constants constant value description default_index -1 this is the default index; this value should be used for apis that allow passing in an index where the index is not known or is not required to be specified, such as when appending an item to a folder.
... beginupdatebatch() obsolete since gecko 1.9 (firefox 3) causes observers to be notified of a beginupdatebatch when a lot of things are about to change.
... calls can be nested, observers will only be notified when all batches begin/end.
...And 8 more matches
nsINavHistoryResultViewer
methods containerclosed() called when a container node's state changes from closed to opened.
... containeropened() called when a container node's state changes from closed to opened.
... invalidatecontainer() called when something has happened that requires that the contents of a container be rebuilt.
...And 8 more matches
nsINavHistoryService
transition_typed 2 this transition type is set when the user typed the url to get to the page.
... transition_bookmark 3 this transition type is set when the user followed a bookmark to get to the page.
... transition_embed 4 this transition type is set when some inner content is loaded.
...And 8 more matches
nsIPromptService
acheckstate contains the initial checked state of the checkbox when this method is called and the final checked state after this method returns.
... acheckstate contains the initial checked state of the checkbox when this method is called and the final checked state after this method returns.
... acheckstate contains the initial checked state of the checkbox when this method is called and the final checked state after this method returns.
...And 8 more matches
Mozilla
adding phishing protection data providers phishing protection technology lets firefox help protect users by comparing the urls the user visits to a list of known scam sites, and presenting a warning to the user when they visit a site on the list.
... continuous integration when you push a commit to mozilla-central or a related repository, it initiates a large chain of builds and tests across multiple types of infrastructure.
...the component can then call methods on the observer interface to signal the external code when predefined events occur.
...And 8 more matches
UI Tour - Firefox Developer Tools
ignore source causes the debugger to skip the file when "stepping into" functions; this can be helpful for avoiding stepping into libraries used by your code.
... when a file is ignored, it has a small eye icon next to it in place of its regular icon.
... when the source pane is focused you can search for a string in the file using ctrl + f (cmd + f on a mac).
...And 8 more matches
Edit fonts - Firefox Developer Tools
the fonts tab the fonts tab is located on the right-hand side of the page inspector when it is docked to the bottom of the screen.
... when it is docked to the right or left sides of the screen, the fonts tab appears beneath the html pane.
... fonts are considered "used" when there is text content in the inspected element that has the font applied to it.
...And 8 more matches
Fullscreen API - Web APIs
event handlers the fullscreen api defines two events which can be used to detect when full-screen mode is turned on and off, as well as when errors occur during the process of changing between full-screen and windowed modes.
... event handlers on documents document.onfullscreenchange an event handler for the fullscreenchange event that's sent to a document when that document is placed into full-screen mode, or when that document exits full-screen mode.
... this handler is called only when the entire document is presented in full-screen mode.
...And 8 more matches
Basic concepts - Web APIs
big concepts if you have assumptions from working with other types of databases, you might get thrown off when working with indexeddb.
... this transaction model is really useful when you consider what might happen if a user opened two instances of your web app in two different tabs simultaneously.
...you get notified by a dom event when the operation finishes, and the type of event you get lets you know if the operation succeeded or failed.
...And 8 more matches
Service Worker API - Web APIs
service workers essentially act as proxy servers that sit between web applications, the browser, and the network (when available).
...it takes the form of a javascript file that can control the web-page/site that it is associated with, intercepting and modifying navigation and resource requests, and caching resources in a very granular fashion to give you complete control over how your app behaves in certain situations (the most obvious one being when the network is not available).
...in firefox, service worker apis are also hidden and cannot be used when the user is in private browsing mode.
...And 8 more matches
Using writable streams - Web APIs
this takes a given message and writes it into a writable stream, displaying each chunk on the ui as it is written to the stream and also displaying the whole message on the ui when writing has finished.
...this is called when each chunk is actually written (see the next section).
... the close() method is called automatically when writing has finished — it prints the entire decoded result to the ui in one string.
...And 8 more matches
Using Touch Events - Web APIs
a multi-touch interaction starts when a finger (or stylus) first touches the contact surface.
...the interaction ends when the fingers are removed from the surface.
... interfaces touch events consist of three interfaces (touch, touchevent and touchlist) and the following event types: touchstart - fired when a touch point is placed on the touch surface.
...And 8 more matches
Geometry and reference spaces in WebXR - Web APIs
geometry operations with matrices we offer a guide to matrix mathematics as it pertains to 3d geometry, including how matrices are used for the three primary transforms that need to be performed when rendering 3d scenes: translation is the use of a matrix to shift the position of a point through the virtual space.
... note that when we say that a transform applies to a point, it also, by extension, can be applied to a collection of points.
...the origin offset is initially simply an identity transform, since typically the two origins are aligned when the space is first established.
...And 8 more matches
Using the Web Animations API - Web APIs
when we want to explicitly set a key’s offset from the other keys, we can specify an offset directly in the object, separated from the declaration with a comma.
...to prevent the cake from eating itself up before the user has had the chance to click on it, we call animation.pause() on it immediately after it is defined, like so: nommingcake.pause(); we can now use the animation.play() method to run it whenever we’re ready: nommingcake.play(); specifically, we want to link it to alice’s animation, so she gets bigger as the cupcake gets eaten.
... nommingcake.play(); } when a user holds their mouse down or presses their finger on the cake on a touch screen, we can now call growalice to make all the animations play: cake.addeventlistener("mousedown", growalice, false); cake.addeventlistener("touchstart", growalice, false); other useful methods in addition to pausing and playing, we can use the following animation methods: animation.finish() skips to the end of the animation.
...And 8 more matches
Specificity - CSS: Cascading Style Sheets
when multiple declarations have equal specificity, the last declaration found in the css is applied to the element.
... specificity only applies when the same element is targeted by multiple declarations.
... the !important exception when an important rule is used on a style declaration, this declaration overrides any other declarations.
...And 8 more matches
User input and controls - Developer guides
when screen orientation matters for your application, through the screen orientation api you can read the screen orientation state and perform other actions.
...for example if you want to add controls when any key gets pressed, you need to add an event listener on the window object: window.addeventlistener("keydown", handlekeydown, true); window.addeventlistener("keyup", handlekeyup, true); where handlekeydown and handlekeyup are the functions implementing the controls about the keydown and keyup events.
... mouse the events occurring when the user interacts with a pointing device such as a mouse are represented by the mouseevent dom interface.
...And 8 more matches
HTML attribute: multiple - HTML: Hypertext Markup Language
in firefox, the file input reads "no files selected" when the attribute is present and "no file selected" when not, when no files are selected.
... most browsers displaying a scrolling list box for a <select> control with the multiple attribute set versus a single line dropdown when the attribute is ommitted.
... when multiple is set on the email input type, the user can inlclude zero (if not also required), one or more comma-separated email addresses.
...And 8 more matches
<audio>: The Embed Audio element - HTML: Hypertext Markup Language
WebHTMLElementaudio
note: sites that automatically play audio (or videos with an audio track) can be an unpleasant experience for users, so should be avoided when possible.
...however, this can be useful when creating media elements whose source will be set at a later time, under user control.
... when not present, the resource is fetched without a cors request (i.e.
...And 8 more matches
<button>: The Button element - HTML: Hypertext Markup Language
WebHTMLElementbutton
autofocus html5 this boolean attribute specifies that the button should have input focus when the page loads.
...possible values: post: the data from the form are included in the body of the http request when sent to the server.
... use when the form contains information that shouldn’t be public, like login credentials.
...And 8 more matches
<input type="number"> - HTML: Hypertext Markup Language
WebHTMLElementinputnumber
<input> types, inputs of type number support these attributes: attribute description list the id of the <datalist> element that contains the optional pre-defined autocomplete options max the maximum value to accept for this input min the minimum value to accept for this input placeholder an example value to display inside the field when it's empty readonly a boolean attribute indicating whether the value is read-only step a stepping interval to use when using up and down arrows to adjust the value, as well as for validation list the values of the list attribute is the id of a <datalist> element located in the same document.
... note: when the data entered by the user doesn't adhere to the stepping configuration, the user agent may round to the nearest valid value, preferring numbers in the positive direction when there are two equally close options.
... using number inputs <input type="number"> elements can help simplify your work when building the user interface and logic for entering numbers into a form.
...And 8 more matches
<input type="url"> - HTML: Hypertext Markup Language
WebHTMLElementinputurl
s the optional pre-defined autocomplete options maxlength the maximum number of characters the input should accept minlength the minimum number of characters long the input can be and still be considered valid pattern a regular expression the input's contents must match in order to be valid placeholder an exemplar value to display in the input field whenever it is empty readonly a boolean attribute indicating whether or not the contents of the input should be read-only size a number indicating how many characters wide the input field should be spellcheck controls whether or not to enable spell checking for the input field, or if the default spell checking configuration should be used list the values of ...
...constraint validation is only applied when the value is changed by the user.
...constraint validation is only applied when the value is changed by the user.
...And 8 more matches
Browser detection using the user agent - HTTP
considerations before using browser detection when considering using the user agent string to detect which browser is being used, your first step is to try to avoid it if possible.
...the first method uses horizontal flexboxes to group the content such that when the page is displayed to the end user, all the dogs boxes are at the top of the page and all the cat boxes are lower on the page.
...the simplest way to do this is to separate all the code that moves content around based on screen size to a single function that is called when the page is loaded and at each resize event thereafter.
...And 8 more matches
Object.defineProperty() - JavaScript
when the property is accessed, this function is called without arguments and with this set to the object through which the property is accessed (this may not be the object on which the property is defined due to inheritance).
...when the property is assigned, this function is called with one argument (the value being assigned to the property) and with this set to the object through which the property is assigned.
... creating a property when the property specified doesn't exist in the object, object.defineproperty() creates a new property as described.
...And 8 more matches
Add to Home screen - Progressive web apps (PWAs)
regardless of which browser you are using, when you choose to add the app to your home screen, you'll see it appear along with a short title, in the same way that native apps do.
... chrome additionally requires the app to have a service worker registered (e.g., so it can function when offline).
...the most relevant one to a2hs is the splash screen displayed when the app icon on the home screen is tapped and it first starts to load (this currently appears only when apps have been added to the home screen by chrome).
...And 8 more matches
How to make PWAs re-engageable using Notifications and Push - Progressive web apps (PWAs)
but instead of relying only on user actions, we can do more, using push messages and notifications to automatically re-engage and deliver new content whenever it is available.
... two apis, one goal the push api and notifications api are two separate apis, but they work well together when you want to provide engaging functionality in your app.
...notifications can be used by the service worker to show new information to the user, or at least alert them when something has been updated.
...And 8 more matches
ui/sidebar - Archive of obsolete content
alternatively, the view->sidebar submenu in firefox will contain a new item which the user can use to show or hide the sidebar: the sidebar generates a show event when it is shown and a hide event when it is hidden.
... using attach the attach event is triggered whenever the dom for a new sidebar instance is loaded and its scripts are attached.
...you should see console output like: console.log: add-on: add-on script got the message console.log: add-on: sidebar script got the reply using ready the ready event is emitted when the dom for the sidebar's content is ready.
...And 7 more matches
package.json - Archive of obsolete content
some of its entries, such as icon, name, and description, have direct analogues in the install manifest format, and entries from package.json are written into the install manifest when the add-on is built using jpm xpi.
... note: this is deprecated along with cfx; it's not available when using jpm.
... firefox: firefox desktop fennec: firefox for android thunderbird: thunderbird seamonkey: seamonkey any application uuid example: "engines": { "firefox": ">= 38.0a1", "fennec": ">= 38.0a1" } fullname note: this is deprecated along with cfx; it's not available when using jpm.
...And 7 more matches
Creating a dynamic status bar extension - Archive of obsolete content
specifically, this sample displays a stock quote in the status bar, and, when you mouse over it, displays a tooltip containing more detailed information about the stock.
.../content/stockwatcher.js"/> <!-- firefox --> <statusbar id="status-bar"> <statusbarpanel id="stockwatcher" label="loading..." tooltiptext="current value" onclick="stockwatcher.refreshinformation()" /> </statusbar> </overlay> also, notice that the definition of the status bar panel now includes a new property, onclick, which references the javascript function that will be executed whenever the user clicks on the status bar panel.
... our extension will refresh the stock information display when the user clicks the panel.
...And 7 more matches
Download Manager preferences - Archive of obsolete content
a boolean value that indicates whether the anti virus software should try to clean a downloaded file when a virus is detected.
... browser.download.manager.closewhendone a boolean value indicating whether or not the downloads window should close automatically when downloads are completed.
... browser.download.manager.flashcount indicates the number of times the appropriate user interface element should be "flashed" to get the user's attention when a download completes.
...And 7 more matches
Binding Attachment and Detachment - Archive of obsolete content
whenever an element is removed from a document, any bindings attached via css loaded by the document will be detached.
... when a binding is attached using the dom, it inherits from the current most derived binding that may already be attached to the element.
...when the load event fires, and if all binding documents loaded successfully, it can be assumed that all bindings are attached to all elements in the page.
...And 7 more matches
Popup Guide - Archive of obsolete content
menus a menu is used when you wish to have a series of commands that can be activated by the user, but don't want to use the extra space for a button for each command.
... a menu is normally hidden, and when activated, a popup appears containing the list of commands.
...it is useful when you wish to display some controls temporarily over the existing ui.
...And 7 more matches
More Event Handlers - Archive of obsolete content
mouse events there are several events which can be used to handle mouse specific actions, which are described briefly below: click called when the mouse is pressed and released on an element.
... dblclick called when the a mouse button is double clicked.
... mousedown called when a mouse button is pressed down on an element.
...And 7 more matches
Popup Menus - Archive of obsolete content
popup menus are typically displayed when the user presses the right mouse button.
... plain popups the plain popup is a popup window which appears when the user presses the left mouse button on an element.
...a good example is the drop down menu that appears when you click on the little down arrows next to the back and forward buttons in a browser window.
...And 7 more matches
menupopup - Archive of obsolete content
when a menupopup is open, it floats above the window and may extend outside the window border.
... there are several ways in which a menupopup may be used: it may be placed inside a menu, menulist, toolbarbutton, or a button with the type attribute set to "menu" to create a popup that will open when the menu or button is pressed.
...when the element is clicked with the left mouse button, the menupopup will be displayed.
...And 7 more matches
toolbar - Archive of obsolete content
it can be collapsed with a grippy when the toolbar is placed inside a toolbox.
... the chromeclass-toolbar class may be used to create a toolbar where its visibility depends on the toolbar flag when opening the window with the window interface's open() method loads the specified resource into the browsing context (window, <iframe> or tab) with the specified name.
... note: starting in gecko 1.9.1, toolbar items are moved from the toolbarpalette and added to the toolbar when a toolbar is first displayed.
...And 7 more matches
tree - Archive of obsolete content
ArchiveMozillaXULtree
it is used when a tree has a datasources attribute, and has dont-build-content in its flags attribute.
...it is similar to the previous type but is used when the tree does not have dont-build-content in its flags attribute.
... enablecolumndrag type: boolean when set to true, the user may drag the column headers around to change the order in which they are displayed.
...And 7 more matches
Table Reflow Internals - Archive of obsolete content
overview review of reflow table frames table reflow intro to paginated reflow table paginated reflow review of reflow reflow process starts when an html document starts loading (the frame tree contains only viewport, scroll(s), canvas, html, body).
... ususally it starts when the pres shell processes its queue of reflow commands.
...if this doesn't change, the row may not have to reflow the cell table incremental reflow outer table is a target when a caption is added or removed (dirty) or the table or caption margin changes (style changed).
...And 7 more matches
Desktop gamepad controls - Game development
r("gamepadconnected", gamepadhandler); it's executed once, so we can create some variables we will need later on for storing the controller info and the pressed buttons: var controller = {}; var buttonspressed = []; function gamepadhandler(e) { controller = e.gamepad; output.innerhtml = "gamepad: " + controller.id; } the second line in the gamepadhandler function shows up on the screen when the device is connected: we can also show the id of the device — in the case above we're using the xbox 360 wireless controller.
...the connect() and disconnect() functions are bound to the following events: window.addeventlistener("gamepadconnected", gamepadapi.connect); window.addeventlistener("gamepaddisconnected", gamepadapi.disconnect); they are fired when the gamepad is connected and disconnected respectively.
...here's the code we've prepared in the create() function that is executed once when the new state is created: create() { // ...
...And 7 more matches
Cascade and inheritance - Learn web development
the cascade, and the closely-related concept of specificity, are mechanisms that control which rule applies when there is such a conflict.
... the cascade stylesheets cascade — at a very simple level this means that the order of css rules matter; when two rules apply that have equal specificity the one that comes last in the css is the one that will be used.
...the live example below allows you to play with the css and see what happens when you make changes.
...And 7 more matches
Images, media, and form elements - Learn web development
prerequisites: basic computer literacy, basic software installed, basic knowledge of working with files, html basics (study introduction to html), and an idea of how css works (study css first steps.) objective: to understand the way that some elements behave unusually when styled with css.
...when using object-fit the replaced element can be sized to fit a box in a variety of ways.
... replaced elements in layout when using various css layout techniques on replaced elements, you may well find that they behave slightly differently to other elements.
...And 7 more matches
CSS values and units - Learn web development
when you see the value <color> as valid for a particular property, that means you can use any valid color as a value for that property, as listed on the <color> reference page.
...the terms are basically interchangeable — when you see something in css referred to as a data type, it is really just a fancy way of saying value.
...name equivalent to cm centimeters 1cm = 96px/2.54 mm millimeters 1mm = 1/10th of 1cm q quarter-millimeters 1q = 1/40th of 1cm in inches 1in = 2.54cm = 96px pc picas 1pc = 1/6th of 1in pt points 1pt = 1/72th of 1in px pixels 1px = 1/96th of 1in most of these values are more useful when used for print, rather than screen output.
...And 7 more matches
CSS FAQ - Learn web development
LearnCSSHowtoCSS FAQ
/dtd html 4.0 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <!doctype html public "-//w3c//dtd html 4.01//en" "http://www.w3.org/tr/html4/strict.dtd"> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> when at all possible, you should just use the html5 doctype.
... use a class-specific style when you want to apply the styling rules to many blocks and elements within the page, or when you currently only have element to style with that style, but you might want to add more later.
... use an id-specific style when you need to restrict the applied styling rules to one specific block or element.
...And 7 more matches
What’s in the head? Metadata in HTML - Learn web development
previous overview: introduction to html next the head of an html document is the part that is not displayed in the web browser when the page is loaded.
... let's revisit the simple html document we covered in the previous article: <!doctype html> <html> <head> <meta charset="utf-8"> <title>my test page</title> </head> <body> <p>this is my page</p> </body> </html> the html head is the contents of the <head> element — unlike the contents of the <body> element (which are displayed on the page when loaded in a browser), the head's content is not displayed on the page.
... the <h1> element appears on the page when loaded in the browser — generally this should be used once per page, to mark up the title of your page content (the story title, or news headline, or whatever is appropriate to your usage.) the <title> element is metadata that represents the title of the overall html document (not the document's content.) active learning: inspecting a simple example to start off this active learning, we'd...
...And 7 more matches
Build your own function - Learn web development
any parameters we want to give to our function go inside the parentheses, and the code that runs when we call the function goes inside the curly braces.
...this button will be what needs to be clicked/activated when the user wants to close the message box.
... const msg = document.createelement('p'); msg.textcontent = 'this is a message box'; panel.appendchild(msg); const closebtn = document.createelement('button'); closebtn.textcontent = 'x'; panel.appendchild(closebtn); finally, we use an globaleventhandlers.onclick event handler to make it so that when the button is clicked, some code is run to delete the whole panel from the page — to close the message box.
...And 7 more matches
Looping code - Learn web development
a condition, which is a true/false test to determine whether the loop continues to run, or stops — usually when the counter reaches a certain value.
... a condition — as mentioned before, this defines when the loop should stop looping.
... when i becomes equal to cats.length (in this case, 5), the loop will stop, and the browser will move on to the next bit of code below the loop.
...And 7 more matches
Basic math in JavaScript — numbers and operators - Learn web development
this is especially true when we are learning to program javascript (or any other language for that matter) — so much of what we do relies on processing numerical data, calculating new values, and so on, that you won't be surprised to learn that javascript has a full-featured set of math functions available.
...you may have encountered these numbers before when setting colors in css.
...this most commonly happens when data is entered into a form input, and the input type is text.
...And 7 more matches
Aprender y obtener ayuda - Learn web development
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 progress in your work.
...it isn't however very good at getting an understanding of "the big picture", and unlocking new neural pathways when you are trying to understand new subjects or solve new problems that you haven't come across before.
... it is also why you can sometimes get really stuck on a problem, but then figure out the answer when you go for a coffee break (or a walk).
...And 7 more matches
Deployment and next steps - Learn web development
it also starts a development server and watches for changes, recompiling the app and refreshing the page when a change occurs.
... our whole app is now just 21 kb — 8.3 kb when gzipped.
... a look behind the svelte compilation process by default, when you create a new app with npx degit sveltejs/template my-svelte-project, svelte will use rollup as the module bundler.
...And 7 more matches
Getting started with Svelte - Learn web development
while frameworks like react and vue do the bulk of their work in the user's browser while the app is running, svelte shifts that work into a compile step that happens only when you build your app, producing highly-optimized vanilla javascript.
...svelte will watch for file updates, and automatically recompile and refresh the app for you when changes are made to the source files.
...o build svelte apps.</p> </main> <style> main { text-align: center; padding: 1em; max-width: 240px; margin: 0 auto; } h1 { color: #ff3e00; text-transform: uppercase; font-size: 4em; font-weight: 100; } @media (min-width: 640px) { main { max-width: none; } } </style> the <script> section the <script> block contains javascript that runs when a component instance is created.
...And 7 more matches
Eclipse CDT Manual Setup
to be able to provide really good code assistance for a project's source code, ides like eclipse need to carry out a thorough static analysis of the project's source files, to build up a picture of the code (what eclipse is trying to do when it "indexes" the source.) static analysis involves parsing the source files, so naturally it can only produce good results if it has a sensible set of preprocessor defines, include paths and pre-include files for each source file.
... for projects the size and complexity of mozilla, it's impractical to manually configure eclipse when there is a valid set of defines and includes paths for each of the different parts of the source code.
...below.) initial workspace preferences when you open eclipse, it will ask you to "select a workspace" (a directory where eclipse will store files that it generates during indexing, and so on.) it's recommended that you have a separate workspace containing only a single project for each mozilla source tree [rational], and that you choose a directory outside the mozilla source.
...And 7 more matches
SVG Guidelines
pros and cons of svg for images when used as a document format there is usually a compelling reason that makes svg the only solution.
... when used as an image format, it is sometimes less obvious whether it would be best to use svg or a raster image format for any given image.
...when choosing whether or not to use svg it is best to understand the advantages and disadvantages of both.
...And 7 more matches
AddonListener
in addon addon) void oninstalling(in addon addon, in boolean needsrestart) void oninstalled(in addon addon) void onuninstalling(in addon addon, in boolean needsrestart) void onuninstalled(in addon addon) void onoperationcancelled(in addon addon) void onpropertychanged(in addon addon, in string properties[]) methods onenabling() called when an add-on is about to be enabled.
... void onenabling( in addon addon, in boolean needsrestart ) parameters addon the addon that is being enabled needsrestart true if an application restart is necessary for the change to take effect onenabled() called when an add-on has been enabled.
... void onenabled( in addon addon, ) parameters addon the addon that has been enabled ondisabling() called when an add-on is about to be disabled.
...And 7 more matches
Mozilla Quirks Mode Behavior
in quirks mode, the url fragment #top scrolls to the top of the page when there is no such anchor.
... there are a bunch of quirks to get percentage heights on images, tables, objects, and applets (etc.?) to "work" (the way they did in netscape navigator 4), even though css says that percentage heights should behave like 'auto' heights when the parent element doesn't have a fixed height.
... maybe (firefox 3) when computing the minimum intrinsic width of an inline flow directly in a table cell (no blocks in between), it is assumed that it is not possible to break before and after an image (when otherwise it would be).
...And 7 more matches
A brief guide to Mozilla preferences
if the application encounters an error when loading user pref files, the application will issue a warning but will continue running.
... preferences saving usually when the user specifically commits a preference change via user interface such as the preferences dialog, the application saves the change by overwriting prefs.js .
... when prefs.js is written, it only saves user preferences which are different from the default.
...And 7 more matches
NSS_3.12_release_notes.html
of uninitialized variable in ckfw/object.c(174) bug 396045: warning: usage of uninitialized variable in ckfw/mechanism.c(719) bug 401986: mac os x leopard build failure in legacydb bug 325805: diff considers mozilla/security/nss/cmd/pk11util/scripts/pkey a binary file bug 385151: remove the link time dependency from nss to softoken bug 387892: add entrust root ca certificate(s) to nss bug 433386: when system clock is off by more than two days, oscp check fails, can result in crash if user tries to view certificate [[@ secitem_compareitem_util] [[@ memcmp] bug 396256: certutil and pp do not print all the generalnames in a crldp extension bug 398019: correct confusing and erroneous comments in der_asciitotime bug 422866: vfychain -pp command crashes in nss_shutdown bug 345779: useless assignment...
... statements in ec_gf2m_pt_mul_mont bug 349011: please stop exporting these crmf_ symbols bug 397178: crash when entering chrome://pippki/content/resetpassword.xul in url bar bug 403822: pkix_pl_ocsprequest_create can leave some members uninitialized bug 403910: cert_findusercertbyusage() returns wrong certificate if multiple certs with same subject available bug 404919: memory leak in sftkdb_readsecmoddb() (sftkmod.c) bug 406120: allow application to specify ocsp timeout bug 361025: support for camellia cipher suites to tls rfc4132 bug 376417: pk11_generatekeypair needs to get the key usage from the caller.
...bug 391292: shared database implementation slow bug 391294: shared database implementation really slow on network file systems bug 392521: automatic shared db update fails if user opens database r/w but never supplies a password bug 392522: integrity hashes must be updated when passwords are changed.
...And 7 more matches
NSS API Guidelines
the security code often wants to be sure to zero memory, when it's being freed; we'll add it to the primitives to deal with.
... threadmark code notes the thread id, whenever an arena is marked, and disallows any allocations or marks by any other thread.
...now some of the pointer-tracking pressure has eased off, we can drop its use when it becomes too difficult.
...And 7 more matches
ssltyp.html
when an application makes a copy of a particular certificate structure that already exists in memory, ssl makes a shallow copy--that is, it increments the reference count for that object rather than making a whole new copy.
... when you call cert_destroycertificate, the function decrements the reference count and, if the reference count reaches zero as a result, frees the memory.
...when an application makes a copy of a particular key structure that already exists in memory, ssl makes a deep copy--that is, it makes a whole new copy of that object.
...And 7 more matches
Introduction to the JavaScript shell
from a bash console when using a pre-compiled binary, try <path to your firefox's run-mozilla.sh>/run-mozilla.sh ./js -- that worked for me] if you'd like to run the javascript code in the file foo.js, you can use this command: js foo.js to run foo.js then drop into the interactive shell, do this: js -f foo.js -i reference note: because the javascript shell is used as a test environment for the javascript eng...
... countheap([start[, kind]]) added in spidermonkey 1.8 count the number of live gc things in the heap, or things reachable from start when it is given and is not null.
... note: this function is intended only for use when testing the javascript engine.
...And 7 more matches
Secure Development Guidelines
the following content will likely see significant revision, though can be used as a reference for security best practices to follow when developing code for mozilla.
....com?something=<script>alert('oops')</script> xss: prevention escape all dynamic input that will be sent back to the user html encoding &amp; → & &lt; → < &gt; → > &quot; → " &apos; → ' url encoding % encoding java/vbscript escaping depends on the context; in a single-quoted string, escaping ' would suffice sql injection occurs when un-trusted input is mixed with a sql string sql is a language used to interact with databases code injection attack that is similar to xss but targeted at sql rather than html and javascript if input is mixed with sql, it could itself become an sql instruction and be used to: query data from the database (passwords) insert value into the database (a user account) change application...
...so data does not get mixed with sql instructions example: sqlite3_stmt *stmt; char *str = "select * from account where name='?'"; sqlite3_prepare_v2(db, str, strlen(str), &stmt, null); sqlite3_bind_text(stmt, 1, name, strlen(name), sqlite_transient); sqlite3_step(stmt); sqlite3_finalize(p_stmt); writing secure code: arithmetic issues integer overflows/underflows overflows occur when an arithmetic operation attempts to create a numeric value that is larger than can be represented within the available storage space max + 1 will be 0 and 0 – 1 will be max!
...And 7 more matches
Avoiding leaks in JavaScript XPCOM components
the requirements for such a memory allocation system are: memory should be returned to the heap when the program no longer needs it (or soon thereafter) so that the amount of memory consumed by the program does not increase.
...it's difficult to use this strategy when there are multiple pointers to a given object and it's uncertain which one will need to last the longest.
...when this count goes to zero, the object destroys itself.
...And 7 more matches
nsIDBChangeListener
the nsidbchangelistener interface is used by components wanting to receive notification when the current database changes somehow.
...adchanged(in nsidbchangelistener ainstigator); void onjunkscorechanged(in nsidbchangelistener ainstigator); void onhdrpropertychanged(in nsimsgdbhdr ahdrtochange, in unsigned long aoldflags, in prbool aprechange, inout pruint32 astatus, in nsidbchangelistener ainstigator); void onevent(in nsimsgdatabase adb, in string aevent); methods onhdrflagschanged() called when a message's flags change.
... onhdrdeleted() called when a header is deleted from the database.
...And 7 more matches
XPIDL
jsval this type gets const when an in type.
... nsid this type gets const when an in type.
...webidl types will be passed as mozilla::dom::interfacename* when used as in-parameters, as mozilla::dom::interfacename** when used as out or inout-parameters, and as refptr<mozilla::dom::interfacename> when used as an array element.
...And 7 more matches
All keyboard shortcuts - Firefox Developer Tools
toolbox these shortcuts work whenever the toolbox is open, no matter which tool is active.
... end end end expand currently selected node right arrow right arrow right arrow collapse currently selected node left arrow left arrow left arrow (when a node is selected) move inside the node so you can start stepping through attributes.
... enter return enter step forward through the attributes of a node tab tab tab step backward through the attributes of a node shift + tab shift + tab shift + tab (when an attribute is selected) start editing the attribute enter return enter hide/show the selected node h h h focus on the search box in the html pane ctrl + f cmd + f ctrl + f edit as html f2 f2 f2 stop editing html f2 / ctrl +enter f2 / cmd + return f2 / ctrl + enter copy the selected node's outer html ctrl + c cmd + c ctrl + c scroll the selected node into view s s s find the next match in the markup, when searching is active enter return enter...
...And 7 more matches
EffectTiming.fill - Web APIs
WebAPIEffectTimingfill
the web animations api's effecttiming dictionary's fill property specifies a fill mode, which defines how the element to which the animation is applied should look when the animation sequence is not actively running, such as before the time specified by iterationstart or after animation's end time.
... syntax var timingproperties = { fill: "none" | "forwards" | "backwards" | "both" | "auto" } value a domstring indicating the fill type to use in order to properly render an affected element when outside the animation's active interval (that is, when it's not actively animating).
...the animation's effects are not visible when its playstate is pending with a delay, when its playstate is finished, or during its enddelay or delay.
...And 7 more matches
KeyboardEvent - Web APIs
when you need to handle text input, use the input event instead.
... keyboardevent.altkey read only returns a boolean that is true if the alt ( option or ⌥ on os x) key was active when the key event was generated.
... keyboardevent.ctrlkey read only returns a boolean that is true if the ctrl key was active when the key event was generated.
...And 7 more matches
Pointer Lock API - Web APIs
pointer lock lets you access mouse events even when the cursor goes past the boundary of the browser or screen.
...mouse capture provides continued delivery of events to a target element while a mouse is being dragged, but it stops when the mouse button is released.
... document.exitpointerlock = document.exitpointerlock || document.mozexitpointerlock; // attempt to unlock document.exitpointerlock(); pointerlockchange event when the pointer lock state changes—for example, when calling requestpointerlock(), exitpointerlock(), the user pressing the esc key, etc.—the pointerlockchange event is dispatched to the document.
...And 7 more matches
Using the Screen Capture API - Web APIs
related to this, the devicechange event is never sent when there are changes to the sources available for getdisplaymedia().
... capturing audio is always optional, and even when web content requests a stream with both audio and video, the returned mediastream may still have only one video track, with no audio.
... using the captured stream the promise returned by getdisplaymedia() resolves to a mediastream that contains at least one video stream that contains the screen or screen area, and which is adjusted or filtered based upon the constraints specifed when getdisplaymedia() was called.
...And 7 more matches
Touch events - Web APIs
a multi-touch interaction starts when a finger (or stylus) first touches the contact surface.
...the interaction ends when the fingers are removed from the surface.
... interfaces touchevent represents an event that occurs when the state of touches on the surface changes.
...And 7 more matches
WebGL model view projection - Web APIs
it explains the three core matrices that are typically used when composing a 3d scene: the model, view and projection matrices.
...the z depth in the squares determines what gets drawn on top when the squares share the same space.
... is defined outside of this article this.webglprogram = mdn.createwebglprogramfromids(gl, 'vertex-shader', 'fragment-shader'); gl.useprogram(this.webglprogram); // save the attribute and uniform locations this.positionlocation = gl.getattriblocation(this.webglprogram, 'position'); this.colorlocation = gl.getuniformlocation(this.webglprogram, 'color'); // tell webgl to test the depth when drawing, so if a square is behind // another square it won't be drawn gl.enable(gl.depth_test); } webglbox draw now we'll create a method to draw a box on the screen.
...And 7 more matches
WebRTC connectivity - Web APIs
when a user starts a webrtc call to another user, a special description is created called an offer.
... the offer/answer process is performed both when a call is first established, but also any time the call's format or other configuration needs to change.
... when reading the description (returned by rtcpeerconnection.localdescription and rtcpeerconnection.remotedescription), the returned value is the value of pendinglocaldescription/pendingremotedescription if there's a pending description (that is, the pending description isn't null); otherwise, the current description (currentlocaldescription/currentremotedescription) is returned.
...And 7 more matches
Movement, orientation, and motion: A WebXR example - Web APIs
when rendering the left eye, the xrwebgllayer has its viewport configured to restrict drawing to the left half of the drawing surface.
... contrarily, when rendering the right eye, the viewport is set to restrict drawing to the right half of the surface.
... this example demonstrates this by showing the canvas on the screen, even when presenting a scene as an immersive display using an xr device.
...And 7 more matches
Example and tutorial: Simple synth keyboard - Web APIs
for now, we will have two controls: one to set the master volume and another to select what periodic waveform to use when generating notes.
... let notefreq = null; let customwaveform = null; let sineterms = null; let cosineterms = null; finally, global variables that will be used when constructing waveforms are created: notefreq will be an array of arrays; each array represents one octave, each of which contains one entry for each note in that octave.
... customwaveform will be set up as a periodicwave describing the waveform to use when the user selects "custom" from the waveform picker.
...And 7 more matches
Web Audio API - Web APIs
audiocontextoptions the audiocontextoptions dictionary is used to provide options when instantiating a new audiocontext.
... the ended event the ended event is fired when playback has stopped because the end of the media was reached.
...when creating the node using the createmediastreamtracksource() method to create the node, you specify which track to use.
...And 7 more matches
XMLHttpRequest - Web APIs
xmlhttprequest.onreadystatechange an eventhandler that is called whenever the readystate attribute changes.
... xmlhttprequesteventtarget.ontimeout is an eventhandler that is called whenever the request times out.
...the channel used by the object when performing the request.
...And 7 more matches
Keyboard-navigable JavaScript widgets - Accessibility
using tabindex by default, when people use the tab key to browse a webpage, only interactive elements (like links, form controls) get focused.
...when set to 0, the element becomes focusable by keyboard and script.
... when set to -1, the element becomes focusable by script, but it does not become part of the keyboard focus order.
...And 7 more matches
<input type="checkbox"> - HTML: Hypertext Markup Language
WebHTMLElementinputcheckbox
<input> elements of type checkbox are rendered by default as boxes that are checked (ticked) when activated, like you might see in an official government paper form.
...when the form is submitted, the data name/value pair will be subscribe=newsletter.
... note: if a checkbox is unchecked when its form is submitted, there is no value submitted to the server to represent its unchecked state (e.g.
...And 7 more matches
<input type="hidden"> - HTML: Hypertext Markup Language
WebHTMLElementinputhidden
<input> elements of type hidden let web developers include data that cannot be seen or modified by users when a form is submitted.
... value the <input> element's value attribute holds a domstring that contains the hidden data you want to include when the form is submitted to the server.
... additional attributes in addition to the attributes common to all <input> elements, hidden inputs offer the following attributes: attribute description name like all input types, the name of the input to report when submitting the form; the special value _charset_ causes the hidden input's value to be reported as the character encoding used to submit the form name this is actually one of the common attributes, but it has a special meaning available for hidden inputs.
...And 7 more matches
<input type="image"> - HTML: Hypertext Markup Language
WebHTMLElementinputimage
additional attributes in addition to the attributes shared by all <input> elements, image button inputs support the following attributes: attribute description alt alternate string to display when the image can't be shown formaction the url to which to submit the data formenctype the encoding method to use when submitting the form data formmethod the http method to use when submitting the form formnovalidate a boolean which, if present, indicates that the form shouldn't be validated before submission formtarget a string indicating...
... formenctype a string that identifies the encoding method to use when submitting the form data to the server.
... formmethod a string indicating the http method to use when submitting the form's data; this value overrides any method attribute given on the owning form.
...And 7 more matches
<input type="tel"> - HTML: Hypertext Markup Language
WebHTMLElementinputtel
ns the optional pre-defined autocomplete options maxlength the maximum length, in utf-16 characters, to accept as a valid input minlength the minimum length that is considered valid for the field's contents pattern a regular expression the entered value must match to pass constraint validation placeholder an example value to display inside the field when it has no value readonly a boolean attribute which, if present, indicates that the field's contents should not be user-editable size the number of characters wide the input field should be onscreen list the values of the list attribute is the id of a <datalist> element located in the same document.
... pattern the pattern attribute, when specified, is a regular expression that the input's value must match in order for the value to pass constraint validation.
... it must be a valid javascript regular expression, as used by the regexp type, and as documented in our guide on regular expressions; the 'u' flag is specified when compiling the regular expression, so that the pattern is treated as a sequence of unicode code points, instead of as ascii.
...And 7 more matches
<input type="text"> - HTML: Hypertext Markup Language
WebHTMLElementinputtext
s the optional pre-defined autocomplete options maxlength the maximum number of characters the input should accept minlength the minimum number of characters long the input can be and still be considered valid pattern a regular expression the input's contents must match in order to be valid placeholder an exemplar value to display in the input field whenever it is empty readonly a boolean attribute indicating whether or not the contents of the input should be read-only size a number indicating how many characters wide the input field should be spellcheck controls whether or not to enable spell checking for the input field, or if the default spell checking configuration should be used list the values of ...
...constraint validation is only applied when the value is changed by the user.
...constraint validation is only applied when the value is changed by the user.
...And 7 more matches
Functions - JavaScript
1 : n * fac(n - 1) } console.log(factorial(3)) function expressions are convenient when passing a function as an argument to another function.
...defining it simply names the function and specifies what to do when the function is called.
... functions must be in scope when they are called, but the function declaration can be hoisted (appear below the call in the code), as in this example: console.log(square(5)); /* ...
...And 7 more matches
Grammar and types - JavaScript
(for more information, see the detailed reference about javascript's lexical grammar.) it is considered best practice, however, to always write a semicolon after a statement, even when it is not strictly needed.
... var input; if (input === undefined) { dothis(); } else { dothat(); } the undefined value behaves as false when used in a boolean context.
... for example, the following code executes the function myfunction because the myarray element is undefined: var myarray = []; if (!myarray[0]) myfunction(); the undefined value converts to nan when used in numeric context.
...And 7 more matches
Loops and iteration - JavaScript
a for statement looks as follows: for ([initialexpression]; [conditionexpression]; [incrementexpression]) statement when a for loop executes, the following occurs: the initializing expression initialexpression, if any, is executed.
...when the condition is false, execution stops, and control passes to the statement following do...while.
... when you use break without a label, it terminates the innermost enclosing while, do-while, for, or switch immediately and transfers control to the following statement.
...And 7 more matches
Optional chaining (?.) - JavaScript
when used with function calls, it returns undefined if the given function does not exist.
... this results in shorter and simpler expressions when accessing chained properties when the possibility exists that a reference may be missing.
... it can also be helpful while exploring the content of an object when there's no known guarantee as to which properties are required.
...And 7 more matches
Populating the page: how browsers work - Web Performance
it occurs whenever a user requests a page by entering a url into the address bar, clicking a link, submitting a form, as well as other actions.
...when a user is on a mobile network, each dns lookup has to go from the phone to the cell tower to reach an authoritative dns server.
...time to first byte (ttfb) is the time between when the user made the request—say by clicking on a link—and the receipt of this first packet of html.
...And 7 more matches
Progressive loading - Progressive web apps (PWAs)
it is faster to load all that information as one file rather than many small ones, but if the user doesn't need everything at the very beginning, we could load only what's crucial and then manage other resources when needed.
...we can also split css files and add media types to them: <link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="print.css" media="print"> this will tell the browser to load them only when the condition is met.
...when you include <img> elements in your html, then every referenced image will be fetched and downloaded during initial website access.
...And 7 more matches
Classes and Inheritance - Archive of obsolete content
each class defines one or more members, which are initialized to a given value when the class is instantiated.
...when javascript looks for a property, it first looks for it in the object itself.
...when a function is used in a constructor call, javascript makes the value of this property the prototype of the newly created object: let shape = shape(2, 3); object.getprototypeof(shape) == shape.prototype; // => true all instances of a class have the same prototype.
...And 6 more matches
windows - Archive of obsolete content
optional options: name type onopen function a callback function that is called when the window has opened.
... onclose function a callback function that is called when the window will be called.
... onactivate function a callback function that is called when the window is made active.
...And 6 more matches
Creating annotations - Archive of obsolete content
when a mouseenter event is triggered the selector checks whether the element is eligible for annotation.
... updating main.js go back to main.js and add the code to create the selector into the main function: var selector = pagemod.pagemod({ include: ['*'], contentscriptwhen: 'ready', contentscriptfile: [data.url('jquery-1.4.2.min.js'), data.url('selector.js')], onattach: function(worker) { worker.postmessage(annotatorison); selectors.push(worker); worker.port.on('show', function(data) { console.log(data); }); worker.on('detach', function () { detachworker(this, selectors); }); } }); make sure the name ...
...you should see the highlight appearing when you move the mouse over certain elements: click on the highlight and you should see something like this in the console output: info: show info: http://blog.mozilla.com/addons/2011/02/04/overview-amo-review-process/, post-2249,when you submit a new add-on, you will have to choose between 2 review tracks: full review and preliminary review.
...And 6 more matches
Preferences - Archive of obsolete content
use this when the preference value may contain non-ascii characters (for example, a user's name).
... nsipreflocalizedstring almost the same as nsisupportsstring, but it is handled differently in getcomplexvalue() when there's no user value for the given preference; see below for details.
...it is similar to nsisupportsstring, except that when there is no user value, getcomplexvalue() gets the default value from a locale file (thus making the default value localizable).
...And 6 more matches
Adding Events and Commands - Archive of obsolete content
the most commonly used event is the onload event, which is used in overlays and other windows to detect when the window has loaded and then run initialization code: // rest of overlay code goes here.
...fired when the selection in a tree or listbox changes.
...triggered when the user clicks on the element, including right clicks.
...And 6 more matches
Adding Toolbars and Toolbar Buttons - Archive of obsolete content
it points to the id of a popup element that holds the customization options that are displayed when the user right-clicks on the toolbar.
...menu toolbar buttons are handy when you want to include many options in your toolbar and you don't want it to be too cluttered.
... the other types, checkbox and radio are useful when you have buttons that change state when the user clicks on them.
...And 6 more matches
Adding windows and dialogs - Archive of obsolete content
you should always include it when opening a xul window or dialog.
...modal windows should be avoided when possible because they interrupt the user's browsing and can become annoying very quickly.
... this feature should only be used when there's no way to continue without having the user do something.
...And 6 more matches
Intercepting Page Loads - Archive of obsolete content
« previousnext » there are several ways to detect and intercept loading of web pages and their content, be it only to realize when it happens, modify their contents, or to block them and do something else instead.
... note: performance is very important when it comes to add-ons and page loads.
...it is full of useful functions, so you should always keep it in mind when you want to handle tabs and web content windows.
...And 6 more matches
Inner-browsing extending the browser navigation paradigm - Archive of obsolete content
introduction when you click a link on a web page, your web browser makes a request to a web server which usually results in a new web page as a response.
...in this model, when a request goes to the web server, the current page is updated rather than replaced.
...webmail application the flexibility to easily access and manage all message headers in mail applications (like netscape mail or eudora) is probably one of the useful features when compared with web-based mail applications.
...And 6 more matches
Drag and Drop JavaScript Wrapper - Archive of obsolete content
<button label="drag me" ondraggesture="nsdraganddrop.startdrag(event,buttonobserver);" /> the function startdrag will be called when a drag starts on the button.
...in this case we only do anything special when the button drag is started.
... ondragstart(event, transferdata, action) define this function to have something happen when a drag starts.
...And 6 more matches
JavaScript Client API - Archive of obsolete content
when something of interest occurs, it interacts with the engine to let it know something has happened and it might want to take action store entity that serves as a data store/proxy for information in an engine.
...when one of these guids is later passed as an argument to createrecord(), you need to return a record based on the matching data.
... wipe() when this method is called, your store needs to completely wipe all of its stored data from the local application.
...And 6 more matches
Supporting private browsing mode - Archive of obsolete content
when private browsing mode is enabled, temporary, databases are created to be used for cookies and local storage; these databases are thrown away when private browsing mode is turned off, and the regular databases are re-activated.
...extensions that may record potentially private information may wish to hook into the private browsing service so that they can avoid saving personal information when private browsing mode is enabled.
...private browsing notifications there are notifications available that allow you to easily watch for changes to the status of the private browsing mode, including detecting when it turns on and off.
...And 6 more matches
Binding Implementations - Archive of obsolete content
when the src attribute is specified, any children of the implementation element are ignored.
...the second type of property is one that defines functions that are invoked when the property is either retrieved or set.
... a getter contains script whose return value is handed back when the property is requested.
...And 6 more matches
Adding Event Handlers - Archive of obsolete content
using scripts to make the find files dialog functional, we need to add some scripts which will execute when the user interacts with the dialog.
... <script src="findfile.js"/> we'll create the script file later when we know what we want to put in it.
... each event has a name, for example, 'mousemove' is the name of the event that is triggered when the user moves the mouse over a ui element.
...And 6 more matches
Adding Event Handlers to XBL-defined Elements - Archive of obsolete content
this could be useful when trapping the focus and blur events.
...a common reason to set handlers is to modify the custom properties when an event occurs.
... for example, a custom checkbox might have a checked property which needs to be changed when the user clicks the checkbox: <handlers> <handler event="mouseup" action="this.checked=!this.checked"/> </handlers> when the user clicks and releases the mouse button over the check box, the mouseup event is sent to it, and the handler defined here is called, causing the state of the checked property to be reversed.
...And 6 more matches
Adding Properties to XBL-defined Elements - Archive of obsolete content
properties can also be used to hold a value but may have code execute when an attempt is made to retrieve or modify the value.
...onget attribute and onset attribute you can use the onget and onset attributes to have code execute when the property is retrieved or modified.
...whenever a script attempts to access the value of the property, the onget script will be called to retrieve the value.
...And 6 more matches
Commands - Archive of obsolete content
however, a command has the advantage that it can be disabled when needed and can be invoked without needing to know about the details of its implementation.
...you should use them when the operation depends on which element is focused.
...the result is that when the button is pressed, the command 'cmd_openhelp' is invoked.
...And 6 more matches
Document Object Model - Archive of obsolete content
when an xul file is loaded, the tags are parsed and converted into a hierarchical document structure of nodes, one for each tag and block of text.
...for example, the following two lines which open a new window are functionally equivalent: window.open("test.xul","_new"); open("test.xul","_new"); when you declare a function or a variable at the top level of a script, that is outside another function, you are actually declaring a property of the global object.
... our find files example it doesn't make sense to have the progress bar and the dummy tree data displayed when the find files dialog is first displayed.
...And 6 more matches
button - Archive of obsolete content
when autocheck is true, the button type should be "checkbox" or "radio".
...when in state 0 or 1, pressing the button will switch to the opposite state.
... when in state 2, pressing the button will switch to state 0.
...And 6 more matches
commandset - Archive of obsolete content
in addition, this element can hold a command updater which is used to update commands when certain events occur.
...typically, this is used to update menu commands such as undo and cut based on when an event occurs.
... for example, since the cut command is only valid when something is selected, a command updater might be used when the select event occurs.
...And 6 more matches
menuitem - Archive of obsolete content
when autocheck is true, the button type should be "checkbox" or "radio".
... note: if the checked attribute is set to true, and you persist its value via the persist attribute, mozilla will fail to persist its value when the menuitem is unchecked because of bug 15232.
... a workaround is to set the autocheck attribute to false, then programmatically set the checked attribute when the user selects the item, and set it to false instead of removing the attribute (i.e.
...And 6 more matches
splitter - Archive of obsolete content
when the splitter is dragged, the sibling elements of the splitter are resized.
... if a grippy is placed inside the splitter, one sibling element of the splitter is collapsed when the grippy is clicked.
...the vbox is used to hold the .png image that a user clicks on to resize the search bar.--> <splitter tooltiptext="resize the search box" oncommand="alert('the splitter was dragged')"> <vbox id="example_vbox" /> </splitter> attributes collapse type: one of the values below determines which side of the splitter is collapsed when its grippy is clicked.
...And 6 more matches
XForms Custom Controls - Archive of obsolete content
for example, you might want to render images that are held inside an instance document or you would like to show a disabled trigger when its bound node becomes irrelevant rather than having it not display (the current default behavior).
...as mentioned in the spec, the appearance attribute can be used to influence the look and feel of a control even when all other conditions remain constant.
... for example, in the mozilla xforms extension we will render a combobox widget when appearance='minimal' on a select1 control.
...And 6 more matches
Paddle and keyboard controls - Game development
we want to run some code to handle the paddle movement when the buttons are pressed.
... two functions handling the keydown and keyup events the code that will be run when the buttons are pressed.
...add the following lines just above the setinterval() line at the bottom of your javascript: document.addeventlistener("keydown", keydownhandler, false); document.addeventlistener("keyup", keyuphandler, false); when the keydown event is fired on any of the keys on your keyboard (when they are pressed), the keydownhandler() function will be executed.
...And 6 more matches
The HTML5 input types - Learn web development
e-mail address field this type of field is set using the value email for the type attribute: <input type="email" id="email" name="email"> when this type is used, the user is required to type a valid email address into the field.
... any other content causes the browser to display an error when the form is submitted.
...often, search fields are rendered with rounded corners; they also sometimes display an "Ⓧ", which clears the field of any value when clicked).
...And 6 more matches
From object to iframe — other embedding technologies - Learn web development
(textarea.selectionend, textarea.value.length); textarea.value = front + text + back; caretpos = caretpos + text.length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to save the state when the user code is being shown, // not the solution, so that solution is not saved over the user code if(solution.value === 'show solution') { userentry = textarea.value; } else { solutionentry = textarea.value; } updatecode(); }; iframes in detail so, that was easy and fun, right?
... only embed when necessary sometimes it makes sense to embed third-party content — like youtube videos and maps — but you can save yourself a lot of headaches if you only embed third-party content when completely necessary.
...that means, you must credit us properly when you quote our content, even if you make substantial changes.
...And 6 more matches
General asynchronous programming concepts - Learn web development
there's no sense sitting there waiting for something when you could let the other task chug along on another processor core and let you know when it's done.
...when a web app runs in a browser and it executes an intensive chunk of code without returning control to the browser, the browser can appear to be frozen.
... in our simple-sync.html example (see it running live), we add a click event listener to a button so that when clicked, it runs a time-consuming operation (calculates 10 million dates then logs the final one to the console) and then adds a paragraph to the dom: const btn = document.queryselector('button'); btn.addeventlistener('click', () => { let mydate; for(let i = 0; i < 10000000; i++) { let date = new date(); mydate = date } console.log(mydate); let pelem = document.createelement('p'); pelem.textcontent = 'this is a newly-added paragraph...
...And 6 more matches
Manipulating documents - Learn web development
previous overview: client-side web apis next when writing web pages and apps, one of the most common things you'll want to do is manipulate the document structure in some way.
...add the following line below the previous one: link.textcontent = 'mozilla developer network'; we should also change the url the link is pointing to, so that it doesn't go to the wrong place when it is clicked on.
...t.createtextnode(): const text = document.createtextnode(' — the premier source for web development knowledge.'); now we'll grab a reference to the paragraph the link is inside, and append the text node to it: const linkpara = document.queryselector('p'); linkpara.appendchild(text); that's most of what you need for adding nodes to the dom — you'll make a lot of use of these methods when building dynamic interfaces (we'll look at some examples later).
...And 6 more matches
Arrays - Learn web development
try this: myarray.push('cardiff'); myarray; myarray.push('bradford', 'brighton'); myarray; the new length of the array is returned when the method call completes.
...try this: myarray.pop(); the item that was removed is returned when the method call completes.
...in this line we currently have i <= 0, which is a conditional test that causes the for loop to only run once, because it is saying "stop when i is no longer less than or equal to 0", and i starts at 0.
...And 6 more matches
Handling common HTML and CSS problems - Learn web development
note: one common problem with css and html arises when different css rules begin to conflict with one another.
... this can be especially problematic when you are using third party code.
... older browsers not supporting modern features this is a common problem, especially when you need to support old browsers (such as old ie versions) or you are using features that are implemented using css prefixes.
...And 6 more matches
Strategies for carrying out testing - Learn web development
when doing cross-browser testing, you need to work out a list of browsers you will need to test on to start with.
... note: when using google analytics, you need to beware of misleading bias, e.g.
... when you've got a new addition to your codebase that needs testing, before you start testing you should write out a list of testing requirements that need to pass to be accepted.
...And 6 more matches
Mozilla's Section 508 Compliance
here are the section 508 requirements and how far along mozilla seamonkey rv1.8a4 is with each one: requirement windows linux/unix mac os requirement windows linux/unix mac os (a) when software is designed to run on a system that has a keyboard, product functions shall be executable from a keyboard where the function itself or the result of performing a function can be discerned textually.
...when an image represents a program element, the information conveyed by the image must also be available in text.
... (e) when bitmap images are used to identify controls, status indicators, or other programmatic elements, the meaning assigned to those images shall be consistent throughout an application's performance.
...And 6 more matches
Software accessibility: Where are we today?
when you add all these groups of people together, that's a lot of potential users!
...finally, this technology could be useful to mainstream users, on portable information appliances, or to access information when the eyes are busy elsewhere.
...the basic concept is easy - dealing with information when you're blind is like seeing everything through a mail slot - sequentially and methodically.
...And 6 more matches
Mozilla’s UAAG evaluation report
when filing mozilla bugs based on uaag requirements, please use bug 24413 as the uaag meta bug.
...(p1) vg alt for img: rendered when images turned off.
... reasons: the title attribute is almost never present when the alt isn't.
...And 6 more matches
Debugging on Mac OS X
macos 10.15 went further, requiring applications to be notarized with hardened runtime enabled in order to launch (ignoring workarounds.) when run on earlier macos versions, notarization and hardened runtime settings have no effect.
... select "build" from the left of the scheme editor window, and check that there is nothing listed under targets (otherwise it may cause problems when you try to run the executable for debugging since you will get build errors).
... at this point you can run the application from xcode, and when you pause or hit breakpoints it should show open the correct source file at the correct line.
...And 6 more matches
How Mozilla's build system works
phases when you type mach build to build the tree, three high-level phases occur within the build system: system detection and validation preparation of the build backend invocation of the build backend phase 1: configure phase 1 centers around the configure script.
... when config.status runs, you'll see the following output: reticulating splines...
... phase 3: invocation of the build backend when most people think of the build system, they think of phase 3.
...And 6 more matches
mach
if the current working directory mach is invoked with is inside an object directory, the mozconfig used when creating that object directory is used.
... you can add the command to your .profile so it will run automatically when you start the shell: source /path/to/mozilla-central/python/mach/bash-completion.sh this will enable tab completion of mach command names, and in the future it may complete flags and other arguments too.
... note: mach tab completion will not work when running mach in a source directory older than firefox 24.
...And 6 more matches
Script security
when code from compartment a tries to access an object in compartment b, gecko gives it a cross-compartment wrapper.
... whenever cross-compartment access happens, the wrappers enable us to implement the appropriate security policy.
... because the wrapper we choose is specific to the relationship between the two compartments, the security policy it implements can be static: when the caller uses the wrapper, there's no need to check who is making the call or where it is going.
...And 6 more matches
IPDL Tutorial
an ipdl protocol declares how actors communicate: it declares the possible messages that may be sent between actors, as well as a state machine describing when messages are allowed to be sent.
... generated c++ code when pplugin.ipdl is compiled, the headers ppluginparent.h, and ppluginchild.h will be generated in the ipc/ipdl/_ipdlheaders/ directory of the build tree.
...maybe); }; custom primitive types when you need to send data of a type other than one built into ipdl, you can add a using declaration in an ipdl specification.
...And 6 more matches
InstallListener
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 existingaddon, in boolean needsrestart) methods onnewinstall() called when a new instance of addoninstall is created, primarily so ui can display some kind of progress for all installs.
... void onnewinstall( in addoninstall install ) parameters install the addoninstall representing the install ondownloadstarted() called when downloading begins for an add-on install.
... void ondownloadprogress( in addoninstall install ) parameters install the addoninstall representing the install ondownloadended() called when downloading completes successfully for an add-on install.
...And 6 more matches
Examples
when the callback finishes execution, newpromise will be fulfilled with an undefined fulfillment value, because the callback does not return any value.
... when newpromise is fulfilled, nothing happens, because no fulfillment callback is specified and the return value of the last then method is ignored.
..."you have .mozconfig in " + currentdir : "you don't have .mozconfig in " + currentdir); }); }).then(null, components.utils.reporterror); parallel promise (this example needs more work) so when chaining promises, consequent promises run after the previous promise completes.
...And 6 more matches
Creating localizable web applications
you can achieve this by setting a cookie when the user changes the locale with the language dropdown, or by looking for locale code in the url.
...good: body.de foo, body.fr foo, body.pl foo { /* locale-specific rules for the foo element */ width: 10em; /* originally 8em */ } adapt the interaction to rtl locales right-to-left locales not only require good images handling (see images), but also should be taken into account when designing the interaction on the website.
... separate urls from navigation sometimes, when the urls are well-designed, you may want to use the url to do something in the code depending on where the user is.
...And 6 more matches
Gecko Profiler FAQ
usually you should be really careful when changing the characteristics of the environment that you are trying to measure to avoid measuring the wrong thing.
... this mode is usually recommended when you want to find a thread you want to do more focused profiling on, so that you can find its name and then construct a more useful thread filter string based on the found thread name.
...when we are accessing a virtual memory page that needs to reload from disk) the gecko profiler does not know about page faults.
...And 6 more matches
AsyncTestUtils extended framework
sometimes in your tests you need to wait for an operation to complete that does not occur synchronously (that is, it is not done when the function call you made to initiate the operation returns control to you).
... this is likely to happen when i/o is involved or a potentially expensive process wants to break itself up into smaller chunks (like a search operation) so that the ui stays responsive.
...when i/o results in newly read data it places an event in the queue.
...And 6 more matches
nss tech note1
this decoder was written when performance issues were discovered with the classic decoder.
...the number of required templates is determined by the type of the first template.when multiple templates are required, the pointer must point to a null-terminated array of templates.
...when only one template is needed, you do not need a null template to terminate the array.
...And 6 more matches
PKCS #11 Module Specs
parameter passing if the parameter is specified, the application/library will strip the value out, processing any outter quotes and escapes appropriately, and pass the parameter to the pkcs #11 library when it calls c_initialize().
... cipherorder - integer value specifiying the order in which tokens are searched when looking for a token to do a generic operation (des/hashing, etc).
... random - this token should be used to generate random numbers when the application call 'pk11_generaterandom'.
...And 6 more matches
Rhino scopes and contexts
only when the counter reaches zero will it be disassociated from the thread.
... a top-level scope is created by calling context.initstandardobjects to create all the standard objects: scriptableobject scope = cx.initstandardobjects(); the easiest way to embed rhino is just to create a new scope this way whenever you need one.
...when we start executing f, the scope chain will start with the function's activation object and will end with the top-level scope (see diagram below).
...And 6 more matches
JIT Optimization Strategies
for example, in the following code: var constants = {}; constants.n = 100; function testarray(array) { for (var i = 0; i < array.length; i++) { if (array[i] > constants.n) return true; } return false; } will have the loop compiled into the following when testarray gets hot.
... for (var i = 0; i < array.length; i++) { if (array[i] > 100) return true; } when this optimization is successful, property access is eliminated entirely and replaced with an inline constant.
... when this optimization is successful, property access is eliminated entirely and replaced with an inline constant.
...And 6 more matches
Property attributes
an application can set property attributes when creating a property.
...obsolete since jsapi 39 this flag has an additional special meaning when used with js_defineproperty, js_fs, and other apis that define properties: it means that the name parameter is actually an integer unsafely cast to a pointer type, not a string.
... mxr id search for jsprop_index jsprop_define_late don't define property when initially creating the constructor.
...And 6 more matches
nsIDynamicContainer
1.0 66 introduced gecko 1.9 inherits from: nsisupports last changed in gecko 1.9 (firefox 3) the service can fill result nodes directly into the container when it is opened.
... overview void oncontainermoved(in long long aitemid, in long long anewparent, in long anewindex); void oncontainernodeclosed(in nsinavhistorycontainerresultnode acontainer); void oncontainernodeopening(in nsinavhistorycontainerresultnode acontainer, in nsinavhistoryqueryoptions aoptions); void oncontainerremoving(in long long aitemid); methods oncontainermoved() this method is called when the given container has just been moved, in case the service needs to do any bookkeeping.
... oncontainernodeclosed() this method is called when the given container has just been collapsed so that the service can do any necessary cleanup.
...And 6 more matches
nsIZipWriter
compression_fastest 1 use the fastest compression method when adding the file to the archive.
... compression_default 6 use the default compression method when adding the file to the archive.
... compression_best 9 use the best compression method when adding the file to the archive.
...And 6 more matches
Reference Manual
whenever you `point' the nscomptr at a different xpcom object (by assignment or initialization), it must release its old value, if any, and addref the new.
...for example, an nscomptr<nsifoo> will always hold the pointer that would be returned by queryinterface, when querying an xpcom object for its nsifoo interface.
...null-dereference safeguards an nscomptr will also assert at runtime if you try to dereference it when it is void, e.g., nscomptr<nsifoo> foo; // note: default initialized to |0| foo->dosomething(); // ns_precondition: "you can't dereference a null nscomptr with operator->()" a similar precondition intervenes on behalf of operator*.
...And 6 more matches
XUL Overlays
MozillaTechXULOverlays
when plug-ins, browser extensions, or other applications provide new ui elements to the browser, these elements should be defined in overlay files.
...ld be defined as a collection of elements or subtrees: <menuitem name="super stream player"/> <menupopup name="ss favorites"> <menuitem name="wave" src="mavericks.ssp"/> <menuitem name="soccer" src="brazil_soccer.ssp"/> </menupopup> <titledbutton id="ssp" crop="right" flex="1" value="&ssbutton.label;" onclick="firessp()"/> overlays and id attributes bases and overlays are merged when they share the same id attribute.
...when you load an overlay explicitly, it means that you intend to make it available every time the base file is loaded.
...And 6 more matches
Mail and RDF
what else do we store?) datasources are created when each window's javascript is loaded by declaring the datasource variables in the source javascript as global variables.
... reflecting data to rdf in order to have a dynamic ui that updates when the underlying content changes, a datasource must implement two key methods of reflecting data into rdf.
... answering queries: when rdf asks for information about a resource, datasources answer with the results of the query.
...And 6 more matches
Introduction to DOM Inspector - Firefox Developer Tools
(note: this is now a dead link.) when you first start the dom inspector, you are presented with a two-pane application window that looks a little like the main mozilla browser.
... inspecting a document when the dom inspector opens, it may or may not load an associated document, depending on the host application.
... when you inspect a web page with this method, a browser pane at the bottom of the dom inspector window will open up, displaying the web page.
...And 6 more matches
Debugging service workers - Firefox Developer Tools
when you open the application panel’s service workers view on a page that doesn't have a service worker registered, you'll get the following output shown: this gives you some advice on what to do if you don't have a service worker registered, and were perhaps expecting there to be one registered!
... debugging your service worker in any case, when the service worker is successfully registered, you'll see information about it displayed in the application > service workers view (along with any other service workers registered on the same domain): this gives you a variety of information about your service worker: the url that the service worker is registered on.
... that last time the service worker was updated (if the service has not been updated, this is when it was first installed).
...And 6 more matches
Waterfall - Firefox Developer Tools
it's based on the idea that the things a browser does when running a site can be divided into various types - running javascript, updating layout, and so on - and that at any given point in time, the browser is doing one of those things.
... when a marker is selected you'll see more information about it in a sidebar on the right.
... worker event in main thread shown when the main thread sends a message to a worker, or receives a message from a worker.
...And 6 more matches
Console messages - Firefox Developer Tools
when you run code containing an async function, its traces (console.trace or thrown error) are shown with an async: prefix.
...reflows occur when a change has happened to a page that the browser thinks affects the layout.
...by logging reflow events the web console can give you insight into when reflow events are being triggered, how long they take to execute and, if the reflows are synchronous reflows triggered from javascript, which code triggered them.
...And 6 more matches
Applying styles and colors - Web APIs
fillstyle = color sets the style used when filling shapes.
... note: when you set the strokestyle and/or fillstyle property, the new value becomes the default for all shapes being drawn from then on.
... the globalalpha property can be useful if you want to draw a lot of shapes on the canvas with similar transparency, but otherwise it's generally more useful to set the transparency on individual shapes when setting their colors.
...And 6 more matches
Introduction to the DOM - Web APIs
many browsers extend the standard, so care must be exercised when using them on the web where documents may be accessed by various browsers with different doms.
... when you create a script–whether it's inline in a <script> element or included in the web page by means of a script loading instruction–you can immediately begin using the api for the document or window elements to manipulate the document itself or to get at the children of that document, which are the various elements in the web page.
... this following javascript will display an alert when the document is loaded (and when the whole dom is available for use): <body onload="window.alert('welcome to my home page!');"> another example.
...And 6 more matches
EventSource - Web APIs
that makes them an excellent choice when there's no need to send data from the client to the server in message form.
... when not used over http/2, sse suffers from a limitation to the maximum number of open connections, which can be specially painful when opening various tabs as the limit is per browser and set to a very low number (6).
...when using http/2, the maximum number of simultaneous http streams is negotiated between the server and the client (defaults to 100).
...And 6 more matches
MediaRecorder - Web APIs
properties mediarecorder.mimetype read only returns the mime type that was selected as the recording container for the mediarecorder object when it was created.
... mediarecorder.state read only returns the current state of the mediarecorder object (inactive, recording, or paused.) mediarecorder.stream read only returns the stream that was passed into the constructor when the mediarecorder was created.
... mediarecorder.ignoremutedmedia indicates whether the mediarecorder instance will record input when the input mediastreamtrack is muted.
...And 6 more matches
Recording a media element - Web APIs
that lets us use promise syntax when using timeouts, which can be very handy when chaining promises, as we'll see later.
... lines 9-12 creates a new promise, named stopped, which is resolved when the mediarecorder's onstop event handler is called, and is rejected if its onerror event handler is called.
... lines 14-16 creates a new promise, named recorded, which is resolved when the specified number of milliseconds have elapsed.
...And 6 more matches
MouseEvent - Web APIs
mouseevent.altkey read only returns true if the alt key was down when the mouse event was fired.
... mouseevent.button read only the button number that was pressed (if applicable) when the mouse event was fired.
... mouseevent.buttons read only the buttons being depressed (if any) when the mouse event was fired.
...And 6 more matches
TouchEvent - Web APIs
the touchevent interface represents an uievent which is sent when the state of contacts with a touch-sensitive surface changes.
... touchevent.altkey read only a boolean value indicating whether or not the alt key was down when the touch event was fired.
... touchevent.ctrlkey read only a boolean value indicating whether or not the control key was down when the touch event was fired.
...And 6 more matches
Web audio spatialization basics - Web APIs
libraries like three.js and a-frame harness its potential when dealing with sound.
...when we move the boombox, the sound it produces changes accordingly, panning as it moves to the left or right of the room, or becoming quieter as it is moved away from the user or is rotated so the speakers are facing away from them, etc.
...we can set this to: equalpower — the default and the general way panning is figured out hrtf — this stands for 'head-related transfer function' and looks to take into account the human head when figuring out where the sound is.
...And 6 more matches
XRSession - Web APIs
WebAPIXRSession
returns a promise which resolves when the session has been shut down.
... inputsourceschange an event of type xrinputsourceschangeevent sent to the xrsession when the list of active xr input sources has changed.
... select an event of type xrinputsourceevent which is sent to the session when one of the session's input sources has successfully completed a primary action.
...And 6 more matches
ARIA annotations - Accessibility
it is useful to know when to use each.
... you’ll see examples of most of these later on in the article, but briefly: aria-label="" can be set on an element to provide a brief descriptive label when it isn't appropriate to have the label actually appearing in the ui, for example a search input in a horizontal nav bar.
...this is useful when the element’s label is available in the ui, but for some reason a conventional <label> won’t work.
...And 6 more matches
ARIA: textbox role - Accessibility
whenever possible, rather than using this role, use an <input> element with type="text", for single-line input, or a <textarea> element for multi-line input.
... description when an element has the textbox role, the browser sends an accessible textbox event to assistive technologies, which can then notify the user about it.
... associated aria properties aria-activedescendent attribute taking as it's value the id of is either a descendant of the element with dom focus or is a logical descendant as indicated by the aria-owns attribute, it indicates when that element has focus, when it is part of a composite widget such as a combobox.
...And 6 more matches
CSS Box Alignment - CSS: Cascading Style Sheets
relationship to writing modes alignment is linked to writing modes in that when we align an item we do not consider whether we are aligning it to the physical dimensions of top, right, bottom and left.
... two dimensions of alignment when using the box alignment properties you will align content on one of two axes — the inline (or main) axis, and the block (or cross) axis.
... when aligning items on the inline axis you will use the properties which begin with justify-: justify-items justify-self justify-content when aligning items on the block axis you will use the properties that begin align-: align-items align-self align-content flexbox adds an additional complication in that the above is true when flex-direction is set to row.
...And 6 more matches
Basic concepts of flexbox - CSS: Cascading Style Sheets
when we describe flexbox as being one dimensional we are describing the fact that flexbox deals with layout in one dimension at a time — either as a row or as a column.
... the two axes of flexbox when working with flexbox you need to think in terms of two axes — the main axis and the cross axis.
... understanding which axis is which is important when we start to look at aligning and justifying flex items; flexbox features properties that align and justify content along one axis or the other.
...And 6 more matches
Scaling of SVG backgrounds - CSS: Cascading Style Sheets
given the flexibility of svg images, there's a lot to keep in mind when using them as background images with the background-image property, and even more to keep in mind when also scaling them using the background-size property.
... this article describes how scaling of svg images is handled when using these properties.
... source image examples before diving in to look at the results of using different kinds of source images and seeing how they look when used with background-size, it would be helpful to look at a few example source images that have different dimensions and sizing settings.
...And 6 more matches
Viewport concepts - CSS: Cascading Style Sheets
on most mobile devices and when the browser is in fullscreen mode, the viewport is the entire screen.
... when zoomed in, both firefox and chrome report the new css pixel size for innerwidth and clientwidth.
...when zoomed in you may get: document.documentelement.clientwidth /* 800 */ window.innerwidth /* 800 */ window.outerwidth /* 800 in firefox, 1200 in chrome */ document.documentelement.clientheight /* 533 */ window.innerheight /* 533 */ window.outerheight /* 596 in firefox, 900 in chrome */ the viewport was originally 1200 x 800 pixels.
...And 6 more matches
Overview of events and handlers - Developer guides
this overview of events and event handling explains the code design pattern used to react to incidents occurring when a browser accesses a web page, and it summarizes the types of such incidents modern web browsers can handle.
... events and event handling provide a core technique in javascript for reacting to incidents occurring when a browser accesses a web page, including events from preparing a web page for display, from interacting with the content of the web page, relating to the device on which the browser is running, and from many other causes such as media stream playback or animation timing.
...the innovation of the dynamic approach allows for a page to be partially rendered even when the browser has not finished retrieving all resources; this approach also allows for event driven actions, which javascript leverages.
...And 6 more matches
<input type="search"> - HTML: Hypertext Markup Language
WebHTMLElementinputsearch
s the optional pre-defined autocomplete options maxlength the maximum number of characters the input should accept minlength the minimum number of characters long the input can be and still be considered valid pattern a regular expression the input's contents must match in order to be valid placeholder an exemplar value to display in the input field whenever it is empty readonly a boolean attribute indicating whether or not the contents of the input should be read-only size a number indicating how many characters wide the input field should be spellcheck controls whether or not to enable spell checking for the input field, or if the default spell checking configuration should be used list the values of ...
... pattern the pattern attribute, when specified, is a regular expression that the input's value must match in order for the value to pass constraint validation.
... it must be a valid javascript regular expression, as used by the regexp type, and as documented in our guide on regular expressions; the 'u' flag is specified when compiling the regular expression, so that the pattern is treated as a sequence of unicode code points, instead of as ascii.
...And 6 more matches
<input type="time"> - HTML: Hypertext Markup Language
WebHTMLElementinputtime
you can set a default value for the input by including a valid time in the value attribute when creating the <input> element, like so: <label for="appt-time">choose an appointment time: </label> <input id="appt-time" type="time" name="appt-time" value="13:30"> you can also get and set the date value in javascript using the htmlinputelement.value property, for example: var timecontrol = document.queryselector('input[type="time"]'); timecontrol.value = '15:30'; time value format the v...
...when this happens, the contents of the <span> are replaced with the new value of the input element.
... var starttime = document.getelementbyid("starttime"); var valuespan = document.getelementbyid("value"); starttime.addeventlistener("input", function() { valuespan.innertext = starttime.value; }, false); when a form including a time input is submitted, the value is encoded before being included in the form's data.
...And 6 more matches
Using HTTP cookies - HTTP
WebHTTPCookies
while this was legitimate when they were the only way to store data on the client, it is now recommended to use modern storage apis.
... get /sample_page.html http/2.0 host: www.example.org cookie: yummy_cookie=choco; tasty_cookie=strawberry note: here's how to use the set-cookie header in various server-side applications: php node.js python ruby on rails define the lifetime of a cookie the lifetime of a cookie can be defined in two ways: session cookies are deleted when the current session ends.
... the browser defines when the "current session" ends, and some browsers use session restoring when restarting, which can cause session cookies to last indefinitely long.
...And 6 more matches
JavaScript data types and data structures - JavaScript
however, you are able to notice this when you divide by zero: > 42 / +0 infinity > 42 / -0 -infinity although a number often represents only its value, javascript provides binary (bitwise) operators.
... it may be necessary to use such techniques in very constrained environments, like when trying to cope with the limitations of local storage, or in extreme cases (such as when each bit over the network counts).
... this technique should only be considered when it is the last measure that can be taken to optimize size.
...And 6 more matches
Equality comparisons and sameness - JavaScript
briefly: double equals (==) will perform a type conversion when comparing two things, and will handle nan, -0, and +0 specially to conform to ieee 754 (so nan != nan, and -0 == +0); triple equals (===) will do the same comparison as double equals (including the special handling for nan, -0, and +0) but without type conversion; if the types differ, false is returned.
...(the only case in which (x !== x) is true is when x is nan.) loose equality using == loose equality compares two values for equality, after converting both values to a common type.
...(this use case demonstrates an instance of the liskov substitution principle.) one instance occurs when an attempt is made to mutate an immutable property: // add an immutable negative_zero property to the number constructor.
...And 6 more matches
Control flow and error handling - JavaScript
best practice in general, it's good practice to always use block statements—especially when nesting if statements: if (condition) { statement_1_runs_if_condition_is_true; statement_2_runs_if_condition_is_true; } else { statement_3_runs_if_condition_is_false; statement_4_runs_if_condition_is_false; } it's unwise to use simple assignments in a conditional expression, because the assignment can be confused with equality when glancing over the code.
...*/ } if you need to use an assignment in a conditional expression, a common practice is to put additional parentheses around the assignment, like this: if ((x = y)) { /* statements here */ } falsy values the following values evaluate to false (also known as falsy values): false undefined null 0 nan the empty string ("") all other values—including all objects—evaluate to true when passed to a conditional statement.
...when break is encountered, the program exits the switch and continues execution from the statement following switch.
...And 6 more matches
JavaScript modules - JavaScript
it has therefore made sense in recent years to start thinking about providing mechanisms for splitting javascript programs up into separate modules that can be imported when needed.
... the <script type="module"> attribute is used to denote when a module is being pointed to, as you'll see below.
... there is no need to use the defer attribute (see <script> attributes) when loading a module script; modules are deferred automatically.
...And 6 more matches
Regular expressions - JavaScript
creating a regular expression you construct a regular expression in one of two ways: using a regular expression literal, which consists of a pattern enclosed between slashes, as follows: let re = /ab+c/; regular expression literals provide compilation of the regular expression when the script is loaded.
...use the constructor function when you know the regular expression pattern will be changing, or you don't know the pattern and are getting it from another source, such as user input.
...for example, the pattern /abc/ matches character combinations in strings only when the exact sequence "abc" occurs (all characters together and in that order).
...And 6 more matches
Working with objects - JavaScript
this notation is also very useful when property names are to be dynamically determined (when the property name is not determined until runtime).
...for example, in the above code, when the key obj is added to the myobj, javascript will call the obj.tostring() method, and use this result string as the new key.
...to illustrate how this works, the following function displays the properties of the object when you pass the object and the object's name as arguments to the function: function showprops(obj, objname) { var result = ``; for (var i in obj) { // obj.hasownproperty() is used to filter out properties from the object's prototype chain if (obj.hasownproperty(i)) { result += `${objname}.${i} = ${obj[i]}\n`; } } return result; } so, the function call showprops(mycar, "m...
...And 6 more matches
Memory Management - JavaScript
in contrast, javascript automatically allocates memory when objects are created and frees it when they are not used anymore (garbage collection).
... memory life cycle regardless of the programming language, the memory life cycle is pretty much always the same: allocate the memory you need use the allocated memory (read, write) release the allocated memory when it is not needed anymore the second part is explicit in all languages.
... allocation in javascript value initialization in order to not bother the programmer with allocations, javascript will automatically allocate memory when values are initially declared.
...And 6 more matches
Error - JavaScript
error objects are thrown when runtime errors occur.
... internalerror creates an instance representing an error that occurs when an internal error in the javascript engine is thrown.
... rangeerror creates an instance representing an error that occurs when a numeric variable or parameter is outside of its valid range.
...And 6 more matches
FinalizationRegistry - JavaScript
a finalizationregistry object lets you request a callback when an object is garbage-collected.
... description finalizationregistry provides a way to request that a cleanup callback get called at some point when an object registered with the registry has been reclaimed (garbage-collected).
... if you might want to unregister an object later, you pass a third value, which is the unregistration token you'll use later when calling the registry's unregister function to unregister the object.
...And 6 more matches
Function.prototype.bind() - JavaScript
the bind() method creates a new function that, when called, has its this keyword set to the provided value, with a given sequence of arguments preceding any provided when the new function is called.
... syntax let boundfunc = func.bind(thisarg[, arg1[, arg2[, ...argn]]]) parameters thisarg the value to be passed as the this parameter to the target function func when the bound function is called.
...when using bind to create a function (supplied as a callback) inside a settimeout, any primitive value passed as thisarg is converted to object.
...And 6 more matches
Promise - JavaScript
description a promise is a proxy for a value not necessarily known when the promise is created.
...when either of these options happens, the associated handlers queued up by a promise's then method are called.
... if the promise has already been fulfilled or rejected when a corresponding handler is attached, the handler will be called, so there is no race condition between an asynchronous operation completing and its handlers being attached.
...And 6 more matches
import - JavaScript
name name of the module object that will be used as a kind of namespace when referring to the imports.
... import {foo, bar} from '/modules/my-module.js'; import an export with a more convenient alias you can rename an export when importing it.
...for instance: import mydefault, * as mymodule from '/modules/my-module.js'; // mymodule used as a namespace or import mydefault, {foo, bar} from '/modules/my-module.js'; // specific, named imports when importing a default export with dynamic imports, it works a bit differently.
...And 6 more matches
Making PWAs work offline with Service workers - Progressive web apps (PWAs)
they finally fix issues that front-end developers have struggled with for years — most notably how to properly cache the assets of a website and make them available when the user’s device is offline.
...you are able to give a service worker something to work on, and receive the result whenever it is ready using a promise-based approach.
... "progressive" in pwa when implemented properly as a progressive 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.
...And 6 more matches
Using templates and slots - Web Components
the truth about templates when you have to reuse the same markup structures repeatedly on a web page, it makes sense to use some kind of a template rather than repeating the same structure over and over again.
... slots are identified by their name attribute, and allow you to define placeholders in your template that can be filled with any markup fragment you want when the element is used in the markup.
... so, if we want to add a slot into our trivial example, we could update our template's paragraph element like this: <p><slot name="my-text">my default text</slot></p> if the slot's content isn't defined when the element is included in the markup, or if the browser doesn't support slots, <my-paragraph> just contains the fallback content "my default text".
...And 6 more matches
Introduction to using XPath in JavaScript - XPath
null, which can be used for html documents or when no namespace prefixes are used.
... simple types when the desired result type in resulttype is specified as either: number_type - a double string_type - a string boolean_type - a boolean we obtain the returned value of the expression by accessing the following properties respectively of the xpathresult object.
... node-set types the xpathresult object allows node-sets to be returned in 3 principal different types: iterators snapshots first nodes iterators when the specified result type in the resulttype parameter is either: unordered_node_iterator_type ordered_node_iterator_type the xpathresult object returned is a node-set of matched nodes which will behave as an iterator, allowing us to access the individual nodes contained by using the iteratenext() method of the xpathresult.
...And 6 more matches
Content Processes - Archive of obsolete content
content scripts when the sdk was first designed, firefox was being refactored towards a multiprocess model.
...when this function is called with a given event name, it calls all the listeners currently associated with that event.
...we can then hook up a listener to be called when this message arrives at the other process, which in turn calls the emit function on the other event emitter.
...And 5 more matches
selection - Archive of obsolete content
usage registering for selection notifications to be notified when the user makes a selection, register a listener for the "select" event.
...getting the selection when there is no current selection returns null.
... setting the selection when there is no current selection throws an exception.
...And 5 more matches
places/bookmarks - Archive of obsolete content
the function returns a placesemitter that emits a data event for each item as it is saved, and an end event when all items have been saved.
... updated a unix timestamp indicating when the bookmark was last updated on the platform.
... updated a unix timestamp indicating when the bookmark was last updated on the platform.
...And 5 more matches
remote/parent - Archive of obsolete content
for example, when the child process is sandboxed, modules won't be able to access the file system.
...quire("sdk/remote/child"); // listeners receive the frame the event was for as the first argument frames.port.on("changelocation", (frame, ref) => { frame.content.location += "#" + ref; }); // main.js const { frames, remoterequire } = require("sdk/remote/parent"); remoterequire("./remote.js", module); frames.port.emit("changelocation", "foo"); tab information this shows sending a message when a tab loads; this is similar to how the sdk/tabs module currently works.
... events attach event emitted when a new process is started.
...And 5 more matches
cfx to jpm - Archive of obsolete content
id handling with cfx when you use cfx, the id is taken from the id field in the add-on's package.json file.
... so: if you never did anything with ids when using cfx, then the value in your add-on's package.json will be something like "jid1-f3boogbjqje67a", and the corresponding id in the install.rdf will be "jid1-f3boogbjqje67a@jetpack".
... id handling with jpm when you create an xpi with jpm xpi: if the package.json does not include an id field, then the id written into the install.rdf is the value of the name field prepended with "@".
...And 5 more matches
Install Manifests - Archive of obsolete content
this allows your add-on's icon to be displayed even when the add-on is disabled, or if the manifest is missing an iconurl entry.
...this allows your add-on's icon to be displayed even when the add-on is disabled, or if the manifest is missing an icon64url entry.
... examples this declares a set of add-on metadata to be displayed when the application is running in the de-de locale.
...And 5 more matches
Adding preferences to an extension - Archive of obsolete content
startup() the stockwatcher.startup() function is called when our extension is first loaded.
... the next step is to register a preference observer by calling the addobserver() method to establish that whenever any events occur on the preferences, our object (this) receives notification.
... when events occur, such as a preference being altered, our observe() method will be called automatically.
...And 5 more matches
Building accessible custom components in XUL - Archive of obsolete content
the individual cells, row headers, and column headers are not in the tab order, but we can still set focus to them programmatically using javascript whenever the user clicks a specific cell.
...the only remaining issue is that when the spreadsheet regains focus (by pressing shift-tab, or cycling all the way around the tab order and coming back into the spreadsheet), we need to programmatically reset the focus to the previously focused cell.
....tagname == 'grid') { if (!gfocuscell) { gfocuscell = e.target.getelementsbytagname('label')[0]; } gfocuscell.focus(); } else { gfocuscell = e.target; } } function spreadsheet_click(e) { e.target.focus(); } </code> finally, we'll add two lines to our .xul file to link in the javascript file (accjax.js) and call the install_handlers function when the spreadsheet is loaded.
...And 5 more matches
Positioning - Archive of obsolete content
first, the position can be specified when using the popup's openpopup method.
... this is used when a popup is opened by a script.
... for instance: <menupopup id="edititems" position="end_before"> <menuitem label="cut"/> <menuitem label="copy"/> <menuitem label="paste"/> </menupopup> <label value="clipboard" popup="edititems"/> in this example, a menupopup is attached to a label via the popup attribute, which will cause the popup to appear when the label is left-clicked.
...And 5 more matches
Template and Tree Listeners - Archive of obsolete content
you would implement this object with these two methods if you wish to be notified when the template is rebuilt using the builder's rebuild call.
... the template builder might also force a rebuild when the underlying data change notifications require it.
...recall that when a template is rebuilt, all of the existing content will be removed and generated fresh.
...And 5 more matches
Content Panels - Archive of obsolete content
adding child panels there may be times when you want to have part of a document loaded from a different page.
...third, it would be difficult to co-ordinate scripts when running in different windows.
...when the user enters a url or clicks on a link in a document, the source of the frame is changed.
...And 5 more matches
Tree View Details - Archive of obsolete content
when the user clicks the twisty to open a row, the tree will call the view's toggleopenstate method.
...the 'init' function is called when the window is loaded to initialize the tree.
...items will be added and removed from this array when items are opened or closed.
...And 5 more matches
Using Remote XUL - Archive of obsolete content
we set this value to the mozilla.org home page by default so that page loads into the iframe when we first load the xul document.
...without it, the iframe's size would be a fixed default and wouldn't change when the user resized their window.
...the independent links, on the other hand, are similar to xul buttons, which perform a function when pressed, so we'll use the button element for those.
...And 5 more matches
XUL Questions and Answers - Archive of obsolete content
support for non-rdf datasources for xul template is planned (bug 321170): xml datasources (bug 321171) storage (sqlite) datasources (bug 321172) when loading an xslt stylesheet into an xml i get the error: "error loading stylesheet: an xslt stylesheet load was blocked for security reasons." that error is from a security check that has been put up to safeguard against cross-site-scripting attacks.
... specifying window.onload function to specify a function to run when the window is loaded,add the following code between the script tags in the xul file: window.addeventlistener("load", function(e) { startup(); }, false); similarly, for onunload use the code: window.addeventlistener("unload", function(e) { shutdown(); }, false); is there an event which is called when the firefox browser is initialized?
... an event is initiated when the application starts up and when the profile is changed.
...And 5 more matches
datepicker - Archive of obsolete content
!!attention: there is also a datepicker in tb-calendar with differing definitions for members (value is a date there) the change event is fired whenever the date is changed.
... however, as described in mozilla bug #799219, a change event handler may encounter erratic behavior when the date is changed using the keyboard instead of the mouse.
... a monthchange event is fired for the grid and popup datepickers whenever a new month is navigated to or displayed.
...And 5 more matches
menulist - Archive of obsolete content
the command event may be used to execute code when the menulist selection changes.
...for example, for a menuitem in a menu you can add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disableautoselect type: boolean if this attribute is true or omitted, the selected item on the menu will update to match what the user entered in the textbox.
... oncommand type: script code this event handler is called when the command is activated.
...And 5 more matches
tabs - Archive of obsolete content
ArchiveMozillaXULtabs
onclosetab type: script code this script will be called when the close tab button is clicked.
... onnewtab not in firefox type: script code this script will be called when the new tab button is clicked.
... onselect type: script code this event is sent to the tabs element when this tab is changed.
...And 5 more matches
window - Archive of obsolete content
without including the css file at "chrome://global/skin/", the window will not be stylized and will be invisible and glitchy when opened as a dialog.
... note: starting in gecko 1.9.2, you can detect when a window is activated or deactivated by watching for the "activate" and "deactivate" events.
... activetitlebarcolor type: color string specify background color of the window's titlebar when it is active (foreground).
...And 5 more matches
Common Firefox theme issues and solutions - Archive of obsolete content
operating system specific issues windows 7 windows 7 aero missing right-hand title bar buttons when tabs are on top and the menu bar is disabled, firefox is missing the min/max/restore/close button on the right side of the title bar.
... app button not styled on linux, but is styled on windows on linux the firefox app button that is displayed when tabs are on top and menu bar is disabled is not styled properly compared to windows and is not changing colors when in private browsing mode.
... toolbars and menus firefox application button application button doesn't change styling for private browsing mode when in private browsing mode there needs to be a visual difference to the firefox app button that is displayed when tabs are on top and the menu bar is disabled.
...And 5 more matches
Using workers in extensions - Archive of obsolete content
every 10 minutes, it calls xmlhttprequest, and, when the results are received, sends an event back to the main thread with the received data.
... postmessage(output.trim()); } httprequest = null; } var httprequest = new xmlhttprequest(); httprequest.open("get", fullurl, true); httprequest.onload = inforeceived; httprequest.send(null); } setinterval(function() { refreshinformation(); }, 10*60*1000); onmessage = function(event) { if (event.data) { symbol = event.data.touppercase(); } refreshinformation(); } when the worker thread is started, the main body of this code (in lines 26-35) is executed.
... when the result is received from xmlhttprequest, instead of immediately updating the displayed information in the status bar, a message is sent to the main thread using the worker's postmessage() method.
...And 5 more matches
Reference - Archive of obsolete content
in particular this means we should define activation object somewhere (and link to it whenever we mention it).
...thanks for your thoughts --callek 15:05, 13 january 2006 (pst) notification when reorganization is finished leandro (localiser for the portuguese wiki) would like to be emailed when the js reference reorganization has been finished.
...but when we create a prototype method for object its also available in function object.prototype.myfunction = function() {}; alert(object.myfunction); //available in object alert(function.myfunction); //available in function also the opposite is correct, when we create a prototype method for function it is available in object function.prototype.myfunction = function() {}; alert(object.myfunction); /...
...And 5 more matches
XForms Select1 Element - Archive of obsolete content
single-node binding special selection - this attribute, when set to 'open', allows the user to provide free entry to the list.
...the data binding restriction to simple content may be relaxed when an itemset element is used, which allows the available choices to be obtained from an xforms model.
... the relaxation happens when the itemset element specifies the item value using a copy (see spec) element.
...And 5 more matches
Desktop mouse and keyboard controls - Game development
previous overview: control mechanisms next now when we have our mobile controls in place and the game is playable on touch-enabled devices, it would be good to add mouse and keyboard support, so the game can be playable also on desktop.
...first, we'd need an event listener to listen for the pressed keys: document.addeventlistener('keydown', keydownhandler, false); document.addeventlistener('keyup', keyuphandler, false); whenever any key is pressed down, we're executing the keydownhandler function, and when press finishes we're executing the keyuphandler function, so we know when it's no longer pressed.
...that way, if you already implemented the buttons as shown in the mobile touch controls article, it will work out of the box on the desktop too: var buttonenclave = this.add.button(10, 10, 'logo-enclave', this.clickenclave, this); the button will be placed ten pixels from the top left corner of the screen, use the logo-enclave image, and will execute the clickenclave() function when clicked.
...And 5 more matches
Responsive design - Learn web development
historic website layouts at one point in history you had two options when designing a website: you could create a liquid site, which would stretch to fill the browser window or a fixed width site, which would be a fixed size in pixels.
...when viewing the example, drag your browser window in and out to see how this looks at different sizes.
... the rest of this article will point you to the various web platform features you might want to use when creating a responsive site.
...And 5 more matches
Styling links - Learn web development
previous overview: styling text next when styling links, it is important to understand how to make use of pseudo-classes to style link states effectively, and how to style links for use in common varied interface features such as navigation menus and tabs.
... link states the first thing to understand is the concept of link states — different states that links can exist in, which can be styled using different pseudo-classes: link (unvisited): the default state that a link resides in, when it isn't in any other state.
... visited: a link when it has already been visited (exists in the browser's history), styled using the :visited pseudo class.
...And 5 more matches
What text editors are available? - Learn web development
in this article we highlight some things to think about when installing a text editor for web development.
... dig deeper choice criteria so, in more detail, what should you be thinking about when you choose a text editor?
...that works great for writing notes to yourself, but when you're doing web development and writing in html, css, and javascript, you can produce some pretty large, complex files.
...And 5 more matches
Advanced form styling - Learn web development
input { -webkit-appearance: none; appearance: none; } note: it is a good idea to always include both declarations — prefixed and unprefixed — when using a prefixed property.
... note: you may have noticed that in the search field, the "x" delete icon disappears when the input loses focus in edge and chrome, but stays put in safari.
...the sizes of check boxes and radio buttons are not meant to be changed with their default designs, and browsers react very differently when you try.
...And 5 more matches
HTML forms in legacy browsers - Learn web development
okay, let's admit it, when we said "legacy browser" we all have in mind safari or old versions of internet explorer, but they are far from the only ones.
... in the mobile world, when neither the browser nor the os can be updated such as on older android phones or iphones, the stock browsers that don't update are also legacy browsers.
...and html5 <input> types don't fail when not supported: they fall back to type=text.
...And 5 more matches
Getting started with HTML - Learn web development
(textarea.selectionend, textarea.value.length); textarea.value = front + text + back; caretpos = caretpos + text.length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to save the state when the user code is being shown, // not the solution, so that solution is not saved over the user code if(solution.value === 'show solution') { userentry = textarea.value; } else { solutionentry = textarea.value; } updatecode(); }; nesting elements elements can be placed within other elements.
...this appears as a tooltip when a cursor hovers over the element.
...you should see a link—that when hovered over—displays the value of the title attribute, and when clicked, navigates to the web address in the href attribute.
...And 5 more matches
Making decisions in your code — conditionals - Learn web development
in the javascript, we are storing a reference to both the <select> and <p> elements, and adding an event listener to the <select> element so that when its value is changed, the setweather() function is run.
... when this function is run, we first set a variable called choice to the current value selected in the <select> element.
...any value that is not false, undefined, null, 0, nan, or an empty string ('') actually returns true when tested as a conditional statement, therefore you can simply use a variable name on its own to test whether it is true, or even that it exists (that is, it is not undefined.) so for example: let cheese = 'cheddar'; if (cheese) { console.log('yay!
...And 5 more matches
Introduction to web APIs - Learn web development
when calling a method from a library, the developer is in control.
... client-side storage apis are becoming a lot more widespread in web browsers — the ability to store data on the client-side is very useful if you want to create an app that will save its state between page loads, and perhaps even work when the device is offline.
...esenting the source of our audio — the <audio> element will be played from: const audioelement = document.queryselector('audio'); const playbtn = document.queryselector('button'); const volumeslider = document.queryselector('.volume'); const audiosource = audioctx.createmediaelementsource(audioelement); next up we include a couple of event handlers that serve to toggle between play and pause when the button is pressed and reset the display back to the beginning when the song has finished playing: // play/pause audio playbtn.addeventlistener('click', function() { // check if context is in suspended state (autoplay policy) if (audioctx.state === 'suspended') { audioctx.resume(); } // if track is stopped, play it if (this.getattribute('class') === 'paused') { ...
...And 5 more matches
JavaScript object basics - Learn web development
object basics an object is a collection of related data and/or functionality (which usually consists of several variables and functions — which are called properties and methods when they are inside objects.) let's work through an example to understand what they look like.
... it is very common to create an object using an object literal when you want to transfer a series of structured, related data items in some manner, for example sending a request to the server to be put into a database.
... sending a single object is much more efficient than sending several items individually, and it is easier to work with than an array, when you want to identify individual items by name.
...And 5 more matches
Object building practice - Learn web development
our little balls will bounce around on the screen, and change color when they touch each other.
... horizontal and vertical velocity (velx and vely) — each ball is given a horizontal and vertical velocity; in real terms these values are regularly added to the x/y coordinate values when we animate the balls, to move them by this much on each frame.
... open the browser's javascript console, and then refresh the page so that the canvas size changes to the smaller visible viewport that remains when the console opens.
...And 5 more matches
Introduction to the server side - Learn web development
most large-scale websites use server-side code to dynamically display different data when needed, generally pulled out of a database stored on a server and sent to the client to be displayed via some code (e.g.
...when you click a link on a web page, submit a form, or run a search, an http request is sent from your browser to the target server.
... web servers wait for client request messages, process them when they arrive, and reply to the web browser with an http response message.
...And 5 more matches
TypeScript support in Svelte - Learn web development
objective: learn how to configure and use typescript when developing svelte applications.
...in this case, the script will execute whenever you change any file.
...replace the export let todo line with the following: import type { todotype } from '../types/todo.type' export let todo: todotype note: another reminder — when importing a .ts file you have to omit the extension.
...And 5 more matches
Setting up your own test automation environment - Learn web development
you can use any url to point to your resource, including a file:// url to test a local document: driver.get('file:///users/chrismills/git/learning-area/tools-testing/cross-browser-testing/accessibility/fake-div-buttons.html'); or driver.get('http://localhost:8888/fake-div-buttons.html'); but it is better to use a remote server location so the code is more flexible — when you start using a remote server to run your tests (see later on), your code will break if you try to use local paths.
...simply call this on your driver instance when you are finished with it.
... add this line to the bottom of your quick_test.js test now: driver.quit(); when you run it, you should now see the test execute and the browser instance shut down again after the test is complete.
...And 5 more matches
Experimental features in Firefox
editor's note: when adding features to these tables, please try to include a link to the relevant bug or bugs using the bug macro: {{bug(bug-number)}}.
... nightly 78 yes developer edition 78 yes beta 78 yes release 78 no preference name network.preload css display stray control characters in css as hex boxes this feature renders control characters (unicode category cc) other than tab (u+0009), line feed (u+000a), form feed (u+000c), and carriage return (u+000d) as a hexbox when they are not expected.
... nightly 75 no developer edition 75 no beta 75 no release 75 no preference name layout.css.conic-gradient.enabled and gfx.webrender.all pseudo-class: :focus-visible allows focus styles to be applied to elements like buttons and form controls, only when they are focused using the keyboard (e.g.
...And 5 more matches
Frame script loading and lifetime
if allowdelayedload is false, the script will only be loaded into frames which are open when the call was made.
...passing allowdelayedload is a way to ensure that the script is loaded correctly, in case the tab is not ready when making the call.
... if you want a frame script to do something when a new document is loaded, you need to listen for an appropriate dom event, generally domwindowcreated, domcontentloaded, or load.
...And 5 more matches
Embedding Tips
how do i know when saving is done, monitor progress etc.?
...when the operation is completed, the onstatechange will be notified by a combination of state_stop | state_is_network state flags.
...hint, add a native message processing loop after the call to saveuri that terminates when onstatechange indicates persistence has finished..
...And 5 more matches
DeferredTask.jsm
this is always true when read from code inside the task function, but can also be true when read from external code, in case the task is an asynchronous generator function.
...if the task is running, the delay will start when the current execution finishes.
... by design, this method doesn't provide a way for the caller to detect when the next execution terminates, or collect a result.
...And 5 more matches
PopupNotifications.jsm
note: you shouldn't need to call this when using the popupnotifications object in firefox windows; firefox code takes care of this automatically.
... callback a javascript function to be invoked when the action is selected by the user.
...this lets you create a notification that will appear when the user clicks the anchor.
...And 5 more matches
Localization content best practices
it's important to consider this when adding strings, and especially localization comments for strings that contain references, or obscure technical details.
...when you have to change a key id, adding a progressive number to the existing key should always be used as a last resort.
... don't forget to add a localization note when: part of the string is not supposed to be localized (for example, the name of an html attribute in a warning).
...And 5 more matches
Mozilla Development Strategies
it's easier to do it right once, when your mind is in the problem, than to do it once quickly and then have to come back and do it again the right way.
...when you land your bug-free code, it's qa's job to assure others that it's really bug free.
...update when you know that the tree is in good shape.
...And 5 more matches
NSS environment variables
nss_shared_db 3.12 nss_disable_arena_free_list string (any non-empty value) define this variable to get accurate leak allocation stacks when using leak reporting software.
...necessary on some platforms to get correct function names when using leak reporting software.
...this value should only be used during the transition period when few servers have been upgraded.
...And 5 more matches
sslintro.html
specifies a callback function for ssl to use when the server asks for client authentication information.
...specifies a callback function that will be used by ssl to inform either a client application or a server application when the ssl handshake is completed.
...these can be used, for example, when interrupting and restarting socket communications, when the application needs to change socket parameters, or when an application imports a socket into ssl after the tcp connection on that socket has already been established.
...And 5 more matches
NSS tools : signtool
when testing is finished and you are ready to disitribute your software, you should obtain an object-signing certificate from one of two kinds of sources: * an independent certificate authority (ca) that authenticates your identity and charges you a fee.
... when you receive an object-signing certificate for your own use, it is automatically installed in your copy of the communicator client software.
...when you use signtool -v, these entries are displayed with the string not present.
...And 5 more matches
Rhino Debugger
break to stop all running scripts and give control to the debugger you may do any of the following: select the debug->break menu item on the menu bar press the break button on the toolbar press the pause/break key on the keyboard break on exceptions to give control to the debugger whenever a javascript is exception is thrown select the debug->break on exceptions checkbox from the menu bar.
... whenever a javascript exception is thrown by a script a message dialog will be displayed and control will be given to the debugger at the location the exception is raised.
... break on function enter selecting debug->break on function enter will give control to the debugger whenever the execution is entered into a function or script.
...And 5 more matches
JSClass
delproperty jsdeletepropertyop a hook called when deleting a property.
... getproperty jspropertyop a hook called when getting a property.
... setproperty jsstrictpropertyop a hook called when setting a property.
...And 5 more matches
JSPropertyOp
getters and setters when a jsapi application creates a property on an object (for example, using js_defineproperty or js_defineproperties) it can specify getter and setter callbacks for the new property.
...it is also called when the property's value is accessed via jsapi functions such as js_getproperty or (less obviously) js_callfunctionname.
...it is also called when the property is set via jsapi functions such as js_setproperty.
...And 5 more matches
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).
... you also need to create the function that displays the weblock window itself when the user clicks the weblock icon in the statusbar.
...in this section, we are going to create the xul interface that calls the javascript methods when the user interacts with it.
...And 5 more matches
Components.utils.Sandbox
like: cc["@mozilla.org/systemprincipal;1"].createinstance(ci.nsiprincipal); content principal you can specify a content principal for a particular origin in one of three ways: as an nsiprincipal, for example by using the nodeprincipal property of a dom node as an nsidomwindow, such as that returned by the dom window property as a string uri like "http://www.example.com/" (discouraged) when possible, specify a window or an nsiprincipal object instead of using a string uri.
...this helps to improve memory usage by allowing sandboxes to be discarded when that zone goes away.
... if the sandbox interacts with untrusted content this should be set to false when possible to further reduce possible attack surface.
...And 5 more matches
Language bindings
these exception objects may be thrown when implementing xpcom interfaces in javascript, and they can provide better diagnostics in the error console if not caught than simply throwing an nsresult's value will.components.idcomponents.id is a constructor that creates native objects that conform to the nsijsid interface.components.interfacescomponents.interfaces is a read-only object whose properties are interfaces indexed by their names.com...
...the mozilla javascript engine will perform garbage collection automatically when the javascript heap grows beyond a certain size.
...in many cases a javascript application will have internal knowledge of javascript objects referencing large (trees of) xpcom objects and know when they are no longer reachable.
...And 5 more matches
nsIAsyncInputStream
inherits from: nsiinputstream last changed in gecko 1.7 if an input stream is non-blocking, it may return ns_base_stream_would_block when read.
...if the stream implements nsiasyncinputstream, then the caller can use this interface to request an asynchronous notification when the stream becomes readable or closed (via the asyncwait() method).
...in other words, this method may be called when the stream already has data to read.
...And 5 more matches
nsIAsyncOutputStream
inherits from: nsioutputstream last changed in gecko 1.7 if an output stream is non-blocking, it may return ns_base_stream_would_block when written to.
...if the stream implements nsiasyncoutputstream, then the caller can use this interface to request an asynchronous notification when the stream becomes writable or closed (via the asyncwait() method).
...in other words, this method may be called when the stream already has room for more data.
...And 5 more matches
nsIContentSecurityPolicy
calls to this may trigger violation reports when queried, so this value should not be cached.
...calls to this may trigger violation reports when queried, so this value should not be cached.
... isinitialized boolean set to true when the content security policy has been read in and parsed and is ready to enforce.
...And 5 more matches
nsIMemory
the result must be freed with a call to free() when it is no longer needed.
...if false, the flush will be scheduled to happen when the app is idle.
...the result must be freed with a call to free() when it is no longer needed.
...And 5 more matches
nsIMessageListenerManager
to access this service, use: var globalmm = components.classes["@mozilla.org/globalmessagemanager;1"] .getservice(components.interfaces.nsimessagelistenermanager); method overview void addmessagelistener(in astring messagename, in nsimessagelistener listener, [optional] in boolean listenwhenclosed) void removemessagelistener(in astring messagename, in nsimessagelistener listener); void addweakmessagelistener(in astring messagename, in nsimessagelistener listener); void removeweakmessagelistener(in astring messagename, in nsimessagelistener listener); met...
... all listener callbacks for a particular message are invoked when that message is received.
... void addmessagelistener(in astring messagename, in nsimessagelistener listener, [optional] in boolean listenwhenclosed); parameters messagename a string indicating the name of the message to listen for.
...And 5 more matches
nsIMsgMessageService
(?) displaymessage() when you want a message displayed....
... savemessagetodisk() when you want to spool a message out to a file on disk.
... this is an async operation of course.note: you must pass in a url listener in order to figure out when the operation is done.
...And 5 more matches
nsINavHistoryObserver
ondeletevisits() called when some visits of an history entry are expired.
... note: when all visits for a page are expired and also the full page entry is expired, you will only get an ondeleteuri notification.
...called when a history entry expires.
...And 5 more matches
nsINavHistoryQuery
toolkit/components/places/public/nsinavhistoryservice.idlscriptable encapsulates all the query parameters you're likely to need when building up history ui.
...when domainishost, domain only does exact matching on host names.
... onlybookmarked boolean when set, returns only bookmarked items, when unset, returns anything.
...And 5 more matches
nsISHistoryListener
inherits from: nsisupports last changed in gecko 1.7 a session history listener is notified when pages are added to, removed from, and loaded from session history.
...method overview boolean onhistorygoback(in nsiuri abackuri); boolean onhistorygoforward(in nsiuri aforwarduri); boolean onhistorygotoindex(in long aindex, in nsiuri agotouri); void onhistorynewentry(in nsiuri anewuri); boolean onhistorypurge(in long anumentries); boolean onhistoryreload(in nsiuri areloaduri, in unsigned long areloadflags); methods onhistorygoback() called when navigating to a previous session history entry, for example due to an nsiwebnavigation.goback() call.
...onhistorygoforward() called when navigating to a next session history entry, for example due to an nsiwebnavigation.goforward() call.
...And 5 more matches
nsITextInputProcessorNotification
when gecko supports new notification to ime, this interface may have some new attributes.
... when this is requested, the callback should commit composition synchronously, i.e., nsitextinputprocessor.commitcomposition() should be called.
... this is typically notified when user clicks somewhere, focus is moved, or web contents modify the value of the editor during composition.
...And 5 more matches
Break on DOM mutation - Firefox Developer Tools
a dom mutation breakpoint pauses the code when the dom node on which you have set the breakpoint is modified.
... that means, the script execution is stopped whenever a child node or descendant node deeper in the dom structure is added to or removed from the element the option is set on.
... examples for when this breakpoint is triggered are calling node.appendchild() and node.removechild(), calling childnode.remove() or setting element.innerhtml on one of the subnodes.
...And 5 more matches
Set event listener breakpoints - Firefox Developer Tools
starting with firefox 69, debugging an application that includes event handlers is simplified because the debugger now includes the ability to automatically break when the code hits an event handler.
... to break when event listeners are hit, check the boxes next the events you are interested in.
... now when a keydown, keyup, keypress, or input event occurs, execution will pause as soon as it enters the listener code.
...And 5 more matches
Debugger - Firefox Developer Tools
the debugger object when called as a constructor, the debugger object creates a new debugger instance.
...changing this flag when any frame of the debuggee is currently active on the stack will produce an exception.
...code coverage reports are monotone, thus one can take a snapshot when the debugger is enabled, and output the difference.
...And 5 more matches
CSS Grid Inspector: Examine grid layouts - Firefox Developer Tools
discovering css grids when an html element on your page has display: grid applied to it, a number of features are made available in the devtools to provide easy access to grid features.
... clicking the icon toggles the display of a grid overlay on the page, which appears over the element, laid out like a grid to show the position of its grid lines and tracks: the overlay is still shown when you select other elements, so you can edit related css properties and see how the grid is affected.
... the layout view grid section when grids are included on a page, the css pane's layout view includes a "grid" section containing a number of options for viewing those grids.
...And 5 more matches
AudioTrackList - Web APIs
event handlers onaddtrack an event handler to be called when the addtrack event is fired, indicating that a new audio track has been added to the media element.
... onchange an event handler to be called when the change event occurs.
... this occurs when one or more tracks have been enabled or disabled by their enabled flag being changed.
...And 5 more matches
Using the CSS properties and values API - Web APIs
when a property isn't registered, the browser doesn't know how to treat it, so it assumes that any value can be used and therefore can't animate it.
... when a property has a registered syntax, though, the browser can optimize around that syntax, including being able to animate it!
...40vh; display: block; width: 100%; font-size: 3vw; } window.css.registerproperty({ name: '--registered', syntax: '<color>', inherits: false, initialvalue: 'red', }); while not functionally accurate, a good way to think about the difference between the unregistered property in the above example and the registered property is the difference between a <custom-ident> and a number when trying to animate height.
...And 5 more matches
Manipulating video using canvas - Web APIs
initializing the chroma-key player the doload() method is called when the xhtml document initially loads.
... this method's job is to prepare the variables needed by the chroma-key processing code, and to set up an event listener so we can detect when the user starts playing the video.
... these will be used when we're actually doing the chroma-keying effect.
...And 5 more matches
Drawing shapes with canvas - Web APIs
working with paths is essential when drawing objects onto the canvas and we will see how that can be done.
... note: when the current path is empty, such as immediately after calling beginpath(), or on a newly created canvas, the first path construction command is always treated as a moveto(), regardless of what it actually is.
... note: when you call fill(), any open shapes are closed automatically, so you don't have to call closepath().
...And 5 more matches
DragEvent - Web APIs
WebAPIDragEvent
event types drag this event is fired when an element or text selection is being dragged.
... dragend this event is fired when a drag operation is being ended (by releasing a mouse button or hitting the escape key).
... dragenter this event is fired when a dragged element or text selection enters a valid drop target.
...And 5 more matches
Guide to the Fullscreen API - Web APIs
this article demonstrates how to use the fullscreen api to place a given element into full-screen mode, as well as how to detect when the browser enters or exits full-screen mode.
... notification when fullscreen mode is successfully engaged, the document which contains the element receives a fullscreenchange event.
... when fullscreen mode is exited, the document again receives a fullscreenchange event.
...And 5 more matches
HTMLScriptElement.referrerPolicy - Web APIs
the referrerpolicy property of the htmlscriptelement interface reflects the html referrerpolicy of the <script> element and fetches made by that script, defining which referrer is sent when fetching the resource.
... no-referrer-when-downgrade (default) this is the user agent's default behavior if no policy is specified.
... the url is sent as a referrer when the protocol security level stays the same (e.g.http→http, https→https), but isn't sent to a less secure destination (e.g.
...And 5 more matches
Browser storage limits and eviction criteria - Web APIs
the process by which the browser works out how much space to allocate to web data storage and what to delete when that limit is reached is not simple, and differs between browsers.
... this article describes how browsers determine what local content to purge and when in order to free up needed local storage space.
... in firefox, the following technologies make use of browser data storage to store data when required.
...And 5 more matches
Key Values - Web APIs
varies varies varies varies modifier keys modifiers are special keys which are used to generate special characters or cause special actions when used in combination with other keys.
... appcommand_undo gdk_key_undo (0xff65) [1] on keyboards without a dedicated del key, the mac generates the "delete" value when fn is pressed in tandem with delete (which is backspace on other platforms).
... [3] internet explorer (tested on release 9 and 11) and firefox 36 and earlier generate the value "crsel" instead of "crsel" when the crsel key is pressed.
...And 5 more matches
Capabilities, constraints, and settings - Web APIs
this isn't always necessary, since any that aren't known will simply be ignored when you specify them—but if you have any that you can't get by without, you can start by checking to be sure they're on the list.
...however, if you use simple values for properties when calling mediastreamtrack.applyconstraints(), the request will always succeed, because these values will be considered a request, not a requirement.
...if any constraint which uses one or more of those can't be met when calling applyconstraints(), the promise will be rejected.
...And 5 more matches
NodeIterator - Web APIs
nodeiterator.root read only returns a node representing the root node as specified when the nodeiterator was created.
...this is meaningful only when creating a nodeiterator with an attr node as its root; in this case, it means that the attribute node will appear in the first position of the iteration or traversal.
... since attributes are never children of other nodes, they do not appear when traversing over the document tree.
...And 5 more matches
Using the Notifications API - Web APIs
examples one of the most obvious use cases for web notifications is a web-based mail or irc application that needs to notify the user when a new message is received, even if the user is doing something else with another application.
...it stores data locally using indexeddb and notifies users when tasks are due using system notifications.
...this is a common requirement when an api tries to interact with something outside a web page — at least once, the user needs to specifically grant that application permission to present notifications, thereby letting the user control which apps/sites are allowed to display notifications.
...And 5 more matches
SVGTransformList - Web APIs
exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only.
... exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only.
... exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only.
...And 5 more matches
Screen Wake Lock API - Web APIs
the screen wake lock api provides a way to prevent devices from dimming or locking the screen when an application needs to keep running.
... screen wake lock api interfaces wakelock the wakelock interface prevents device screens from dimming or locking when an application needs to keep running.
...there's a checkbox which when checked, will automatically reacquire the wake lock if the document's visibility state changes and becomes visible again.
...And 5 more matches
SpeechSynthesisUtterance - Web APIs
speechsynthesisutterance.text gets and sets the text that will be synthesised when the utterance is spoken.
... boundary fired when the spoken utterance reaches a word or sentence boundary.
... end fired when the utterance has finished being spoken.
...And 5 more matches
TreeWalker - Web APIs
treewalker.root read only returns a node representing the root node as specified when the treewalker was created.
...this is meaningful only when creating a treewalker with an attr node as its root.
...since attributes are never children of other nodes, they do not appear when traversing over the document tree.
...And 5 more matches
WebGL best practices - Web APIs
when using webgl extensions, if possible, try to make them optional by gracefully adapting to the case there they are not supported.
...for unchanged vaos, browsers can cache the fetch limits, whereas when vaos change, browsers must revalidate and recalculate limits.
... flush when expecting results (like queries or rendering frame completion) flush tells the implementation to push all pending commands out for execution, flushing them out of the queue, instead of waiting for more commands to enqueue before sending for execution.
...And 5 more matches
Establishing a connection: The WebRTC perfect negotiation pattern - Web APIs
however, despite that flexibility in transport and communication of signaling messages, there's still a recommended design pattern you should follow when possible, known as perfect negotiation.
... pc.ontrack = ({track, streams}) => { track.onunmute = () => { if (remotevideo.srcobject) { return; } remotevideo.srcobject = streams[0]; }; }; when the track event occurs, this handler executes.
...if an error occurs and we've ignored the most recent offer, we also ignore any error that may occur when trying to add the candidate.
...And 5 more matches
WebRTC API - Web APIs
included are interfaces representing peer media connections, data channels, and interfaces used when exchanging information on the capabilities of each peer in order to select the best possible configuration for a two-way media connection.
... icecandidate an rtcpeerconnectioniceevent which is sent whenever the local device has identified a new ice candidate which needs to be added to the local peer by calling setlocaldescription().
... iceconnectionstatechange sent to an rtcpeerconnection when its ice connection's state—found in the iceconnectionstate property—changes.
...And 5 more matches
WebSocket - Web APIs
WebAPIWebSocket
websocket.onclose an event listener to be called when the connection is closed.
... websocket.onerror an event listener to be called when an error occurs.
... websocket.onmessage an event listener to be called when a message is received from the server.
...And 5 more matches
Fundamentals of WebXR - Web APIs
this is an important fact to keep in mind; while webxr manages the timing, scheduling, and the various points of view relevant when drawing the scene, it does not actually know how to load and manage models, render and texture them, and so forth.
...a system with two degrees of freedom can sense when the user looks left and right or up and down, but can't report any other kind of movement.
...which type of session you want to create is specified when creating the session.
...And 5 more matches
Using the Web Speech API - Web APIs
speech recognition speech recognition involves receiving speech through a device's microphone, which is then checked by a speech recognition service against a list of grammar (basically, the vocabulary you want to have recognised in a particular app.) when a word or phrase is successfully recognised, it is returned as a result (or list of results) as a text string, and further actions can be initiated as a result.
...when the screen is tapped/clicked, you can say an html color keyword, and the app's background color will change to that color.
...ecognition.grammars = speechrecognitionlist; recognition.continuous = false; recognition.lang = 'en-us'; recognition.interimresults = false; recognition.maxalternatives = 1; starting the speech recognition after grabbing references to the output <div> and the html element (so we can output diagnostic messages and update the app background color later on), we implement an onclick handler so that when the screen is tapped/clicked, the speech recognition service will start.
...And 5 more matches
Window.open() - Web APIs
WebAPIWindowopen
when window.open() returns, the window always contains about:blank.
... note that when noopener is used, nonempty target names other than _top, _self, and _parent are all treated like _blank in terms of deciding whether to open a new window/tab.
... in general, users usually disable moving and resizing of existing windows because allowing authors' scripts to do so has been abused overwhelmingly in the past and the rare scripts that do not abuse such feature are often wrong, inaccurate when resizing the window.
...And 5 more matches
Using XMLHttpRequest - Web APIs
it starts with "xml" because when it was created the main format that was originally used for asynchronous data exchange were xml handling responses there are several types of response attributes defined by the living standard specification for the xmlhttprequest() constructor.
...in this case, the progress event is automatically fired when the load event occurs for that packet.
... a little vanilla framework all these effects are done automatically by the web browser whenever you submit a <form>.
...And 5 more matches
ARIA: listbox role - Accessibility
when a list is tabbed to, the first item in the list will be selected if nothing else already is.
... when the listbox role is added to an element, or such an element becomes visible, screen readers announce the label and role of the listbox when it gets focus.
... (for further details and a full list of aria states and properties see the aria listbox (role) documentation.) keyboard interactions when a single-select listbox receives focus: if none of the options are selected before the listbox receives focus, the first option receives focus.
...And 5 more matches
Accessibility documentation index - Accessibility
found 105 pages: # page tags and summary 1 accessibility accessibility, landing accessibility (often abbreviated to a11y—as in "a" then 11 characters then "y") in web development means enabling as many people as possible to use web sites, even when those people's abilities are limited in some way.
... 10 basic form hints aria, accessibility, forms when implementing forms using traditional html form-related elements, it is important to provide labels for controls, and explicitly associate a label with its control.
...when this role is added to an element, the browser will send out an accessible alert event to assistive technology products which can then notify the user about it.
...And 5 more matches
Controlling Ratios of Flex Items Along the Main Axis - CSS: Cascading Style Sheets
here we will explore them in depth in order that you can fully understand what the browser is doing when you use them.
... important concepts when working on the main axis there are a few concepts worth digging into before looking at how the flex properties work to control ratios along the main axis.
...when a flex container has positive free space, it has more space than is required to display the flex items inside the container.
...And 5 more matches
Flow Layout and Overflow - CSS: Cascading Style Sheets
when there is more content than can fit into a container, an overflow situation occurs.
...this guide explains how overflow works when working with normal flow.
...comparing the next example with the example for overflow: scroll you should see overflow scroll has horizontal and vertical scrollbars when it only needs vertical scrolling.
...And 5 more matches
Basic Concepts of grid layout - CSS: Cascading Style Sheets
the grid layout specification is flexible enough to add additional rows and columns when needed.
... grid is a powerful specification that, when combined with other parts of css such as flexbox, can help you create layouts that were previously impossible to build in css.
... .wrapper { display: grid; grid-template-columns: repeat(5, 1fr 2fr); } the implicit and explicit grid when creating our example grid we specifically defined our column tracks with the grid-template-columns property, but the grid also created rows on its own.
...And 5 more matches
Relationship of grid layout to other layout methods - CSS: Cascading Style Sheets
this is because when you wrap flex items, each new row (or column when working by column) becomes a new flex container.
...; background-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; padding: 1em; color: #d9480f; } <div class="wrapper"> <div>one</div> <div>two</div> <div>three</div> <div>four</div> <div>five</div> </div> .wrapper { display: grid; grid-template-columns: repeat(3, 1fr); } a simple question to ask yourself when deciding between grid or flexbox is: do i only need to control the layout by row or column – use a flexbox do i need to control the layout by row and column – use a grid content out or layout in?
...an ideal use case for flexbox is when you have a set of items and want to space them out evenly in a container.
...And 5 more matches
position - CSS: Cascading Style Sheets
WebCSSposition
this value creates a new stacking context when the value of z-index is not auto.
... this value creates a new stacking context when the value of z-index is not auto.
...it is positioned relative to the initial containing block established by the viewport, except when one of its ancestors has a transform, perspective, or filter property set to something other than none (see the css transforms spec), in which case that ancestor behaves as the containing block.
...And 5 more matches
right - CSS: Cascading Style Sheets
WebCSSright
description the effect of right depends on how the element is positioned (i.e., the value of the position property): when position is set to absolute or fixed, the right property specifies the distance between the element's right edge and the right edge of its containing block.
... when position is set to relative, the right property specifies the distance the element's right edge is moved to the left from its normal position.
... when position is set to sticky, the right property is used to compute the sticky-constraint rectangle.
...And 5 more matches
Mouse gesture events - Developer guides
note: some operating systems, including mac os x and windows 7, provide default actions when gesture events occur.
...types of gesture events mozswipegesture the mozswipegesture event is sent when the user uses three fingers to "swipe" the trackpad.
... mozmagnifygesturestart the mozmagnifygesturestart event is sent when the user begins performing a "pinch" gesture, by using two fingers as the corners of a rectangle and moving them either closer together or farther apart.
...And 5 more matches
HTML attribute: pattern - HTML: Hypertext Markup Language
the pattern attribute, when specified, is a regular expression which the input's value must match in order for the value to pass constraint validation.
... it must be a valid javascript regular expression, as used by the regexp type, and as documented in our guide on regular expressions; the 'u' flag is specified when compiling the regular expression, so that the pattern is treated as a sequence of unicode code points, instead of as ascii.
... usability when including a pattern, provide a description of the pattern in visible text near the control.
...And 5 more matches
<a>: The Anchor element - HTML: Hypertext Markup Language
WebHTMLElementa
when the link is followed, the browser will send post requests with the body ping to the urls.
... referrerpolicy how much of the referrer to send when following the link.
... note: when using target, add rel="noreferrer noopener" to avoid exploitation of the window.opener api; note: in newer browser versions (e.g.
...And 5 more matches
<iframe>: The Inline Frame element - HTML: Hypertext Markup Language
WebHTMLElementiframe
referrerpolicy indicates which referrer to send when fetching the frame's resource: no-referrer: the referer header will not be sent.
... no-referrer-when-downgrade (default): the referer header will not be sent to origins without tls (https).
... origin-when-cross-origin: the referrer sent to other origins will be limited to the scheme, the host, and the port.
...And 5 more matches
<input type="color"> - HTML: Hypertext Markup Language
WebHTMLElementinputcolor
this makes sense when you keep in mind that html and css are separate languages and specifications.
...the change event is fired when the user dismisses the color picker.
... colorwell.select(); appearance variations as previously mentioned, when a browser doesn't support a color picker interface, its implementation of color inputs will be a text box that validates the contents automatically to ensure that the value is in the correct format.
...And 5 more matches
<input type="datetime-local"> - HTML: Hypertext Markup Language
when the above value submitted to the server, for example, it will look like partydate=2017-06-01t08:30.
... additional attributes in addition to the attributes common to all <input> elements, datetime-local inputs offer the following attributes: attribute description max the latest date and time to accept min the earliest date and time to accept step the stepping interval to use for this input, such as when clicking arrows on spinner controls or performing validation max the latest date and time to accept.
... note: when the data entered by the user doesn't adhere to the stepping configuration, the user agent may round to the nearest valid value, preferring numbers in the positive direction when there are two equally close options.
...And 5 more matches
<input type="radio"> - HTML: Hypertext Markup Language
WebHTMLElementinputradio
radio buttons are typically rendered as small circles, which are filled or highlighted when selected.
... you can try out this example here: data representation of a radio group when the above form is submitted with a radio button selected, the form's data includes an entry in the form contact=value.
... note: if no radio button is selected when the form is submitted, the radio group is not included in the submitted form data at all, since there is no value to report.
...And 5 more matches
<textarea> - HTML: Hypertext Markup Language
WebHTMLElementtextarea
the html <textarea> element represents a multi-line plain-text editing control, useful when you want to allow users to enter a sizeable amount of free-form text, for example a comment on a review or feedback form.
... the above example demonstrates a number of features of <textarea>: an id attribute to allow the <textarea> to be associated with a <label> element for accessibility purposes a name attribute to set the name of the associated data point submitted to the server when the form is submitted.
... autofocus this boolean attribute lets you specify that a form control should have input focus when the page loads.
...And 5 more matches
Using the application cache - HTML: Hypertext Markup Language
as of firefox 44+, when appcache is used to provide offline support for a page, a warning message displays in the console advising developers to use service workers instead (bug 1204581).
... an application cache gives the following benefits: offline browsing users can navigate a site even when they are offline.
... 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.
...And 5 more matches
HTTP conditional requests - HTTP
such requests can be useful to validate the content of a cache, and sparing a useless control, to verify the integrity of a document, like when resuming a download, or when preventing to lose updates when uploading or modifying a document on the server.
... comparing versions of the same resource is a bit tricky: depending on the context, there are two kinds of equality checks: strong validation is used when byte to byte identity is expected, for example when resuming a download.
... weak validation is used when the user-agent only needs to determine if the two resources have the same content.
...And 5 more matches
Set-Cookie - HTTP
a session finishes when the client shuts down, and session cookies will be removed.
... when an expires date is set, the deadline is relative to the client the cookie is being set on, not the server.
... secure optional a secure cookie is only sent to the server when a request is made with the https: scheme.
...And 5 more matches
Link prefetching FAQ - HTTP
when the user visits one of the prefetched documents, it can be served up quickly out of the browser's cache.
... the browser observes all of these hints and queues up each unique request to be prefetched when the browser is idle.
...the last document stop notification occurs roughly when the onload handler would fire for the toplevel document.
...And 5 more matches
JSON.stringify() - JavaScript
exceptions throws a typeerror ("cyclic object value") exception when a circular reference is found.
... throws a typeerror ("bigint value can't be serialized in json") when trying to stringify a bigint value.
...if any such values are encountered during conversion they are either omitted (when found in an object) or changed to null (when found in an array).
...And 5 more matches
Object - JavaScript
when called in a non-constructor context, object behaves identically to new object().
... object.prototype.__proto__ points to the object which was used as prototype when the object was instantiated.
... object.prototype.__nosuchmethod__ allows a function to be defined that will be executed when an undefined object member is called as a method.
...And 5 more matches
TypedArray - JavaScript
calling it or using it in a new expression will throw a typeerror, except when used during object creation in js engines that support subclassing.
... when creating an instance of a typedarray (e.g.
... parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros.
...And 5 more matches
SVG Presentation Attributes - SVG: Scalable Vector Graphics
value: auto|optimizespeed|optimizequality|inherit; animatable: yes cursor it specifies the mouse cursor displayed when the mouse pointer is over an element.
... 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-progression-direction is horizontal.
... value: <angle>|inherit; animatable: no glyph-orientation-vertical deprecated since svg 2 it controls glyph orientation when the inline-progression-direction is vertical.
...And 5 more matches
Content type - SVG: Scalable Vector Graphics
when used in the value of a property in a stylesheet, an <angle> is defined as follows: angle ::= number (~"deg" | ~"grad" | ~"rad")?
... when angles are used in an svg attribute, <angle> is instead defined as follows: angle ::= number ("deg" | "grad" | "rad")?
...when used in a stylesheet, a <length> is defined as follows: length ::= number (~"em" | ~"ex" | ~"px" | ~"in" | ~"cm" | ~"mm" | ~"pt" | ~"pc")?
...And 5 more matches
Understanding WebAssembly text format - WebAssembly
(note that when this text gets converted to binary, though, the binary will contain only the integer.) stack machines before we can write a function body, we have to talk about one more thing: stack machines.
... when a function is called, it starts with an empty stack which is gradually filled up and emptied as the body’s instructions are executed.
...when growth occurs, since arraybuffers can’t change size, the current arraybuffer is detached and a new arraybuffer is created to point to the newer, bigger memory.
...And 5 more matches
page-worker - Archive of obsolete content
from the page to the add-on: var script = "var elements = document.queryselectorall('h2 > span'); " + "for (var i = 0; i < elements.length; i++) { " + " postmessage(elements[i].textcontent) " + "}"; // create a page worker that loads wikipedia: pageworkers.page({ contenturl: "http://en.wikipedia.org/wiki/internet", contentscript: script, contentscriptwhen: "ready", onmessage: function(message) { console.log(message); } }); for conciseness, this example creates the content script as a string and uses the contentscript property.
... include string, regexp, array of (string or regexp) this is useful when your page worker loads a page which will redirect to other pages.
... contentscriptwhen string when to load the content scripts.
...And 4 more matches
system/unload - Archive of obsolete content
experimental register callbacks that are called when a module is unloaded.
... it ensures that this wrapper method is called when the object's module is unloaded.
... therefore, when you register an object with ensure(), you can call its destructor method yourself, you can let it happen for you, or you can do both.
...And 4 more matches
Storing annotations - Archive of obsolete content
anchor); simplestorage.storage.annotations.push(newannotation); } this function calls a constructor for an annotation object, which we also need to supply: function annotation(annotationtext, anchor) { this.annotationtext = annotationtext; this.url = anchor[0]; this.ancestorid = anchor[1]; this.anchortext = anchor[2]; } now we need to link this code to the annotation editor, so that when the user presses the return key in the editor, we create and store the new annotation: var annotationeditor = panels.panel({ width: 220, height: 220, contenturl: data.url('editor/annotation-editor.html'), contentscriptfile: data.url('editor/annotation-editor.js'), onmessage: function(annotationtext) { if (annotationtext) handlenewannotation(annotationtext, this.annotationanch...
... var annotationlist = panels.panel({ width: 420, height: 200, contenturl: data.url('list/annotation-list.html'), contentscriptfile: [data.url('jquery-1.4.2.min.js'), data.url('list/annotation-list.js')], contentscriptwhen: 'ready', onshow: function() { this.postmessage(simplestorage.storage.annotations); }, onmessage: function(message) { require('sdk/tabs').open(message); } }); since this panel's content script uses jquery we will pass that in too: again, make sure the name of it matches the version of jquery you downloaded.
... when the panel is shown we send it the array of stored annotations.
...And 4 more matches
Modifying Web Pages Based on URL - Archive of obsolete content
a simple code snippet where content script is supplied as contentscript option and url pattern is given as include option is as follows: // import the page-mod api var pagemod = require("sdk/page-mod"); // create a page-mod // it will run a script whenever a ".org" url is loaded // the script replaces the page contents with a message pagemod.pagemod({ include: "*.org", contentscript: 'document.body.innerhtml = ' + ' "<h1>page matches ruleset</h1>";' }); do as follows: create a new directory and navigate to it.
... for example, if we save the script above under the add-on's data directory in a file called my-script.js: // import the page-mod api var pagemod = require("sdk/page-mod"); // import the self api var self = require("sdk/self"); // create a page-mod // it will run a script whenever a ".org" url is loaded // the script replaces the page contents with a message pagemod.pagemod({ include: "*.org", contentscriptfile: self.data.url("my-script.js") }); or from firefox 34 onwards: // import the page-mod api var pagemod = require("sdk/page-mod"); // create a page-mod // it will run a script whenever a ".org" url is loaded // the script replaces the page contents with a m...
... // import the page-mod api var pagemod = require("sdk/page-mod"); // import the self api var self = require("sdk/self"); // create a page mod // it will run a script whenever a ".org" url is loaded // the script replaces the page contents with a message pagemod.pagemod({ include: "*.org", contentscriptfile: [self.data.url("jquery-1.7.min.js"), self.data.url("my-script.js")] }); you can use both contentscript and contentscriptfile in the same page-mod.
...And 4 more matches
Progress Listeners - Archive of obsolete content
enerateqi(["nsiwebprogresslistener", "nsisupportsweakreference"]), onstatechange: function(awebprogress, arequest, aflag, astatus) { // if you use mylistener for more than one tab/window, use // awebprogress.domwindow to obtain the tab/window which triggers the state change if (aflag & state_start) { // this fires when the load event is initiated } if (aflag & state_stop) { // this fires when the load finishes } }, onlocationchange: function(aprogress, arequest, auri) { // this fires when the location bar changes; that is load event is confirmed // or when the user switches tabs.
...elf, curtot, maxtot) {}, onstatuschange: function(awebprogress, arequest, astatus, amessage) {}, onsecuritychange: function(awebprogress, arequest, astate) {} } attach the progress listener to a <browser> or a <tabbrowser> element using addprogresslistener, for example for firefox put the following code in a load listener of a main window: gbrowser.addprogresslistener(mylistener); when used with a browser, the second argument is a mask which determines the type of events that will be received.
... when used with a tabbrowser, you cannot choose which types of events that will be received.
...And 4 more matches
Extension Versioning, Update and Compatibility - Archive of obsolete content
how applications determine compatibility when installing add-ons applications look at the targetapplication entries in the add-on's install.rdf.
... overriding compatibility checking for testing purposes you can tell the application to somewhat ignore compatibility checks when installing add-ons.
...this is visible when the user gets an add-on update notification and should be used to give a quick overview of what new features have been added and any security issues that have been resolved.
...And 4 more matches
How to convert an overlay extension to restartless - Archive of obsolete content
logerrormessage("error attempting to load: " + url); returnresult(null); }; request.onload = function(event) { if (request.response) returnresult(request.response); else request.onerror(event); }; request.send(); } loadfile("chrome://myaddon/content/filename.ext",datatype,function(data) { /* do stuff with data */ }); note: when using xmlhttprequest to access a file:// url the request.status is not properly set to 200 to indicate success.
... reportedly xmlhttprequest doesn't work reliably when used in jsm under versions of firefox less than 16, however as previously mentioned, this guide should be taken as requiring firefox 17+.
...well, you should probably consider switching to be extractionless when you go restartless.
...And 4 more matches
Jetpack Processes - Archive of obsolete content
privileged apis when script is evaluated in a jetpack process via a call to nsijetpack.evalscript(), the script's global scope is endowed with the following privileged apis: sendmessage(amessagename [, v1 [, v2 [, ...]]]) similar to nsijetpack.sendmessage(), this function asynchronously sends a message to the chrome process.
...registerreceiver(amessagename, areceiver) similar to nsijetpack.registerreceiver(), this function registers a callback that is triggered when the chrome process sends a message with the given name.
...either process may invalidate a handle when it is no longer useful.
...And 4 more matches
Connecting to Remote Content - Archive of obsolete content
assume we need to parse the following data: {"shops": [{"name": "apple", "code": "a001"}, {"name": "orange"}], "total": 100} when the onload callback function is called, the response text is converted into a js object using the parse method.
...let's assume that the xml returned from remote server is this: <?xml version="1.0"?> <data> <shops> <shop> <name>apple</name> <code>a001</code> </shop> <shop> <name>orange</name> </shop> </shops> <total>2</total> </data> when a valid xml response comes back from the remote server, the xml document object can be manipulated using different dom methods, to display the data in the ui or store it into a local datasource.
... xpath is very useful for cases when you're receiving large and complex xml files, and you only need some of the data contained in them.
...And 4 more matches
Custom XUL Elements with XBL - Archive of obsolete content
you'll need to keep this in mind when defining the content of the binding, because weird things can happen if you don't add "xul:" to your content nodes.
... a field holds a value that can be changed, except when the readonly attribute is set.
... when you add a node to a xul document using an xbl binding, all normal dom operations can be performed on it.
...And 4 more matches
The Essentials of an Extension - Archive of obsolete content
you only need to change namespace declarations when you mix different types of content in the same document, such as xul with html or svg.
... now let's look at the javascript file and see what's going on when the event is fired.
...dtd is the most efficient way of showing text in xul, so you should use it whenever possible.
...And 4 more matches
User Notifications and Alerts - Archive of obsolete content
the notification shows up again when you come back to the tab that displayed it.
... this means that these notifications make the most sense when they are related to the page currently being displayed, such as a page trying to install an add-on, or a site you just entered a password on.
...the level argument determines the "strength" of the message, indicated by its background color when it is displayed.
...And 4 more matches
Setting up an extension development environment - Archive of obsolete content
(linux, mac os x, windows instructions.) you'll see the list of available user profiles one which is default (stable) and other (unstable) profile(s) created automatically when you run other versions of firefox earlier.
...now when you start any version of firefox you may choose any profile you like.
... development preferences there is a set of development preferences that, when enabled, allows you to view more information about application activity, thus making debugging easier.
...And 4 more matches
Layout System Overview - Archive of obsolete content
the decision about when to apply css-specified formatting and when to apply legacy formatting is controlled by the document's doctype specification.
...when out-of-flow frames are present this is a more difficult problem, however.
...when a content element is modified, added or removed, layout is notified.
...And 4 more matches
Style System Overview - Archive of obsolete content
style contexts own their parents, since inheritance operates through style context parents (ugly when we have multiple frames per content node).
...in this case: inherited structs: same value as parent style context (optimization breaks when property has non-inherit value) reset structs: same struct for every style context using rule node (optimization breaks when a value is explicit inherit) reset structs: rule nodes have the same shared struct as their parent (optimization breaks when a property is specified with a different value or when there is an explicit inherit value).
...this happens when properties are inherited or when percentage units are used in a way that is handled by the style code (rather than reflow).
...And 4 more matches
Frequently Asked Questions - Archive of obsolete content
when servers send user agents an svg file they must tell the user agent that the file has the mime type "image/svg+xml", and if the svg file is stored gzipped they must tell the browser that too.
...mozilla will show this message when there's an xml well formedness error in the file it tried to load.
... when you try to load svg files from some websites you may get a dialogue asking you "what should firefox do with this file?".
...And 4 more matches
Writing to Files - Archive of obsolete content
when writing text files, characters are writing using a chosen character set, encoded automatically.
...creating and appending to files a number of flags control whether a new file is created when writing or whether data is appended to an existing file.
... these flags should be included in addition to the 'text' or 'binary' flags when using the newoutputstream method.
...And 4 more matches
Rule Compilation - Archive of obsolete content
for each result that is generated by the query, the conditions specified within the rules are scanned, and content is generated when a rule matches.
...<vbox datasources="http://www.xulplanet.com/ds/sample.rdf" ref="http://www.xulplanet.com/rdf/a" flex="1"> <template> <query> -- query content goes here -- </query> <rule> -- rule content goes here -- </rule> <rule> -- rule content goes here -- </rule> </template> </vbox> query/rule compilation and lazy content generation when the template builder starts processing, and after it has started the datasource loading, it first must compile the query and rules.
...the template builder generates content lazily, that is, it processes as little as needed, and only continues when necessary.
...And 4 more matches
SeaMonkey - making custom toolbar (SM ver. 1.x) - Archive of obsolete content
when you have completed all the steps, you will have a structure like this in the directory where you installed seamonkey: 1.
...when it rebuilds them, it will include your new extension.
... explanation: this file specifies what happens when you press the button.
...And 4 more matches
Adding Methods to XBL-defined Elements - Archive of obsolete content
the body element contains the script that is executed when the method is called.
... accessing the anonymous content there may be times when you want to modify some aspect of the elements defined in the content element, either from a method body or elsewhere.
...a constructor is called whenever the binding is attached to an element.
...And 4 more matches
Creating a Wizard - Archive of obsolete content
when creating a wizard, use the wizard tag instead of the window tag.
...for example: <wizard id="example-window" title="select a dog wizard" onwizardfinish="return savedoginfo();" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> when the user clicks the finish button, the function savedoginfo() will be called, which would be defined in a script file to save the information that was entered.
... there are also related onwizardback, onwizardnext and onwizardcancel attributes, which are called when the back, next and cancel buttons are pressed respectively.
...And 4 more matches
Modifying a XUL Interface - Archive of obsolete content
here is an example: example 2 : source view <hbox height="400"> <button label="copy" oncommand="this.parentnode.appendchild(this.nextsibling.clonenode(true));"/> <vbox> <button label="first"/> <button label="second"/> </vbox> </hbox> when the copy button is pressed..
... note that some elements, such as listbox and menulist provide some additional specialized modification functions which you should use instead when you can.
...label and value properties examples here is a simple example which changes the label on a button: example 3 : source view <button label="hello" oncommand="this.label = 'goodbye';"/> when the button is pressed, the label is changed.
...And 4 more matches
Scroll Bars - Archive of obsolete content
you can also use it when you need to ask for a value that falls within a certain range.
...some elements, such as text boxes, will also add scroll bars as necessary when the content inside is too large.
... increment the value here specifies how much the value of curpos changes by when the user clicks on one of the scroll bar arrows.
...And 4 more matches
colorpicker - Archive of obsolete content
this is modified when the user selects a color.
...a change event is fired in different ways for different xul input elements as listed below: onchange type: script code textbox when enter key is pressed radio/check box when the state is changed select list when the selected item is changed what is accessible the script context at this point can only access the following things: global values/functions i.e.
...this attribute only has any effect when used inside a prefwindow.
...And 4 more matches
tab - Archive of obsolete content
ArchiveMozillaXULtab
this is automatically set when needed and you shouldn't adjust it manually.
...this is set automatically set when needed and you shouldn't adjust it manually.
...for example, for a menuitem in a menu you can add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled type: boolean indicates whether the element is disabled or not.
...And 4 more matches
RDF in Mozilla FAQ - Archive of obsolete content
when should i use a xul template?
...there are times, however, when doing so may be inconvenient: there are several "views" of the data.
... what gets loaded when i specify "datasources=" the datasources attribute on the "root" of a template specifies a whitespace-separated list of datasource uris to load.
...And 4 more matches
Game monetization - Game development
when you've spent your time building a game, distributing it and promoting it you should consider earning some money out of it.
...the worst cases were when you could use real money to pay for getting advantages over other players, or when they restricted access to the next stages of the game unless the players paid.
...most of the deals are done through emails when talking to a dedicated person on the publisher side.
...And 4 more matches
Game promotion - Game development
promoting the game helps a lot when monetizing it later on too, so it's important to do it correctly.
...when the time comes your community will help you spread the word about your shiny little game.
... press you can try and reach the press about your game, but bear in mind that they get a tonne of requests like this every single day, so be humble and patient if they don't answer right away, and be polite when talking to them.
...And 4 more matches
Audio for Web games - Game development
var myaudio = document.createelement("audio"); myaudio.src = "mysprite.mp3"; myaudio.play(); myaudio.pause(); you'll need to sample the current time to know when to stop.
...the "countdown.mp3" mp3 file consists of a number being spoken every 2 seconds, the idea being that we play back that number when the corresponding button is pressed.
...you'll need to take account of the time between creating an audio context and when the first audio track starts playing.
...And 4 more matches
Extra lives - Game development
new variables add the following new variables below the existing ones in your code: var lives = 3; var livestext; var lifelosttext; these respectively will store the number of lives, the text label that displays the number of lives that remain, and a text label that will be shown on screen when the player loses one of their lives.
... the lifelosttext will be shown only when the life is lost, so its visibility is initially set to false.
...to make it easier for us to maintain in the future we can create a separate variable that will hold our styling, let's call it textstyle and place it before the text definitions: textstyle = { font: '18px arial', fill: '#0095dd' }; we can now use this variable when stlying our text labels — update your code so that the multiple instances of the text styling are replaced with the variable: scoretext = game.add.text(5, 5, 'points: 0', textstyle); livestext = game.add.text(game.world.width-5, 5, 'lives: '+lives, textstyle); livestext.anchor.set(1,0); lifelosttext = game.add.text(game.world.width*0.5, game.world.height*0.5, 'life lost, click to continue', te...
...And 4 more matches
Plug-in Development Overview - Gecko Plugin API Reference
when it needs to display data of a particular mime type, the browser finds and invokes the plug-in object that supports that type.
... when it starts up, the browser checks for plug-in modules for the platform and registers them.
... but when the plug-in is loaded from a well-known directory, a different method must be used.
...And 4 more matches
Packet - MDN Web Docs Glossary: Definitions of Web-related terms
a packet contains: hop limit a hop occurs when a packet is passed from one network to the next network.
... error detection and correction error detection and correction are codes that are used to detect and apply corrections to the errors that occur when data is transmitted to the receiver.
...backward error correction is when the receiver requests the sender to retransmit the entire data unit.
...And 4 more matches
Debugging CSS - Learn web development
previous overview: building blocks next sometimes when writing css you will encounter an issue where your css doesn't seem to be doing what you expect.
... you will also find that browsers have chosen to focus on different areas when creating their devtools.
... the dom versus view source something that can trip up newcomers to devtools is the difference between what you see when you view the source of a webpage, or look at the html file you put on the server, and what you can see in the html pane of the devtools.
...And 4 more matches
Handling different text directions - Learn web development
when we switch the writing mode, we are changing which direction is block and which is inline.
... this figure shows the two dimensions when in a horizontal writing mode.
... logical properties and values the reason to talk about writing modes and direction at this point in your learning however, is because of the fact we have already looked at a lot of properties which are tied to the physical dimensions of the screen, and make most sense when in a horizontal writing mode.
...And 4 more matches
Organizing your CSS - Learn web development
if spaces, how many spaces?) having a set of rules you always follow reduces the amount of mental overhead needed when writing css, as some of the decisions are already made.
... comment your css adding comments to your css will help any future developer work with your css file, but will also help you when you come back to the project after a break.
...*/ a good tip is to add a block of comments between logical sections in your stylesheet too, to help locate different sections quickly when scanning through, or even give you something to search for to jump right into that part of the css.
...And 4 more matches
Sizing items in CSS - Learn web development
when a size is given to an element (and the content of which then needs to fit into that size) we refer to it as an extrinsic size.
...when using a percentage you need to be aware what it is a percentage of.
... when you use margin and padding set in percentages, the value is calculated from the inline size — therefore the width when working in a horizontal language.
...And 4 more matches
Introduction to CSS layout - Learn web development
normal flow normal flow is how the browser lays out html pages by default when you do nothing to control page layout.
...however, when using these, you will generally need to invoke additional properties.
... the two values most important for our purposes when discussing layout are display: flex and display: grid.
...And 4 more matches
Legacy layout methods - Learn web development
it is especially useful when there is complex math to be done, and you can even compute a calculation that uses different units, for example "i want this element's height to always be 100% of its parent's height, minus 50px".
... floated grid limitations when using a system like this you do need to take care that your total widths add up correctly, and that you don’t include elements in a row that span more columns than the row can contain.
...there are many flexbox-based grid systems available and flexbox can solve many of the issues that we’ve already discovered when creating our grid above.
...And 4 more matches
Getting started with CSS - Learn web development
changing the default behavior of elements when we look at a well-marked up html document, even something as simple as our example, we can see how the browser is making the html readable by adding some default styling.
... styling things based on their location in a document there are times when you will want something to look different based on where it is in the document.
... something else you might like to try is styling a paragraph when it comes directly after a heading at the same hierarchy level in the html.
...And 4 more matches
Fundamental text and font styling - Learn web development
those are very generic and the exact font face used when using those generic names is up to each browser and can vary for each operating system they are running on.
... things become more tricky when you start altering the font size of nested elements.
... a simple sizing example when sizing your text, it is usually a good idea to set the base font-size of the document to 10 px, so that then the maths is a lot easier to work out — required (r)em values are then the pixel font size divided by 10, not 16.
...And 4 more matches
What are hyperlinks? - Learn web development
back in 1989, tim berners-lee, the web's inventor, spoke of the three pillars on which the web stands: url, an address system that keeps track of web documents http, a transfer protocol to find documents when given their urls html, a document format allowing for embedded hyperlinks as you can see in the three pillars, everything on the web revolves around documents and how to access them.
...being human-readable, urls already made things easier, but it's hard to type a long url whenever you want to access a document.
...note that you don't have to link back when someone links to your site.
...And 4 more matches
Basic native form controls - Learn web development
this is used to create a form control that is invisible to the user, but is still sent to the server along with the rest of the form data once submitted — for example you might want to submit a timestamp to the server stating when an order was placed.
... <input type="checkbox" id="carrots" name="carrots" value="carrots" checked> including the checked attribute makes the checkbox checked automatically when the page loads.
...only one button in a given group may be checked at a time; this means that when one of them is checked all the others automatically get unchecked.
...And 4 more matches
Tips for authoring fast-loading HTML pages - Learn web development
it allows for efficient page caching; by means of this header, information is conveyed to the user agent about the file it wants to load, such as when it was last modified.
...first, browsers will have no need to perform error-correction when parsing the html (this is aside from the philosophical issue of whether to allow format variation in user input and then programmatically "correct" or normalize it; or whether, instead, to enforce a strict, no-tolerance input format).
...this not only speeds the display of the page but prevents annoying changes in a page's layout when the page completes loading.
...And 4 more matches
Video and audio content - Learn web development
video and audio on the web web developers have wanted to use video and audio on the web for a long time, ever since the early 2000s when we started to have bandwidth fast enough to support any kind of video (video files are much larger than text or even images.) in the early days, native web technologies such as html didn't have the ability to embed video and audio on the web, so proprietary (or plugin-based) technologies like flash (and later, silverlight) became popular for handling such content.
... other <video> features there are a number of other features you can include when displaying an html video.
... loop makes the video (or audio) start playing again whenever it finishes.
...And 4 more matches
Choosing the right approach - Learn web development
previous overview: asynchronous to finish this module off, we'll provide a brief discussion of the different coding techniques and features we've discussed throughout, looking at which one you should use when, with recommendations and reminders of common pitfalls where appropriate.
... objective: to be able to make a sound choice of when to use different asynchronous programming techniques.
... asynchronous callbacks generally found in old-style apis, involves a function being passed into another function as a parameter, which is then invoked when an asynchronous operation has been completed, so that the callback can in turn do something with the result.
...And 4 more matches
Third-party APIs - Learn web development
note: when creating your own examples, you'll use your own api key in place of any placeholder.
...when the developer has registered for a key, they are then known to the api provider, and action can be taken if they start to do anything malicious with the api (such as tracking people's location or trying to spam the api with loads of requests to stop it working, for example).
... onto the end of the first method call we chain .bindpopup('this is manchester!'), which defines content to display when the marker is clicked.
...And 4 more matches
Handling text — strings in JavaScript - Learn web development
in this article, we'll look at all the common things that you really ought to know about strings when learning javascript, such as creating strings, escaping quotes in strings, and joining strings together.
...html provides structure and meaning to our text, css allows us to precisely style it, and javascript contains a number of features for manipulating strings, creating custom welcome messages and prompts, showing the right text labels when needed, sorting terms into the desired order, and much more.
... strings — the basics strings are dealt with similarly to numbers at first glance, but when you dig deeper you'll start to see some notable differences.
...And 4 more matches
Storing the information you need — Variables - Learn web development
note: in javascript, all code instructions should end with a semi-colon (;) — your code may work correctly for single lines, but probably won't when you are writing multiple lines of code together.
...when you enter the variable names, you should get a value of undefined returned.
...back when javascript was first created, there was only var.
...And 4 more matches
Routing in Ember - Learn web development
typically, when writing web applications, you want the page to be represented by the url so that if (for any reason), the page needs to refresh, the user isn't surprised by the state of the web app — they can link directly to significant views of the app.
...it contains the following contents: import emberrouter from '@ember/routing/router'; import config from './config/environment'; export default class router extends emberrouter { location = config.locationtype; rooturl = config.rooturl; } router.map(function() { this.route('completed'); this.route('active'); }); the highlighted lines were added when the 2nd and 3rd commands above were run.
... it also tells ember how to interact with your route, such as when loading arbitrary data, handling errors while loading that data, or interpreting dynamic segments of the url.
...And 4 more matches
React interactivity: Events and state - Learn web development
the onclick attribute has special meaning here: it tells react to run a given function when the user clicks on the button.
...when we start giving ourselves the power to make new tasks, things that happen in the <form /> component will affect the list rendered in <app />.
...update your <h2> like so: <h2 id="list-heading">{headingtext}</h2> completing a task you might notice that, when you click on a checkbox, it checks and unchecks appropriately.
...And 4 more matches
Understanding client-side JavaScript frameworks - Learn web development
as an aspiring front-end developer, it can be hard to work out where to begin when learning frameworks — there are so many different frameworks to choose from, new ones appear all the time, they mostly work in a similar way but do some things differently, and there are some specific things to be careful about when using frameworks.
... what questions should i ask when trying to choose a framework?
...what we really need next is the ability to allow our users to enter their own todo items into the app, and for that, we'll need a text <input>, an event to fire when the data is submitted, a method to fire upon submission to add the data and rerender the list, and a model to control the data.
...And 4 more matches
Adding a new CSS property
issues about how to write such a specification (including things such as whether it is appropriate to use prefixes or when properties should be inherited by default) are not covered here.
... (note that when the longhand property css_property_parse_value_list, the shorthand property parser would be assumed to be reusing the longhand parser once per item, not for a whole list, as for properties like background-image or transform-timing-function.) if the property takes a list of keywords other than inherit/initial/etc., auto, none, or normal (which can be expressed using the variant_* flags), you shou...
... when writing the custom parsing code for a shorthand, you'll need to ensure that any successful parse sets all of the subproperties of the shorthand (since that's the way shorthands work in css).
...And 4 more matches
What to do and what not to do in Bugzilla
resolving bugs some general rules: when you resolve a bug, cc yourself so that you are informed when new facts come up.
... when in doubt about resolving a bug, leave it alone!
... resolving bugs as duplicate in general newer bugs should be marked as duplicates of older bugs, except when the newer bug contains more information (bug description clearer, patch already attached, lots of people already cc'ed, etc.).
...And 4 more matches
Chrome registration
firefox 2, thunderbird 2, and seamonkey 1.1 will not find the chrome when packagename is mixed case.
... content a content package is registered with the line: content packagename uri/to/files/ [flags] this will register a location to use when resolving the uri chrome://packagename/content/....
... locale a locale package is registered with the line: locale packagename localename uri/to/files/ [flags] this will register a locale package when resolving the uri chrome://packagename/locale/...
...And 4 more matches
Creating reftest-based unit tests
this idea can seem odd when first encountered.
... when we run them, we see: $ ./mach reftest path/to/reftest.txt 2>&1 | grep reftest reftest pass: file:///users/ray/mo/spaces1.html reftest pass: (!=) file:///users/ray/mo/spaces3.html $ fabulous!
...another part is testing invalidation - testing that when a document is changed after it has finished loading and displaying, that the browser correctly "invalidates" the parts of the screen that should change so that the screen displays the correct output the next time it is repainted.
...And 4 more matches
Debugging on Windows
making it the startup project, by right clicking on it (it appears bold when it's the case) can be useful.
... automatically handling assertions without a debugger attached when an assertion happens and there is not a debugger attached, a small helper application (windbgdlg.exe) is run.
...because the code is optimized, stepping through the code may occasionally provide small surpises when the debugger jumps over something.
...And 4 more matches
Reviewer Checklist
make sure the patch doesn't create any unused code (e.g., remove strings when removing a feature) all caught exceptions should be logged at the appropriate level, bearing in mind personally identifiable information, but also considering the expense of computing and recording log output.
... be careful when reading user input, network input, or files on disk.
... [fennec: when writing tests that use paintedsurface, ensure the paintedsurface is closed when you're done with it.] performance impact check for main-thread io [fennec: android may warn about this with strictmode].
...And 4 more matches
Getting Started with Chat
when addressing someone directly, try to use name: message format.
... when asking a question, be patient.
...for example, you can connect using ssl or a non-secure connection, and you can configure the client to automatically connect to a server and join a particular set of channels when you start the client.
...And 4 more matches
How to implement a custom autocomplete search component
note: when copying the examples below, change the uuid that uniquely identifies the component, otherwise you might have problems if your component gets installed along another component derived from those same examples.
...ex == 0) return 'suggestfirst'; // category label on first line of results return 'suggesthint'; // category label on any other line of results }, /** * gets the image for the result at the given index * * @return {string} the uri to the image to display */ getimageat : function (index) { return ''; }, /** * get the final value that should be completed when the user confirms * the match at the given index.
... classdescription : class_name, contractid : contract_id, /** * searches for a given string and notifies a listener (either synchronously * or asynchronously) of the result * * @param searchstring the string to search for * @param searchparam an extra parameter * @param previousresult a previous result to use for faster searchinig * @param listener the listener to notify when the search 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 ...
...And 4 more matches
JavaScript-DOM Prototypes in Mozilla
prototype setup on an xpconnect wrapped dom node in mozilla when a dom node is accessed from javascript in mozilla, the native c++ dom node is wrapped using xpconnect and the wrapper is exposed to javascript as the javascript representation of the dom node.
... when xpconnect wraps a c++ object it will create a jsobject that is unique to this c++ object.
... var obj = document.images[0]; here, obj will not really have any properties (except for the standard jsobject properties such as constructor, and the non-standard __parent__, __proto__, etc.), all the dom functionality of obj comes from obj's prototype (obj.__proto__) that xpconnect sets up when exposing the first image in document to javascript.
...And 4 more matches
API-provided widgets
viewid only useful for views (and required there): the id of the that should be shown when clicking the widget.
... overflows whether widget can overflow when in an overflowable toolbar (optional, default: true) defaultarea default area to add the widget to (optional, default: none; required if non-removable) shortcutid id of an element that has a shortcut for this widget (optional, default: null).
... oncreated(anode) attached to all widgets; a function that will be invoked whenever the widget has a dom node constructed, passing the constructed node as an argument.
...And 4 more matches
Downloads.jsm
when you catch an exception during a download, you can use this to verify if ex instanceof downloads.error, before reading the exception properties with the error details.
... promise resolves to undefined when the download has finished successfully and you can access the target file.
...there is one download list for each type, and this method always retrieves a reference to the same download list when called with the same argument.
...And 4 more matches
Interfacing with the Add-on Repository
to make the service work for the time being, you can use code like this when your extension starts up: var prefsservice = components.classes["@mozilla.org/preferences-service;1"] .getservice(components.interfaces.nsiprefservice); var prefbranch = prefsservice.getbranch("extensions."); var recurl = ""; try { recurl = prefbranch.getcharpref("getaddons.recommended.url"); } catch(e) { recurl = ""; } if (recurl == "") { prefbranch.setcharpref(...
... when the user clicks a toolbar button to initiate the query, the following code gets run to start the request: addonrepository.retrieverecommendedaddons(10, this); this asks the repository to fetch up to 10 add-ons, using the object this as the target for callbacks.
... the callback object needs to implement the searchcallback interface, providing the methods that get called when a search either fails or completes successfully.
...And 4 more matches
Using the viewport meta tag to control layout on mobile browsers
this is done because many pages are not mobile optimized, and break (or at least look bad) when rendered at a small viewport width.
...(there are corresponding height and device-height values, which may be useful for pages with elements that change size or position based on the viewport height.) the initial-scale property controls the zoom level when the page is first loaded.
...note that the default ratio is true only when the viewport scale equals 1.
...And 4 more matches
Memory reporting
this document describes things that you should know when writing a memory reporter.
... sometimes counter-based reporters are unavoidable, particularly when writing memory reporters for third-party code that cannot be modified.
...the amallocsizeof parameter allows mozilla::mallocsizeof functions with dmd-specific hooks to be passed in when they are used by memory reporters, but functions without such hooks (such as moz_malloc_size_of) can also be passed in when they are used in other circumstances.
...And 4 more matches
NSS 3.12.4 release notes
inside a union, to be matched and not treated as a special character, these characters must be escaped: \ ( | ) [ ~ except when they occur inside a bracketed expression, where only \ and ] require escaping.
...g/decoding of pkix_pl_oid to and from ascii string bug 405297: problems building nss/lib/ckfw/capi/ with mingw gcc bug 420991: libpkix returns wrong nss error code bug 427135: add super-h (sh3,4) architecture support bug 431958: improve des and sha512 for x86_64 platform bug 433791: win16 support should be deleted from nss bug 449332: secu_parsecommandline does not validate its inputs bug 453735: when using cert9 (sqlite3) db, set or change master password fails bug 463544: warning: passing enum* for an int* argument in pkix_validate.c bug 469588: coverity errors reported for softoken bug 470055: pkix_httpcertstore_findsocketconnection reuses closed socket bug 470070: multiple object leaks reported by tinderbox bug 470479: io timeout during cert fetching makes libpkix abort validation.
...est of nss bug 483653: unable to build certutil.exe for fennec/wince bug 485145: miscellaneous crashes in signtool on windows bug 485155: nss_enable_pkix_verify=1 causes sec_error_unknown_issuer errors bug 485527: rename the _x86_ macro in lib/freebl bug 485658: vfychain -p reports revoked cert bug 485745: modify fipstest.c to support cavs 7.1 drbg testing bug 486304: cert7.db/cert8.db corruption when importing a large certificate (>64k) bug 486405: allocator mismatches in pk12util.c bug 486537: disable execstack in freebl x86_64 builds on linux bug 486698: facilitate the building of major components independently and in a chain manner by downstream distributions bug 486999: calling ssl_setsockpeerid a second time leaks the previous value bug 487007: make lib/jar conform to nss coding style bu...
...And 4 more matches
NSS PKCS11 Functions
optimizespace - allocate smaller hash tables and lock tables.when this flag is not specified, softoken will allocatelarge tables to prevent lock contention.
...the caller is responsible for freeing the slot reference when it is through.
... description when you are finished with the certificate structure returned by pk11_findcertfromnickname, you must free it by calling cert_destroycertificate.
...And 4 more matches
NSS_3.12.3_release_notes.html
kix_pl_nss/system/pkix_pl_object.c bug 466745: random number generator fails on windows ce bug 467298: sql db code uses local cache on local file system bug 468279: softoken crash importing email cert into newly upgraded db bug 468532: trusted ca trust flags not being honored in cert_verifycert bug 469583: coverity: uninitialized variable used in sec_pkcs5createalgorithmid bug 469944: when built with microsoft compilers bug 470351: crlutil build fails on windows because it calls undeclared isatty bug 471539: stop honoring digital signatures in certificates and crls based on weak hashes bug 471665: nss reports incorrect sizes for (aes) symmetric keys bug 471715: add cert to nssckbi to override rogue md5-collision ca cert bug 472291: crash in libpkix object leak tests due t...
... bug 472749: softoken permits aes keys of any length to be created bug 473147: pk11mode tests fails on aix when using shareable dbs.
... bug 473505: softoken's c_initialize and c_finalize should succeed after a fork in a child process bug 473944: trust anchor is not trusted when requirefreshinfo flag is set.
...And 4 more matches
GCIntegration - SpiderMonkey Redirect 1
the fundamental invariant that this barrier guarantees is that any object reachable when the incremental gc started will be marked.
... a simple way to visualize the invariant is that, when an incremental gc starts, an "initial snapshot" of the heap is taken.
...in the diagram above, c will be marked when the pointer from a to c is nulled out.
...And 4 more matches
Garbage collection
this allows compartments to be used for security checks: objects in the same compartment have the same access requirements, so no checks are needed, but checks may be done when traversing cross-compartment wrappers.
...the barrier fires whenever the mutator is about to overwrite a location that holds a gc pointer.
...thus, if whenever we're about to overwrite a pointer to an object we mark the object black first, then no objects can get 'lost'.
...And 4 more matches
Redis Tips
here's a stupid node script to show how this works: #!/usr/bin/env node var r = require('redis').createclient(); r.multi() .set("foo", 42) .set("bar", "ice cream") .set("baz", 6.28) .get("foo") .get("bar") .get("baz") .exec(function(err, resultlist) { console.log(json.stringify(resultlist, null, 2)); r.end(); // terminate the redis connection; node can quit }); when run, this prints: [ "ok", "ok", "ok", "42", "ice cream", "6.28" ] the result list includes one value per each command executed.
... you just have to be careful that you check the result type of an exec() when you're watching variables.
... > var r = require('redis').createclient(); // and i'll define these utility functions just for this example > function now() { return (new date()).gettime() / 1000 } > function print(err, results) { console.log(json.stringify(results, null, 2)) } whenever someone logs into my site, i record them in my 'last-login' zset.
...And 4 more matches
History Service Design
finally temporary tables, indexes and triggers are created, this happens at every run since those entities are removed when closing the connection.
... performance to ensure performance a bunch of statements, commonly used when adding or reading visit informations, are created at startup.
...at the moment this is used when catching favicons or bookmarks for redirected pages.
...And 4 more matches
Places Developer Guide
// create a bookmark observer var observer = { onbeginupdatebatch: function() { // this method is notified when a batch of changes are about to occur.
...ion(iid) { if (iid.equals(ci.nsinavbookmarkobserver) || iid.equals(ci.nsisupports)) { return this; } throw cr.ns_error_no_interface; }, }; // register the observer with the bookmarks service var bmsvc = cc["@mozilla.org/browser/nav-bookmarks-service;1"] .getservice(ci.nsinavbookmarksservice); bmsvc.addobserver(observer, false); // un-register the observer when done.
...this is very useful when writing long sql statements.
...And 4 more matches
Introduction to XPCOM for the DOM
let's consider what happens when the class nsfoo implements an interface nsifoo.
...in summary, manipulate an interface rather than its implementation whenever possible!
...from now on, when i speak of a "pointer to an interface", i really mean a "pointer to an interface implemented by an instance of a concrete c++ class".
...And 4 more matches
nsIAnnotationService
urceitemid, in long long adestitemid, in boolean aoverwritedest); void addobserver(in nsiannotationobserver aobserver); void removeobserver(in nsiannotationobserver aobserver); nsiuri getannotationuri(in nsiuri auri, in autf8string aname); constants constant value description expire_session 0 for temporary data that can be discarded when the user exits.
... note: all page annotations will get deleted when the page is removed from history if the page is not bookmarked.
... this means that if you create an annotation on an unvisited uri, it will get deleted when the browser shuts down.
...And 4 more matches
nsIChannel
setting contenttype between the time that asyncopen() is called and the time when onstartrequest is fired has undefined behavior at this time.
... when the channel is done, it must not continue holding references to this object.
... note: a channel implementation should take care when "caching" an interface pointer queried from its notification callbacks.
...And 4 more matches
nsIFile
lastmodifiedtime print64 this attribute exposes the time when the file referenced by this nsifile was last modified.
... lastmodifiedtimeoflink print64 this attribute exposes the time when the symbolic link referenced by this nsifile was last modified.
... the parent will be null when this nsifile references the top of the volume.
...And 4 more matches
nsINavHistoryResultTreeViewer
1.0 66 introduced gecko 1.8 inherits from: nsinavhistoryresultobserver last changed in gecko 1.9 (firefox 3) this object removes itself from the associated result when the tree is detached; this prevents circular references.
... it's important to be aware of this—if you want to reuse the same viewer, you need to keep your own reference to it, then reinitialize it when the tree changes.
...this prevents you from seeing multiple entries for things when you have selected to get visits.
...And 4 more matches
nsIRequest
when added to a load group, this request's load flags are merged with the load flags of the load group.
... the following flags control what happens when the cache contains data that could perhaps satisfy this request.
...this flag is used when browsing via history.
...And 4 more matches
nsISound
various event names are provided, which will result in playing the corresponding sound effect on the platform the user is running on: _moz_mailbeep the system sound when the system receives email.
... _moz_alertdialog the system sound when an alert dialog is opened.
... _moz_confirmdialog the system sound when a confirm dialog is opened.
...And 4 more matches
Storage
the latter will allow all ongoing transactions to complete before closing the connection, and will optionally notify you via callback when the connection is closed.
... resetting a statement when you execute a statement synchronously, it is important to make sure you reset your statement.
... } } finally { statement.reset(); } in c++, storage provides a helper object in storage/public/mozstoragehelper.h, mozstoragestatementscoper, which ensures that the statement object is reset when the object falls out of scope.
...And 4 more matches
Creating a Custom Column
getcelltext() is the text that is displayed to the user while getsort*forrow() is what is used internally when sorting by your column a simple implementation objects in javascript are just "advanced" variables, so an implementation of the nsimsgcustomcolumnhandler interface looks like: var columnhandler = { getcelltext: function(row, col) { //get the message's header so that we can extract the reply to field var hdr = gdbview.getmsghdrat(row); return hdr.getstringproperty("...
... function() {return true;}, getcellproperties: function(row, col, props){}, getrowproperties: function(row, props){}, getimagesrc: function(row, col) {return null;}, getsortlongforrow: function(hdr) {return 0;} } basically, all we are doing here is making sure that both the text that is displayed to the user (getcelltext()) and the string we sort according to (when the user decided to sort the view by our custom column) are identical.
...our implementation will need to call something similar to: gdbview.addcolumnhandler("colreplyto", columnhandler); setting the custom column handler we've added a special event that gets fired whenever a view is created.
...And 4 more matches
Flash Activation: Browser Comparison - Plugins
when a site attempts to use flash, the browser will prompt the user in some way and give the user an opportunity to enable flash for that site.
... mozilla firefox google chrome microsoft edge setting name ask to activate html5 by default click-to-run 'application/x-shockwave-flash' in navigator.mimetypes by default when flash is inactive yes no no 'application/x-shockwave-flash' in navigator.mimetypes when user enables flash yes yes yes <object> with fallback content triggers ui yes, with exceptions no yes small/hidden flash triggers additional ui yes no no enabling flash automatically reloads the page no yes yes other features related to flash domain blocking plugin power saver per...
... ui comparison mozilla firefox in-page ui is displayed when the site attempts to use flash.
...And 4 more matches
Plug-in Development Overview - Plugins
when it needs to display data of a particular mime type, the browser finds and invokes the plug-in object that supports that type.
... when it starts up, the browser checks for plug-in modules for the platform and registers them.
... but when the plug-in is loaded from a well-known directory, a different method must be used.
...And 4 more matches
Set a breakpoint - Firefox Developer Tools
breakpoints in brief breakpoints are very useful when debugging javascript — you basically set a point in your code where you would like execution of the code to pause.
... continue to here: when stepping through code, this option tells the debugging to continue execution through to this point.
... unconditional breakpoints an unconditional breakpoint is one where the code will always pause execution when it is reached.
...And 4 more matches
Debugger.Object - Firefox Developer Tools
this means that the debugger can use the == operator to recognize when two debugger.object instances refer to the same debuggee object, and place its own properties on a debugger.object instance to store metadata about particular debuggee objects.
...for example: function f() {} // display name: f (the given name) var g = function () {}; // display name: g o.p = function () {}; // display name: o.p var q = { r: function () {} // display name: q.r }; note that the display name may not be a proper javascript identifier, or even a proper expression: we attempt to find helpful names even when the function is not immediately assigned as the value of some variable or property.
... environment if the referent is a function that is debuggee code, a debugger.environment instance representing the lexical environment enclosing the function when it was created.
...And 4 more matches
DevTools API - Firefox Developer Tools
the toolpanel is built only when the tool is selected (not when the toolbox is opened).
... getpanelwhenready(toolid) similar to getpanel() but waits for the tool to load first.
...a method that is called when the keyboard shortcut for the tool is activated while the tool is the active tool.
...And 4 more matches
Network request details - Firefox Developer Tools
the request details pane appears when you click on a network request in the request list.
... the tabs at the top of this pane enable you to switch between the following pages: headers messages (only for websocket items) cookies params response cache timings security (only for secure pages) stack trace (only when the request has a stack trace, e.g.
... request information the following information is shown only when the section is expanded: scheme: the scheme used in the url host: the server involved in the request filename: the full path to the file requested address: the ip address of the host the following information is shown in both the collapsed and the expanded states: status: the http response code for the request.
...And 4 more matches
Page inspector keyboard shortcuts - Firefox Developer Tools
end end end expand currently selected node right arrow right arrow right arrow collapse currently selected node left arrow left arrow left arrow (when a node is selected) move inside the node so you can start stepping through attributes.
... enter return enter step forward through the attributes of a node tab tab tab step backward through the attributes of a node shift + tab shift + tab shift + tab (when an attribute is selected) start editing the attribute enter return enter hide/show the selected node h h h focus on the search box in the html pane ctrl + f cmd + f ctrl + f edit as html f2 f2 f2 stop editing html f2 / ctrl +enter f2 / cmd + return f2 / ctrl + enter copy the selected node's outer html ctrl + c cmd + c ctrl + c scroll the selected node into view s s s find the next match in the markup, when searching is active enter return enter...
... find the previous match in the markup, when searching is active shift + enter shift + return shift + enter breadcrumbs bar these shortcuts work when the breadcrumbs bar is focused.
...And 4 more matches
Settings - Firefox Developer Tools
there's just one of these: enable persistent logs a setting to control whether or not the web console and network monitor clear their output when you navigate to a new page.
... style editor show original sources when a css preprocessor supporting source maps is used, this enables the style editor to display the original, preprocessor, sources rather than the generated css.
... screenshot behavior screenshot to clipboard when you click the icon for the screenshot tool, copy the screenshot image to the clipboard (the image will still be saved to your downloads directory).
...And 4 more matches
Using images - Web APIs
to do this, you can use the convenient image() constructor: var img = new image(); // create new img element img.src = 'myimage.png'; // set source path when this script gets executed, the image starts loading.
... drawimage(image, x, y, width, height) this adds the width and height parameters, which indicate the size to which to scale the image when drawing it onto the canvas.
... note: images can become blurry when scaling up or grainy if they're scaled down too much.
...And 4 more matches
Using channel messaging - Web APIs
when these act as standalone units, things are ok, but the difficulty comes when you want interaction between the main site and the iframes, or the different iframes.
...nel(); var port1 = channel.port1; // wait for the iframe to load iframe.addeventlistener("load", onload); function onload() { // listen for button clicks button.addeventlistener('click', onclick); // listen for messages on port1 port1.onmessage = onmessage; // transfer port2 to the iframe iframe.contentwindow.postmessage('init', '*', [channel.port2]); } // post a message on port1 when the button is clicked function onclick(e) { e.preventdefault(); port1.postmessage(input.value); } // handle messages received on port1 function onmessage(e) { output.innerhtml = e.data; input.value = ''; } we start off by creating a new message channel by using the messagechannel() constructor.
... when the iframe has loaded, we register an onclick handler for our button and an onmessage handler for messagechannel.port1.
...And 4 more matches
Document.createTreeWalker() - Web APIs
this is meaningful only when creating a treewalker with an attr node as its root; in this case, it means that the attribute node will appear in the first position of the iteration or traversal.
... since attributes are never children of other nodes, they do not appear when traversing over the document tree.
...this is meaningful only when creating a treewalker with an entity node as its root; in this case, it means that the entity node will appear in the first position of the traversal.
...And 4 more matches
GlobalEventHandlers.ontransitioncancel - Web APIs
the transitioncancel event is sent when a css transition is cancelled.
... the transition is cancelled when: the value of the transition-property property that applies to the target is changed the display property is set to "none".
... syntax var transitioncancelhandler = target.ontransitioncancel; target.ontransitioncancel = function value a function to be called when a transitioncancel event occurs indicating that a css transition has been cancelled on the target, where the target object is an html element (htmlelement), document (document), or window (window).
...And 4 more matches
HTMLIFrameElement.referrerPolicy - Web APIs
the htmliframeelement.referrerpolicy property reflects the html referrerpolicy attribute of the <iframe> element defining which referrer is sent when fetching the resource.
... no-referrer-when-downgrade (default) this is the user agent's default behavior if no policy is specified.
... the url is sent as a referrer when the protocol security level stays the same (http→http, https→https), but isn't sent to a less secure destination (https→http).
...And 4 more matches
IDBRequest - Web APIs
each request has a readystate that is set to the 'pending' state; this changes to 'done' when the request is completed or fails.
... when the state is set to done, every request returns a result and an error, and an event is fired on the request.
... when the state is still pending, any attempt to access the result or error raises an invalidstateerror exception.
...And 4 more matches
IDBTransaction - Web APIs
saction" target="_top"><rect x="151" y="1" width="140" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="221" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">idbtransaction</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} transactions are started when the transaction is created, not when the first request is placed; for example consider this: var trans1 = db.transaction("foo", "readwrite"); var trans2 = db.transaction("foo", "readwrite"); var objectstore2 = trans2.objectstore("foo") var objectstore1 = trans1.objectstore("foo") objectstore2.put("2", "key"); objectstore1.put("1", "key"); after the code is executed the object store should cont...
... firefox durability guarantees note that as of firefox 40, indexeddb transactions have relaxed durability guarantees to increase performance (see bug 1112702.) previously in a readwrite transaction idbtransaction.oncomplete was fired only when all data was guaranteed to have been flushed to disk.
... idbtransaction.error read only returns a domexception indicating the type of error that occured when there is an unsuccessful transaction.
...And 4 more matches
KeyboardEvent.key - Web APIs
WebAPIKeyboardEventkey
keyboardevent sequence example consider the event sequence generated when we interact with the shift and the 2 key using a u.s keyboard layout as compared to when we do so using a uk keyboard layout.
... case 1 when the shift key is pressed, a keydown event is first fired, and the key property value is set to the string shift.
... when key 2 is pressed, another keydown event is fired for this new key press, and the key property value for the event is set to the string @ for the u.s keyboard type and " for the uk keyboard type, because of the active modifier shift key.
...And 4 more matches
MediaQueryList - Web APIs
the resulting object handles sending notifications to listeners when the media query state changes (i.e.
... when the media query test starts or stops evaluating to true).
... this is very useful for adaptive design, since this makes it possible to observe a document to detect when its media queries change, instead of polling the values periodically, and allows you to programmatically make changes to a document based on media query status.
...And 4 more matches
MediaStreamTrack - Web APIs
this happens when the peeridentity property is set, or if the track comes from a cross-origin source.
...when the track is deassociated from its source, the label is not changed.
... events listen to these events using addeventlistener() or by assigning an event listener to the oneventname property of this interface: ended sent when playback of the track ends (when the value readystate changes to ended).
...And 4 more matches
Using the MediaStream Recording API - Web APIs
when used with navigator.mediadevices.getusermedia(), it provides an easy way to record from the user's input devices and instantly use the result in web apps.
...to sit in by default, and give it a transition for smooth showing/hiding: aside { position: fixed; top: 0; left: 0; text-shadow: 1px 1px 1px black; width: 100%; height: 100%; transform: translatex(100%); transition: 0.6s all; background-color: #999; background-image: linear-gradient(to top right, rgba(0,0,0,0), rgba(0,0,0,0.5)); } last, we write a rule to say that when the checkbox is checked (when we click/focus the label), the adjacent <aside> element will have its horizontal translation value changed and transition smoothly into view: input[type=checkbox]:checked ~ aside { transform: translatex(0); } basic app setup to grab the media stream we want to capture, we use getusermedia().
...first of all, mediarecorder.start() is used to start recording the stream once the record button is pressed: record.onclick = function() { mediarecorder.start(); console.log(mediarecorder.state); console.log("recorder started"); record.style.background = "red"; record.style.color = "black"; } when the mediarecorder is recording, the mediarecorder.state property will return a value of "recording".
...And 4 more matches
MessagePort - Web APIs
start() starts the sending of messages queued on the port (only needed when using eventtarget.addeventlistener; it is implied when using messageport.onmessage.) close() disconnects the port, so it is no longer active.
... event handlers inherits event handlers from its parent, eventtarget onmessage an eventlistener called when messageevent of type message is fired on the port—that is, when the port receives a message.
... onmessageerror an eventlistener called when a messageevent of type messageerror is fired—that is, when it receives a message that cannot be deserialized.
...And 4 more matches
Push API - Web APIs
WebAPIPush API
push concepts and usage when implementing pushmanager subscriptions, it is vitally important that you protect against csrf/xsrf issues in your app.
...when the service worker is active, it can subscribe to push notifications, using pushmanager.subscribe().
... note: as of gecko 44, the allowed quota of push messages per application is not incremented when a new notification fires, when another is still visible, for a period of three seconds.
...And 4 more matches
SVGLengthList - Web APIs
exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only.
... exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only.
... exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only.
...And 4 more matches
SVGNumberList - Web APIs
exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only.
... exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only.
... exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only.
...And 4 more matches
SVGPathSegList - Web APIs
exceptions: a domexception with code no_modification_allowed_err is raised when the list cannot be modified.
... exceptions: a domexception with code no_modification_allowed_err is raised when the list cannot be modified.
... exceptions: a domexception with code no_modification_allowed_err is raised when the list cannot be modified.
...And 4 more matches
SVGPointList - Web APIs
exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only.
... exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only.
... exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only.
...And 4 more matches
SVGStringList - Web APIs
exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only.
... exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only.
... exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only.
...And 4 more matches
SVGTransform - Web APIs
when the rotation is around the center point (0, 0), e and f will be zero.
... exceptions: a domexception with code no_modification_allowed_err is raised when attempting to modify a read only attribute or when the object itself is read only.
... exceptions: a domexception with code no_modification_allowed_err is raised when attempting to modify a read only attribute or when the object itself is read only.
...And 4 more matches
TextTrackList - Web APIs
event handlers onaddtrack an event handler to be called when the addtrack event is fired, indicating that a new text track has been added to the media element.
... onchange an event handler to be called when the change event occurs.
... onremovetrack an event handler to call when the removetrack event is sent, indicating that a text track has been removed from the media element.
...And 4 more matches
VideoTrackList - Web APIs
event handlers onaddtrack an event handler to be called when the addtrack event is fired, indicating that a new video track has been added to the media element.
... onchange an event handler to be called when the change event occurs — that is, when the value of the selected property for a track has changed, due to the track being made active or inactive.
... onremovetrack an event handler to call when the removetrack event is sent, indicating that a video track has been removed from the media element.
...And 4 more matches
Using WebRTC data channels - Web APIs
the rtcdatachannel object is returned immediately by createdatachannel(); you can tell when the connection has been made successfully by watching for the open event to be sent to the rtcdatachannel.
...while there's no way to control the size of the buffer, you can learn how much data is currently buffered, and you can choose to be notified by an event when the buffer starts to run low on queued data.
... this can complicate things, since you don't necessarily know what the size limits are for various user agents, and how they respond when a larger message is sent or received.
...And 4 more matches
Basic concepts behind Web Audio API - Web APIs
audio data: what's in a sample when an audio signal is processed, sampling means the conversion of a continuous signal to a discrete signal; or put another way, a continuous sound wave, such as a band playing live, is converted to a sequence of samples (a discrete-time signal) that allow a computer to handle the audio in distinct blocks.
... when a buffer plays, you will hear the left most sample frame, and then the one right next to it, etc.
... if you use this call above, you will get a stereo buffer with two channels, that when played back on an audiocontext running at 44100hz (very common, most normal sound cards run at this rate), will last for 0.5 seconds: 22050 frames/44100hz = 0.5 seconds.
...And 4 more matches
Web Authentication API - Web APIs
similar to the other forms of the credential management api, the web authentication api has two basic methods that correspond to register and login: navigator.credentials.create() - when used with the publickey option, creates new credentials, either for registering a new account or for associating a new asymmetric key pair credentials with an existing account.
... navigator.credentials.get() - when used with the publickey option, uses an existing set of credentials to authenticate to a service, either logging a user in or as a form of second-factor authentication.
...this is a new concept in authentication: when authenticating using passwords, the password is stored in a user's brain and no other device is needed; when authenticating using web authentication, the password is replaced with a key pair that is stored in an authenticator.
...And 4 more matches
Web Locks API - Web APIs
the lock is automatically released when the task completes.
...the first queued request will be granted only when the lock is released.
...the callback is invoked when the lock is granted.
...And 4 more matches
Worker - Web APIs
WebAPIWorker
event handlers abstractworker.onerror an eventlistener called whenever an errorevent of type error bubbles through to the worker.
... worker.onmessage an eventlistener called whenever a messageevent of type message bubbles through the worker — i.e.
... when a message is sent to the parent document from the worker via dedicatedworkerglobalscope.postmessage.
...And 4 more matches
Synchronous and asynchronous requests - Web APIs
asynchronous request if you use an asynchronous xmlhttprequest, you receive a callback when the data has been received.
...the callback routine is called whenever the state of the request changes.
... line 1 declares a function invoked when the xhr operation completes successfully.
...And 4 more matches
XRInputSourceEvent() - Web APIs
event types select sent to an xrsession when the sending input source has fully completed a primary action.
... selectend sent to an xrsession when an ongoing primary action ends, or when an input source with an ongoing primary action has been disconnected from the system.
... selectstart sent to an xrsession when an input source begins its primary action, indicating that the user has begun a command-like input, such as pressing a trigger or button, issuing a spoken command, tapping on a touchpad, or the like.
...And 4 more matches
XRInputSourceEvent - Web APIs
event types select sent to an xrsession when the sending input source has fully completed a primary action.
... selectend sent to an xrsession when an ongoing primary action ends, or when an input source with an ongoing primary action has been disconnected from the system.
... selectstart sent to an xrsession when an input source begins its primary action, indicating that the user has begun a command-like input, such as pressing a trigger or button, issuing a spoken command, tapping on a touchpad, or the like.
...And 4 more matches
XRReferenceSpace: reset event - Web APIs
the reset event is sent to an xrreferencespace object when a discontinuity is detected in either the native origin or the effective origin, causing a jump in the position or orientation of objects oriented using the reference space.
... this is common when the user calibrates or recalibrates an xr device, or if the device automatically changes its origin after losing tracking of the user, then re-gaining it.
... in the case of xrboundedreferencespace objects, the reset event can also be fired when the boundsgeometry changes.
...And 4 more matches
ARIA: tab role - Accessibility
the aria tab role indicates an interactive element inside a tablist that, when activated, displays its associated tabpanel.
...when an element with the tabpanel role has focus, or a child of it has focus, that indicates that the connected element with the tab role is the active tab in a tablist.
... when working with elements with the tab role, when they are selected or active, they should have their aria-selected attribute set to true, otherwise it should be set to false.
...And 4 more matches
Layout using named grid lines - CSS: Cascading Style Sheets
in this guide we are going to look at how these two things work together when we use named lines.
... naming lines when defining a grid you can assign some or all of the lines in your grid a name when you define your grid with the grid-template-rows and grid-template-columns properties.
... * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; padding: 1em; color: #d9480f; } when defining the grid, i name my lines inside square brackets.
...And 4 more matches
Using media queries - CSS: Cascading Style Sheets
media queries are useful when you want to modify your site or app depending on a device's general type (such as print vs.
... a media query computes to true when the media type (if specified) matches the device on which a document is being displayed and all media feature expressions compute as true.
...except when using the not or only logical operators, the media type is optional and the all type will be implied.
...And 4 more matches
Shorthand properties - CSS: Cascading Style Sheets
tricky edge cases even if they are very convenient to use, there are a few edge cases to keep in mind when using them: a value which is not specified is set to its initial value.
...this works well when these properties use values of different types, as the order has no importance, but this does not work as easily when several properties can have identical values.
... margin: 10px 5px 10px 5px; margin shorthand rules for one, two, three and four value declarations are: when one value is specified, it applies the same margin to all four sides.
...And 4 more matches
Visual formatting model - CSS: Cascading Style Sheets
when reading specifications you will often find references to the model as defined in css2, so an understanding of the model and the terms used to describe it in css2 is valuable when reading other layout specifications.
...user agents can change the layout of the page when the viewport size changes — for example, if you resize your window, or change the orientation of a mobile device.
... the principal box when an element generates one or more boxes, one of them is the principal box, which contains its descendant boxes and generated content in the box tree, and is also the box involved in any positioning scheme.
...And 4 more matches
Creating a cross-browser video player - Developer guides
note: ie9 behaves differently than most other browsers when a poster attribute is set.
... play/pause playpause.addeventlistener('click', function(e) { if (video.paused || video.ended) video.play(); else video.pause(); }); when a click event is detected on the play/pause button, the handler first of all checks if the video is currently paused or has ended (via the media api's paused and ended attributes); if so, it uses the play() method to playback the video.
... progress when the <progress> element was defined above in the html, only two attributes were set, value and min, both being given a value of 0.
...And 4 more matches
DOM onevent handlers - Developer guides
when an event occurs that applies to an element, each of its event handlers is called to allow them to handle the event, one after another.
...if the event handler doesn't access any data from the event object, you can leave out the event when calling onclick().
...when the element is built from the html, the value of its onevent attributes are copied to the dom object that represents the element, so that accessing the attributes' values using javascript will get the value set in the html.
...And 4 more matches
HTML5 - Developer guides
WebGuideHTMLHTML5
html5-compliant parser the parser, which turns the bytes of an html document into a dom, has been extended and now precisely defines the behavior to use in all cases, even when faced with invalid html.
... online and offline events firefox 3 supports whatwg online and offline events, which let applications and extensions detect whether or not there's an active internet connection, as well as to detect when the connection goes up and down.
... pointer lock api allows locking the pointer to the content, so games and similar applications don't lose focus when the pointer reaches the window limit.
...And 4 more matches
<input type="file"> - HTML: Hypertext Markup Language
WebHTMLElementinputfile
because a given file type may be identified in more than one manner, it's useful to provide a thorough set of type specifiers when you need files of a given format.
... multiple when the multiple boolean attribute is specified, the file input allows the user to select more than one file.
...you should try to avoid using them when possible, since doing so will limit the ability of your code to function in browsers that don't implement them.
...And 4 more matches
<input type="week"> - HTML: Hypertext Markup Language
WebHTMLElementinputweek
when the above value is submitted to the server, for example, browsers may display it as week 01, 2017, but the submitted value will always look like week=2017-w01.
... note: when the data entered by the user doesn't adhere to the stepping configuration, the user agent may round to the nearest valid value, preferring numbers in the positive direction when there are two equally close options.
... at this time, it's unclear what a value of "any" means for step when used with week inputs.
...And 4 more matches
Standard metadata names - HTML: Hypertext Markup Language
WebHTMLElementmetaname
no-referrer-when-downgrade send the full url when the destination is at least as secure as the current page (http(s)→https), but send no referrer when it's less secure (https→http).
... origin-when-cross-origin send the full url (stripped of parameters) for same-origin requests, but only send the origin for other cases.
... strict-origin send the origin when the destination is at least as secure as the current page (http(s)→https), but send no referrer when it's less secure (https→http).
...And 4 more matches
MIME types (IANA media types) - HTTP
structure of a mime type the simplest mime type consists of a type and a subtype; these are each strings which, when concatenated with a slash (/) between them, comprise a mime type.
...for example, multipart mime types are used when attaching multiple files to an email.
...example can also be used as a subtype; for instance, in an example related to working with audio on the web, the mime type audio/example can be used to indicate that the type is a placeholder and should be replaced with an appropriate one when using the code in the real world.
...And 4 more matches
Configuring servers for Ogg media - HTTP
in particular, the article on media container formats will be especially helpful when configuring serers to host media properly.
... include regular key frames when the browser seeks through ogg media to a specified time, it has to seek to the nearest key frame before the seek target, then download and decode the video from there until the requested target time.
... consider using the preload attribute the html <audio> and <video> elements provide the preload attribute, which tells the browser to attempt to download the entire media when the page loads.
...And 4 more matches
Closures - JavaScript
this is an example of lexical scoping, which describes how a parser resolves variable names when functions are nested.
...in this case, myfunc is a reference to the instance of the function displayname created when makefunc is run.
...for this reason, when myfunc is invoked, the variable name remains available for use, and "mozilla" is passed to alert.
...And 4 more matches
Indexed collections - JavaScript
when these values are specified, the array is initialized with them as the array's elements.
...when a single number value is passed to the array() constructor or function, it is interpreted as an arraylength, not as a single element.
... let arr = [] arr[3.4] = 'oranges' console.log(arr.length) // 0 console.log(arr.hasownproperty(3.4)) // true you can also populate an array when you create it: let myarray = new array('hello', myvar, 3.14159) // or let myarray = ['mango', 'apple', 'orange'] understanding length at the implementation level, javascript's arrays actually store their elements as standard object properties, using the array index as the property name.
...And 4 more matches
Arrow function expressions - JavaScript
syntax basic syntax (param1, param2, …, paramn) => { statements } (param1, param2, …, paramn) => expression // equivalent to: => { return expression; } // parentheses are optional when there's only one parameter name: (singleparam) => { statements } singleparam => { statements } // the parameter list for a function with no parameters should be written with a pair of parentheses.
... shorter functions var elements = [ 'hydrogen', 'helium', 'lithium', 'beryllium' ]; // this statement returns the array: [8, 6, 7, 9] elements.map(function(element) { return element.length; }); // the regular function above can be written as the arrow function below elements.map((element) => { return element.length; }); // [8, 6, 7, 9] // when there is only one parameter, we can remove the surrounding parentheses elements.map(element => { return element.length; }); // [8, 6, 7, 9] // when the only statement in an arrow function is `return`, we can remove `return` and remove // the surrounding curly brackets elements.map(element => element.length); // [8, 6, 7, 9] // in this case, because we only need the length property, we can use...
... strict mode should prevent creating global variables when assigning to an undeclared identifier in a function.
...And 4 more matches
String.prototype.split() - JavaScript
the simplest case is when separator is just a single character; this is used to split a delimited string.
... warning: when the empty string ("") is used as a separator, the string is not split by user-perceived characters (grapheme clusters) or unicode characters (codepoints), but by utf-16 codeunits.
...if provided, splits the string at each occurrence of the specified separator, but stops when limit entries have been placed in the array.
...And 4 more matches
Lexical grammar - JavaScript
bom will not work when you try to run the script in unix/linux.
... these are always reserved: enum the following are only reserved when they are found in strict mode code: implements interface let package private protected public static the following are only reserved when they are found in module code: await future reserved keywords in older standards the following are reserved as future keywords by older ecmascript specifications (ecmascript 1 till 3).
... decimal 1234567890 42 // caution when using with a leading zero: 0888 // 888 parsed as decimal 0777 // parsed as octal, 511 in decimal note that decimal literals can start with a zero (0) followed by another decimal digit, but if all digits after the leading 0 are smaller than 8, the number is interpreted as an octal number.
...And 4 more matches
delete operator - JavaScript
return value true for all cases except when the property is an own non-configurable property, in which case, false is returned in non-strict mode.
... the following snippet gives a simple example: var employee = { age: 28, name: 'abc', designation: 'developer' } console.log(delete employee.name); // returns true console.log(delete employee.age); // returns true // when trying to delete a property that does // not exist, true is returned console.log(delete employee.salary); // returns true non-configurable properties when a property is marked as non-configurable, delete won't have any effect, and will return false.
...non-strict mode when in strict mode, if delete is used on a direct reference to a variable, a function argument or a function name, it will throw a syntaxerror.
...And 4 more matches
Image file type and format guide - Web media technologies
for example, apng is one of the formats supported when creating animated stickers for apple's imessage application (and the messages application on ios).
...its animation support caused a resurgence in its popularity in the social media era, when animated gifs began to be widely used for short "videos", memes, and other simple animation sequences.
...this is particularly useful when network connections are slow.
...And 4 more matches
The "codecs" parameter in common media types - Web media technologies
when the codecs parameter is used, the specified list of codecs must include every codec used for the contents of the file.
... 8a 00 mpeg-4 audio when the value of an entry in the codecs list begins with mp4a, the syntax of the value should be: mp4a.oo[.a] here, oo is the two-digit hexadecimal object type indication which specifies the codec class being used for the media.
...older implementations of mpeg-4 codecs may not support two-digit values, however, so using a single digit when possible will maximize compatibility.
...And 4 more matches
Mapping the width and height attributes of media container elements to their aspect-ratio - Web media technologies
this article explains a change that has occured in the way sizes are worked out on web documents when width and height attributes are set on them.
... jank problems when loading images in the olden days of web development, it was always seen as a good practice to add width and height attributes to your html <img> elements, so that when browsers first loaded the page, they could put a correctly-sized placeholder box in the layout for each image to appear in when it finally loads.
... without the width and height attributes, no placeholder space would be created, and when the image finally loaded you would get a noticeable jank in the page layout.
...And 4 more matches
OpenSearch description format
inputencoding the character encoding to use when submitting input to the search engine.
...when possible, include a 16×16 image of type image/x-icon (such as /favicon.ico) and a 64×64 image of type image/jpeg or image/png.
...http: and https: urls are converted to data: uris when this is done.
...And 4 more matches
Optimizing startup performance - Web Performance
this article offers tips and suggestions to help you achieve that goal, both when writing a new app and when porting an app from another platform to the web.
...instead, we're going to look at a more important issue when building web apps: starting up as asynchronously as possible.
... on the other hand, however, it can get tricky when you're porting an existing app to the web.
...And 4 more matches
Introduction to progressive web apps - Progressive web apps (PWAs)
an app could be considered a pwa when it meets certain requirements, or implements a set of given features: works offline, is installable, is easy to synchronize, can send push notifications, etc.
... re-engageable, so it's able to send notifications whenever there's new content available.
... the ability to update only the content that has changed when an app update is available.
...And 4 more matches
Mobile first - Progressive web apps (PWAs)
then at implementation stage, we present the mobile layout and functionality as the default configuration provided, before additional information is loaded on top of that, whenever appropriate.
...you should at least consider it as an option, especially if you are experiencing slow or laggy performance when your application is running on mobile.
... mobile navigation when developing mobile app layouts, you often run into problems with navigation menus.
...And 4 more matches
Types of attacks - Web security
cross-site scripting attacks usually occur when 1) data enters a web app through an untrusted source (most often a web request) or 2) dynamic content is sent to a web user without being validated for malicious content.
...the victim then retrieves this malicious script from the server when the browser sends a request for data.
... reflected xss attacks when a user is tricked into clicking a malicious link, submitting a specially crafted form, or browsing to a malicious site, the injected code travels to the vulnerable website.
...And 4 more matches
PI Parameters - XSLT: Extensible Stylesheet Language Transformations
overview xslt supports the concept of passing parameters to a stylesheet when executing it.
... this has been possible for a while when using the xsltprocessor in javascript.
... however when using an <?xml-stylesheet?> processing instruction (pi) there used to be no way to provide parameters.
...And 4 more matches
Content Scripts - Archive of obsolete content
controlling when to attach the script the contentscriptwhen option specifies when the content script(s) should be loaded.
... note that tab.attach() doesn't accept contentscriptwhen, because it's generally called after the page has loaded.
...for example, here's an add-on that tries to add a click handler by assignment to window.onclick: var myscript = "window.onclick = function() {" + " console.log('unsafewindow.onclick: ' + window.document.title);" + "}"; require("sdk/page-mod").pagemod({ include: "*", contentscript: myscript, contentscriptwhen: "start" }); this will work fine on most pages, but will fail on pages which also assign to onclick: <html> <head> </head> <body> <script> window.onclick = function() { window.alert("it's my click now!"); } </script> </body> </html> for these reasons, it's better to add event listeners using addeventlistener(), defining the listener as a function: var themessage ...
...And 3 more matches
dev/panel - Archive of obsolete content
when the panel's created, the framework passes it a debuggee: this is a messageport object that you can use to exchange json messages with the browser that the developer tools are currently debugging.
... optional setup function a function that will be called when the panel is created.
... optional dispose function a function that will be called when the panel is about to be destroyed.
...And 3 more matches
lang/functional - Archive of obsolete content
when the method is invoked on an instance of the object, the original function is called.
... wrapper : function the function that is called when the return function is executed, taking the wrapped fn as the first parameter.
... returns function : a function which, when called, executes wrapper with fn as the first parameter, and passes in any additional parameters to the wrapper function.
...And 3 more matches
ui/toolbar - Archive of obsolete content
showing and hiding toolbars by default, a toolbar is shown when it is created, although you can specify that a toolbar should be hidden initially by passing hidden:true as an option in its constructor.
... toolbar events toolbars get attach and detach events when their content is loaded and unloaded, and show and hide events when the uses shows or hides them.
... events attach this event is emitted when the toolbar is first loaded.
...And 3 more matches
Display a Popup - Archive of obsolete content
in this tutorial we'll create an add-on that adds an action button to the toolbar that displays a panel when clicked.
... the panel just contains a <textarea> element: when the user presses the return key, the contents of the <textarea> is sent to the main add-on code.
... the add-on consists of seven files: package.json: created when you run jpm init index.js: the main add-on code, that creates the button and panel get-text.js: the content script that interacts with the panel content text-entry.html: the panel content itself, specified as html icon-16.png, icon-32.png, and icon-64.png: icons for the button in three different sizes the "index.js" looks like this: var data = require("sdk/self").data; // construct a panel, loading its content from the "text-entry.html" // file in the "data" directory, and loading the "get-text.js" script // into it.
...And 3 more matches
Getting started (cfx) - Archive of obsolete content
when firefox launches, in the top-right corner of the browser you'll see an icon with the firefox logo.
... packaging the add-on when you've finished the add-on and are ready to distribute it, you'll need to package it as an xpi file.
... summary in this tutorial we've built and packaged an add-on using three commands: cfx init to initialize an empty add-on template cfx run to run a new instance of firefox with the add-on installed, so we can try it out cfx xpi to package the add-on into an xpi file for distribution these are the three main commands you'll use when developing sdk add-ons.
...And 3 more matches
Examples and demos from articles - Archive of obsolete content
in such a condition is difficult and unnatural to keep track of all events started and then to stop them when appropriate through the cleartimeout() function.
....[article] pure-css web gallery based on the :hover pseudoclass [zip] you can use the :hover pseudo-class in order to build an image gallery with full-size images shown only when mouse goes over previews.
... .[article] pure-css web gallery based on the :checked pseudoclass [zip] you can also use the :checked pseudo-class applied to hidden radioboxes in order to build, for example, an image gallery with full-size images shown only when mouse clicks on previews.
...And 3 more matches
Creating custom Firefox extensions with the Mozilla build system - Archive of obsolete content
the process of creating a component is actually relatively straightforward when the mozilla build system is used.
...otherwise the first module's xpt file will be overwritten by the second and you'll get ns_error_xpc_bad_iid errors when you try to access its idl interfaces from your code.
... a lot of this stuff won't get created on this first pass since make will gag when it doesn't find the source files for your components.
...And 3 more matches
Extension Etiquette - Archive of obsolete content
this article describes best practices when making extensions, including how to be kind to your users.
... ids and class names in html and xul documents, when extensions add elements to web pages or browser windows.
...in general, care must be taken whenever defining a name anywhere that other code might do likewise.
...And 3 more matches
Appendix D: Loading Scripts - Archive of obsolete content
this behavior can be reversed by setting the wantsxrays parameter to false when constructing the sandbox.
...these scripts execute with the same privileges and restrictions of the global associated with the target object, and this method can therefore also be used when with sandbox objects with the same effect as evalinsandbox and into content windows with the same effect as injecting script tags into their documents.
... when loading into a sandbox object, the same advantages apply as above.
...And 3 more matches
JavaScript Object Management - Archive of obsolete content
that should come in handy when you have general utility functions or properties that you want to use across all objects within the namespace.
...this is an odd, but powerful feature that comes in handy at times when things get complicated.
... the general guideline we follow is this: whenever you have to set a callback function parameter, wrap it in an anonymous function.
...And 3 more matches
Setting Up a Development Environment - Archive of obsolete content
when creating a development profile for your add-on, make sure you choose an easy name for the profile folder, and set it in your makefile in order to take advantage of the install command.
...you can see the names of the files involved, which gives you a good starting point when looking into the mozilla source.
...it is specially unreliable when debugging code in javascript xpcom and xbl files.
...And 3 more matches
Performance best practices in extensions - Archive of obsolete content
improving startup performance extensions are loaded and run whenever a new browser window opens.
... load only what you need, when you need it don't load things during startup that are only needed if the user clicks a button, or if a given preference is enabled when it's not.
... if your extension has features that only work when the user has logged into a service, don't load the resources for those features until the user actually logs in.
...And 3 more matches
Signing an XPI - Archive of obsolete content
the 7-zip tool doesn't work when creating mozilla xpi signed archives because it sorts the directory entries alphabetically, and mozilla requires the first entry to be meta-inf/zigbert.rsa.
...when the mozilla firefox software installation dialog appears the organisation name of the certificate will appear where firefox usually displays unsigned.
...when you receive the signed certificate it must be imported into the certificate database.
...And 3 more matches
An Interview With Douglas Bowman of Wired News - Archive of obsolete content
when you get to that point, the amount of markup you have to sift through to find anything becomes ridiculous.
...when one or more columns is positioned absolutely, there is no way to ensure a footer would always appear at the bottom of the longest column.
... how does the new design perform when the pages are printed?
...And 3 more matches
Images, Tables, and Mysterious Gaps - Archive of obsolete content
however, these techniques may be relevant when the developer cannot assume that users have a modern browser, such as for html-based e-mail messages.
... almost no matter when you started creating web pages, odds are pretty high you have one or more designs based on the classic "convoluted tables and lots of images" paradigm.
... now let's see what that same simple table looks like in a modern browser when the page has a strict doctype.
...And 3 more matches
Repackaging Firefox - Archive of obsolete content
notice: the article is about repackaging firefox 2.0 and is obsolete when working on 3.x repackaging.
...using an extension makes it far easier to keep track of your changes easily when the time comes to upgrade to new versions of firefox, and also ensures, when set-up correctly, that users are able to safely receive firefox updates from mozilla.
... of course, this strategy only works when your strings either do not need localization, or are programmatically localizable (for example, simply adding the locale to a url, like http://<locale>.example.com/).
...And 3 more matches
Tamarin Build System Documentation - Archive of obsolete content
when all of the slave machines are free they all start the first build phase simultaneously.
... the next phase is started when all slaves have completed the previous phase successfully.
... the phases run when slaves are available and the other phases do not wait for completion to start the next build.
...And 3 more matches
accesskey - Archive of obsolete content
for example, when a menu labeled 'file' has an accesskey of 'f', the generated label will be 'file'.
... when the user presses a modifier key specific to the platform (eg, control* on windows, command* on macintosh) and the access key, the element will be focused and/or activated from anywhere in the window.
... *(these are the keys corresponding to event.ctrlkey and event.metakey respectively when listening to key events) although the value is case insensitive, a letter with the case matching the accesskey attribute will be used if both cases exist in the label.
...And 3 more matches
command - Archive of obsolete content
ArchiveMozillaXULEventscommand
the command event is executed when an element is activated.
...currently only set when a command event is redirected though use of the command attribute.
... ctrlkey read only boolean true if the control key was down when the event was fired.
...And 3 more matches
PopupKeys - Archive of obsolete content
handling keys within menus when using a menupopup element, a keyboard listener is attached to the window that will handle keypresses for the menu.
...on linux and the macintosh, disabled items within the menu are skipped over when navigating with the cursor keys.
... cursor left/right when a menu is selected, cursor right opens the menu, while a cursor left closes a menu.
...And 3 more matches
Filtering - Archive of obsolete content
when removing the filter, we only need to remove the triple from the query.
...when a choice is made, the applyfilter function as shown above is called and the template content gets rebuilt with the desired filter applied.
...even though the same datasource is used, it will only be loaded once and both templates will be notified when the data has loaded.
...And 3 more matches
Introduction - Archive of obsolete content
when the xul parser sees an element with this attribute, it constructs a template builder for the element and attaches it to the element.
...this file will be loaded and the resulting xml document will be used as the datasource when the template builder generates results and creates content.
...when multiple datasources are used, an nsirdfcompositedatasource is created to hold all of the datasources.
...And 3 more matches
Multiple Queries - Archive of obsolete content
this may be used to combine the results from several queries together, or may be used to generate different types of results when recursive iterations.
...if there is only rule, the rule element may be omitted as is the case when only one query is used.
...when used together in this example, the results are combined and only three results are shown.
...And 3 more matches
Simple Query Syntax - Archive of obsolete content
« previousnext » when iterating over the children of an rdf container, there is a simpler query syntax which may used.
... it may also be used when iterating over only one predicate.
... simple rdf graph navigation such as this is common, so the simpler syntax is usually used in this situation since it avoids extra tags, although the simple syntax is not more or less efficient, at least when a single query is involved.
...And 3 more matches
Custom toolbar button - Archive of obsolete content
when you have completed all the steps, you will have a structure like this in your profile directory: the profile directory and the extensions directory already exist.
... explanation: this file specifies what happens when you press the button.
...underneath it is a darker version, used when the mouse pointer is over the button.
...And 3 more matches
Accesskey display rules - Archive of obsolete content
e.g., when an accesskey of "file" is 'f', the generated label will be "file".
...e.g., when an accesskey of "open" is 'a', the generated label will be "open (a)".
...i.e., when an accesskey of "open…" is 'a', the generated label will be "open (a)…".
...And 3 more matches
Creating Dialogs - Archive of obsolete content
second, you could pass a function or object as one of the arguments when creating the dialog, then call that function or modify the object in the opened dialog.
... the dialog element the dialog element should be used in place of the window element when creating a dialog.
...you do not need to include the xul for each button; however, you do need to supply code to perform the appropriate tasks when the user presses each button.
...And 3 more matches
Element Positioning - Archive of obsolete content
an inflexible element never changes size even when space is available, so the button can't grow either.
...then, when you make the window wider, extra space will be available, so the box will grow to fill the extra space.
...you will often want to use ems when specifying sizes with text in them.
...And 3 more matches
Using Spacers - Archive of obsolete content
if you place a spacer directly inside a window, the spacer will grow in size when the size of the window is changed.
...first, let's take a look at what happens when the current dialog is resized.
...let's see what happens when a spacer is added between the text box and the find button.
...And 3 more matches
XML - Archive of obsolete content
there are many times, for example, when you may use javascript tricks to add extra behavior.
...when an attribute is assigned a value (e.g., flex="1" or "onload='dointerestingstartupthing()'") that value must be double-quoted.
... when someone says they are using xml, what they probably mean is that they have used xml to define their own syntax for marking up some data they are interested in.
...And 3 more matches
XUL Event Propagation - Archive of obsolete content
when the mouse moves over the button, for example, the "hover" event is raised.
...any element that is interested in the event -- any part of the interface, in other words, that needs to know about and respond to the user's click action on the button -- "handles" the event with an event handler, or chunk of code to be executed when the given event is "heard".
...the hierarchy of the interface can be represented as follows: when one of these menuitems raises an event, any of the elements above it in the hierarchy can handle it.
...And 3 more matches
dialog - Archive of obsolete content
tle="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).
...the following values can be used in the list: accept: the ok button, which will accept the changes when pressed.
...typically, this means that the button will be activated when the enter key is pressed.
...And 3 more matches
menu - Archive of obsolete content
ArchiveMozillaXULmenu
when the user clicks the menu element, the child menupopup of the menu will be displayed.
...for example, for a menuitem in a menu you can add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled type: boolean indicates whether the element is disabled or not.
... menuactive type: boolean this attribute is set on an item in a menu when it is being hovered over.
...And 3 more matches
prefpane - Archive of obsolete content
the uri will be opened using the help viewer when the help button is pressed.
... onpaneload type: script code code defined here is called when the pane has been loaded, much like the load event for a window.
... (1) an example of a widget that has state changes tracked for it includes the checkbox element, whose state is tracked automatically when the "command" event fires.
...And 3 more matches
richlistbox - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] this element is used to create a list of listitems (richlistitems), similar to a listbox, but is designed to be used when the items do not contain simple text content.
...this attribute only has any effect when used inside a prefwindow.
... suppressonselect type: boolean if this attribute is not specified, a select event is fired whenever an item is selected, either by the user or by calling one of the select methods.
...And 3 more matches
tabbrowser - Archive of obsolete content
onbookmarkgroup not in firefox type: script code this code executes when the user chooses the "bookmark this group of tabs" command.
... onnewtab not in firefox type: script code this script will be called when the new tab button is clicked.
...the returned index is dependent on the tabs in the tabbrowser and is invalidated when the tab ordering changes.
...And 3 more matches
timepicker - Archive of obsolete content
the change event is fired whenever the time is changed.
... however, as described in mozilla bug #799219, a change event handler may encounter erratic behavior when the time is changed using the keyboard instead of the mouse.
...the tab order is the order in which the focus is moved when the user presses the "tab" key.
...And 3 more matches
tooltip - Archive of obsolete content
for example, for a menuitem in a menu you can add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } default type: boolean if true, the tooltip is used as the default popup for displaying tooltips in the window.
...if this attribute is set to true, this will not happen and the tooltip will only hide when the user moves the mouse to another element.
... this event may also be received while the popup is still open, but when sub-menus contained within this popup are hidden.
...And 3 more matches
Archived Mozilla and build documentation - Archive of obsolete content
dtrace dtrace is sun microsystem's dynamic tracing framework that allows developers to instrument a program with probes that have little to no effect on performance when not in use and very little when active.
... migrate apps from internet explorer to mozilla when netscape started the mozilla browser, it made the conscious decision to support w3c standards.
...when elements are floated to the left or right in a layout, they take up space and influence where other elements can be placed.
...And 3 more matches
NPEvent - Archive of obsolete content
syntax microsoft windows typedef struct _npevent { uint16 event; uint32 wparam; uint32 lparam; } npevent; mac os typedef eventrecord npevent; type eventrecord = record { what: integer; message: longint; when: longint; where: point; modifiers: integer; end; xwindows typedef xevent npevent; fields npevent on microsoft windows the data structure has the following fields: event one of the following event types: wm_paint wm_lbuttondown wm_lbuttonup wm_lbuttondblclk wm_rbuttondown wm_rbuttonup wm_rbuttondblclk wm_mbuttondown wm_mbuttonup wm_mbuttondblclk wm_mousemove ...
... when longint.
... in addition to these standard types, the browser provides three additional event types that can be passed in the what field of the eventrecord: getfocusevent: sent when the instance could become the focus of subsequent key events, when the user clicks the instance or presses the tab key to focus the instance.
...And 3 more matches
Introduction to Public-Key Cryptography - Archive of obsolete content
after entering this password once, the user doesn't need to enter it again for the rest of the session, even when accessing other ssl-enabled servers.
... figure 8 shows what happens when only root ca is included in the verifier's local database.
...there are two major stages in the lifecycle of a certificate: the point when it is issued (issuance and enrollment) and the period when the certificates are no longer valid (renewal or revocation).
...And 3 more matches
Introduction to SSL - Archive of obsolete content
the ssl handshake protocol involves using the ssl record protocol to exchange a series of messages between an ssl-enabled server and an ssl-enabled client when they first establish an ssl connection.
...when a particular client and server exchange information during the ssl handshake, they identify the strongest enabled cipher suites they have in common and use those for the ssl session.
...that way, when a domestic client or server is dealing with another domestic server or client, respectively, it will negotiate the use of the strongest ciphers available.
...And 3 more matches
XForms Select Element - Archive of obsolete content
this attribute, when set to 'open', allows the user to provide free entry to the list.
...the data binding restriction to simple content may be relaxed when an itemset element is used, which allows the available choices to be obtained from an xforms model.
... the relaxation happens when the itemset element specifies the item value using a copy (see spec) element.
...And 3 more matches
Index - Game development
4 index meta found 74 pages: 5 introduction to html5 game development (summary) firefox os, games, html5, mobile games built with html5 work on smartphones, tablets, pcs and smart tvs.update your game whenever you want.players can play the game anywhere, anytime.
... 7 publishing games games, html5, javascript, monetization, promotion, distribution, publishing this series of articles looks at the options you have when you want to publish and distribute your game, and earn something out of it while you wait for it to become famous.
...when you've published the game it's time to focus on promotion — letting people know your game exists.
...And 3 more matches
Mobile touch controls - Game development
the events are as follows: touchstart is fired when the user puts a finger on the screen.
... touchmove is fired when they move the finger on the screen while touching it touchend is fired when the user stops touching the screen touchcancel is fired when a touch is cancelled, for example when the user moves their finger outside of the screen.
...the function touchhandler will assign proper variables to the ship's position so that we can use it for both cases: when the player touches the screen but doesn't move it (touchstart), and when the finger is moved on the screen (touchmove): document.addeventlistener("touchstart", touchhandler); document.addeventlistener("touchmove", touchhandler); the touchhandler function looks like this: function touchhandler(e) { if(e.touches) { playerx = e.touches[0].pagex - canvas.offsetleft - playerwidth / 2; ...
...And 3 more matches
Animations and tweens - Game development
as an example, we will make the ball wobble when it hits something.
... applying the animation when the ball hits the paddle in the arcade.collide() method call that handles the collision between the ball and the paddle (the first line inside update(), see below) we can add an extra parameter that specifies a function to be executed every time the collision happens, in the same fashion as the ballhitbrick() function.
... update the first line inside update() as shown below: function update() { game.physics.arcade.collide(ball, paddle, ballhitpaddle); game.physics.arcade.collide(ball, bricks, ballhitbrick); paddle.x = game.input.x || game.world.width*0.5; } then we can create the ballhitpaddle() function (having ball and paddle as default parameters), playing the wobble animation when it is called.
...And 3 more matches
Buttons - Game development
add the following lines to the bottom of your create() function: startbutton = game.add.button(game.world.width*0.5, game.world.height*0.5, 'button', startgame, this, 1, 0, 2); startbutton.anchor.set(0.5); the button() method's parameters are as follows: the button's x and y coordinates the name of the graphic asset to be displayed for the button a callback function that will be executed when the button is pressed a reference to this to specify the execution context the frames that will be used for the over, out and down events.
... note: the over event is the same as hover, out is when the pointer moves out of the button and down is when the button is pressed.
... now we need to define the startgame() function referenced in the code above: function startgame() { startbutton.destroy(); ball.body.velocity.set(150, -150); playing = true; } when the button is pressed, we remove the button, sets the ball's initial velocity and set the playing variable to true.
...And 3 more matches
Asynchronous - MDN Web Docs Glossary: Definitions of Web-related terms
networking and communications asynchronous communication is a method of exchanging messages between two or more parties in which each party receives and processes messages whenever it's convenient or possible to do so, rather than doing so immediately upon receipt.
... for humans, e-mail is an asynchronous communication method; the sender sends an email and the recipient will read and reply to the message when it's convenient to do so, rather than doing so at once.
... and both sides can continue to send and receive messages whenever they wish, instead of having to schedule them around each other.
...And 3 more matches
Flexbox - Learn web development
the flex model when elements are laid out as flex items, they are laid out along two axes: the main axis is the axis running in the direction the flex items are being laid out in (e.g.
... wrapping one issue that arises when you have a fixed amount of width or height in your layout is that eventually your flexbox children will overflow their container, breaking the layout.
... now add the following rule below the previous one: article:nth-of-type(3) { flex: 2; } now when you refresh, you'll see that the third <article> takes up twice as much of the available width as the other two — there are now four proportion units available in total (since 1 + 1 + 2 = 4).
...And 3 more matches
How CSS works - Learn web development
prerequisites: basic computer literacy, basic software installed, basic knowledge of working with files, and html basics (study introduction to html.) objective: to understand the basics of how css and html are parsed by the browser, and what happens when a browser encounters css it does not understand.
... when a browser displays a document, it must combine the document's content with its style information.
...bear in mind that this is a very simplified version of what happens when a browser loads a webpage, and that different browsers will handle the process in different ways.
...And 3 more matches
How can we design for all types of users? - Learn web development
summary when you're building a website, one top issue to consider is universal design: accommodating all users regardless of disability, technical constraints, culture, location, and so on.
...modern browsers get around this rule by pretending that you're asking for "16 pixels when the user sets a zoom factor of 100%".
...*/ the same problem expressed with ems: body { font-size:1em; } /* 1em = 100% of the browser's base font size, so in most cases this will render as 16 pixels */ h1 { font-size:2em; } /* twice the size of the body, thus 32 pixels */ span.subheading { font-size:0.5em; } /* half the size of the h1, thus 16 pixels to come back to the original size */ as you can see, the math quickly gets daunting when you have to keep track of the parent, the parent's parent, the parent's parent's parent, and so on.
...And 3 more matches
Other form controls - Learn web development
pressing return) that will be included when the data is submitted.
...the values are soft (the default value), which means the text submitted is not wrapped but the text rendered by the browser is wrapped; hard (the cols attribute must be specified when using this value), which means both the submitted and rendered texts are wrapped, and off, which stops wrapping.
... <select id="simple" name="simple"> <option>banana</option> <option selected>cherry</option> <option>lemon</option> </select> if required, the default value for the select box can be set using the selected attribute on the desired <option> element — this option is then preselected when the page loads.
...And 3 more matches
Web forms — Working with user data - Learn web development
the html5 input types here we continue our deep dive into the <input> element, looking at the additional input types provided when html5 was released, and the various ui controls and data collection enhancements they provide.
... advanced form styling here we look at some more advanced form styling techniques that need to be used when trying to deal with some of the more difficult-to-style form elements.
...we also want to help our users to fill out our forms correctly and not get frustrated when trying to use our apps.
...And 3 more matches
Debugging HTML - Learn web development
debugging isn't scary when writing code of some kind, everything is usually fine, until that dreaded moment when an error occurs — you've done something wrong, so your code doesn't work — either not at all, or not quite how you wanted it to.
... for example, the following shows an error reported when trying to compile a simple program written in the rust language.
...well, generally when you do something wrong in code, there are two main types of error that you'll come across: syntax errors: these are spelling errors in your code that actually cause the program not to run, like the rust error shown above.
...And 3 more matches
Function return values - Learn web development
return values are just what they sound like — the values that a function returns when it has completed.
... when the function completes (finishes running), it returns a value, which is a new string with the replacement made.
...(in these cases, our reference pages list the return value as void or undefined.) for example, in the displaymessage() function we built in the previous article, no specific value is returned when the function is invoked.
...And 3 more matches
Useful string methods - Learn web development
when you create a string, for example by using let string = 'this is my string'; your variable becomes a string object instance, and as a result has a large number of properties and methods available to it.
...try the following: browsertype.indexof('vanilla'); this should give you a result of -1 — this is returned when the substring, in this case 'vanilla', is not found in the main string.
...you could do something like this: if(browsertype.indexof('mozilla') !== -1) { // do stuff with the string } when you know where a substring starts inside a string, and you know at which character you want it to end, slice() can be used to extract it.
...And 3 more matches
What went wrong? Troubleshooting JavaScript - Learn web development
previous overview: first steps next when you built up the "guess the number" game in the previous article, you may have found that it didn't work.
... types of error generally speaking, when you do something wrong in code, there are two main types of error that you'll come across: syntax errors: these are spelling errors in your code that actually cause the program not to run at all, or stop working part way through — you will usually be provided with some error messages too.
... try playing the game — you'll notice that when you press the "submit guess" button, it doesn't work!
...And 3 more matches
Using Vue computed properties - Learn web development
these work similarly to methods, but only re-run when one of their dependencies changes.
...for bigger apps, or when the expression is more complicated, that could cause a serious performance problem.
...computed properties work similarly to methods, but only re-run when one of their dependencies changes.
...And 3 more matches
Command line crash course - Learn web development
navigation on the command line when you visit the command line you will inevitably need to navigate to a particular directory to "do something".
... for example, if you wanted to go to a directory called src, located inside a directory called project, located on the desktop, you could type these three commands to get there from your home folder: cd desktop cd project cd src but this a waste of time — instead, you can type one command, with the different items in the path separated by forward slashes, just like you do when specifying paths to images or other assets in css, html, or javascript code: cd desktop/project/src note that including a leading slash on your path makes the path absolute, for example /users/your-user-name/desktop.
... connecting commands together with pipes the terminal really comes into its own when you start to chain commands together using the | (pipe) symbol.
...And 3 more matches
Deploying our app - Learn web development
it's exactly these kinds of connected services that we would encourage you to look for when deciding on your own build toolchain.
..."continuous deployment" means that whenever the code repository changes, netlify will (try) to deploy the code, thus it being "continuous".
... and even better, whenever we make a change and push the change to our remote git repository (on github), this will trigger a notification to netlify which will then run our specified build task and then deploy the resulting dist directory to our published site.
...And 3 more matches
Client-side tooling overview - Learn web development
there is usually a way of controlling and coordinating what changes are made to the "master" copy of the code, and when, so a team of developers doesn’t end up overwriting each other’s work all the time.
... parcel is a particularly clever tool that fits into this category — it can do the above tasks, but also helps to package assets like html, css, and image files into convenient bundles that you can then go on to deploy, and also adds dependencies for you automatically whenever you try to use them.
...the typescript compiler converts typescript code to javascript when building for production.
...And 3 more matches
Package management basics - Learn web development
without modern build tools, dependencies like this might be included in your project using a simple <script> element, but this might not work right out of the box and you will likely need some modern tooling to bundle your code and dependencies together when they are released on the web.
...go there now and you’ll not see anything for now, but what is cool is that when you do make changes to your app, parcel will rebuild it and refresh the server automatically so you can instantly see the effect your update had.
...these are the files you would upload to your web server when releasing the site online for public consumption.
...And 3 more matches
Multiprocess on Windows
when an incoming rpc invokes a method on an interceptor, the interceptor dispatches a callback that allows us to do whatever we want with that request.
... ensuring that the interceptor supports your interfaces this information is current, but is likely to change when bug 1346957 is landed.
...oicf metadata is much richer than typelib metadata, however com requires typelibs whenever it is being used with interpreted languages.
...And 3 more matches
Debugging a hang on OS X (Archived)
creating the sample on mac os x 10.5 (xcode < 4.2) when the application is still hung, open up spin control.app (it’s in your <tt>/developer/applications/performance tools/</tt> folder; if it is missing, install the latest computer hardware understanding development (chud) tools from apple).
... when it's done parsing the data, click the "show text report" button; a new window will open with a couple of rows with stacktraces for all the threads in the sampled application.
... creating the sample on mac os x 10.4 when the application is still hung, open up sampler.app (it’s in your <tt>/developer/applications/performance tools/</tt> folder; if it is missing, install the latest computer hardware understanding development (chud) tools from apple.).
...And 3 more matches
Cross Process Object Wrappers
however, although cpows are convenient, they have serious limitations and can cause responsiveness problems, so should only be used when necessary and only as a migration aid.
...for example, this frame script sends a dom node to chrome when the user clicks it, as the clicked property of the third argument: // frame script addeventlistener("click", function (event) { sendasyncmessage("my-e10s-extension-message", {}, { clicked : event.target }); }, false); in the chrome script, the dom node is now accessible through a cross process object wrapper, as a property of the objects property of the message.
...one of these shims provides the following behavior: whenever chrome code tries to access content directly (for example, through window.content or browser.contentdocument), it is given back a cpow that wraps the content object.
...And 3 more matches
Tracking Protection
when firefox blocks content, it logs a message to the web console like this: the resource at "http://some/url" was blocked because tracking protection is enabled.
...the popup that appears will notify you when content has been blocked.
...when tracking protection is enabled, firefox blocks content from sites in the list.
...And 3 more matches
DownloadList
the returned array does not change when downloads are added or removed, though the download objects it contains are still updated in real time.
... note: when a download is added to the list, its onchange event is registered by the list, thus it cannot be used to monitor the download.
... promise resolves to undefined when the download has been added.
...And 3 more matches
Promise
once you have a reference to a promise, you can call its then() method to execute an action when the value becomes available, or when an error occurs.
... internally, a promise can be in one of three states: pending, when the final value is not available yet.
... fulfilled, when and if the final value becomes available.
...And 3 more matches
PromiseWorker.jsm
this answers the question "when should i use a promiseworker?", and the answer is, whenever you would normally use a chromeworker, but want postmessage to return promises.
...transferring is possible only when resolving the promise from the worker.
... unlike when sending/transferring from the main thread, transferring from worker does not require each piece of data that you want transferred to be wrapped in its own meta object.
...And 3 more matches
Task.jsm
task.spawn() returns a promise that is resolved when the task completes successfully, or is rejected if an exception occurs.
...this reduces the syntax overhead of calling task.spawn() explicitly when you want to recurse into other task functions.
...this comes in handy when iterating over function lists where some items have been converted to tasks and some not.
...And 3 more matches
Investigating leaks using DMD heap scan mode
when combined with cycle collector logging, this can be used to investigate leaks of refcounted cycle collected objects, by figuring out what holds a strong reference to a leaked object.
... when should you use this?
...dmd heap scan mode is a "tool of last resort" that should only be used when all other avenues have been tried and failed, except possibly ref count logging.
...And 3 more matches
DMD
to have dmd active while running it, you just need to set the environment variable dmd=1 when running.
...(if you are familiar with the recommended "--es env0" method for setting environment variables when launching fennec, note that you cannot use this method here because those are processed too late in the startup process.
...since you cannot mark files in /sdcard/ as executable, we will use /data/local/tmp for this purpose: adb push dmd_fennec /data/local/tmp adb shell cd /data/local/tmp chmod 755 dmd_fennec the final step is to make android use the above wrapper script while launching fennec, so that the environment variable is present when fennec starts up.
...And 3 more matches
NSPR Contributor Guide
we (the nspr module owners) sometimes disappoint our contributors when we must reject their contributions.
...see also: xxx ownership of your contribution when you contribute something to nspr, you must have intellectual property rights to that contribution.
... license under mpl or gpl when you contribute material to nspr, you agree to allow your contribution to be licensed under the mpl or gpl.
...And 3 more matches
Scripting Java
"f(int)"; } public string g(string s, int i) { return "g(string,int)"; } public string g(int i, string s) { return "g(int,string)"; } public static void main(string[] args) { overload o = new overload(); object[] a = new object[] { new integer(3), "hi", overload.class }; for (int i = 0; i != a.length; ++i) system.out.println(o.f(a[i])); } } when we compile and execute the program, it produces the output f(object) f(object) f(object) however, if we write a similar script var o = new packages.overload(); var a = [ 3, "hi", packages.overload ]; for (var i = 0; i != a.length; ++i) print(o.f(a[i])); and execute it, we get the output f(int) f(string) f(object) because rhino selects an overloaded method at runtime, it calls the mor...
...one example of this is the thread class: its constructor takes a runnable that contains a single method run that will be called when the new thread is started.
... javascript functions as java interfaces often we need to implement an interface with only one method, like in the previous runnable example or when providing various event listener implementations.
...And 3 more matches
SpiderMonkey Build Documentation
when building a version older than 28, you'll additionally need nspr.
...however, you can build spidermonkey as a static library by specifying the --disable-shared-js flag when you run configure.
... specifying compilers and compiler flags if you want to use a compiler other than the one the configure script chooses for you by default, you can set the cxx variable in the environment when you run configure.
...And 3 more matches
JS::Value
the number mutators attempt to use int32_t representation for compatible input values, returning true when int32 could be used and false when double representation was required.
... the are two major issues to be aware of when using js::value.
... in particular, note that it is an error to call val.toobject() when val.isnull().
...And 3 more matches
Running Automated JavaScript Tests
(some js reftests will be skipped when run in the browser, as it lacks some shell-specific testing functionality.) running jstests running jstests on a js shell the jstests shell harness is js/src/tests/jstests.py.
... developers will often want to use the -d option: jstests.py -d path_to_js_shell the -d option skips tests that are marked as randomly failing; random failures are usually just noise when being run for day-to-day developer testing.
...by default, these are only run when no tests paths are specified; this can be overridden by the --wpt=enabled flag.
...And 3 more matches
Using RAII classes in Mozilla
raii classes are useful when two operations (e.g., lock/unlock, addref/release, pushstate/popstate) must be paired.
... ensuring raii classes are not used as temporaries a common mistake when using raii classes is to accidentally forget to name object, which causes its scope to be different from what is intended.
... static analysis static analysis passes are run on our testing infrastructure using our clang plugin, you can also run them locally marking a raii class for the static analysis is very simple, and performing this marking causes the static analysis to produce a build-time error whenever a raii class is allocated as a temporary, on the heap, or in static storage.
...And 3 more matches
Querying Places
a new session starts when the user types a new url or follows a bookmark (xxx link to more details about what constitutes a session).
...when you specify exactly one folder and no query parameters, the system will be more efficient querying and keeping the results up-to-date since this maps to exactly one bookmark folder.
...when a "place:" uri is bookmarked, it will expand to the results of the query when it is opened by the user.
...And 3 more matches
IAccessibleText
when a method doesn't implement this method it must return s_false.
...it should be roughly equivalent to the bounding box of some character when inserted at the end of the text().
...when the new caret position differs from the old one (which, of course, is the standard case) this is notified to the accessibility event listeners with an ::ia2_event_text_caret_moved event.
...And 3 more matches
imgIDecoderObserver
called when there is more to paint.
... acurrentframe missing description arect missing description ondiscard() called when the decoded image data is discarded.
... onimageisanimated() notification for when an image is known to be animated.
...And 3 more matches
mozIAsyncFavicons
the auri parameter will be the favicon uri, or null when no favicon is associated with the page or an error occurred while fetching it.
...icons that fail to load will automatically be added to the failed favicon cache, and this function will not save favicons for non-bookmarked uris when history is disabled.
... replacefavicondata() sets the data for a given favicon uri either by replacing existing data in the database or taking the place of otherwise fetched icon data when calling setandfetchfaviconforpage later.
...And 3 more matches
mozIStorageConnection
this is used by the storage api when creating new databases, and must match the sqlite_default_page_size configured in db/sqlite3/src/makefile.in.
... void asyncclose( in mozistoragecompletioncallback acallback optional ); parameters acallback optional an optional callback handler to be executed when the connection is successfully closed.
... in javascript, managing transactions can be difficult when you are using the same connection on different threads, or are using a combination of asynchronous and synchronous statement execution.
...And 3 more matches
nsIAnnotationObserver
last changed in gecko 1.9 (firefox 3) method overview void onitemannotationremoved(in long long aitemid, in autf8string aname); void onitemannotationset(in long long aitemid, in autf8string aname); void onpageannotationremoved(in nsiuri auri, in autf8string aname); void onpageannotationset(in nsiuri apage, in autf8string aname); methods onitemannotationremoved() this method is called when an annotation is deleted for an item.
...this is not called when annotations are expired (normally happens when the application exits).
... onitemannotationset() this method is called when an annotation value is set for an item.
...And 3 more matches
nsICachingChannel
support for uniquely identifying cached data in cases when the url is insufficient.
... exceptions thrown ns_error_not_available when there is not offline cache token.
... load_check_offline_cache 1 << 27 this load flag causes the offline cache to be checked when fetching a request.
...And 3 more matches
nsIDOMGeoGeolocation
starting in gecko 1.9.2, you can access this service using: var geolocation = components.classes["@mozilla.org/geolocation;1"] .getservice(components.interfaces.nsidomgeogeolocation); note: if nsidgeogeolocation throws an exception when importing, try using this: var geolocation = components.classes["@mozilla.org/geolocation;1"] .getservice(components.interfaces.nsisupports); method overview void clearwatch(in unsigned short watchid); void getcurrentposition(in nsidomgeopositioncallback successcallback, [optional] in nsidomgeopositionerrorcallback errorca...
... methods clearwatch() when the clearwatch() method is called, the watch() process stops calling for new position identifiers and cease invoking callbacks.
...void getcurrentposition( in nsidomgeopositioncallback successcallback, [optional] in nsidomgeopositionerrorcallback errorcallback, [optional] in nsidomgeopositionoptions options ); parameters successcallback an nsidomgeopositioncallback to be called when the current position is available.
...And 3 more matches
nsIDOMOfflineResourceList
onchecking nsidomeventlistener an event listener to be called when fetching the application cache manifest and checking for updates.
... onerror nsidomeventlistener an event listener to be called when an error occurs during the caching process.
... onnoupdate nsidomeventlistener an event listener to be called when there is no update to download.
...And 3 more matches
nsIDownloadProgressListener
when you no longer need to listen to the download manager's state, call nsidownloadmanager.removelistener() to stop listening.
... methods ondownloadstatechange() called when the status of a particular download changes.
... onprogresschange() called when the download progress level changes for a download.
...And 3 more matches
nsIFileInputStream
if open_on_read is defined, and the file was recreated after the first delete, the file will be deleted again when it is closed again.
... close_on_eof 1<<2 if this is set, the file will close automatically when the end of the file is reached.
... reopen_on_rewind 1<<3 if this is set, the file will be reopened whenever seek(0) occurs.
...And 3 more matches
nsIHttpChannel
netwerk/protocol/http/nsihttpchannel.idlscriptable this interface allows for the modification of http request parameters and the inspection of the resulting http response status and headers when they become available.
...e); void setresponseheader(in acstring header, in acstring value, in boolean merge); void visitoriginalresponseheaders(in nsihttpheadervisitor avisitor); void visitrequestheaders(in nsihttpheadervisitor avisitor); void visitresponseheaders(in nsihttpheadervisitor avisitor); constants constant description referrer_policy_no_referrer_when_downgrade default; indicates not to pass on the referrer when downgrading from https to http referrer_policy_no_referrer indicates no referrer will be sent referrer_policy_origin only send the origin of the referring uri referrer_policy_origin_when_xorigin same as the default; only send the origin of the referring uri for cross-origin requests refer...
...rer_policy_unsafe_url always send the referrer, even when downgrading from https to http attributes attribute type description allowpipelining boolean this attribute is a hint to the channel to indicate whether or not the underlying http transaction should be allowed to be pipelined with other transactions.
...And 3 more matches
nsINavBookmarkObserver
this will be called whenever any attributes like "title" are changed.
...when a new item is created, all the items following it in the same folder will have their index shifted down, but no additional notifications will be sent.
... auri the uri of the item that was added when aitemtype is type_bookmark, null otherwise.
...And 3 more matches
nsISHEntry
this is typically loadhistory except when reload is pressed, it has the appropriate reload flag.
...the child shells are restored as children of the parent docshell, in this order, when the parent docshell restores a saved presentation.
...this forgets its pointer, so free it when you're done.
...And 3 more matches
nsIScriptableIO
block: when this mode is specified, reading from a transport such as a socket when no data is available will block until data is available before returning.
... deleteonclose: the file is automatically deleted when the stream is closed.
... closeoneof: the file is automatically closed when the end of the file is reached.
...And 3 more matches
nsIWindowWatcher
windows must notify this component when they are created or destroyed, so only a weak reference is kept.
... example for example, in a xul application or mozilla extension, if the window object is unavailable (for example, when opening a window from xpcom component code), you might want to use this interface for opening a new window: var ww = components.classes["@mozilla.org/embedcomp/window-watcher;1"] .getservice(components.interfaces.nsiwindowwatcher); var win = ww.openwindow(null, "chrome://myextension/content/about.xul", "aboutmyextension", "chrome,centerscreen", null...
...); note: versions of gecko before gecko 2.0 would ignore some of the chrome flags when opening a chrome window without an opener window, instead behaving as if the "all" flag was present.
...And 3 more matches
Using the clipboard
this ensures that if the copied data comes from a window in private browsing mode, the clipboard will be cleared when private browsing mode ends.
...; // store the javascript string that we want to wrap in the new nsisupportsstring object res.data = str; return res; } // create a constructor for the built-in transferable class const nstransferable = components.constructor("@mozilla.org/widget/transferable;1", "nsitransferable"); // create a wrapper to construct an nsitransferable instance and set its source to the given window, when necessary function transferable(source) { var res = nstransferable(); if ('init' in res) { // when passed a window object, find a suitable privacy context for it.
...next we need to initialize it with a "privacy context", which will ensure that source data from inside private browsing mode will be cleared when the mode is exited.
...And 3 more matches
nsIMsgCloudFileProvider
constant value description offlineerr 0x80550014 returned when it appears that there is no active network connection.
... autherr 0x8055001e returned when authorizing has failed.
... uploaderr 0x8055311a returned when uploading has failed for an unknown reason.
...And 3 more matches
Gloda examples
a) show all messages in a conversation regardless of the folder in which they are stored, b) search messages by subject assuming that you have a message (glodamessage) in the conversation already, this is straight forward using glodamessage.conversation.getmessagescollection() alistener = { /* called when new items are returned by the database query or freshly indexed */ onitemsadded: function _onitemsadded(aitems, acollection) { }, /* called when items that are already in our collection get re-indexed */ onitemsmodified: function _onitemsmodified(aitems, acollection) { }, /* called when items that are in our collection are purged from the system */ onitemsremoved: func...
...tion _onitemsremoved(aitems, acollection) { }, /* called when our database query completes */ onquerycompleted: function _onquerycompleted(conversation_coll) { try { for (var conv in conversation_coll) { //do something with the conversation here alert(conv.subject); } } catch (e) {} } } glodamessage.conversation.getmessagescollection(alistener) alternatively if you need to get a conversation based on the subject, you need to do a query (using the same listener as above).
...noun_message); let tagarray = mailservices.tags.getalltags({}); query.tags(...tagarray); let collection = query.getcollection(mylistener); search messages by daterange searches for all messages within a date range id_q=gloda.newquery(gloda.noun_message); // define a date range form yesterday to now id_q.daterange([new date() - 86400000, new date()]); var mylistener = { /* called when new items are returned by the database query or freshly indexed */ onitemsadded: function _onitemsadded(aitems, acollection) { }, /* called when items that are already in our collection get re-indexed */ onitemsmodified: function _onitemsmodified(aitems, acollection) { }, /* called when items that are in our collection are purged from the system */ onitemsremoved: func...
...And 3 more matches
Mail composition back end
nsimsgsendlistener the following describes the methods of the nsimsgsendlistener interface: onstartsending the onstartsending interface is called when the sending operation has begun.
... ns_imethod onstatus(const char *amsgid, - the message id for the message being sent const prunichar *amsg) = 0; - a message concerning the status of the send operation onstopsending the onstopsending interface is called when the sending operation has completed.
... onstartcopy the onstartcopy interface is called when the copy operation has begun.
...And 3 more matches
Adding items to the Folder Pane
when this happens, the folder pane consults the map-generator for the current mode, and that generator returns the necessary data for the folder pane's display.
...the following code snippet listens for that event: let gnumbersext = { load: function gne_load() { window.removeeventlistener("load", gnumbersext.load, false); let tree = document.getelementbyid("foldertree"); tree.addeventlistener("maprebuild", gnumbersext._insert, false); }, _insert: function gne__insert() { // this function is called when a rebuild occurs } }; window.addeventlistener("load", gnumbersext.load, true); the structure of folder-tree-items the folder pane stores its current display data in a property called _rowmap.
...splay in the tree level (attribute) the level in the tree to display the item at open (rw, attribute) whether or not this container is open children (attribute) an array of child items also conforming to this spec getproperties (function) a call from getrowproperties or getcellproperties for this item will be passed into this function command (function) this function will be called when the item is double-clicked for our example extension, two different types of folder-tree-items will be defined.
...And 3 more matches
Add to iPhoto
once installed, when you right-click on an image, you'll see among the options in the contextual menu an option to "add image to iphoto".
...some of this may change as i refine the example in the future; i'll update the article if and when that happens.
... there's nothing particularly interesting about how we declare this api, but it will be noteworthy when we look at how we use cfmutablearray objects with methods that accept a cfarray as input, so i introduce this concept here.
...And 3 more matches
Working with data
creating initialized cdata objects similarly, you can initialize cdata objects with specific values at the type of creation by specifying them as a parameter when calling the ctype's constructor, like this: var mycdataobj = new type(value); var mycdataobj = type(value); if the size of the specified type isn't undefined, the specified value is converted to the given type.
...this will happen, for example, when type casting.
... see determining if two pointers are equal for an example of how this works when comparing pointers.
...And 3 more matches
Debugger.Object - Firefox Developer Tools
this means that the debugger can use the == operator to recognize when two debugger.object instances refer to the same debuggee object, and place its own properties on a debugger.object instance to store metadata about particular debuggee objects.
...for example: function f() {} // display name: f (the given name) var g = function () {}; // display name: g o.p = function () {}; // display name: o.p var q = { r: function () {} // display name: q.r }; note that the display name may not be a proper javascript identifier, or even a proper expression: we attempt to find helpful names even when the function is not immediately assigned as the value of some variable or property.
... environment if the referent is a function that is debuggee code, a debugger.environment instance representing the lexical environment enclosing the function when it was created.
...And 3 more matches
CSS Flexbox Inspector: Examine Flexbox layouts - Firefox Developer Tools
discovering flex containers when an html element on your page has display: flex applied to it, a number of features are made available in the devtools to provide easy access to flexbox layout features.
... in the html pane in the html pane, an element laid out with flexbox has the word flex next to it as shown in the following image: click the word flex in the html pane to keep the overlay visible when you move the mouse away from the container.
... in the infobar when you hover over an element in the html pane, you will see a tooltip that gives you more information about the element.
...And 3 more matches
Paint Flashing Tool - Firefox Developer Tools
the paint flashing tool, when activated, highlights the part of a page that the browser needs to repaint in response to some input: for example, the user moving the mouse or scrolling.
... repaints and responsiveness when the browser renders a web page it parses the html and css, determines how to lay it out, and then paints it to actually display the content on the screen.
... whenever an event happens that might change a visible part of the web page then the browser must repaint some portion of the page.
...And 3 more matches
Intensive JavaScript - Firefox Developer Tools
you can use the frame rate and waterfall tools to see when javascript is causing performance problems, and to single out the particular functions that need attention.
...we can see that frame rate is pretty healthy for most of the recording, but collapses completely whenever we press the button.
... we can select one of these periods and have a closer look at it in the main waterfall view: here, when we pressed the button, the browser ran a javascript function, or series of functions, that blocked the main thread for 71.73ms, or more than four times our frame budget.
...And 3 more matches
Taking screenshots - Firefox Developer Tools
just check the box in settings labeled "screenshot to clipboard": now, whenever you take a screenshot, the screenshot is also copied to the clipboard.
... the command has the following optional parameters: command type description --clipboard boolean when present, this parameter will cause the screenshot to be copied to the clipboard.
... --dpr number the device pixel ratio to use when taking the screenshot.
...And 3 more matches
about:debugging (before Firefox 68) - Firefox Developer Tools
when about:debugging opens, on the left-hand side, you'll see a sidebar enabling you to switch between the two main views: one for add-ons and one for workers.
... the big advantages of this method, compared with installing an add-on from an xpi, are: you don't have to rebuild an xpi and reinstall when you change the add-on's code you can load an add-on without signing it and without needing to disable signing.
... updating a temporary add-on if you install the add-on in this way, what happens when you update the add-on's files?
...And 3 more matches
about:debugging - Firefox Developer Tools
when about:debugging opens, on the left-hand side, you'll see a sidebar with two options and information about your remote debugging setup: setup use the setup tab to configure the connection to your remote device.
...when you do, the developer tools open in a new tab.
...when you do, it is added to the network locations list along with the devices, as shown below: this firefox the this firefox tab combines the features of extensions, tabs, and workers into a single tab with the following sections: temporary extensions displays a list of the extensions that you have loaded using the load temporary add-on button.
...And 3 more matches
AudioScheduledSourceNode.onended - Web APIs
the onended event handler for the audioscheduledsourcenode interface specifies an eventhandler to be executed when the ended event occurs on the node.
... this event is sent to the node when the concrete interface (such as audiobuffersourcenode, oscillatornode, or constantsourcenode) determines that it has stopped playing.
... the ended event is only sent to a node configured to loop automatically when the node is stopped using its stop() method.
...And 3 more matches
Using the CSS Painting API - Web APIs
the first is the name we give the worklet — this is the name we will use in our css as the parameter of the paint() function when we want to apply this styling to an element.
... we can add these extra arguments when we call the function in the css.
...when we get our list of argument values, we ask specifically for a <length> unit.
...And 3 more matches
Optimizing canvas - Web APIs
however, when websites and apps push the canvas api to its limits, performance begins to suffer.
... mycanvas.offscreencanvas = document.createelement('canvas'); mycanvas.offscreencanvas.width = mycanvas.width; mycanvas.offscreencanvas.height = mycanvas.height; mycanvas.getcontext('2d').drawimage(mycanvas.offscreencanvas, 0, 0); avoid floating-point coordinates and use integers instead sub-pixel rendering occurs when you render objects on a canvas without whole values.
... don’t scale images in drawimage cache various sizes of your images on an offscreen canvas when loading as opposed to constantly scaling them in drawimage().
...And 3 more matches
DedicatedWorkerGlobalScope - Web APIs
dedicatedworkerglobalscope.name read only the name that the worker was (optionally) given when it was created using the worker() constructor.
... dedicatedworkerglobalscope.onmessage is an eventhandler representing the code to be called when the message event is raised.
... these events are of type messageevent and will be called when the worker receives a message from the document that started it (i.e.
...And 3 more matches
Document.createNodeIterator() - Web APIs
this is meaningful only when creating a treewalker with an attr node as its root.
...since attributes are never children of other nodes, they do not appear when traversing over the document tree.
...this is meaningful only when creating a treewalker with an entity node as its root; in this case, it means that the entity node will appear in the first position of the traversal.
...And 3 more matches
How whitespace is handled by HTML, CSS, and in the DOM - Web APIs
this article explores when difficulties can occur, and looks at what can be done to mitigate resulting problems.
...in the earlier example one of the spaces between "hello" and "world!" still exists when the page is rendered in a browser.
...in fact, we saw this already in our very first example, when we described how whitespace is processed inside inline formatting contexts.
...And 3 more matches
Element: mouseenter event - Web APIs
the mouseenter event is fired at an element when a pointing device (usually a mouse) is initially moved so that its hotspot is within the element at which the event was fired.
... bubbles no cancelable no interface mouseevent event handler property onmouseenter usage notes though similar to mouseover, mouseenter differs in that it doesn't bubble and it isn't sent to any descendants when the pointer is moved from one of its descendants' physical space to its own physical space.
... one mouseenter event is sent to each element of the hierarchy when entering them.
...And 3 more matches
Using FormData Objects - Web APIs
retrieving a formdata object from an html form to construct a formdata object that contains the data from an existing <form>, specify that form element when creating the formdata object: note: formdata will only use input fields that use the name attribute.
...) { var ooutput = document.queryselector("div"), odata = new formdata(form); odata.append("customfield", "this is some extra data"); var oreq = new xmlhttprequest(); oreq.open("post", "stash.php", true); oreq.onload = function(oevent) { if (oreq.status == 200) { ooutput.innerhtml = "uploaded!"; } else { ooutput.innerhtml = "error " + oreq.status + " occurred when trying to upload your file.<br \/>"; } }; oreq.send(odata); ev.preventdefault(); }, false); note: if you pass in a reference to the form, the request method specified in the form will be used over the method specified in the open() call.
... you can also append a file or blob directly to the formdata object, like this: data.append("myfile", myblob, "filename.txt"); when using the append() method it is possible to use the third optional parameter to pass a filename inside the content-disposition header that is sent to the server.
...And 3 more matches
Using the Gamepad API - Web APIs
connecting to a gamepad when a new gamepad is connected to the computer, the focused page first receives a gamepadconnected event.
... if a gamepad is already connected when the page loaded, the gamepadconnected event is dispatched to the focused page when the user presses a button or moves an axis.
... in firefox, gamepads are only exposed to a page when the user interacts with one with the page visible.
...And 3 more matches
GlobalEventHandlers.onerror - Web APIs
error events are fired at various targets for different kinds of errors: when a javascript runtime error (including syntax errors and exceptions thrown within handlers) occurs, an error event using interface errorevent is fired at window and window.onerror() is invoked (as well as handlers attached by window.addeventlistener (not only capturing)).
... when a resource (such as an <img> or <script>) fails to load, an error event using interface event is fired at the element that initiated the load, and the onerror() handler on the element is invoked.
... source: url of the script where the error was raised (string) lineno: line number where error was raised (number) colno: column number for the line where the error occurred (number) error: error object (object) when the function returns true, this prevents the firing of the default event handler.
...And 3 more matches
HTMLImageElement.alt - Web APIs
the htmlimageelement property alt provides fallback (alternate) text to display when the image specified by the <img> element is not loaded.
... think of it like this: when choosing alt strings for your images, imagine what you would say when reading the page to someone over the phone without mentioning that there's an image on the page.
... syntax htmlimageelement.alt = alttext; let alttext = htmlimageelement.alt; value a domstring which contains the alternate text to display when the image is not loaded or for use by assistive devices.
...And 3 more matches
HTMLTableElement - Web APIs
when set, if the object doesn't represent a <caption>, a domexception with the hierarchyrequesterror name is thrown.
...when set, if the object doesn't represent a <thead>, a domexception with the hierarchyrequesterror name is thrown.
...when set, if the object doesn't represent a <tfoot>, a domexception with the hierarchyrequesterror name is thrown.
...And 3 more matches
Recommended Drag Types - Web APIs
for example, this sample text/uri-list data contains two links and a comment: http://www.mozilla.org #a second link http://www.example.com when retrieving a dropped link, ensure you handle when multiple links are dragged, including any comments.
...similarly, when retrieving the data, you must use the mozgetdataat() method.
...when this stream is read, it should provide the data bits for the image, as if the image was a file of that type.
...And 3 more matches
IDBDatabase - Web APIs
when a database is first created, this attribute is an empty string.
... abort fired when when a transaction is aborted and bubbles up to the connection object.
... close fired when the database connection is unexpectedly closed.
...And 3 more matches
IntersectionObserver - Web APIs
when an intersectionobserver is created, it's configured to watch for given ratios of visibility within the root.
... constructor intersectionobserver.intersectionobserver() creates a new intersectionobserver object which will execute a specified callback function when it detects that a target element's visibility has crossed one or more thresholds.
... properties intersectionobserver.root read only the element or document whose bounds are used as the bounding box when testing for intersection.
...And 3 more matches
MediaDevices.ondevicechange - Web APIs
the mediadevices.ondevicechange property is an eventhandler which specifies a function to be called when the devicechange event occurs on a mediadevices instance.
... this happens whenever the set of media devices available to the user agent and, by extension, to the web site or app has changed.
... example in this example, we create a function called updatedevicelist(), which is called once when mediadevices.getusermedia() successfully obtains a stream, and then is called any time the device list changes.
...And 3 more matches
MediaRecorder.onerror - Web APIs
the mediarecorder interface's onerror event handler is called by the mediastream recording api when an error occurs.
... syntax mediarecorder.onerror = errorhandlerfunction; value a function to be called whenever an error occurs during the recorder's lifetime.
... in addition to other general errors that might occur, the following errors are specifically possible when using the mediastream recording api; to determine which occurred, check the value of mediarecordererrorevent.error.name.
...And 3 more matches
MediaStream - Web APIs
event handlers mediastream.onaddtrack an eventhandler containing the action to perform when an addtrack event is fired when a new mediastreamtrack object is added.
... mediastream.onremovetrack an eventhandler containing the action to perform when a removetrack event is fired when a mediastreamtrack object is removed from it.
... events addtrack fired when a new mediastreamtrack object is added.
...And 3 more matches
Web-based protocol handlers - Web APIs
an example is the mailto: protocol: <a href="mailto:webmaster@example.com">web master</a> web authors can use a mailto: link when they want to provide a convenient way for users to send an email, directly from the webpage.
... when the link is activated, the browser should launch the default desktop application for handling email.
... when a browser executes this code, it should display a prompt to the user, asking permission to allow the web application to register as a handler for the protocol.
...And 3 more matches
NodeIterator.whatToShow - Web APIs
this is meaningful only when creating a nodeiterator or treewalker with an attr node as its root; in this case, it means that the attribute node will appear in the first position of the iteration or traversal.
... since attributes are never children of other nodes, they do not appear when traversing over the document tree.
...this is meaningful only when creating a nodeiterator or treewalker with an entity node as its root; in this case, it means that the entity node will appear in the first position of the traversal.
...And 3 more matches
PaymentResponse - Web APIs
this option is only present when the requestpayeremail option is set to true in the options parameter of the paymentrequest() constructor.
...this option is only present when the requestpayername option is set to true in the options parameter of the paymentrequest() constructor.
...this option is only present when the requestpayerphone option is set to true in the options parameter of the paymentrequest() constructor.
...And 3 more matches
Using Pointer Events - Web APIs
example the text below uses the term "finger" when describing the contact with the surface, but it could, of course, also be a stylus, mouse, or other method of pointing at a location.
...</canvas> <br> <button onclick="startup()">initialize</button> <br> log: <pre id="log" style="border: 1px solid #ccc;"></pre> setting up the event handlers when the page loads, the startup() function shown below should be called by our <body> element's onload attribute (but in the example we use a button to trigger it, due to limitations of the mdn live example system).
... var ongoingtouches = new array(); when a pointerdown event occurs, indicating that a new touch on the surface has occurred, the handlestart() function below is called.
...And 3 more matches
RTCDtlsTransport - Web APIs
description allocation of dtls transports rtcdtlstransport objects are created when an app calls either setlocaldescription() or setremotedescription().
... the number of dtls transports created and how they're used depends on the bundling mode used when creating the rtcpeerconnection.
...all browsers support bundling, so when both endpoints are browsers, you can rest assured that bundling will be used.
...And 3 more matches
Reporting API - Web APIs
concepts and usage there are a number of different features and problems on the web platform that generate information useful to web developers when they are trying to fix bugs or improve their websites in other ways.
... deprecated feature usage (when you are using something that will stop working soon in browsers).
... occurrence of user-agent interventions (when the browser blocks something your code is trying to do because it is deemed a security risk for example, or just plain annoying, like auto-playing audio).
...And 3 more matches
SVGElement - Web APIs
abort fired when page loading is stopped before an svg element has been allowed to load completely.
... error fired when an svg element does not load properly or when an error occurs during script execution.
... load fires on an svgelement when it is loaded in the browser.
...And 3 more matches
Using server-sent events - Web APIs
you can also listen for events with addeventlistener(): evtsource.addeventlistener("ping", function(event) { const newelement = document.createelement("li"); const time = json.parse(event.data).time; newelement.innerhtml = "ping at " + time; eventlist.appendchild(newelement); }); this code is similar, except that it will be called automatically whenever the server sends a message with the event field set to "ping"; it then parses the json in the data field and outputs that information.
... when not used over http/2, sse suffers from a limitation to the maximum number of open connections, which can be especially painful when opening multiple tabs, as the limit is per browser and is set to a very low number (6).
...when using http/2, the maximum number of simultaneous http streams is negotiated between the server and the client (defaults to 100).
...And 3 more matches
Streams API - Web APIs
this is something browsers do anyway when receiving assets to be shown on webpages — videos buffer and more is gradually available to play, and sometimes you'll see images display gradually as more is loaded.
... there are more advantages too — you can detect when streams start or end, chain streams together, handle errors and cancel streams as required, and react to the speed of the stream is being read at.
...when constructing a writablestream, the underlying sink is given a corresponding writablestreamdefaultcontroller instance to manipulate.
...And 3 more matches
TreeWalker.whatToShow - Web APIs
this is meaningful only when creating a treewalker with an attr node as its root; in this case, it means that the attribute node will appear in the first position of the iteration or traversal.
... since attributes are never children of other nodes, they do not appear when traversing over the document tree.
...this is meaningful only when creating a treewalker with an entity node as its root; in this case, it means that the entity node will appear in the first position of the traversal.
...And 3 more matches
Visual Viewport API - Web APIs
when the user pinch-zooms into the page, the visual viewport shrinks but the layout viewport is unchanged.
... what happens when a web page element needs to be visible on screen regardless of the visible portion of a web page?
...it also adds two events, onresize and onscroll, that fire whenever the visual viewport changes.
...And 3 more matches
WebGLRenderingContext.clearColor() - Web APIs
the webglrenderingcontext.clearcolor() method of the webgl api specifies the color values used when clearing color buffers.
... this specifies what color values to use when calling the clear() method.
... syntax void gl.clearcolor(red, green, blue, alpha); parameters red a glclampf specifying the red color value used when the color buffers are cleared.
...And 3 more matches
WebGLRenderingContext.getParameter() - Web APIs
parameter names webgl 1 you can query the following pname parameters when using a webglrenderingcontext.
... when using the webgl_compressed_texture_s3tc extension: ext.compressed_rgb_s3tc_dxt1_ext ext.compressed_rgba_s3tc_dxt1_ext ext.compressed_rgba_s3tc_dxt3_ext ext.compressed_rgba_s3tc_dxt5_ext when using the webgl_compressed_texture_s3tc_srgb extension: ext.compressed_srgb_s3tc_dxt1_ext ext.compressed_srgb_alpha_s3tc_dxt1_ext ext.compressed_srgb_al...
...pha_s3tc_dxt3_ext ext.compressed_srgb_alpha_s3tc_dxt5_ext when using the webgl_compressed_texture_etc extension: ext.compressed_r11_eac ext.compressed_signed_r11_eac ext.compressed_rg11_eac ext.compressed_signed_rg11_eac ext.compressed_rgb8_etc2 ext.compressed_rgba8_etc2_eac ext.compressed_srgb8_etc2 ext.compressed_srgb8_alpha8_etc2_eac ext.compressed_rgb8_punchthrough_alpha1_etc2 ext.compressed_srgb8_punchthrough_alpha1_etc2 when using the webgl_compressed_texture_pvrtc extension: ext.compressed_rgb_pvrtc_4bppv1_img ext.compressed_rgba_pvrtc_4bppv1_img ext.compressed_rgb_pvrtc_2bppv1_img ext.compressed_rgba_pvrtc_2bppv1_img when using the webgl_compressed_texture_etc1 extension: ...
...And 3 more matches
Introduction to the Real-time Transport Protocol (RTP) - Web APIs
rtp supports multicast; while this isn't yet important for webrtc, it's likely to matter in the future, when webrtc is (hopefully) enhanced to support multi-user conversations.
... activating hold mode local peer when the local user decides to enable hold mode, the enablehold() method below is called.
... remote peer on the remote peer, when we receive an sdp offer with the directionality set to "sendonly", we handle it using the holdrequested() method, which accepts as input an sdp offer string.
...And 3 more matches
Taking still photos with WebRTC - Web APIs
<div class="camera"> <video id="video">video stream not available.</video> <button id="startbutton">take photo</button> </div> this is straightforward, and we'll see how it ties together when we get into the javascript code.
... the startup() function the startup() function is run when the page has finished loading, courtesy of window.addeventlistener().
... this function's job is to request access to the user's webcam, initialize the output <img> to a default state, and to establish the event listeners needed to receive each frame of video from the camera and react when the button is clicked to capture an image.
...And 3 more matches
Writing WebSocket servers - Web APIs
server handshake response when the server receives the handshake request, it should send back a special response that indicates that the protocol will be changing from http to websocket.
...(in fact, section 5.1 of the spec says that your server must disconnect from a client if that client sends an unmasked message.) when sending a frame back to the client, do not mask it and do not set the mask bit.
...note: you must mask messages even when using a secure socket.
...And 3 more matches
Lighting a WebXR setting - Web APIs
care needs to be taken to try to match the ambient light to what would really be the effect of the scene's lighting when doing this, however.
... lighting issues for mixed reality content in addition to the usual issues that you need to contend with while lighting a scene, the vr or ar use case adds additional areas of concern when writing your shaders.
...obviously, there are exceptions to this guideline, such as when your scene represents an otherworldly or alien setting, or when your goal is to create an unsettling visual effect.
...And 3 more matches
Web Audio API best practices - Web APIs
there's no strict right or wrong way when writing creative code.
... when working with files, you are looking at either the grabbing the file from an htmlmediaelement (i.e.
...both are legitimate ways of working, however, it's more common to use the former when you are working with full-length tracks, and the latter when working with shorter, more sample-like tracks.
...And 3 more matches
Background audio processing using AudioWorklet - Web APIs
when the web audio api was first introduced to browsers, it included the ability to use javascript code to create custom audio processors that would be invoked to perform real-time audio manipulations.
...with the processor registered, you can create a new audioworkletnode which passes the audio through the processor's code when the node is linked into the chain of audio nodes along with any other audio nodes.
...this call to registerprocessor() registers your class as the basis for any audioworkletprocessors created when audioworkletnodes are set up.
...And 3 more matches
Using the Web Audio API - Web APIs
// for legacy browsers const audiocontext = window.audiocontext || window.webkitaudiocontext; const audiocontext = new audiocontext(); so what's going on when we do this?
... controlling sound when playing sound on the web, it's important to allow the user to control it.
...we have a play button that changes to a pause button when the track is playing: <button data-playing="false" role="switch" aria-checked="false"> <span>play/pause</span> </button> before we can play our track we need to connect our audio graph from the audio source/input node to the destination.
...And 3 more matches
Attestation and Assertion - Web APIs
attestation when an authenticator registers a new key pair with a service, the authenticator signs the public key with an attestation certificate.
...the attestation format contains two basic arraybuffers: clientdatajson - an arraybuffer that contains a json representation of what the browser saw when being asked to authenticate.
...it is not included when used in the authenticatorassertionresponse.) different devices have different attestation formats.
...And 3 more matches
window.postMessage() - Web APIs
always specify an exact target origin, not *, when you use postmessage to send data to other windows.
... secure shared memory messaging if postmessage() throws when used with sharedarraybuffer objects, you might need to make sure you cross-site isolated your site properly.
... example /* * in window a's scripts, with a being on <http://example.com:8080>: */ var popup = window.open(/* popup details */); // when the popup has fully loaded, if not blocked by a popup blocker: // this does nothing, assuming the window hasn't changed its location.
...And 3 more matches
WorkerGlobalScope - Web APIs
(this does not yet appear to be implemented in any browser.) events error fired when an error occured.
... offline fired when the browser has lost access to the network and the value of navigator.online switched to false.
... online fired when the browser has gained access to the network and the value of navigator.online switched to true.
...And 3 more matches
ARIA live regions - Accessibility
the screen reader will speak changes whenever the user is idle.
...when a planet is selected from the dropdown, a region on the page is updated with information about the selected planet.
...iceover on mac announcing the update (via subtitles) to the live region: preferring specialized live region roles in the following well-known predefined cases it is better to use a specific provided "live region role": role description compatibility notes log chat, error, game or other type of log to maximize compatibility, add a redundant aria-live="polite" when using this role.
...And 3 more matches
Using the alert role - Accessibility
when this role is added to an element, the browser will send out an accessible alert event to assistive technology products which can then notify the user about it.
... possible effects on user agents and assistive technology when the alert role is added to an element, or such an element becomes visible, the user agent should do the following: expose the element as having an alert role in the operating system's accessibility api.
...if the element was already in the original source code when the page loaded, the screen reader will announce the error immediately after announcing the page title.
...And 3 more matches
Using the alertdialog role - Accessibility
unlike regular alerts, an alert dialog must have at least one focusable control and focus must be moved to that control when the alert dialog appears.
... the difference with regular dialogs is that the alertdialog role should only used when an alert, error, or warning occurs.
... in other words, when a dialog's information and controls require the user's immediate attention alertdialog should be used instead of dialog.
...And 3 more matches
ARIA: feed role - Accessibility
an article should be scrolled into view when it, or a descendant element, receives focus.
... if the addition of articles occupies the main browser thread, make sure to set aria-busy="true" on the feed itself, and make sure to set it back to false when processing ends, or the user may not see the updates.
... another feature of the feed pattern is skim reading: articles within a feed can contain both an accessible name with the aria-label and a description with an aria-describedby, suggesting to screen readers which elements to speak after the label when navigating by article.
...And 3 more matches
ARIA: switch role - Accessibility
the developer is required to change the value of the aria-checked attribute dynamically when the switch is toggled.
... associated aria roles, states, and properties aria-checked attribute the aria-checked attribute is required when using the switch role, as it represents the current state of the widget that the switch role is applied to.
... required javascript features handler for click events when the user clicks on the switch widget, a click event is fired, which must be handled in order to change the state of the widget.
...And 3 more matches
ARIA: dialog role - Accessibility
the combination of the aria dialog role and labeling techniques should make the screen reader announce the dialog's information when focus is moved into it.
... when the dialog appears on the screen, keyboard focus (whose control depends upon the dialogs purpose) should be moved to the default focusable control inside the dialog.
... for most dialogs, the expected behavior is that the dialog's tab order wraps, which means that when the user tabs through the focusable elements in the dialog, the first focusable element will be focused after the last one has been reached.
...And 3 more matches
Mastering Wrapping of Flex Items - CSS: Cascading Style Sheets
wrapping and flex-direction wrapping works as you might expect when combined with flex-direction.
... single-dimensional layout explained as we have seen from the above examples if our items are allowed to grow and shrink, when there are fewer items in the last row or column then those items grow to fill the available space.
...however, in this case the items stay in their grid and don’t stretch out when there are fewer of them on the final row.
...And 3 more matches
CSS grids, logical values, and writing modes - CSS: Cascading Style Sheets
in the code snippet below, the item is placed 20 pixels from the top, and 30 pixels from the left of the container: .container { position: relative; } .item { position: absolute; top: 20px; left: 30px; } <div class="container"> <div class="item">item</div> </div> another place you might see physical keywords in use, is when using text-align: right to align text to the right.
... this can become an issue when developing a site that has to work in multiple languages, including languages that have text starting on the right, rather than the left.
...which is why in grid layout we use the keyword start when aligning something to the start of the container.
...And 3 more matches
Grid template areas - CSS: Cascading Style Sheets
when you use css grid layout you always have lines, and this can be a straightforward way to place items on your grid.
... .box1 { grid-area: 1 / 1 / 4 / 2; } what we are doing here when defining all four lines, is defining the area by specifying the lines that enclose that area.
... when doing this, define the names for your areas outside of any media queries.
...And 3 more matches
Using CSS transitions - CSS: Cascading Style Sheets
css transitions provide a way to control animation speed when changing css properties.
... css transitions let you decide which properties to animate (by listing them explicitly), when the animation will start (by setting a delay), how long the transition will last (by setting a duration), and how the transition will run (by defining a timing function, e.g.
...d.</p> <div class="box">sample</div> </body> css content .box { border-style: solid; border-width: 1px; display: block; width: 100px; height: 100px; background-color: #0000ff; transition: width 2s, height 2s, background-color 2s, transform 2s; } .box:hover { background-color: #ffcccc; width: 200px; height: 200px; transform: rotate(180deg); } when property value lists are of different lengths if any property's list of values is shorter than the others, its values are repeated to make them match.
...And 3 more matches
border-style - CSS: Cascading Style Sheets
when one value is specified, it applies the same style to all four sides.
... when two values are specified, the first style applies to the top and bottom, the second to the left and right.
... when three values are specified, the first style applies to the top, the second to the left and right, the third to the bottom.
...And 3 more matches
bottom - CSS: Cascading Style Sheets
WebCSSbottom
the effect of bottom depends on how the element is positioned (i.e., the value of the position property): when position is set to absolute or fixed, the bottom property specifies the distance between the element's bottom edge and the bottom edge of its containing block.
... when position is set to relative, the bottom property specifies the distance the element's bottom edge is moved above its normal position.
... when position is set to sticky, the bottom property is used to compute the sticky-constraint rectangle.
...And 3 more matches
calc() - CSS: Cascading Style Sheets
WebCSScalc
the calc() css function lets you perform calculations when specifying css property values.
...you may also use parentheses to establish computation order when needed.
... formal syntax calc( <calc-sum> )where <calc-sum> = <calc-product> [ [ '+' | '-' ] <calc-product> ]*where <calc-product> = <calc-value> [ '*' <calc-value> | '/' <number> ]*where <calc-value> = <number> | <dimension> | <percentage> | ( <calc-sum> ) accessibility concerns when calc() is used for controlling text size, be sure that one of the values includes a relative length unit, for example: h1 { font-size: calc(1.5rem + 3vw); } this ensures that text size will scale if the page is zoomed.
...And 3 more matches
Adapting to the new two-value syntax of display - CSS: Cascading Style Sheets
what happens when we change the value of the display property?
...only when the value of display is changed do the children become flex or grid items and begin to respond to the other properties in the grid or flexbox specifications.
... as an example, when we use display: flex we create a block-level container, with flex children.
...And 3 more matches
left - CSS: Cascading Style Sheets
WebCSSleft
description the effect of left depends on how the element is positioned (i.e., the value of the position property): when position is set to absolute or fixed, the left property specifies the distance between the element's left edge and the left edge of its containing block.
... (the containing block is the ancestor to which the element is relatively positioned.) when position is set to relative, the left property specifies the distance the element's left edge is moved to the right from its normal position.
... when position is set to sticky, the left property is used to compute the sticky-constraint rectangle.
...And 3 more matches
<length> - CSS: Cascading Style Sheets
WebCSSlength
note: these units, especially em and rem, are often used to create scalable layouts, which maintain the vertical rhythm of the page even when the user changes the font size.
...when used within the root element font-size, it represents its initial value (a common browser default is 16px, but user-defined preferences may modify this).
...when used on the font-size or line-height properties of the root element, it refers to the properties' initial value.
...And 3 more matches
text-rendering - CSS: Cascading Style Sheets
the text-rendering css property provides information to the rendering engine about what to optimize for when rendering text.
... syntax values auto the browser makes educated guesses about when to optimize for speed, legibility, and geometric precision while drawing text.
... optimizespeed the browser emphasizes rendering speed over legibility and geometric precision when drawing text.
...And 3 more matches
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 (ή/Ή).
...ς is used only when sigma terminates a word.
... when applying text-transform: lowercase to an uppercase sigma (Σ), the browser needs to choose the right lowercase form based on context.
...And 3 more matches
Video player styling basics - Developer guides
'); } when the data-state of the button is changed, the appropriate image will also be changed.
... as mentioned in the previous article, there is a fallback provided for browsers that do not support the <progress> element; this also needs to be styled appropriately: .controls progress[data-state="fake"] { background:#e6e6e6; height:65%; } .controls progress span { width:0%; height:100%; display:inline-block; background-color:#2a84cd; } a .data-state class is also used here when a <progress> element is being "faked"; when it's in this state the background colour needs to be set.
... control visibility the first change is simple: the data-state for showing the video controls when javascript is available to the browser now needs to be set: // display the user defined video controls videocontrols.setattribute('data-state', 'visible'); progress bar support a check also needs to be made to set up the "fake" progress bar if the browser doesn't support the <progress> element: var supportsprogress = (document.createelement('progress').max !== undefined); if (!supportsprogres...
...And 3 more matches
Index - Developer guides
WebGuideIndex
20 media events intermediate, media various events are sent when handling media that are embedded in html documents using the <audio> and <video> elements; this section lists them and provides some helpful information about using them.
... 23 orientation and motion data explained intermediate, mobile, motion, needscontent, orientation, páginas_a_traducir, rotation when using orientation and motion events, it's important to understand what the values you're given by the browser mean.
... 24 overview of events and handlers beginner, dom, example, javascript, needsbeginnerupdate, needsupdate, events this overview of events and event handling explains the code design pattern used to react to incidents occurring when a browser accesses a web page, and it summarizes the types of such incidents modern web browsers can handle.
...And 3 more matches
<area> - HTML: Hypertext Markup Language
WebHTMLElementarea
implicit aria role link when href attribute is present, otherwise no corresponding role permitted aria roles no role permitted dom interface htmlareaelement attributes this element's attributes include the global attributes.
...the text should be phrased so that it presents the user with the same kind of choice as the image would offer when displayed without the alternative text.
... ping contains a space-separated list of urls to which, when the hyperlink is followed, post requests with the body ping will be sent by the browser (in the background).
...And 3 more matches
<details>: The Details disclosure element - HTML: Hypertext Markup Language
WebHTMLElementdetails
the html details element (<details>) creates a disclosure widget in which information is visible only when the widget is toggled into an "open" state.
...when the user clicks on the widget or focuses it then presses the space bar, it "twists" open, revealing its contents: from there, you can use css to style the disclosure widget, and you can programmatically open and close the widget by setting/removing its open attribute.
... by default when closed, the widget is only tall enough to display the disclosure triangle and summary.
...And 3 more matches
<input type="month"> - HTML: Hypertext Markup Language
WebHTMLElementinputmonth
when the above value is submitted to the server, for example, it will look like bday-month=1978-06.
...on list the id of the <datalist> element that contains the optional pre-defined autocomplete options max the latest year and month to accept as a valid input min the earliest year and month to accept as a valid input readonly a boolean which, if present, indicates that the input's value can't be edited step a stepping interval to use when incrementing and decrementing the value of the input field list the values of the list attribute is the id of a <datalist> element located in the same document.
... note: when the data entered by the user doesn't adhere to the stepping configuration, the user agent may round to the nearest valid value, preferring numbers in the positive direction when there are two equally close options.
...And 3 more matches
<marquee>: The Marquee element (Obsolete) - HTML: Hypertext Markup Language
WebHTMLElementmarquee
you can control what happens when the text reaches the edges of its content area using its attributes.
... event handlers onbounce fires when the marquee has reached the end of its scroll position.
... it can only fire when the behavior attribute is set to alternate.
...And 3 more matches
<script>: The Script element - HTML: Hypertext Markup Language
WebHTMLElementscript
referrerpolicy indicates which referrer to send when fetching the script, or resources fetched by the script: no-referrer: the referer header will not be sent.
... no-referrer-when-downgrade (default): the referer header will not be sent to origins without tls (https).
... origin-when-cross-origin: the referrer sent to other origins will be limited to the scheme, the host, and the port.
...And 3 more matches
HTML elements reference - HTML: Hypertext Markup Language
WebHTMLElement
however, <s> is not appropriate when indicating document edits; for that, use the <del> and <ins> elements, as appropriate.
... <select> the html <select> element represents a control that provides a menu of options <textarea> the html <textarea> element represents a multi-line plain-text editing control, useful when you want to allow users to enter a sizeable amount of free-form text, for example a comment on a review or feedback form.
... element description <details> the html details element (<details>) creates a disclosure widget in which information is visible only when the widget is toggled into an "open" state.
...And 3 more matches
List of default Accept values - HTTP
default values these are the values sent when the context doesn't give better information.
... edge text/html, application/xhtml+xml, image/jxr, */* opera text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/webp, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1 values for an image when requesting an image, like through an html <img> element, user-agent often sets a specific list of media types to be welcomed.
...source safari */* chrome image/webp,image/apng,image/*,*/*;q=0.8 source internet explorer 8 or earlier */* see ie and the accept header (ieinternals' msdn blog) internet explorer 9 image/png,image/svg+xml,image/*;q=0.8, */*;q=0.5 see fiddler is better with internet explorer 9 (ieinternals' msdn blog) values for a video when a video is requested, via the <video> html element, most browsers use specific values.
...And 3 more matches
HTTP response status codes - HTTP
WebHTTPStatus
206 partial content this response code is used when the range header is sent from the client to request only part of a resource.
... 406 not acceptable this response is sent when the web server, after performing server-driven content negotiation, doesn't find any content that conforms to the criteria given by the user agent.
... 409 conflict this response is sent when a request conflicts with the current state of the server.
...And 3 more matches
Concurrency model and the event loop - JavaScript
function foo(b) { let a = 10 return a + b + 11 } function bar(x) { let y = 3 return foo(x * y) } console.log(bar(7)) //returns 42 when calling bar, a first frame is created containing bar's arguments and local variables.
... when bar calls foo, a second frame is created and pushed on top of the first one containing foo's arguments and local variables.
... when foo returns, the top frame element is popped out of the stack (leaving only bar's call frame).
...And 3 more matches
Functions - JavaScript
when functions are used only once, a common pattern is an iife (immediately invoked function expression).
... get binds an object property to a function that will be called when that property is looked up.
... set binds an object property to a function to be called when there is an attempt to set that property.
...And 3 more matches
Promise() constructor - JavaScript
} at the time when the constructor generates the new promiseobj, it also generates a corresponding pair of functions for resolutionfunc and rejectionfunc; these are "tethered" to the promiseobj.
... each function is used by simply calling it when appropriate.
... return value promiseobj when called via new, the promise constructor returns a promise object.
...And 3 more matches
Promise.prototype.finally() - JavaScript
when the promise is settled, i.e either fulfilled or rejected, the specified callback function is executed.
... syntax p.finally(onfinally); p.finally(function() { // settled (fulfilled or rejected) }); parameters onfinally a function called when the promise is settled.
... the finally() method is very similar to calling .then(onfinally, onfinally) however there are a couple of differences: when creating a function inline, you can pass it once, instead of being forced to either declare it twice, or create a variable for it a finally callback will not receive any argument, since there's no reliable means of determining if the promise was fulfilled or rejected.
...And 3 more matches
parseInt() - JavaScript
the description below explains in more detail what happens when radix is not provided.
... or nan when the radix is smaller than 2 or bigger than 36, or the first non-whitespace character cannot be converted to a number.
...6.022e23 for 6.022 × 1023), using parseint to truncate numbers will produce unexpected results when used on very large or very small numbers.
...And 3 more matches
Iteration protocols - JavaScript
whenever an object needs to be iterated (such as at the beginning of a for...of loop), its @@iterator method is called with no arguments, and the returned iterator is used to obtain the values to be iterated.
... note that when this zero-argument function is called, it is invoked as a method on the iterable object.
... this function can be an ordinary function, or it can be a generator function, so that when invoked, an iterator object is returned.
...And 3 more matches
Destructuring assignment - JavaScript
, b; [a, b] = f(); console.log(a); // 1 console.log(b); // 2 ignoring some returned values you can ignore return values that you're not interested in: function f() { return [1, 2, 3]; } const [a, , b] = f(); console.log(a); // 1 console.log(b); // 3 const [c] = f(); console.log(c); // 1 you can also ignore all returned values: [,,] = f(); assigning the rest of an array to a variable when destructuring an array, you can unpack and assign the remaining part of it to a variable using the rest pattern: const [a, ...b] = [1, 2, 3]; console.log(a); // 1 console.log(b); // [2, 3] be aware that a syntaxerror will be thrown if a trailing comma is used on the left-hand side with a rest element: const [a, ...b,] = [1, 2, 3]; // syntaxerror: rest element may not have a trailing comma // ...
...always consider using rest operator as the last element unpacking values from a regular expression match when the regular expression exec() method finds a match, it returns an array containing first the entire matched portion of the string and then the portions of the string that matched each parenthesized group in the regular expression.
...) around the assignment statement are required when using object literal destructuring assignment without a declaration.
...And 3 more matches
Strict mode - JavaScript
arguments objects for strict mode functions store the original arguments when the function was invoked.
...arguments.callee for strict mode functions is a non-deletable property which throws an error when set or retrieved: 'use strict'; var f = function() { return arguments.callee; }; f(); // throws a typeerror "securing" javascript strict mode makes it easier to write "secure" javascript.
...in normal code with these extensions, when a function fun is in the middle of being called, fun.caller is the function that most recently called fun, and fun.arguments is the arguments for that invocation of fun.
...And 3 more matches
Progressive web app structure - Progressive web apps (PWAs)
client-side rendering (csr) allows the website to be updated in the browser almost instantly when navigating to different pages, but requires more of an initial download hit and extra rendering on the client at the beginning.
... mixing ssr with csr can lead to the best results — you can render a website on the server, cache its contents, and then update the rendering on the client-side as and when needed.
... being linkable, progressive and responsive by design it's important to remember the pwa advantages and keep them in mind when designing the application.
...And 3 more matches
Media - Progressive web apps (PWAs)
(in html5, this can be marked up with the <nav> element instead of <div> with an id attribute.) when printing the document, the navigation area has no purpose.
... this css (below) removes the navigation area when printing the document: @media print { #nav-area {display: none;} } some common media types are: screen color device display print printed paged media projection projected display all all media (the default) more details there are other ways to specify the media type for a set of rules.
... the document's markup language might allow the media type to be specified when the stylesheet is linked to the document.
...And 3 more matches
Structural overview of progressive web apps - Progressive web apps (PWAs)
in this structural overview, we'll look at the features that make up a standard web application, as well as some design patterns you can follow when building your pwa.
... client-side rendering (csr) allows the website to be updated in the browser almost instantly when navigating to different pages, but requires more of an initial download hit and extra rendering on the client at the beginning.
... the best results tend to come when you use both client-side and server-side rendering; you can render a web site on the server, cache its contents, and then update the rendering on the client side as needed.
...And 3 more matches
Gradients in SVG - SVG: Scalable Vector Graphics
when it is used, attributes and stops from one gradient can be included on another.
...more on that when we talk about images.
...this attribute controls what happens when the gradient reaches its end, but the object isn't filled yet.
...And 3 more matches
Same-origin policy - Web security
note: when using document.domain to allow a subdomain to access its parent securely, you need to set document.domain to the same value in both the parent domain and the subdomain.
... cross-origin network access the same-origin policy controls interactions between two different origins, such as when you use xmlhttprequest or an <img> element.
...when your resource is not an entry point to your site, you can also use a csrf token to prevent embedding.
...And 3 more matches
Using custom elements - Web Components
for example, connectedcallback is invoked each time the custom element is appended into a document-connected element, while attributechangedcallback is invoked when one of the custom element's attributes is added, removed, or changed.
...when the icon is focused, it displays the text in a pop up information box to provide further in-context information.
... inside the constructor, we define all the functionality the element will have when an instance of it is instantiated.
...And 3 more matches
Web Components
life cycle callbacks special callback functions defined inside the custom element's class definition, which affect its behavior: connectedcallback: invoked when the custom element is first connected to the document's dom.
... disconnectedcallback: invoked when the custom element is disconnected from the document's dom.
... adoptedcallback: invoked when the custom element is moved to a new document.
...And 3 more matches
Modules - Archive of obsolete content
loading subscripts when a javascript project reaches a certain size, it becomes necessary to split it up into multiple files.
...however, the following example shows how it can be used to load scripts from other locations: const { classes: cc interfaces: ci } = components; var instance = cc["@mozilla.org/moz/jssubscript-loader;1"]; var loader = instance.getservice(ci.mozijssubscriptloader); function loadscript(url) { loader.loadsubscript(url); } when a script is loaded, it is evaluated in the scope of the global object of the script that loaded it.
...this becomes a problem when two scripts try to define the same property: // index.js: loadscript("www.foo.com/a.js"); loadscript("www.foo.com/b.js"); foo; // => 5 // a.js: foo = 3; // b.js: foo = 5; in the above example, the value of foo depends on the order in which the subscripts are loaded: there is no way to access the property foo defined by "a.js", since it is overwritten by "b.js".
...And 2 more matches
Porting the Library Detector - Archive of obsolete content
when this is triggered, the testlibraries() function builds an array of libraries by iterating through the tests and adding an entry for each library which passes.
...however, instead of maintaining its own state by listening for gbrowser events and updating the user interface, the content script will just run when it's loaded, collect the array of library names, and post it back to main.js: function testlibraries() { var win = unsafewindow; var librarylist = []; for(var i in ld_tests) { var passed = ld_tests[i].test(win); if (passed) { var libraryinfo = { name: i, version: passed.version }; librarylist.push(libraryinfo); } } self.postmessage(libraryl...
...ist); } testlibraries(); main.js responds to that message by fetching the tab corresponding to that worker using worker.tab, and adding the array of library names to that tab's libraries property: pagemod.pagemod({ include: "*", contentscriptwhen: 'end', contentscriptfile: (data.url('library-detector.js')), onattach: function(worker) { worker.on('message', function(librarylist) { if (!worker.tab.libraries) { worker.tab.libraries = []; } librarylist.foreach(function(library) { if (worker.tab.libraries.indexof(library) == -1) { worker.tab.libraries.push(library); } }); if (worker.tab == tabs.activetab) { updatewidgetview(worker.tab); } }); } }); the content script is executed once for every wind...
...And 2 more matches
ui/button/action - Archive of obsolete content
for example, in the screenshots above, firefox uses the small icon when the button is in the toolbar and the large icon when the button is in the menu panel.
... here's an add-on with a button that disables itself when you click it, but only for the currently active window: var { actionbutton } = require("sdk/ui/button/action"); var button = actionbutton({ id: "my-button", label: "my button", icon: { "16": "./firefox-16.png", "32": "./firefox-32.png" }, onclick: disableforthiswindow }); function disableforthiswindow(state) { button.state("window", { disabled: true })...
... destroying buttons when you've finished with a button, destroy it by calling its destroy() method.
...And 2 more matches
Displaying annotations - Archive of obsolete content
when a page is loaded the matcher searches the dom for elements that match annotations.
... updating main.js first, initialize an array to hold workers associated with the matcher's content scripts: var matchers = []; in the main function, add the code to create the matcher: var matcher = pagemod.pagemod({ include: ['*'], contentscriptwhen: 'ready', contentscriptfile: [data.url('jquery-1.4.2.min.js'), data.url('matcher.js')], onattach: function(worker) { if(simplestorage.storage.annotations) { worker.postmessage(simplestorage.storage.annotations); } worker.port.on('show', function(data) { annotation.content = data; annotation.show(); }); worker.port.on('hide', function...
...() { annotation.content = null; annotation.hide(); }); worker.on('detach', function () { detachworker(this, matchers); }); matchers.push(worker); } }); when a new page is loaded the function assigned to onattach is called.
...And 2 more matches
Listening for Load and Unload - Archive of obsolete content
if your add-on exports a function called main(), then that function will be called whenever the add-on is loaded, and it will be passed an object containing a string describing the reason it was loaded as well as any arguments passed to it.
... if your add-on exports a function called onunload(), then that function will be called when the add-on is unloaded, and it will be passed a string describing the reason it was unloaded.
...it is loaded when it is installed, when it is enabled, or when firefox starts.
...And 2 more matches
Localization - Archive of obsolete content
now whenever your javascript or html asks the localization system for the translation of the hello_id identifier, it will get the correct translation for the current locale.
... ordering placeholders when a localizable string can take two or more placeholders, translators can define the order in which placeholders are inserted, without affecting the code.
... now when the browser's locale is set to "en-us", users see this in the add-ons manager: when the browser's locale is set to "fr", they see this: the menulist and the radio preference types have options.
...And 2 more matches
StringView - Archive of obsolete content
views) which work strictly on arrays of numbers rather than on creating new immutable javascript strings to work with unicode encodings other than javascript's default utf-16 domstrings introduction as web applications become more and more powerful, adding features such as audio and video manipulation, access to raw data using websockets, and so forth, it has become clear that there are times when it would be helpful for javascript code to be able to quickly and easily manipulate raw binary data.
...you rarely need to invoke the stringview.valueof() method yourself; javascript automatically invokes it when encountering an object where a primitive value is expected.
... examples alert((new stringview("hello world!")).tostring() === "hello world!"); // true the stringview.tostring() method is automatically called when the object is to be represented as a text value or when an object is referred to in a manner in which a string is expected.
...And 2 more matches
Displaying web content in an extension without security issues - Archive of obsolete content
note: dynamic changes of the "type" attribute have no effect, the frame type is read out when the frame element is inserted into the document and never again.
...ant to start with an empty document, you would rather want to load some template into the frame: var request = new xmlhttprequest(); request.open("get", "chrome://foo/content/template.html", false); request.send(null); frame.setattribute("src", "data:text/html," + encodeuricomponent(request.responsetext)); that way you can have the template in your extension but still strip it off all privileges when it is loaded in a frame.
... and the event handler would look like that: function handlebrowserclick(event) { // only react to left mouse clicks if (event.button != 0) return; // default action on link clicks is to go to this link, cancel it event.preventdefault(); if (event.target instanceof htmlanchorelement && event.target.href) openlinkinbrowser(event.target.href); } safe html manipulation functions when it comes to displaying the data, it is tempting to generate some html code and to insert it into the document via innerhtml.
...And 2 more matches
Installing Extensions and Themes From Web Pages - Archive of obsolete content
the href attribute contains a direct link to the extension xpi file, this is what will show in the location bar when the link is moused over.
... users can save the xpi file to disk easily by right clicking on the link and choosing "save link as..." when the link is clicked it calls the function install passing the event object as the parameter.
... return false; this last part is the most important - the install function must return false so that when the link is clicked, only the script is run, and the link href is not navigated to.
...And 2 more matches
Chapter 4: Using XPCOM—Implementing advanced processes - Archive of obsolete content
listing 2: setting privileges netscape.security.privilegemanager.enableprivilege('universalxpconnect'); note: this is unneeded when the code is part of an extension, and will result in rejection if submitted to addons.mozilla.org.
...when you initialize this by passing the full path to the file with the nsilocalfile.initwithpath() method, it becomes available to all functions.
...let's see what happens when we pass true to delete all the contents of a folder.
...And 2 more matches
Adding menus and submenus - Archive of obsolete content
instead of setting the menupopup directly in the xul, you can use the onpopupshowing event to fill the children when the popup is about to be displayed.
... the item's checked state changes when the user clicks on it.
...here's a list of the known issues we've run into when handling menus on mac: the about, preferences and quit menu items are located under the "firefox" menu, not the usual places you would find them.
...And 2 more matches
Appendix B: Install and Uninstall Scripts - Archive of obsolete content
it is also common for an add-on to require to run a script only when it is installed for the first time, or every time it is updated.
...then the user has the option to restart right away, wait to restart whenever is convenient, or even cancel the uninstall operation.
...set a boolean flag that indicates if your add-on is set to be uninstalled or not, and reset it when necessary.
...And 2 more matches
Handling Preferences - Archive of obsolete content
this file is updated when preferences are modified by the user.
...as the warning message states, you should be very careful when changing preferences.
...when your storage needs are more complicated than this, you'll need more advanced apis that will be discussed in a section further ahead.
...And 2 more matches
Local Storage - Archive of obsolete content
we recommend that you at least keep an error log, so that you can request error data from your users when you encounter problems that are hard to debug.
... finally, there's the issue of deleting local files when the extension is going to be uninstalled.
...this is the default behavior when firefox is uninstalled: the profile information remains intact and it will be there waiting for you if firefox is installed again.
...And 2 more matches
The Box Model - Archive of obsolete content
we recommended that you use proportional units (em, %) instead of absolute units (px) whenever possible.
...a common exception to this rule is when your css is directly related to images, where you'll usually handle measurements in pixels (px).
...you should only use it when you need flexible space.
...And 2 more matches
CSS3 - Archive of obsolete content
new modules are also added when new needs are identified.
... the control of the aspect ratio to use when fallback fonts are selected via the css font-size-adjust property.
... the control of the automatic generation of an oblique or bold face when none are found via the css font-synthesis property.
...And 2 more matches
Working with BFCache - Archive of obsolete content
q: when a user clicks a link that replaces the view in the current tab with a new page, what is the fate of the nsidomwindow supporting the view they click on?
... or: what happens when they hit the 'back' button?
...the inner nsidomwindow (the global scope object in content js) is either thrown away when gc happens, or frozen and placed in the bfcache.
...And 2 more matches
Tamarin build documentation - Archive of obsolete content
$ make cppflags=-davmplus_verbose additional instructions for non-android cross-platform tamarin-redux build on osx 10.6 (snow leopard) (to build tamarin-central on mac please see previous cross-platform instructions here: https://developer.mozilla.org/index.php?title=en/tamarin/tamarin_build_documentation&revision=21 the bug when building on snow leopard (bug 537817) has been fixed in the tamarin-redux repo.
... alternatively, run make, in which case the process will complete with errors when it tries to create the shared lib crt0.o: $ /android-public/android-ndk/toolchains/arm-eabi-4.4.0/prebuilt/darwin-x86/bin/../lib/gcc/arm-eabi/4.4.0/../../../../arm-eabi/bin/ld: crt0.o: no such file: no such file or directory collect2: ld returned 1 exit status make[2]: *** [link_app.] error 1 make[1]: *** [openssl] error 2 make: *** [build_apps] error 1 you can ignore these errors.
...note that, whereas before when you selected the aggregate 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.
...And 2 more matches
Using XPInstall to Install Plugins - Archive of obsolete content
it can be a way to ensure a smooth user-experience when obtaining plugins, without obliging the user to exit the browsing environment to launch a binary installer (the classic setup.exe experience on windows) or obliging the user to restart their browser.
... the first install problem the first install problem refers to the conditions arising when a plugin arrives on a user's machine before a browser arrives.
...the plugin identifier (or plid) is a useful concept that is also applicable when initializing the installation via the initinstall api.
...And 2 more matches
execute - Archive of obsolete content
the optional blocking argument, when set to true, specifies that the installation should wait for this executable to finish before processing the next queued install command.
... if you do not set this flag and launch an executable that is not a part of the installation, you will raise an error when you restart the browser.
... passing arguments to the executable the args parameter, when present, passes a string to the executable as command-line parameters.
...And 2 more matches
Learn XPI Installer Scripting by Example - Archive of obsolete content
note also that when you call methods on the install--as you do so often in installation scripts (getfolder, initinstall, addfile, and performinstall are all examples of common install object methods)--the install object is implicit; like the window object in regular web page scripts, the install object does not need to be prefixed to the method.
... verifying the target the first thing the installation script does when it's executed is to check that there is adequate disk space for the software to be installed, where the verifydiskspace function is called as a condition of the main installation block that starts at line 24).
...in the example above, all of the contents of the "bin" directory in the archive are queued for installation, and the target of that installation (when the installation is actually begun with a call to performinstall at the end), is the communicatorfolder directory defined at line 22 as "program." "program" is one of a short list of keywords that can be used in place of full path names in methods such as addfile.
...And 2 more matches
Introduction to XUL - Archive of obsolete content
mozilla applications will be built of "small" components like dialog buttons and mail inbox folders, which we collectively term "widgets." within a widget, drawing and user interactions are completely under control of the individual widget, and set when the widget was built.
... applications, for instance, will have preconceived notions of what to do when they receive an "open file" command.
...p://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <broadcaster id="cangoback"/> <titledbutton src="resource:/res/toolbar/tb_back.gif" align="bottom" value="back" onclick="browserback()"> <observes element="cangoback" attribute="disabled"/> </titledbutton> </window> but it is up to the application code to locate the broadcasters within a window so it can punch them when necessary.
...And 2 more matches
Tooltips - Archive of obsolete content
when the mouse is moved again, the tooltip disappears.
...the result is that the toolbar's tooltip will apply when the mouse is moved over the close button, as well as when the mouse is over an empty part of the toolbar.
... note that when using a specialized tooltip element, any labels used inside it are not populated based on what the tooltip applies to, so you may need to set the content in a tooltip if you wish to use the same tooltip for several elements.
...And 2 more matches
Building Trees - Archive of obsolete content
there may be situations that call for this, typically when handling smaller amounts of data.
...when using the tree builder, the uri attribute must be declared on the treeitem element.
...when the tree is displayed, it asks the view for the contents of each cell.
...And 2 more matches
Static Content - Archive of obsolete content
this demonstrates how the template builder generates content, and the specifics of how this is done become important when dealing with recursive content and multiple rules.
...when processing the action body, the builder looks at the first element inside the action, in this case, the menupopup.
...if you were to change the static content to be some other element besides a menupopup, it won't match, so the builder will create a new one when handling the action.
...And 2 more matches
Template Builder Interface - Archive of obsolete content
« previousnext » when inserting an element into a xul document, the element is checked to see if it has a datasources attribute.
...the processes of creating a builder for an element applies both when an element is created when the window is loaded and when an element is inserted dynamically.
...since templates were designed for creating xul content, sometimes there can be unusual results when using html.
...And 2 more matches
Custom Tree Views - Archive of obsolete content
this is necessary when the page has a lot of data or that data is highly nested.
...you might also implement a custom view when you want to perform computations on the data to be displayed.
... since the view can store and retrieve the data in the most suitable manner for the kind of data used, the tree can be used even when there are hundreds of thousands of rows to be displayed.
...And 2 more matches
Manifest Files - Archive of obsolete content
the manifest files in the chrome directory will be examined when a mozilla application starts up to see what packages are installed.
...however, when distributing an application or extension, you will want to package them into an archive to avoid having to install lots of smaller files.
...this may be done when creating an extension such that all of the parts are in one file.
...And 2 more matches
Manipulating Lists - Archive of obsolete content
although listboxes may be manipulated using the standard dom functions as well, it is recommended that the specialized listbox functions be used instead when possible.
... getting the selected item these two properties are commonly inspected during a select event, as in the following example: example 2 : source view <listbox id="thelist" onselect="alert(this.selecteditem.label);"> <listitem label="short"/> <listitem label="medium"/> <listitem label="tall"/> </listbox> the select event is fired for a listbox when an item in the list is selected.
... the select event is also fired when a radio button in a radiogroup is selected and when a tab is selected in a tabs element.
...And 2 more matches
More Menu Features - Archive of obsolete content
this works because the menu element is valid even when it isn't directly placed inside a menu bar.
...the three dots after open search and save search are the usual way that you indicate to the user that a dialog will open when selecting the command.
...when the user selects the menu, the check state is switched.
...And 2 more matches
Numeric Controls - Archive of obsolete content
other numeric textbox attributes the increment attribute may be used to specify by how much the value changes when the arrows are pressed.
...a scale will fire a change event whenever the scales's value is modified.
...a numeric textbox would normally be used when the value was important to the user, for instance, a field to enter a number of days, or the maximum size of a file.
...And 2 more matches
Tabboxes - Archive of obsolete content
it is useful in cases when you have more options than will fit in one screen.
... when determining the size of the tabbox, the size of the largest page is used.
...the area taken up by the tab area does not change when the user switches to a new tab page.
...And 2 more matches
Templates - Archive of obsolete content
we'll see more about this when we get to creating templates for trees.
... example 3 : source <vbox datasources="rdf:bookmarks" ref="nc:bookmarksroot" flex="1"> <template> <label uri="rdf:*" value="rdf:http://home.netscape.com/nc-rdf#name rdf:http://home.netscape.com/nc-rdf#url"/> </template> </vbox> how templates are built when an element has a datasources attribute, it indicates that the element is expected to be built from a template.
...when this attribute is present, an object called a builder is added to the element which is responsible for building the content from the template.
...And 2 more matches
Trees - Archive of obsolete content
ArchiveMozillaXULTutorialTrees
when it comes time to display a cell, the tree widget will call out to this tree view to determine what to display, which in turn will be drawn by the tree.
...this allows more flexibility when using trees.
...for most trees, especially when you first start to use trees, you will use one of these built-in types.
...And 2 more matches
XUL Structure - Archive of obsolete content
when you type the url of an html page into the browser's address field, the browser locates the web site and downloads the content.
...when the user downloads the zipped file, the packaged files will be installed onto the user's machine.
...it is important to note that when accessing content through a chrome url, it gains the enhanced privileges described above that other kinds of urls do not.
...And 2 more matches
listbox - Archive of obsolete content
this attribute only has any effect when used inside a prefwindow.
... suppressonselect type: boolean if this attribute is not specified, a select event is fired whenever an item is selected, either by the user or by calling one of the select methods.
...the tab order is the order in which the focus is moved when the user presses the "tab" key.
...And 2 more matches
Creating XULRunner Apps with the Mozilla Build System - Archive of obsolete content
in addition, builds are faster when you include all makefiles in this file since they can be generated with a single shell invocation.
...default-prefs.js - these are the default mozilla preferences used by xulrunner when running your app.
...macbuild/ - when steve jobs said "think different", we took that to heart, and not just by rejecting useless adverbial endings.
...And 2 more matches
Debugging a XULRunner Application - Archive of obsolete content
/* debugging prefs */ pref("browser.dom.window.dump.enabled", true); pref("javascript.options.showinconsole", true); pref("javascript.options.strict", true); pref("nglayout.debug.disable_xul_cache", true); pref("nglayout.debug.disable_xul_fastload", true); don't forget to change these preferences back to their defaults when you've finished debugging; leaving them as-is can significantly harm performance and usability.
...make it call start_venkman() when activated.
... troubleshooting x-jsd is not a registered protocol if the message "x-jsd is not a registered protocol" appears when trying to open *.js files in venkman, then add an empty file called .autoreg in the same directory as your xulrunner binary.
...And 2 more matches
mozilla.dev.platform FAQ - Archive of obsolete content
0x00016b50 in xre_createappdata () a: when you <tt>--disable-libxul</tt>, the xpcom glue doesn't have information about how to load all the dependent libraries like <tt>libgfx.dylib</tt>.
... in order to use xr successfully in <tt>--disable-libxul</tt> mode, you have to setup dyld_library_path to include <tt>/library/frameworks/xul.framework/versions/1.9a1</tt> - benjamin smedberg, fri, oct 20 2006 9:12 am q: when i try to build a completely standalone xul app on os x (10.4.8).
...it works fine when the xul.framework is installed in /library/frameworks.
...And 2 more matches
Mozilla release FAQ - Archive of obsolete content
when was mozilla released?
...the current arrangement between netscape (aol) and the mozilla project is that mozilla develops its own releases, and when netscape (aol) is preparing to make a release, it takes the current version of mozilla, makes modifications, and does its own qa.
...take this into consideration when posting things) ftp see the mozilla ftp mirror section for ftp sites under which license terms was mozilla released?
...And 2 more matches
2006-11-03 - Archive of obsolete content
summary: mozilla.dev.builds - october 28th to november 3rd 2006 no such file or directory (build problem on winxp) november 2nd: kenoa complained that when he is compiling using cygwin on win32 he gets the following error no such file or directory1: /cygdrive/c/mozilla/mail/config/mozconfig client.mk:339: /cygdrive/c/mozilla/.mozconfig.mk: no such file or directory he claims that the file ".mozconfig" exists in /cygdrive/c/mozilla/mail/config/mozconfig the disable-crypto cause problem originally posted on november 2nd: gxk is building minimo using the code base from sept.
... when he builds using the disable.crypto option he encounters the following problem: no rule to make target `../../dist/lib/components/libpipboot.a', needed by `minimo'.
... problem compiling with vs 2003 .net phil is trying to compile firefox for the first time and is getting an error when doing so: building deps for /cygdrive/c/mozilla/toolkit/airbag/airbag/src/common/windows/guid_string.cc make[1]: leaving directory `/cygdrive/c/mozilla/obj-i686-pc-cygwin' make: *** [build] error 2 he also noted that he is using make 3.80-1.
...And 2 more matches
NPP_NewStream - Archive of obsolete content
description npp_newstream notifies the plug-in when a new stream is created.
...the browser calls npp_destroystream when the stream completes (either successfully or abnormally).
...when the stream is complete, the browser calls npp_streamasfile to deliver the path of the file to the plug-in.
...And 2 more matches
-ms-scroll-chaining - Archive of obsolete content
the -ms-scroll-chaining css property is a microsoft extension that specifies the scrolling behavior that occurs when a user hits the scroll limit during a manipulation.
...the nearest scrollable parent element begins scrolling when the user hits a scroll limit during any manipulation.
... none a bounce effect is shown when the user hits a scroll limit during any manipulation.
...And 2 more matches
::-ms-check - Archive of obsolete content
op 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.
... */ color: red; /* this will make the circle 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.
...And 2 more matches
Displaying notifications (deprecated) - Archive of obsolete content
for example, on android, notifications appear in the bar at the top of the screen, and in the panel that appears when you drag that bar downward.
...this lets you configure the event listeners before the notification is shown, if you need to be notified when the notification is dismissed.
... setting up event listeners on the notification there are two events you can listen to on created notifications: onclick this event is fired when the user clicks (or taps) on the notification.
...And 2 more matches
Old Proxy API - Archive of obsolete content
if a derived trap is implemented, then that trap's code is called whenever the corresponding behavior happens on the proxy.
... derived traps default implementation refers to the code that is called for that trap when the trap isn't explicitly defined.
... typeof typeof anobjectproxy === "object" typeof afunctionproxy === "function" instanceof anobjectproxy instanceof c === true if and only if the prototype with which anobjectproxy was initialized equals or inherits from c.prototype afunctionproxy instanceof function === true common mistakes and misunderstanding when starting using proxies, there are often a few beginners' mistakes and misunderstandings: not implementing all traps.
...And 2 more matches
Writing JavaScript for XHTML - Archive of obsolete content
(rather than displaying content, it would present the user with a file download dialog.) but it is also founded in the experience that javascript, authored carefully for html, can break when placed with an xml environment.
...the code looks something like this: <script type="text/javascript"> //<!-- window.alert("hello world!"); //--> </script> solution: the cdata trick this problem usually arises, when inline scripts are included in comments.
... solution: use dom methods many people avoided dom methods because of the typing to create one simple element, when document.write() worked.
...And 2 more matches
Fixing Table Inheritance in Quirks Mode - Archive of obsolete content
summary: when in quirks mode, gecko-based browsers will appear to ignore inheritance of font styles into tables from parent elements.
... tables and inheritance in css terms, tables are like any other element when it comes to inheritance.
...this represented a violation of css inheritance rules, and led many authors to create workarounds such as: <style type="text/css"> body, table, td {font-size: 11px;} </style> recreating legacy behavior to avoid "breaking" older pages that were authored with old-browser behaviors in mind, mozilla and related browsers will mimic old browsers when in "quirks" mode.
...And 2 more matches
The Business Benefits of Web Standards - Archive of obsolete content
improved user experience: less bandwidth and fast loads html code is often much more compact (therefore easier to read and maintain) when used in conjunction with css.
...this translates into better user experience, according to usability guru jakob nielsen, who notes that users tend to close a web page when it takes more than 10 seconds to load.
...increasingly one person may need to acccess the same site using different platforms at home, in the office and when travelling.
...And 2 more matches
Implementing game control mechanisms - Game development
streamlining cross device differences creates multiple challenges, not least when providing appropriate controls for different contexts.
... captain rogers was created using the phaser framework, the most popular tool for simple 2d game development in javascript right now, but it should be fairly easy to reuse the knowledge contained within these articles when building games in pure javascript or any other framework.
...} it will be created once at the start of the game, and will execute this.clickenclave() action assigned to it when clicked, but you can also use the mouse's pointer value in the update() function to make an action: update: function() { // ...
...And 2 more matches
Implementing controls using the Gamepad API - Game development
when you connect the controller, the game significantly changes (hungry fridge turns into the super turbo hungry fridge) and you're able to control the armored fridge using the gamepad api.
...the first one is fired when the browser detects the connection of a new gamepad while the second one is fired when a gamepad is disconnected (either physically by the user or due to inactivity.) in the demo, the gamepadapi object is used to store everything related to the api: var gamepadapi = { controller: {}, turbo: false, connect: function() {}, disconnect: function() {}, update: function() {}, buttonpressed...
... the index variable is useful if we're connecting more than one controller and want to identify them to act accordingly — for example when we have a two-player game requiring two devices to be connected.
...And 2 more matches
Tiles and tilemaps overview - Game development
when it's time to draw a tile, only a small section of this bigger image is rendered on the game canvas.
...this index is perfect to use as the tile identifier when creating the tilemap object.
... one simple technique consists of pre-rendering the map in a canvas on its own (when using the canvas api) or on a texture (when using webgl), so tiles don't need to be re-drawn every frame and rendering can be done in just one blitting operation.
...And 2 more matches
CORS - MDN Web Docs Glossary: Definitions of Web-related terms
access-control-allow-credentials indicates whether or not the response to the request can be exposed when the credentials flag is true.
... access-control-allow-headers used in response to a preflight request to indicate which http headers can be used when making the actual request.
... access-control-allow-methods specifies the method or methods allowed when accessing the resource in response to a preflight request.
...And 2 more matches
Advanced styling effects - Learn web development
when the button is pressed in, the active state causes the first box shadow to be swapped for a very dark inset shadow, giving the appearance of the button being pressed in.
... blend modes css blend modes allow us to add blend modes to elements that specify a blending effect when two elements overlap — the final color shown for each pixel will be the result of a combination of the original pixel color, and that of the pixel in the layer underneath it.
...it's especially useful when working with an image which has some white-space you might want to float text around.
...And 2 more matches
CSS selectors - Learn web development
there are a wide variety of css selectors available, allowing for fine-grained precision when selecting elements to style.
... when you group selectors in this way, if any selector is invalid the whole rule will be ignored.
... h1 { color: blue; } ..special { color: blue; } when combined however, neither the h1 nor the class will be styled as the entire rule is deemed invalid.
...And 2 more matches
Beginner's guide to media queries - Learn web development
previous overview: css layout next the css media query gives you a way to apply css only when the browser and device environment matches a rule that you specify, for example "viewport is wider than 480 pixels".
...it will not apply when the page is loaded in a browser.
... a standard desktop view has a landscape orientation, and a design that works well in this orientation may not work as well when viewed on a phone or tablet in portrait mode.
...And 2 more matches
create fancy boxes - Learn web development
it starts to get interesting when you push the properties to the limit by having negative padding and/or- margin by having border-radius larger than the actual size of the box.
... if it's not a square, we'll get an ellipsis rather than a circle ;) */ width : 4em; height : 4em; /* and let's turn the square into a circle */ border-radius: 100%; } yes, we get a circle: backgrounds when we talk about a fancy box, the core properties to handle that are background-* properties.
... when you start fiddling with backgrounds it's like your css box is turned into a blank canvas you'll fill.
...And 2 more matches
How to structure a web form - Learn web development
using correct structure when building an html form will help ensure that the form is both usable and accessible.
... when reading the above form, a screen reader will speak "fruit juice size small" for the first widget, "fruit juice size medium" for the second, and "fruit juice size large" for the third.
...this is the most important element if you want to build accessible forms — when implemented properly, screenreaders will speak a form element's label along with any related instructions, as well as it being useful for sighted users.
...And 2 more matches
How the Web works - Learn web development
previous overview: getting started with the web how the web works provides a simplified view of what happens when you view a webpage in a web browser on your computer or phone.
...when a client device wants to access a webpage, a copy of the webpage is downloaded from the server onto the client machine to be displayed in the user's web browser.
...when you type a web address in your browser, the browser looks at the dns to find the website's real address before it can retrieve the website.
...And 2 more matches
Getting started with the Web - Learn web development
installing basic software when it comes to tools for building a website, there's a lot to pick from.
...when you're building a website, you need to assemble these files into a sensible structure and make sure they can talk to one another.
...some examples could be games, things that happen when buttons are pressed or data is entered in forms, dynamic styling effects, animation, and much more.
...And 2 more matches
Advanced text formatting - Learn web development
(textarea.selectionend, textarea.value.length); textarea.value = front + text + back; caretpos = caretpos + text.length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to save the state when the user code is being shown, // not the solution, so that solution is not saved over the user code if(solution.value === 'show solution') { userentry = textarea.value; } else { solutionentry = textarea.value; } updatecode(); }; quotations html also has features available for marking up quotations; which element you use depends on whether you are marking up a block or inli...
...(textarea.selectionend, textarea.value.length); textarea.value = front + text + back; caretpos = caretpos + text.length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to save the state when the user code is being shown, // not the solution, so that solution is not saved over the user code if(solution.value === 'show solution') { userentry = textarea.value; } else { solutionentry = textarea.value; } updatecode(); }; abbreviations another fairly common element you'll meet when looking around the web is <abbr> — this is used to wrap around an abbreviation or a...
...d 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.
...And 2 more matches
Adding vector graphics to the Web - Learn web development
previous overview: multimedia and embedding next vector graphics are very useful in many circumstances — they have small file sizes and are highly scalable, so they don't pixelate when zoomed in or blown up to a large size.
...popular web raster formats include bitmap (.bmp), png (.png), jpeg (.jpg), and gif (.gif.) vector images are defined using algorithms — a vector image file contains shape and path definitions that the computer can use to work out what the image should look like when rendered on the screen.
... the difference becomes apparent when you zoom in the page — the png image becomes pixellated as you zoom in because it contains information on where each pixel should be (and what color).
...And 2 more matches
Images in HTML - Learn web development
essentially, the key is to deliver a usable experience, even when the images can't be seen.
...(textarea.selectionend, textarea.value.length); textarea.value = front + text + back; caretpos = caretpos + text.length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to save the state when the user code is being shown, // not the solution, so that solution is not saved over the user code if(solution.value === 'show solution') { userentry = textarea.value; } else { solutionentry = textarea.value; } updatecode(); }; annotating images with figures and figure captions speaking of captions, there are a number of ways that you could add a caption to go with your i...
...for example, when you have 50 images and captions, which caption goes with which image?
...And 2 more matches
Solve common problems in your JavaScript code - Learn web development
the following links point to solutions to common problems you may encounter when writing javascript.
... running code after a return statement remember also that when you return from a function, the javascript interpreter exits the function — no code after the return statement will run.
... object notation versus normal assignment when you assign something normally in javascript, you use a single equals sign, e.g.: const mynumber = 0; with objects, however, you need to take care to use the correct syntax.
...And 2 more matches
Working with JSON - Learn web development
json exists as a string — useful when you want to transmit data across a network.
... it needs to be converted to a native javascript object when you want to access the data.
...we only need the two mandatory ones for this simple example: the http method to use when making the network request.
...And 2 more matches
Object-oriented JavaScript for beginners - Learn web development
from our person class, we can now create some actual people: when an object instance is created from a class, the class's constructor function is run to create it.
...notice also the this keyword being used here as well — it is basically saying that whenever one of these object instances is created, the object's name property will be equal to the name value passed to the constructor call, and the greeting() method will use the name value passed to the constructor call too.
...you can now see that we have two new objects on the page, each of which is stored under a different namespace — when you access their properties and methods, you have to start calls with person1 or person2; the functionality contained within is neatly packaged away so it won't clash with other functionality.
...And 2 more matches
Ember resources and troubleshooting - Learn web development
both of these files are generated with sourcemaps, so when you open the vendor.js or {app-name}.js to search for relevant code, when a debugger is placed, the sourcemap will be loaded and the breakpoint will be placed in the pre-transpiled code for easier correlation to your project code.
... mut was not covered in this tutorial and is really baggage from a transitional time when ember was moving from two-way bound data to the more common and easier-to-reason-about one-way bound data flow.
... a route represents part of the url when a user navigates from place to place in the app.
...And 2 more matches
React interactivity: Editing, filtering, conditional rendering - Learn web development
add the following line just inside the top of your todo(props) { … } component definition: const [isediting, setediting] = usestate(false); next, we're going to rethink the <todo /> component — from now on, we want it to display one of two possible “templates", rather than the single template it's used so far: the "view" template, when we are just viewing a todo; this is what we’ve used in rest of the tutorial so far.
... the "editing" template, when we are editing a todo.
...to start with, we want to call setediting() with a value of true when a user presses the "edit" button in our viewtemplate, so that we can switch templates.
...And 2 more matches
Git and GitHub - Learn web development
overview vcses are essential for software development: it is rare that you will work on a project completely on your own, and as soon as you start working with other people you start to run the risk of conflicting with each other's work — this is when both of you try to update the same piece of code at the same time.
... when working on a project on your own or with others, you'll want to be able to back up the code in a central place, so it is not lost if your computer breaks.
... different team members will commonly want to create their own separate versions of the code (called branches in git), work on a new feature in that version, and then get it merged in a controlled manner (in github we use pull requests) with the master version when they are done with it.
...And 2 more matches
Introducing a complete toolchain - Learn web development
finally, it can help you undo changes or revert your code back to a time "when it was working" if a mistake has been introduced somewhere and you are having trouble fixing it — something all developers need to do once in a while!
... as with other tools, code editor integration support is typically good for eslint, and potentially more useful as it can give us real-time feedback when issues crop up: configuring the initial project using these tools, a new project can be set up safe in the knowledge that many "basic" issues will be caught early on.
...keeping them as separate dependencies reduces any unnecessary work when deploying to production (which we will look at in the next chapter).
...And 2 more matches
Accessibility API cross-reference
command a supporting section of the document, designed to be complementary to the main content at a similar level in the dom hierarchy, but remains meaningful when separated from the main content.
... contentinfo <footer> page footers are often tagged as an artifact (not "real" content) with the 'contentinfo' provided as document level xmp metadata instead the mouse pointer - when and how is this used?
...ion of window titlebar n/a n/a <title> a button that can be pushed in or out, but doesn't provide separate indicator of checked state n/a toggle_button toggle_button button with aria-pressed attribute a toolbar toolbar tool_bar tool_bar toolbar the little piece of help text that comes up when you put your mouse over something tooltip tool_tip tool_tip tooltip a grid whose rows can be expanded and collapsed in the same manner as for a tree.
...And 2 more matches
Command line options
you can also control how mozilla applications open, which components open initially, and what the components do when they open.
...also when using this argument a new instance is created in any case.
... firefox www.mozilla.com firefox www.mozilla.com developer.mozilla.org note: when opening multiple urls, firefox always opens them as tabs in a new window.
...And 2 more matches
Configuring Build Options
this will also help when troubleshooting because people will want to know which build options you have selected and will assume that you have put them in your mozconfig file.
... parallel compilation note: the build system automatically makes an intelligent guess for how many cpu cores to use when building.
...this can significantly slow a build, but it is invaluable when writing patches.
...And 2 more matches
Performance
but care must be taken to not leak references to the frame script global when it is passed into a jsm.
... alternatively the frame's unload event or weak maps can be used to ensure that frames can be cleaned up when their respective tab is closed.
...ner("my-addon:paragraph-count", callback) decoratebutton(button, message.data.num) } tabmm.addmessagelistener("my-addon:paragraph-count", callback); tabmm.loadframescript("data:,sendasyncmessage('my-addon:paragraph-count', {num: content.document.queryselectorall('p').length})", false) } function decoratebutton(button, count) { // do stuff with result } this executes the script only when it is needed and only in one tab and allows it to be garbage-collected immediately after execution.
...And 2 more matches
Implementing QueryInterface
// ...but that won't matter when someone calls me wrongly in a non-debug build.
... it addrefs the resulting interface, not this, thus following the com-correct way (particularly important in aggregation) 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 clears the result, *ainstanceptr, when returning an error.
...And 2 more matches
AddonManager
update check reasons constant description update_when_user_requested an update check performed at the explicit request of the user.
... update_when_new_app_detected an update check performed when a new version of the application has been detected.
... update_when_new_app_installed an update check performed after a new version of the application has been installed.
...And 2 more matches
UpdateListener
method overview void oncompatibilityupdateavailable(in addon addon) void onnocompatibilityupdateavailable(in addon addon) void onupdateavailable(in addon addon, in addoninstall install) void onnoupdateavailable(in addon addon) void onupdatefinished(in addon addon, in integer error) methods oncompatibilityupdateavailable() called when the update check found compatibility information for the application and platform version that the update check was being performed for.
... void oncompatibilityupdateavailable( in addon addon ) parameters addon the addon that was being checked for updates onnocompatibilityupdateavailable() called when the update check found no new compatibility information for the application and platform version that the update check was being performed for.
... void onnocompatibilityupdateavailable( in addon addon ) parameters addon the addon that was being checked for updates onupdateavailable() called when a new version of an add-on has been found for install.
...And 2 more matches
NetUtil.jsm
both streams are automatically closed when the copy operation is completed.
... acallback an optional function that will be called when the copy operation is completed.
... acallback a function that will be called when the open operation is completed.
...And 2 more matches
OS.File for the main thread
when opening files for writing, they will be opened for appending unless you specify append: false in gecko 27 and later.
...when you are done with it, like in shutdown of restartless add-on, you should close the file so it becomes editable again.
... let options = { winshare: 0 // exclusive lock on windows }; if (os.constants.libc.o_exlock) { // exclusive lock on *nix options.unixflags = os.constants.libc.o_exlock; } let file = yield os.file.open(..., options); then when you want to unlock the file so it can be edited from other places, close the file.
...And 2 more matches
What every Mozilla translator should know
to keep the track of what's going on, it's also a good idea to read the planet mozilla l10n when you have a problem use the above mailing lists the person in charge of the mozilla l10n is axel hecht (l10n at mozilla.com), pike on irc another interesting way of getting help is the irc channel #l10n at irc.mozilla.org useful tools the l10n dashboard pontoon narro translate toolkit koala 0.1 mozillatranslator mercurial the hg is organized into several repositories, sometimes c...
...when a development is started for an specific version, a new repository is created under hg.mozilla.org/releases/.
... when you create a bug, if you want the person in charge of the l10n to follow up your bug you should cc: l10n@mozilla.com if you choose to make changes to your localization, you should make the changes local to your disk, push them to your hg repository on merucial, test the changes on a nightly/tinderbox build, fix any errors if some are found and test again, and send the new changeset id as your "o...
...And 2 more matches
Mozilla Style System Documentation
style context management a style context (class nsstylecontext, currently also interface nsistylecontext although the interface should go away when all of the style systems can be moved back into the layout dll) represents the style data for a css formatting object.
... style contexts and the rule tree when the style system creates a style context, it walks through the style sheets (interface nsistylesheet) attached to a document in the order defined by the css cascade and finds the style rules (interface nsistylerule) thatmatch the content node or content node + pseudo-element pair.
...for those structs where all the values are inherited by default, a style context can often (when none of the rules matched by the style context specifies any properties in the struct, or when explicit inherit is used) use the same struct as its parent style context.
...And 2 more matches
Activity Monitor, Battery Status Menu and top
using the high-performance gpu can greatly increase power consumption, and should be avoided whenever possible.
... when the energy tab of activity monitor is first opened, the "average energy impact" column is empty and the title bar says "activity monitor (processing...)".
...if a laptop is closed for several hours and then reopened, those hours are not included in the calculation.) battery status menu when you click on the battery icon in the os x menu bar you get a drop-down menu that includes a list of “apps using significant energy”.
...And 2 more matches
Reporting a Performance Problem
visit https://profiler.firefox.com/ click on "enable profiler menu button" the profiler toolbar button will show up in the top right of the url bar as a small stopwatch icon you can right-click on the button and remove it from the toolbar when you're done with it.
... using the profiler when enabled, the profiler toolbar button is not recording by default.
...the toolbar icon turns blue when it is recording.
...And 2 more matches
FIPS Mode - an explanation
nss has a "fips mode" that can be enabled when nss is compiled in a specific way.
... to that end, mozilla products can function in a "fips mode", which is really "fips 140 mode", when paired with a compliant copy of nss.
... fips 140-3 is being devised by nist now for adoption in the future.) users who are subject to the fips regulations must ensure that they have mozilla's fips mode enabled when they use mozilla software, in order to be fully conformant.
...And 2 more matches
JSS Provider Notes
at runtime, the jre automatically verifies this signature whenever a jss class is loaded that implements a jce algorithm.
...when you call getinstance() on a jca class, the jss provider checks the current per-thread default token (by calling cryptomanager.getthreadtoken()) and instructs the new object to use that token for cryptographic operations.
... whenever a new thread is created, its token is initialized to the default, the internal key storage token.
...And 2 more matches
Mozilla-JSS JCA Provider notes
at runtime, the jre automatically verifies this signature whenever a jss class is loaded that implements a jce algorithm.
...when you call getinstance() on a jca class, the jss provider checks the current per-thread default token (by calling cryptomanager.getthreadtoken()) and instructs the new object to use that token for cryptographic operations.
...whenever a new thread is created, its token is initialized to the default, the internal key storage token.
...And 2 more matches
NSS Memory allocation
when a plarenapool is freed, all the arenas in that pool are put on an arena free list.
... when nss attempts to allocate more memory for an arena pool, the plarenapool code attempts to use an arena from its free list, and only gets a new arena from the heap if there are no arenas in the free list that are large enough to satisfy the request.
...when the arena free list is in use, the first user of an arena will allocate it from the heap, but will then free it to the free list.
...And 2 more matches
NSS 3.14 release notes
such changes may present interoperability concerns when enabling tls 1.1.
... when connecting to a server, the record layer version of the initial clienthello will be at most { 3, 1 } (tls 1.0), even when attempting to negotiate tls 1.1 (https://bugzilla.mozilla.org/show_bug.cgi?id=774547) the choice of client_version sent during renegotiations has changed.
... support for application-defined certificate chain validation callback when using libpkix to better support per-application security policies, a new callback has been added for applications that use libpkix to verify certificates.
...And 2 more matches
pkfnc.html
when you are finished with the certificate structure returned by pk11_findcertfromnickname, you must free it by calling cert_destroycertificate.
... description when you are finished with the private key structure returned by pk11_findkeybyanycert, you must free it by calling seckey_destroyprivatekey.
... pk11_setpasswordfunc defines a callback function used by the nss libraries whenever information protected by a password needs to be retrieved from the key or certificate databases.
...And 2 more matches
sslerr.html
it is a generic error, used when none of the other more specific error codes defined in this file applies.
...it is a generic error, used when none of the other more specific error codes defined in this file applies.
...ng_certificate -12277 "client authentication failed: private key in key database does not correspond to public key in certificate database." ssl_error_bad_cert_domain -12276 "unable to communicate securely with peer: requested domain name does not match the server's certificate." this error code should be returned by the certificate authentication callback function when it detects that the common name in the remote server's certificate does not match the hostname sought by the local client, according to the matching rules specified for cert_verifycertname.
...And 2 more matches
GC Rooting Guide
a js::handle<t> is a reference to a js::rooted<t>, and is created implicitly by referencing a js::rooted<t>: it is not valid to create a js::handle<t> manually (the whole point of a handle is that it only reference pointers that the gc knows about so it can update them when they move).
... } return obj; } autorooters gc thing pointers that appear as part of a stack-allocated aggregates (array, structure, class, union) should use js::rooted<t> when possible.
... there are some situations when using js::rooted<t> is not possible, or is undesirable for performance reasons.
...And 2 more matches
Functions
when the function object is created, its parent is set to the first object on the scope chain.
... when a name is evaluated that doesn't refer to a local variable, the interpreter consults the scope chain to find the variable.
... when with or eval are used, we have to do this for correctness.
...And 2 more matches
Invariants
(we don't bother locking when accessing slots of a sealed object.
... when a new object is created, it is automatically created in cx->compartment, but its parent and prototype are often determined by examining the scope chain.
... however, there is another internal api, js::switchtocompartment, that lets you break this invariant, and of course in xpconnect we use that from time to time when we know we aren't going to be creating any new objects (other than global objects, which have no parent or prototype) or doing anything that might call back into native code that could create objects.
...And 2 more matches
JSAPI Cookbook
note: the foss wiki page contains a few links to other libraries and programs that can make life easier when using spidermonkey and jsapi.
... // javascript throw exc; /* jsapi */ js_setpendingexception(cx, exc); return false; when js_reporterror creates a new error object, it sets the filename and linenumber properties to the line of javascript code currently at the top of the stack.
...when an error occurs, the jscontext's pending exception is set.
...And 2 more matches
SpiderMonkey 1.8.5
embedders must be careful when converting numbers from jsvals into c.
...bug 614138 introduces a c++ js::anchor<> template class to help tie lexical scope to the conservative gc for cases where the compiler might optimize away important stack/register roots (such as when we access the jschars in a jsstring).
...strings js_comparestrings received a new function signature with bug 609440, allowing us to correctly propagate exceptions when the underlying functions to retrieve the characters in the string failed.
...And 2 more matches
SpiderMonkey 1.8.7
embedders must be careful when converting numbers from jsvals into c.
...bug 614138 introduces a c++ js::anchor<> template class to help tie lexical scope to the conservative gc for cases where the compiler might optimize away important stack/register roots (such as when we access the jschars in a jsstring).
...strings js_comparestrings received a new function signature with bug 609440, allowing us to correctly propagate exceptions when the underlying functions to retrieve the characters in the string failed.
...And 2 more matches
Handling Mozilla Security Bugs
thus someone reporting a security bug essentially becomes a member of the overall group of people working to investigate and fix that particular vulnerability, and anyone else may be easily invited to assist as well, if and when it makes sense.
... when a bug is put into the security bug group, the group members, bug reporter, and others associated with the bug will decide by consensus, either through comments on the bug or the group mailing list, whether an immediate warning to users is appropriate and how it should be worded.
... the original reporter of a security bug may decide when that bug report will be made public.
...And 2 more matches
A Web PKI x509 certificate primer
one issue that is not commonly known is that the x509 trust graph is not a forest (a bunch of trees where each root is a trusted root) but a cyclic graph, where the same key/issuer can be a root or an intermediate for another root in the browsers key store (when roots create intermediates for each other it is called cross-signing).
...extensions can be marked as critical or non-critical, conforming certificate verification libraries should stop processing verification when encountering a critical extension that they do not understand ( and should continue processing if the extension is marked as non-critical) mozila::pkix has this behavior.
...self-sign csr (using sha256) and append the extensions described in the file "openssl x509 -req -sha256 -days 3650 -in example.csr -signkey key.pem -set_serial $any_integer -extfile openssl.ss.cnf -out example.pem" you can now use example.pem as your certfile cas included in firefox when you visit a secure website, firefox will validate the website’s certificate by checking that the certificate that signed it is valid, and checking that the certificate that signed the parent certificate is valid and so forth up to a root certificate that is known to be valid.
...And 2 more matches
Places utilities for JavaScript
its not an interface, and as such it will never be frozen, but it provides some easy to use functions that can save you from reinventing the wheel and cluttering up your own classes/functions when you need it.
... note: when adefaultinsertionpoint is not set, the dialog defaults to the bookmarks root folder.
... note: when adefaultinsertionpoint is not set, the dialog defaults to the bookmarks root folder.
...And 2 more matches
Using the Places annotation service
when the annotation name is "favicon," the annotation protocol handler will pass the request through to the favicon service for handling.
...it is important that you use these functions and not make up your own uris, because these functions will efficiently default to the default page favicon when it does not exist.
... lifetime of annotations annotation expiration can be explicitly stated when the annotation is created.
...And 2 more matches
XPCOM glue
MozillaTechXPCOMGlue
use this when you have a custom application where you want to embed gecko to show webpages in your own window.
...this linkage strategy is used when an embedder needs to bootstrap xpcom by finding a compatible gre on disk and loading it.
...however, when using threadsafe together with the glue libraries from gecko 1.8 or later, a special step needs to be taken to use ns_impl_threadsafe_isupportsn.
...And 2 more matches
Using XPCOM Components
« previousnext » one of the best ways to begin working with xpcom - especially when you are designing the interface to a component that will be used by others, as we do in starting weblock - is to look at how clients are already using xpcom components.
...whenever a user accesses the cookie manager dialog to view, organize, or remove cookies that have been stored on the system, they are using the cookiemanager component behind the scenes.
...when a user selects one of the cookies displayed in the list and then clicks the remove button, the remove method in the nsicookiemanager interface is called.
...And 2 more matches
Detailed XPCOM hashtable guide
when should i use a hashtable?
...note: because of the double-hashing implementation, entries may move in memory when the hashtable is altered.
... pldhashtables can be allocated on the stack or the heap: when allocated on the stack, or as a c++ class member, the table must be initialized using pl_dhashtableinit, and finalized using pl_dhashtablefinish; when allocated on the heap, use pl_newdhashtable and pl_dhashtabledestroy to allocate and delete the table.
...And 2 more matches
XPCOM Stream Guide
MozillaTechXPCOMGuideStreams
it is not that sequence of characters, though: the characters may not all be available when you read from the stream.
... stream listeners a stream listener is an object you build to let you know when there is data in a stream ready for you to consume.
...from the nsirequestobserver interface, the .onstartrequest(request, context) method tells you when the request begins, while the .onstoprequest(request, context) method tells you when the request ends.
...And 2 more matches
IAccessibleTable
in this case iaccessible2.indexinparent() will return the child index which then can be used when calling rowindex() and columnindex().
...when the table cells are not direct children of a table, the object representing the cell can define a "table-cell-index" object attribute identifying the 0 based table cell index.
...refer to @ref _arrayconsideration "special consideration when using arrays" for more details.
...And 2 more matches
mozISpellCheckingEngine
when this attribute's value is changed, a "spellcheck-dictionary-update" notification is sent.
... language wstring the language this spell checker is using when checking.
... when this changes, the spell checker sends a "spellcheck-dictionary-update" notification.
...And 2 more matches
nsIAutoCompleteInput
forcecomplete boolean if true, the text field automatically completes to the default result whenever the user hits the enter key or the text field loses focus.
...onsearchbegin() called when the search starts.
...onsearchcomplete() called when the search ends successfully.
...And 2 more matches
nsIBrowserHistory
alastvisited when the page was last visited, in microseconds since the unix epoch.
...it is called by the url bar when the user types in a url.
...the page itself is only deleted when it is not bookmarked and when it is not a place: uri.
...And 2 more matches
nsIDOMMouseScrollEvent
ctrlkeyarg true if the control key was down when the event occurred, otherwise false.
... altkeyarg true if the alt key was down when the event occurred, otherwise false.
... shiftkeyarg true if the shift key was down when the event occurred, otherwise false.
...And 2 more matches
nsIDownloadManager
toolkit/components/downloads/public/nsidownloadmanager.idlscriptable this interface lets applications and extensions communicate with the download manager, adding and removing files to be downloaded, fetching information about downloads, and being notified when downloads are completed.
... amimeinfo the mime information associated with the target; this may include mime type and helper application when appropriate.
...the file will be moved to the location indicated by atarget when the download is complete.
...And 2 more matches
nsIEditorSpellCheck
getnextmisspelledword() when interactively spell checking the document, this will return the value of the next word that is misspelled.
...returns an empty string when there are no more words.
...when there are no more suggestions, an empty string (not a null pointer) is returned.
...And 2 more matches
nsIHttpChannelInternal
this may throw an ns_error_not_available exception if accessed when the channel's endpoints haven't been determined yet, or any time the nsihttpactivityobserver.isactive attribute is false.
...this may throw an ns_error_not_available exception if accessed when the channel's endpoints haven't been determined yet, or any time the nsihttpactivityobserver.isactive attribute is false.
...this may throw an ns_error_not_available exception if accessed when the channel's endpoints haven't been determined yet, or any time the nsihttpactivityobserver.isactive attribute is false.
...And 2 more matches
nsIIOService
when in offline mode, attempts to access the network will fail (although this does not necessarily correlate with whether there is actually a network available -- that's hard to detect without causing the dialer to come up).
...this defaults to the principal of aloadingnode, so when aloadingnode is passed this can be left as null.
... this defaults to the principal of aloadingnode, so when aloadingnode is passed this can be left as null.
...And 2 more matches
nsILoginManager
called when only the number of logins is needed, and not the actual logins (which avoids prompting the user for a master password, as the logins don't need to be decrypted).
...to not match any form logins (for example when interested in protocol logins only), specify null.
...to not match any protocol logins (for example when interested in form logins only), specify null.
...And 2 more matches
nsILoginManagerStorage
ogin(in nsilogininfo oldlogin, in nsisupports newlogindata); void removealllogins(); void removelogin(in nsilogininfo alogin); void searchlogins(out unsigned long count, in nsipropertybag matchdata, [retval, array, size_is(count)] out nsilogininfo logins); void setloginsavingenabled(in astring ahost, in boolean isenabled); attributes attribute type description uibusy boolean true when a master password prompt is being shown.
...this method is called by the login manager when looking for saved logins that might apply to a form or authentication request.
...this is called by the browser sanitization feature when the user asks to clear all stored passwords.
...And 2 more matches
nsINavHistoryQueryOptions
asyncenabled boolean when true, the root container node generated by these options and all of its descendant containers are opened asynchronously if they support doing so.
... expandqueries boolean when set, allows items with "place:" uris to appear as containers, with the container's contents filled in from the stored query.
... querytype short the type of search to use when querying the db; this attribute is only honored by query nodes.
...And 2 more matches
nsINavHistoryResult
the result indicates to the view when something changes by using the nsinavhistoryresultviewer interface.
...the viewer provides notifications to the controller when view events occur; this is done using the nsinavhistoryresultviewobserver interface.
... when a result goes out of scope it will continue to observe changes till it is cycle collected.
...And 2 more matches
nsIScrollable
when passing this in to a method you are requesting or setting data for the horizontal scrollbar.
...when passing this in to a method you are requesting or setting data for the vertical scrollbar.
... constant value description scrollbar_auto 1 scrollbars visible only when needed.
...And 2 more matches
nsISocketTransportService
nsisockettransport createtransport(in array<acstring> asockettypes, in autf8string ahost, in long aport, in nsiproxyinfo aproxyinfo); void init(); obsolete since gecko 1.8 void notifywhencanattachsocket(in nsirunnable aevent); native code only!
...in this case, the notifywhencanattachsocket() method should be used.
... ahandler socket handler that will receive notifications when the socket is ready or detached.
...And 2 more matches
nsITaskbarPreviewController
methods drawpreview() invoked by nsitaskbarpreview when it needs to render the preview.
... drawthumbnail() invoked by the taskbar preview when it needs to draw the thumbnail in the taskbar's application preview window.
... onactivate() invoked when the user clicks on the tab preview.
...And 2 more matches
nsIWebBrowserPersist
this can only be used when persisting to a local file.
... encode_flags_preformatted 16 wrap even if when not doing formatted output (for example for text fields).
...this is used when converting to text for mail sending.
...And 2 more matches
nsIWindowMediator
this example below waits for listens to when a window opens, and then after that window opens it adds event listener to listen to when the window completes loading, after that it fires a function.
... native code only!updatewindowtimestamp call this method when a window gains focus.
... native code only!updatewindowtitle call this method when a window's title changes.
...And 2 more matches
nsIXMLHttpRequestEventTarget
content/base/public/nsixmlhttprequest.idlscriptable this interface provides access to the event listeners used when uploading data using the xmlhttprequest object.
... onload nsidomeventlistener a javascript function object that gets invoked when the operation is successfully completed.
... onloadend nsidomeventlistener a javascript function object that gets invoked when the operation is completed for any reason; it will always follow a an abort, error, or load event.
...And 2 more matches
nsIXULTemplateBuilder
this query processor is expected to use this query to generate results when asked by the template builder.
...when a result no longer matches, the result's hasbeenremoved() method must be called.
...when using multiple queries, each may generate results with the same id.
...And 2 more matches
Performance
when you execute a sql statement in isolation, an implicit transaction is created around that statement.
... when transactions are committed, sqlite does journaling which requires syncing data to disk.
...when data is deleted, the associated bytes are marked as free but are not removed from the file.
...And 2 more matches
Weak reference
when you hold an owning reference on an object (i.e., you have addrefed it), you are holding that object in existence for the duration of your reference.
... what is actually needed in this case, is either out-of-band signaling, where when the observer wants to go away, it unregisters itself from the observable, which then releases its owning reference, allowing the observer to die, or else a new kind of reference.
...when the referent is destroyed, the weak reference automatically becomes nsnull.
...And 2 more matches
Using the Multiple Accounts API
the ui will act slighty strange when you share information between accounts.
... appendix a: listing of all properties (when brendan's idldoc comes along, i'll just link to that) all preferences are strings, unless otherwise noted.
...use lsub instead of list) preference: mail.server.server.cleanup_inbox_on_exit - boolean, should we purge the inbox when we quit?
...And 2 more matches
Zombie compartments
when are compartments created?
... any compartments with the following forms are created by firefox for its own internal use, and can usually be ignored when looking for zombie 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.
...And 2 more matches
Set a logpoint - Firefox Developer Tools
the logpoint is especially useful in cases where breaking the execution breaks testing procedures, such as when you are debugging popup windows, or executing focus-related logic.
... working with logpoints when you set a logpoint, the indicator is purple, rather than the blue of an unconditional breakpoint or the orange of a conditional breakpoint.
... when execution hits a logpoint, the message you have defined is logged to the console.
...And 2 more matches
Network request list - Firefox Developer Tools
the mouse pointer changes to a resize icon when you move it over the border of a column.
...(click the icon again when you want to close the sidebar.) enter a string in the field with the placeholder text block resource when url contains.
... to delete a blocked item, click the x icon that appears when you focus the item.
...And 2 more matches
Responsive Design Mode - Firefox Developer Tools
note: the device you select when in responsive design mode and the orientation (portrait or landscape) is saved between sessions.
...(note that when touch simulation is enabled, this toolbar icon is blue; when simulation is disabled, it is black.
... on the right end of the screen, three buttons allow you to: camera button - take a screenshot settings button - opens the rdm settings menu close button - closes rdm mode and returns to regular browsing the settings menu includes the following commands: left-align viewport - when checked moves the rdm viewport to the left side of the browser window show user agent - when checked displays the user agent string the final two options define when the page is reloaded: reload when touch simulation is toggled: when this option is enabled, the page is reloaded whenever you toggle touch support.
...And 2 more matches
Cookies - Firefox Developer Tools
when you select an origin inside the cookies storage type from the storage tree, all the cookies present for that origin will be listed in a table.
... expires / max-age — the time when the cookie will expire.
... last accessed — date and time when the cookie was last read.
...And 2 more matches
View Source - Firefox Developer Tools
syntax highlighting (toggle) applies syntax highlighting to the code.when syntax highlighting is on, view source also highlights parsing errors in red.
... this feature is useful when you're looking for html errors.
... xml syntax highlighting view source uses the html tokenizer when highlighting xml source.
...And 2 more matches
Web Console Helpers - Firefox Developer Tools
if you don't supply a filename, the image file will be named with the following format: screen shot yyy-mm-dd at hh.mm.ss.png the command has the following optional parameters: command type description --clipboard boolean when present, this parameter will cause the screenshot to be copied to the clipboard.
... --dpr number the device pixel ratio to use when taking the screenshot.
... --file boolean when present, the screenshot will be saved to a file, even if other options (e.g.
...And 2 more matches
Web Console UI Tour - Firefox Developer Tools
settings ("gear" menu): new in firefox 71, you can click the gear icon to access the new settings menu, where you can toggle the following features on and off: persist logs: when enabled, the console doesn't clear on page reload, or new page load.
... show timestamps: when enabled, timestamps are shown on the left-hand side of each message row to say when the messages were logged.
... group similar messages: when enabled, similar types of messages are grouped together, with an indicator of the number of occurrences.
...And 2 more matches
Animation.ready - Web APIs
WebAPIAnimationready
the read-only animation.ready property of the web animations api returns a promise which resolves when the animation is ready to play.
... a new promise is created every time the animation enters the "pending" play state as well as when the animation is canceled, since in both of those scenarios, the animation is ready to be started again.
... since the same promise is used for both pending play and pending pause requests, authors are advised to check the state of the animation when the promise is resolved.
...And 2 more matches
Animation - Web APIs
WebAPIAnimation
animation.starttime gets or sets the scheduled time when an animation's playback should begin.
... animation.onremove allows you to set and run an event handler that fires when the animation is removed (i.e., put into an active replace state).
... animation.persist() explicitly persists an animation, when it would otherwise be removed due to the browser's automatically removing filling animations behavior.
...And 2 more matches
Using the CSS Typed Object Model - Web APIs
e following javascript: const allcomputedstyles = document.queryselector('button').computedstylemap(); the following examples reference allcomputedstyles: cssunparsedvalue the cssunparsedvalue represents custom properties: // cssunparsedvalue let unit = allcomputedstyles.get('--unit'); console.log( unit ) // cssunparsedvalue {0: " 1.2rem", length: 1} console.log (unit[0] ) // " 1.2rem" when we invoke get(), a custom property of type cssunparsedvalue is returned.
... when we get() the width, we get a cssmathsum returned.
...gth ); // 1 console.log( transform[0] ); // cssscale {x: cssunitvalue, y: cssunitvalue, z: cssunitvalue, is2d: true} console.log( transform[0].x ); // cssunitvalue {value: 0.95, unit: "number"} console.log( transform[0].y ); // cssunitvalue {value: 0.95, unit: "number"} console.log( transform[0].z ); // cssunitvalue {value: 1, unit: "number"} console.log( transform.is2d ); // true when we get() the transform property, we get a csstransformvalue.
...And 2 more matches
Cache.match() - Web APIs
WebAPICachematch
for example, if set to true the ?value=bar part of http://foo.com/?value=bar would be ignored when performing a match.
... ignoremethod: a boolean that, when set to true, prevents matching operations from validating the request http method (normally only get and head are allowed.) it defaults to false.
... ignorevary: a boolean that when set to true tells the matching operation not to perform vary header matching — i.e.
...And 2 more matches
CanvasRenderingContext2D.drawImage() - Web APIs
if not specified, the image is not scaled in width when drawn.
...if not specified, the image is not scaled in height when drawn.
...use .complete === true and .onload to determine when it is ready.
...And 2 more matches
Content Index API - Web APIs
serviceworkerglobalscope.oncontentdelete an event handler fired whenever a contentdelete event occurs.
... this happens when content is removed by the user agent.
...they are accessible from the workerglobalscope.self property: // service worker script self.registration.index.add(item); self.registration.index.delete(item.id); const contentindexitems = self.registration.index.getall(); contentdelete event when an item is removed from the user agent interface, a contentdelete event is received by the service worker.
...And 2 more matches
Element: mousedown event - Web APIs
the mousedown event is fired at an element when a pointing device button is pressed while the pointer is inside the element.
... when the page loads, constants mypics and context are created to store a reference to the canvas and the 2d context we will use to draw.
... drawing begins when the mousedown event fires.
...And 2 more matches
Element: mouseleave event - Web APIs
the mouseleave event is fired at an element when the cursor of a pointing device (usually a mouse) is moved out of it.
...this means that mouseleave is fired when the pointer has exited the element and all of its descendants, whereas mouseout is fired when the pointer leaves the element or leaves one of the element's descendants (even if the pointer is still within the element).
... one mouseleave event is sent to each element of the hierarchy when leaving them.
...And 2 more matches
Element: mousemove event - Web APIs
the mousemove event is fired at an element when a pointing device (usually a mouse) is moved while the cursor's hotspot is inside it.
... when the page loads, constants mypics and context are created to store a reference to the canvas and the 2d context we will use to draw.
... drawing begins when the mousedown event fires.
...And 2 more matches
Element: mouseout event - Web APIs
the mouseout event is fired at an element when a pointing device (usually a mouse) is used to move the cursor so that it is no longer contained within the element or one of its children.
...the mouseleave event is added to the <ul> to color the list purple whenever the mouse exits the <ul>.
... mouseout is added to the list to color the targeted element orange when the mouse exits it.
...And 2 more matches
Element: mouseup event - Web APIs
the mouseup event is fired at an element when a button on a pointing device (such as a mouse or trackpad) is released while the pointer is located inside it.
... when the page loads, constants mypics and context are created to store a reference to the canvas and the 2d context we will use to draw.
... drawing begins when the mousedown event fires.
...And 2 more matches
FileReader - Web APIs
abort fired when a read has been aborted, for example because the program called filereader.abort().
... error fired when the read failed due to an error.
... load fired when a read has completed successfully.
...And 2 more matches
Introduction to the File and Directory Entries API - Web APIs
sample use cases the following are just a few examples of how you can use the file and directory entries api: apps with persistent uploader when a file or directory is selected for upload, you can copy the file into a local sandbox and upload a chunk at a time.
... big concepts before you start using the file and directory entries api, you need to understand a few concepts: the file and directory entries api is a virtual representation of a file system the file and directory entries api can use different storage types browsers impose storage quota the file and directory entries api has asynchronous and synchronous versions when using the asynchronous api, always use the error callbacks the file and directory entries api interacts with other apis the file and directory entries api is case-sensitive the file and directory entries api is a virtual representation of a file system the api doesn't give you access to the local file system, nor is the sandbox really a section of the file system.
...temporary storage is easier to get, because the browser just gives it to you, but it is limited and can be deleted by the browser when it runs out of space.
...And 2 more matches
Frame Timing API - Web APIs
the observer (callback) will be notified when new "frame" events are added to the browser's performance timeline and the frame's duration (length of time) will be available.
... performanceentry.starttime set to the domhighrestimestamp when the frame was started.
...when one of those event types is recorded in the browser's performance timeline, the application is notified of the event via the observer's callback function that was specified when the observer was created.
...And 2 more matches
GlobalEventHandlers.ontransitionend - Web APIs
the transitionend event is sent to when a css transition completes.
... syntax var transitionendhandler = target.ontransitionend; target.ontransitionend = function value a function to be called when a transitionend event occurs indicating that a css transition has completed on the target, where the target object is an html element (htmlelement), document (document), or window (window).
... example in this example, we use the transitionrun and transitionend events to detect when the transition begins and ends, to cause a text update to occur during the transition.
...And 2 more matches
HTMLCanvasElement - Web APIs
when the attribute is not specified, or if it is set to an invalid value, like a negative, the default value of 150 is used.
...when the attribute is not specified, or if it is set to an invalid value, like a negative, the default value of 300 is used.
...web content can set this to a javascript function that will be called when the canvas is to be redrawn while the page is being printed.
...And 2 more matches
HTMLElement: input event - Web APIs
the input event fires when the value of an <input>, <select>, or <textarea> element has been changed.
... bubbles yes cancelable no interface inputevent event handler property globaleventhandlers.oninput the event also applies to elements with contenteditable enabled, and to any element when designmode is turned on.
... for <input> elements with type=checkbox or type=radio, the input event should fire whenever a user toggles the control, per the html5 specification.
...And 2 more matches
HTMLFormElement - Web APIs
when false is returned, cancelable invalid events are fired for each invalid child and validation problems are reported to the user.
...the form will receive an event once the user has finished with the interface, the event will either be autocomplete when the fields have been filled or autocompleteerror when there was a problem.
... reset the reset event fires when a form is reset.
...And 2 more matches
HTMLImageElement.loading - Web APIs
usage notes timing of the load event the load event is fired when the document has been fully processed.
... when images are loaded eagerly (which is the default), every image in the document must be fetched before the load event can fire.
...in other words, these images aren't loaded immediately when processing the <img> element, but are still loaded as part of the initial page load.
...And 2 more matches
HTMLImageElement.srcset - Web APIs
syntax htmlimageelement.srcset = imagecandidatestrings; let srcset = htmlimageelement.srcset; value a usvstring containing a comma-separated list of one or more image candidate strings to be used when determining which image resource to present inside the <img> element represented by the htmlimageelement.
...otherwise, the condition descriptor may take one of two forms: to indicate that the image resource specified by the image candidate string should be used when the image is being rendered with a particular width in pixels, provide a width descriptor comprised the number giving that width in pixels followed by the lower case letter "w".
... for example, to provide an image resource to be used when the renderer needs a 450 pixel wide image, use the width descriptor string 450w.
...And 2 more matches
HTMLInputElement.stepDown() - Web APIs
the method, when invoked, decrements the value by (step * n), where n defaults to 1 if not specified, and step defaults to the default value for step if not specified.
... <!-- decrements by intervals of 900 seconds (15 minute) --> <input type="time" max="17:00" step="900"> <!-- decrements by intervals of 7 days (one week) --> <input type="date" max="2019-12-25" step="7"> <!-- decrements by intervals of 12 months (one year) --> <input type="month" max="2019-12" step="12"> the method, when invoked, changes the form control's value by the value given in the step attribute, multiplied by the parameter, within the constraints set within the form control.
...the stepdown() method will not allow the input to go out of range, in this case stopping when it reaches 0 and rounding down and floats that are passed as a parameter.
...And 2 more matches
HTMLInputElement.stepUp() - Web APIs
the method, when invoked, increments the value by (step * n), where n defaults to 1 if not specified, and step defaults to the default value for step if not specified.
... (15 minute) increments: <input type="time" min="09:00" step="900"> datetime-local 1 (day) same day of the week: <input type="datetime-local" min="019-12-25t19:30" step="7"> number 1 0.1 increments <input type="number" min="0" step="0.1" max="10"> range 1 increments by 2: <input type="range" min="0" step="2" max="10"> the method, when invoked, changes the form control's value by the value given in the step attribute, multiplied by the parameter, within the constraints set on the form control.
...the stepup will not allow the input to out of range, in this case stopping when it reaches 400, and rounding down any floats that are passed as a parameter.
...And 2 more matches
HTMLMarqueeElement - Web APIs
event handlers htmlmarqueeelement.onbounce fires when the marquee has reached the end of its scroll position.
... it can only fire when the behavior attribute is set to alternate.
... htmlmarqueeelement.onfinish fires when the marquee has finished the amount of scrolling that is set by the loop attribute.
...And 2 more matches
HTML Drag and Drop API - Web APIs
a typical drag operation begins when a user selects a draggable element, drags the element to a droppable element, and then releases the dragged element.
... each drag event type has an associated global event handler: event on event handler fires when… drag ondrag …a dragged item (element or text selection) is dragged.
...(see performing a drop.) note: neither dragstart nor dragend events are fired when dragging a file into the browser from the os.
...And 2 more matches
IntersectionObserver.thresholds - Web APIs
the intersectionobserver interface's read-only thresholds property returns the list of intersection thresholds that was specified when the observer was instantiated with intersectionobserver().
... if only one threshold ratio was provided when instanitating the object, this will be an array containing that single value.
... syntax var thresholds = intersectionobserver.thresholds; value an array of intersection thresholds, originally specified using the threshold property when instantiating the observer.
...And 2 more matches
LockManager.request() - Web APIs
request an "exclusive" lock when it should only be held by one code instance at a time.
...when an "exclusive" lock for a given name is held, no other lock with the same name can be held.
... request a "shared" lock when multiple instances of the code can share access to a resource.
...And 2 more matches
MediaDevices.getUserMedia() - Web APIs
here's a full example: { audio: true, video: { width: { min: 1024, ideal: 1280, max: 1920 }, height: { min: 576, ideal: 720, max: 1080 } } } an ideal value, when used, has gravity, which means that the browser will try to find the setting (and camera, if you have more than one), with the smallest fitness distance from the ideal values given.
...again, to require the specific camera, you would use: { video: { deviceid: { exact: myexactcameraorbustdeviceid } } } return value a promise whose fulfillment handler receives a mediastream object when the requested media has successfully been obtained.
... because this error can occur even when the user has not yet granted permission to use the underlying device, it can potentially be used as a fingerprinting surface.
...And 2 more matches
MediaStream.onaddtrack - Web APIs
the mediastream.onaddtrack property is an eventhandler which specifies a function to be called when the addtrack event occurs on a mediastream instance.
... this happens when a new track of any kind is added to the media stream.
... this event is fired when the browser adds a track to the stream (such as when a rtcpeerconnection is renegotiated or a stream being captured using htmlmediaelement.capturestream() gets a new set of tracks because the media element being captured loaded a new source.
...And 2 more matches
MediaStream.onremovetrack - Web APIs
the mediastream.onremovetrack property is an eventhandler which specifies a function to be called when the removetrack event occurs on a mediastream instance.
... this happens when a track of any kind is removed from the media stream.
... this event is fired when the browser removes a track from the stream (such as when a rtcpeerconnection is renegotiated or a stream being captured using htmlmediaelement.capturestream() gets a new set of tracks because the media element being captured loaded a new source.
...And 2 more matches
MediaStreamTrack: mute event - Web APIs
the mute event is sent to a mediastreamtrack when the track's source is temporarily unable to provide media data.
... when the track is once again able to produce media output, an unmute event is sent.
... bubbles no cancelable no interface event event handler property onmute examples in this example, event handlers are established for the mute and unmute events in order to detect when the media is not flowing from the source for the mediastreamtrack referenced by musictrack.
...And 2 more matches
Microdata DOM API - Web APIs
microdata becomes even more useful when scripts can use it to expose information to the user, for example offering it in a form that can be used by other applications.
...when called, the method must return a live nodelist object containing all the elements in the document, in tree order, that are each top-level microdata items whose types include all the types specified in the method's argument, having obtained the types by splitting the string on spaces.
...when the method is invoked on a document object again with the same argument, the user agent may return the same object as the object returned by the earlier call.
...And 2 more matches
PaymentRequest - Web APIs
when none is set, it defaults to a uuid.
... events merchantvalidation secure context with some payment handlers (e.g., apple pay), this event handler is called to handle the merchantvalidation event, which is dispatched when the user agent requires that the merchant validate that the merchant or vendor requesting payment is legitimate.
... paymentmethodchange secure context with some payment handlers (e.g., apple pay), dispatched whenever the user changes payment instrument, like switching from a credit card to a debit card.
...And 2 more matches
Performance Timeline - Web APIs
the standard also includes interfaces that allow an application to define performance observer callbacks that are notified when specific performance events are added to the browser's performance timeline.
...this interface has the following four properties, and these properties are extended (with additional constraints) by other interfaces (such as performancemark): name the name of the performance entry when the metric was created.
... performance observers the performance observer interfaces allow an application to register an observer for specific performance event types, and when one of those event types is recorded, the application is notified of the event via the observer's callback function that was specified when the observer was created.
...And 2 more matches
Multi-touch interaction - Web APIs
el.onpointerup = pointerup_handler; el.onpointercancel = pointerup_handler; el.onpointerout = pointerup_handler; el.onpointerleave = pointerup_handler; } function init() { set_handlers("target1"); set_handlers("target2"); set_handlers("target3"); } pointer down the pointerdown event is fired when a pointer (mouse, pen/stylus or touch point on a touchscreen) makes contact with the contact surface.
... in this application, when a pointer is placed down on an element, the background color of the element changes, depending on the number of active touch points the element has.
... // save this event for later processing (this could be part of a // multi-touch interaction) and update the background color push_event(ev); if (logevents) log("pointerdown: name = " + ev.target.id, ev); update_background(ev); } pointer move the pointermove handler is called when the pointer moves.
...And 2 more matches
RTCConfiguration - Web APIs
it may be passed into the constructor when instantiating a connection, or used with the rtcpeerconnection.getconfiguration() and rtcpeerconnection.setconfiguration() methods, which allow inspecting and changing the configuration while a connection is established.
... properties bundlepolicy optional specifies how to handle negotiation of candidates when the remote peer is not compatible with the sdp bundle standard.
...you may find in some cases that connections can be established more quickly by allowing the ice agent to start fetching ice candidates before you start trying to connect, so that they're already available for inspection when rtcpeerconnection.setlocaldescription() is called.
...And 2 more matches
RTCPeerConnection.addIceCandidate() - Web APIs
when a web site or app using rtcpeerconnection receives a new ice candidate from the remote peer over its signaling channel, it delivers the newly-received candidate to the browser's ice agent by calling rtcpeerconnection.addicecandidate().
... if the candidate parameter is missing or a value of null is given when calling addicecandidate(), the added ice candidate is an "end-of-candidates" indicator.
... successcallback a function to be called when the ice candidate has been successfully added.
...And 2 more matches
ServiceWorkerContainer - Web APIs
events controllerchange occurs when the document's associated serviceworkerregistration acquires a new active worker.
... error fired whenever an error occurs in the associated service workers.
... message occurs when incoming messages are received by the serviceworkercontainer object (e.g.
...And 2 more matches
ServiceWorkerRegistration.showNotification() - Web APIs
badge: a usvstring containing the url of an image to represent the notification when there is not enough space to display the notification itself such as for example, the android notification bar.
... renotify: a boolean that indicates whether to suppress vibrations and audible alerts when reusing a tag value.
... silent: when set indicates that no sounds or vibrations should be made.
...And 2 more matches
SourceBuffer - Web APIs
event handlers sourcebuffer.onabort fired whenever sourcebuffer.appendbuffer() or sourcebuffer.appendstream() is ended by a call to sourcebuffer.abort().
... sourcebuffer.onerror fired whenever an error occurs during sourcebuffer.appendbuffer() or sourcebuffer.appendstream().
... sourcebuffer.onupdate fired whenever sourcebuffer.appendbuffer() method or the sourcebuffer.remove() completes.
...And 2 more matches
Storage - Web APIs
WebAPIStorage
methods storage.key() when passed a number n, this method will return the name of the nth key in the storage.
... storage.getitem() when passed a key name, will return that key's value.
... storage.setitem() when passed a key name and value, will add that key to the storage, or update that key's value if it already exists.
...And 2 more matches
Storage Access API - Web APIs
these restrictions range from giving embedded resources under each top-level origin a unique storage space to outright blocking of storage access when resources are loaded in a third-party context.
... the semantics around third-party cookie blocking policies in particular differ from browser to browser, but the core functionality is similar: cross-origin resources embedded in a third-party context are not given access to the same cookies and site storage that they would have access to when loaded in a first-party context.
... user prompts when requeststorageaccess() is called by an embedded, cross-origin document, the user agent may choose to involve the user in the decision of whether to grant storage access to the requesting origin.
...And 2 more matches
Streams API concepts - Web APIs
there are two types of underlying source: push sources constantly push data at you when you’ve accessed them, and it is up to you to start, pause, or cancel access to the stream.
... only one reader can read a stream at a time; when a reader is created and starts reading a stream (an active reader), we say it is locked to it.
... when a writer is created and starts writing to a stream (an active writer), it is said to be locked to it.
...And 2 more matches
SubtleCrypto.unwrapKey() - Web APIs
exceptions the promise is rejected when one of the following exceptions is encountered: invalidaccesserror raised when the unwrapping key is not a key for the requested unwrap algorithm or if the cryptokey.usages value of that key doesn't contain unwrap.
... notsupported raised when trying to use an algorithm that is either unknown or isn't suitable for encryption or wrapping.
... syntaxerror raised when keyusages is empty but the unwrapped key is of type secret or private.
...And 2 more matches
WebGLRenderingContext.getFramebufferAttachmentParameter() - Web APIs
when using a webgl 2 context, the following values are available additionally: gl.draw_framebuffer: equivalent to gl.framebuffer.
... when using a webgl 2 context, the following values are available additionally: gl.color_attachment1 gl.color_attachment2 gl.color_attachment3 gl.color_attachment4 gl.color_attachment5 gl.color_attachment6 gl.color_attachment7 gl.color_attachment8 gl.color_attachment9 gl.color_attachment10 gl.color_attachment11 gl.color_attachment12 gl...
....color_attachment13 gl.color_attachment14 gl.color_attachment15 when using the webgl_draw_buffers extension: ext.color_attachment0_webgl (same as gl.color_attachment0) ext.color_attachment1_webgl ext.color_attachment2_webgl ext.color_attachment3_webgl ext.color_attachment4_webgl ext.color_attachment5_webgl ext.color_attachment6_webgl ext.color_attachment7_webgl ext.color_attachment8_webgl ext.color_attachment9_webgl ext.color_attachment10_webgl ext.color_attachment11_webgl ext.color_attachment12_webgl ext.color_attachment13_webgl ext.color_attachment14_webgl ext.color_attachment15_webgl pname a glenum specifying information to query.
...And 2 more matches
WebGLRenderingContext.stencilOp() - Web APIs
fail a glenum specifying the function to use when the stencil test fails.
... zfail a glenum specifying the function to use when the stencil test passes, but the depth test fails.
... zpass a glenum specifying the function to use when both the stencil test and the depth test pass, or when the stencil test passes and there is no depth buffer or depth testing is disabled.
...And 2 more matches
WebGLRenderingContext.stencilOpSeparate() - Web APIs
the possible values are: gl.front gl.back gl.front_and_back fail a glenum specifying the function to use when the stencil test fails.
... zfail a glenum specifying the function to use when the stencil test passes, but the depth test fails.
... zpass a glenum specifying the function to use when both the stencil test and the depth test pass, or when the stencil test passes and there is no depth buffer or depth testing is disabled.
...And 2 more matches
WebGLRenderingContext - Web APIs
webglrenderingcontext.clearcolor() specifies the color values used when clearing color buffers.
... webglrenderingcontext.cleardepth() specifies the depth value used when clearing the depth buffer.
... webglrenderingcontext.clearstencil() specifies the stencil value used when clearing the stencil buffer.
...And 2 more matches
Matrix math for the web - Web APIs
matrices can be used to represent transformations of objects in space, and are used for performing many key types of computation when constructing images and visualizing data on the web.
...the flatness is equivalent to when a camera zooms in really close onto an object in the distance — the sense of perspective disappears.
...when matrices of a certain class are multiplied together they preserve the history of the transformations and are reversible.
...And 2 more matches
Lifetime of a WebRTC session - Web APIs
in this article, we'll look at the lifetime of a webrtc session, from establishing the connection all the way through closing the connection when it's no longer needed.
... this is like trying to mail a package to your friend michelle by labeling it “michelle” and dropping it in a mailbox when you don't know her address.
... each peer establishes a handler for track event, which is received when the remote peer adds a track to the stream.
...And 2 more matches
WebXR Device API - Web APIs
the equipment may also include an accelerometer, barometer, or other sensors which are used to sense when the user moves through space, rotates their head, or the like.
... xrinputsourceevent sent when the state of an xrinputsource changes.
... this can happen, for example, when the position and/or orientation of the device changes, or when buttons are pressed or released.
...And 2 more matches
Using IIR filters - Web APIs
when you are using an iirfilternode instead of a biquadfilternode you are creating the filter yourself, rather than just choosing a pre-programmed type.
... setting our iirfilter co-efficients when creating an iir filter, we pass in the feedforward and feedback coefficients as options (coefficients is how we describe the values).
... when setting our coefficients, the feedforward values can't all be set to zero, otherwise nothing would be sent to the filter.
...And 2 more matches
Using the Web Storage API - Web APIs
localstorage does the same thing, but persists even when the browser is closed and reopened.
...the landing page provides controls that can be used to customize the color, font, and decorative image: when you choose different options, the page is instantly updated; in addition, your choices are stored in localstorage, so that when you leave the page and load it again, later on, your choices are remembered.
...next, we set the values displayed in the form elements to those values, so that they keep in sync when you reload the page.
...And 2 more matches
Web Storage API - Web APIs
localstorage does the same thing, but persists even when the browser is closed and reopened.
... note: from firefox 45 onwards, when the browser crashes/restarts, the amount of data saved per origin is limited to 10mb.
...interfaces storage allows you to set, retrieve and remove data for a specific domain and storage type (session or local.) window the web storage api extends the window object with two new properties — window.sessionstorage and window.localstorage — which provide access to the current domain's session and local storage objects respectively, and a window.onstorage event handler that fires when a storage area changes (e.g.
...And 2 more matches
Window.getSelection() - Web APIs
when cast to string, either by appending an empty string ("") or using selection.tostring(), this object returns the text selected.
... when called on an <iframe> that is not displayed (eg.
... examples function foo() { var selobj = window.getselection(); alert(selobj); var selrange = selobj.getrangeat(0); // do stuff with the range } notes string representation of the selection object in javascript, when an object is passed to a function expecting a string (like window.alert() or document.write()), the object's tostring() method is called and the returned value is passed to the function.
...And 2 more matches
Window: popstate event - Web APIs
the popstate event of the window interface is fired when the active history entry changes while the user navigates the session history.
... note: when writing functions that process popstate event it is important to take into account that properties like window.location will already reflect the state change (if it affected the current url), but document might still not.
... if the goal is to catch the moment when the new document state is already fully in place, a zero-delay settimeout() method call should be used to effectively put its inner callback function that does the processing at the end of the browser event loop: window.onpopstate = () => settimeout(dosomething, 0); when popstate is sent when the transition occurs, either due to the user triggering the browser's "back" button or otherwise, the popstate event is near the end of the process to transition to the new location.
...And 2 more matches
Window.requestAnimationFrame() - Web APIs
you should call this method whenever you're ready to update your animation onscreen.
...requestanimationframe() calls are paused in most browsers when running in background tabs or hidden <iframe>s in order to improve performance and battery life.
...when callbacks queued by requestanimationframe() begin to fire multiple callbacks in a single frame, each receives the same timestamp even though time has passed during the computation of every previous callback's workload.
...And 2 more matches
WritableStream.WritableStream() - Web APIs
underlyingsink can contain the following: start(controller) optional this is a method, called immediately when the object is constructed.
... write(chunk, controller) optional this method, also defined by the developer, will be called when a new chunk of data (specified in the chunk parameter) is ready to be written to the underlying sink.
... the highwatermark property, which is set when creating the counting strategy (line 35), sets the maximum amount of data that the writablestream instance will handle in a single write() operation.
...And 2 more matches
XMLHttpRequestEventTarget - Web APIs
" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="276" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">xmlhttprequesteventtarget</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties xmlhttprequesteventtarget.onabort contains the function to call when a request is aborted and the abort event is received by this object.
... xmlhttprequesteventtarget.onerror contains the function to call when a request encounters an error and the error event is received by this object.
... xmlhttprequesteventtarget.onload contains the function to call when an http request returns after successfully fetching content and the load event is received by this object.
...And 2 more matches
XRInputSource - Web APIs
if the device includes a trigger or other squeezable input, such as a hand gesture device that recognizes when the user squeezes their fist, that action is called a primary squeeze action.
...when a squeeze action begins, such as by the user pressing the trigger or tightening their grip, a squeezestart event is sent to the xrsession.
...a primary action may occur when the user presses a button, clicks on a touchpad or the top button of a thumb stick, or uses a hand gesture or spoken command that invokes the button-like action.
...And 2 more matches
XRReferenceSpace - Web APIs
this is useful for positioning objects while rendering, and to perform the needed transforms when changing the viewer's position and/or orientation in 3d space.
... reset the reset event is sent to an xrreferencespace object when the browser detects a discontinuity has occurred wherein the tracked object's origin relative to the user's environment or location.
...it's particularly useful when determining the distance between the viewer and an input, or when working with offset spaces.
...And 2 more matches
ARIA: alert role - Accessibility
screen readers will instantly start reading out the updated content when the role is added.
...it is perfect for situations such as when a user fills out a form and javascript is used to add an error message - the alert would immediately read out the message.
...when the display value is changed with css or javascript, it would automatically trigger the screen reader to read out the content.
...And 2 more matches
ARIA: row role - Accessibility
using native html <tr> elements, whenever possible, is strongly encouraged.
... note: using the native html table element (<table>) along with the table row element (<tr>) whenever possible is strongly encouraged.
...when placed on the row, the aria-colindex defines an element's column index or position with respect to the total number of columns within a row.
...And 2 more matches
WAI-ARIA Roles - Accessibility
screen readers will instantly start reading out the updated content when the role is added.
...this usually includes a logo, company name, search icon, photo related to the page, or slogan.aria: button rolethe button role should be used for clickable elements that trigger a response when activated by the user.
...checkbox" must also include the aria-checked attribute to expose the checkbox's state to assistive technology.aria: comment rolethe comment landmark role semantically denotes a comment/reaction to some content on the page, or to a previous comment.aria: complementary rolethe complementary landmark role is used to designate a supporting section that relates to the main content, yet can stand alone when separated.
...And 2 more matches
An overview of accessible web applications and widgets - Accessibility
this provides a much more consistent user experience than was possible in the previous generation of web applications, since assistive technology users can apply all of their knowledge of how desktop applications work when they are using web-based applications.
... visibility changes when content visibility is changed (i.e., an element is hidden or shown), developers should change the aria-hidden property value.
...see also live regions keyboard navigation often times developers overlook support for the keyboard when they create custom widgets.
...And 2 more matches
Architecture - Accessibility
when the hierarchy is finally exposed to atk they are stripped out.
...when the hierarchy is finally exposed to atk they are stripped out as leaf nodes, but the \n remains in the containing text.
...when you have an nsiaccessiblehypertext, you can ask for its links, which is the subset of children from the nsiaccessible hierarchy that are not text or whitespace.
...And 2 more matches
Operable - Accessibility
see ui controls and building keyboard accessibility back in 2.1.2 no keyboard trap (a) when entering a section of functionality using the keyboard, you should be able to get out of that section again using *only* the keyboard.
... see ui controls and building keyboard accessibility back in 2.1.4 character key shortcuts (a) added in 2.1 if a single character key shortcut exists, then at least one of the following is true: single character key shortcuts can be turned off, remapped or are only active when the relevant user interface component is in focus.
... 2.4.7 visible focus for focusable elements (aa) when tabbing through focusable elements such as links or form inputs, there should be a visual indicator to show you which element currently has focus.
...And 2 more matches
Perceivable - Accessibility
1.4.4 resize text (aa) the page should be readable and usable when the text size is doubled.
... this means that designs should be responsive, so that when the text size is increased, the content is still accessible.
... when the text size is doubled, the content should not need to be scrolled.
...And 2 more matches
Coordinate systems - CSS: Cascading Style Sheets
when specifying the location of a pixel in a graphics context (just like when specifying coordinate systems in algebra), its position is defined relative to a fixed point in the context.
... when drawing 3d graphics, or using a third dimension to layer objects from front to back, the z-coordinate is also used.
... for example, when a mouse event occurs, the position of the mouse as specified in the event's offsetx and offsety properties are given relative to the top-left corner of the node to which the event has been delivered.
...And 2 more matches
Using CSS animations - CSS: Cascading Style Sheets
mation-name: slidein; animation-iteration-count: infinite; animation-direction: alternate; } could be replaced by p { animation: 3s infinite alternate slidein; } note: you can find more details out at the animation reference page: setting multiple animation property values the css animation longhand values can accept multiple values, separated by commas — this feature can be used when you want to apply multiple animations in a single rule, and set separate durations, iteration counts, etc.
...these events, represented by the animationevent object, can be used to detect when animations start, finish, and begin a new iteration.
... we'll modify the sliding text example to output some information about each animation event when it occurs, so we can get a look at how they work.
...And 2 more matches
Aligning Items in a Flex Container - CSS: Cascading Style Sheets
changing the main axis so far we have looked at the behaviour when our flex-direction is row, and while working in a language written top to bottom.
... once again we can switch our flex-direction to column in order to see how this property behaves when we are working by column.
...you can remove this, or change the values of justify-content to see how flexbox behaves when the start of the inline direction is on the right.
...And 2 more matches
Cross-browser Flexbox mixins - CSS: Cascading Style Sheets
when an element is a flex item, flex is consulted instead of the main size property to determine the main size of the element.
...typically, it helps to distribute extra free space leftover when either all the flex items on a line are inflexible, or are flexible but have reached their maximum size.
... it also exerts some control over the alignment of items when they overflow the line.
...And 2 more matches
Flow Layout and Writing Modes - CSS: Cascading Style Sheets
in this guide, we look at how flow layout behaves when used with different document writing modes.
... boxes with a different writing mode to their parent when a nested box is assigned a different writing mode to its parent, then an inline level box will display as if it has display: inline-block.
... summary in most cases, flow layout works as you would expect it to when changing the writing mode of the document or parts of the document.
...And 2 more matches
Box alignment in CSS Grid Layout - CSS: Cascading Style Sheets
so we will start by looking at the two axes that we deal with when aligning things in a grid.
... the two axes of a grid layout when working with grid layout you have two axes available to align things against – the block axis and the inline axis.
...when we use these properties, we are changing the alignment of the item within the grid area you have placed it.
...And 2 more matches
Line-based placement with CSS Grid - CSS: Cascading Style Sheets
starting your exploration of grid with numbered lines is the most logical place to begin, as when you use grid layout you always have numbered lines.
... when we specify our grid area using the grid-area property we first define both start lines block-start and inline-start, then both end lines block-end and inline-end.
... in this next example i have flipped the layout we were working with by working from the right and bottom of our grid when placing the items.
...And 2 more matches
Subgrid - CSS: Cascading Style Sheets
introduction to subgrid when you add display: grid to a grid container, only the direct children become grid items and can then be placed on the grid that you have created.
... note that line numbering restarts inside the subgrid — column line 1, when inside the subgrid, is the first line of the subgrid.
... no implicit grid in a subgridded dimension if you need to autoplace items, and do not know how many items you will have, take care when creating a subgrid, as it will prevent additional rows being created to hold those items.
...And 2 more matches
CSS values and units - CSS: Cascading Style Sheets
when both quoted and unquoted user defined text values are permitted, the specification will list <custom-ident> | <string>, meaning quotes are optional, such as is the case with animation names: @keyframe validident { /* keyframes go here */ } @keyframe 'validstring' { /* keyframes go here */ } some text values are not valid if encompassed in quotes.
... when viewing css property value syntax in a css specification or the mdn property page, allowable keywords will be listed in the following form.
...many of these units are therefore more useful when the output is a fixed size media, such as print.
...And 2 more matches
Column layouts - CSS: Cascading Style Sheets
download this example use multicol when: you want your text to display in newspaper-like columns.
... when you want to do alignment on the cross axis after laying out your items.
... when you are happy for wrapped items to share out space along their line only and not line up with items in other lines.
...And 2 more matches
<basic-shape> - CSS: Cascading Style Sheets
when creating a shape, the reference box is defined by each property that uses <basic-shape> values.
... when all of the first four arguments are supplied they represent the top, right, bottom and left offsets from the reference box inward that define the positions of the edges of the inset rectangle.
...default value when omitted is nonzero.
...And 2 more matches
border-image-slice - CSS: Cascading Style Sheets
when one position is specified, it creates all four slices at the same distance from their respective sides.
... when two positions are specified, the first value creates slices measured from the top and bottom, the second creates slices measured from the left and right.
... when three positions are specified, the first value creates a slice measured from the top, the second creates slices measured from the left and right, the third creates a slice measured from the bottom.
...And 2 more matches
border-image-width - CSS: Cascading Style Sheets
when one value is specified, it applies the same width to all four sides.
... when two values are specified, the first width applies to the top and bottom, the second to the left and right.
... when three values are specified, the first width applies to the top, the second to the left and right, the third to the bottom.
...And 2 more matches
border-width - CSS: Cascading Style Sheets
when one value is specified, it applies the same width to all four sides.
... when two values are specified, the first width applies to the top and bottom, the second to the left and right.
... when three values are specified, the first width applies to the top, the second to the left and right, the third to the bottom.
...And 2 more matches
<color> - CSS: Cascading Style Sheets
there are a few caveats to consider when using color keywords: html only recognizes the 16 basic color keywords found in css1, using a specific algorithm to convert unrecognized values (often to completely different colors).
...hsl can also make it easier to create a set of matching colors (such as when you want multiple shades of a single hue).
...when written as a unitless <number>, it is interpreted as degrees, as specified in css color module level 3.
...And 2 more matches
mask-border-outset - CSS: Cascading Style Sheets
when one value is specified, it applies the same outset to all four sides.
... when two values are specified, the first outset applies to the top and bottom, the second to the left and right.
... when three values are specified, the first outset applies to the top, the second to the left and right, the third to the bottom.
...And 2 more matches
mask-border-slice - CSS: Cascading Style Sheets
when one position is specified, it creates all four slices at the same distance from their respective sides.
... when two positions are specified, the first value creates slices measured from the top and bottom, the second creates slices measured from the left and right.
... when three positions are specified, the first value creates a slice measured from the top, the second creates slices measured from the left and right, the third creates a slice measured from the bottom.
...And 2 more matches
mask-border-width - CSS: Cascading Style Sheets
when one value is specified, it applies the same width to all four sides.
... when two values are specified, the first width applies to the top and bottom, the second to the left and right.
... when three values are specified, the first width applies to the top, the second to the left and right, the third to the bottom.
...And 2 more matches
overscroll-behavior - CSS: Cascading Style Sheets
the overscroll-behavior css property sets what a browser does when reaching the boundary of a scrolling area.
... /* keyword values */ overscroll-behavior: auto; /* default */ overscroll-behavior: contain; overscroll-behavior: none; /* two values */ overscroll-behavior: auto contain; /* global values */ overscroll-behavior: inherit; overscroll-behavior: initial; overscroll-behavior: unset; by default, mobile browsers tend to provide a "bounce" effect or even a page refresh when the top or bottom of a page (or other scroll area) is reached.
... you may also have noticed that when you have a dialog box with scrolling content on top of a page of scrolling content, once the dialog box's scroll boundary is reached, the underlying page will then start to scroll — this is called scroll chaining.
...And 2 more matches
top - CSS: Cascading Style Sheets
WebCSStop
the effect of top depends on how the element is positioned (i.e., the value of the position property): when position is set to absolute or fixed, the top property specifies the distance between the element's top edge and the top edge of its containing block.
... when position is set to relative, the top property specifies the distance the element's top edge is moved below its normal position.
... when position is set to sticky, the top property is used to compute the sticky-constraint rectangle.
...And 2 more matches
Getting Started - Developer guides
at this stage, you need to tell the xmlhttp request object which javascript function will handle the response, by setting the onreadystatechange property of the object and naming it after the function to call when the request changes state, like this: httprequest.onreadystatechange = nameofthefunction; note that there are no parentheses or parameters after the function name, because you're assigning a reference to the function, rather than actually calling it.
...}; next, after declaring what happens when you receive the response, you need to actually make the request, by calling the open() and send() methods of the http request object, like this: httprequest.open('get', 'http://www.example.org/some.file', true); httprequest.send(); the first parameter of the call to open() is the http request method – get, post, head, or another method supported by your server.
...be sure to use the exact domain name on all of your pages or you will get a "permission denied" error when you call open().
...And 2 more matches
Web Audio playbackRate explained - Developer guides
defaultplaybackrate and ratechange in addition to playbackrate, we also have a defaultplaybackrate property available, which lets us set the default playback rate: the playback rate to which the media resets; for example, if we change the source of the video, or (in some browsers) when an ended event is generated.
... the pitch of the audio track does not change when playbackrate is altered.
... ie9+ switches to the default playback rate when an ended event is fired.
...And 2 more matches
Audio and Video Delivery - Developer guides
also, the autoplay feature can be controversial when misused.
... var mediaelement = document.queryselector('#mediaelementid'); mediaelement.seekable.start(0); // returns the starting time (in seconds) mediaelement.seekable.end(0); // returns the ending time (in seconds) mediaelement.currenttime = 122; // seek to 122 seconds mediaelement.played.end(0); // returns the number of seconds the browser has played specifying playback range when specifying the uri of media for an <audio> or <video> element, you can optionally include additional information to specify the portion of the media to play.
...at this time, this is the only part of the media fragments uri specification implemented by gecko, and it can only be used when specifying the source for media elements, and not in the address bar.
...And 2 more matches
Orientation and motion data explained - Developer guides
summary when using orientation and motion events, it's important to understand what the values you're given by the browser mean.
...there are two coordinate frames to consider when using orientation and motion events: earth coordinate frame the earth coordinate frame is the coordinate frame fixed on the center of the earth; that is, the axes are aligned based on the pull of gravity and the standard magnetic north orientation.
... alpha rotation around the z axis -- that is, twisting the device -- causes the alpha rotation angle to change: the alpha angle is 0° when top of the device is pointed directly toward the earth's north pole, and increases as the device is rotated toward the left.
...And 2 more matches
Touch events (Mozilla experimental) - Developer guides
warning: this experimental api was removed in gecko 18.0 (firefox 18.0 / thunderbird 18.0 / seamonkey 2.15), when support for the standard touch events was implemented.
...when the moztouchdown event is built, a unique value is assigned to that finger.
... types of touch events moztouchdown sent when the user begins a screen touch action.
...And 2 more matches
HTML5 Parser - Developer guides
WebGuideHTMLHTML5HTML5 Parser
firefox writes a warning to the javascript console when it ignores a call to document.write().
...when the attribute value is not the empty string and does not contain whitespace, ", ', `, <, =, or >).
... when an svg or mathml element is open <![cdata[…]]> sections work the way they do in xml.
...And 2 more matches
Localizations and character encodings - Developer guides
to specify that a page is using, for example, the utf-8 character encoding (as per the recommendation), simply place the following line in the <head> block: <meta charset="utf-8"> details and browser internals when the encoding is declared by web content like the html specification requires, firefox will use that encoding for turning the bytes into the internal representation.
...it should be set to the canonical name of the legacy encoding that users of the localizations are most likely to encounter when browsing non-conforming legacy web content that doesn't declare its encoding.
...note that firefox no longer sends the accept-charset http header, so there is no need to consider what gets advertised in accept-charset when setting the fallback encoding.
...And 2 more matches
Writing forward-compatible websites - Developer guides
this page explains how to write websites that do not break when new browser versions are released.
... javascript prefix all global variable access in onfoo attributes with “window.” when an event handler content attribute (onclick, onmouseover, and so forth) is used on html element, all name lookup in the attribute first happens on the element itself, then on the element's form if the element is a form control, then on the document, and then on the window (where the global variables you have defined are).
... to avoid this, fully qualify global variable access using "window.", like so: <script> function localname() { alert('function localname has been called'); } </script> <div onclick="window.localname()">clicking me should show an alert<div> don't concatenate scripts you don't control the "use strict;" directive in ecmascript, when used on the file level, applies to everything in the file.
...And 2 more matches
HTML attribute: rel - HTML: Hypertext Markup Language
WebHTMLAttributesrel
useful for resources the user will likely need, it helps reduce latency and thereby improves performance when the user does access the resources as the browser preemptively performed dns resolution for the origin of the specified resource.
...when used within <link>, the help is for the whole document.
... when included with <a> and <area> and supported, the default cursor will be help instead of pointer.
...And 2 more matches
<input type="date"> - HTML: Hypertext Markup Language
WebHTMLElementinputdate
additional attributes along with the attributes common to all <input> elements, date inputs have the following attributes: attribute description max the latest acceptable date min the earliest acceptable date step the stepping interval, when clicking up and down spinner buttons and validating the date max the latest date to accept.
... note: when the data entered by the user doesn't adhere to the stepping configuration, the user agent may round to the nearest valid value, preferring numbers in the positive direction when there are two equally close options.
...daynum = 29 : daynum = 28; } // inject the right number of new <option> elements into the day <select> for(i = 1; i <= daynum; i++) { var option = document.createelement('option'); option.textcontent = i; dayselect.appendchild(option); } // if previous day has already been set, set dayselect's value // to that day, to avoid the day jumping back to 1 when you // change the year if(previousday) { dayselect.value = previousday; // if the previous day was set to a high number, say 31, and then // you chose a month with less total days in it (e.g.
...And 2 more matches
<input type="submit"> - HTML: Hypertext Markup Language
WebHTMLElementinputsubmit
when the click event occurs (typically because the user clicked the button), the user agent attempts to submit the form to the server.
...he attributes shared by all <input> elements, submit button inputs support the following attributes: attribute description formaction the url to which to submit the form's data; overrides the form's action attribute, if any formenctype a string specifying the encoding type to use for the form data formmethod the http method (get or post) to use when submitting the form.
... formenctype a string that identifies the encoding method to use when submitting the form data to the server.
...And 2 more matches
<select>: The HTML Select element - HTML: Hypertext Markup Language
WebHTMLElementselect
each <option> element should have a value attribute containing the data value to submit to the server when that option is selected.
...you can include a selected attribute on an <option> element to make it selected by default when the page first loads.
... autofocus this boolean attribute lets you specify that a form control should have input focus when the page loads.
...And 2 more matches
<source>: The Media or Image Source element - HTML: Hypertext Markup Language
WebHTMLElementsource
the sizes attribute has an effect only when the <source> element is the direct child of a <picture> element.
...the value of this attribute is ignored when the <source> element is placed inside a <picture> element.
... the srcset attribute has an effect only when the <source> element is the direct child of a <picture> element.
...And 2 more matches
<tr>: The Table Row element - HTML: Hypertext Markup Language
WebHTMLElementtr
this can take a little practice to get right when building your tables.
...there are also several deprecated attributes, which you should avoid but may need to know when reading older code.
...this uses the char and charoff to establish the alignment character (typically "." or "," when aligning numerical data) and the number of characters that should follow the alignment character.
...And 2 more matches
Regular expression syntax cheatsheet - JavaScript
\u{hhhh} or \u{hhhhh} (only when the u flag is set.) matches the character with the unicode value u+hhhh or u+hhhhh (hexadecimal digits).
...neither have a special meaning when escaped nor when unescaped.
... this character has a different meaning when it appears at the start of a group.
...And 2 more matches
TypeError: X.prototype.y called on incompatible type - JavaScript
the javascript exception "called on incompatible target (or object)" occurs when a function (on a given object), is called with a this not corresponding to the type expected by the function.
... when this error is thrown, a function (on a given object), is called with a this not corresponding to the type expected by the function.
... this issue can arise when using the function.prototype.call() or function.prototype.apply() methods, and providing a this argument which does not have the expected type.
...And 2 more matches
TypeError: Reduce of empty array with no initial value - JavaScript
the javascript exception "reduce of empty array with no initial value" occurs when a reduce function is used.
...this error is raised when an empty array is provided because no initial value can be returned in that case.
... examples invalid cases this problem appears frequently when combined with a filter (array.prototype.filter(), typedarray.prototype.filter()) which will remove all elements of the list.
...And 2 more matches
InternalError: too much recursion - JavaScript
the javascript exception "too much recursion" or "maximum call stack size exceeded" occurs when there are too many function calls, or a function is missing a base case.
...when there are too many function calls, or a function is missing a base case, javascript will throw this error.
... function loop(x) { // the base case is missing loop(x + 1); // recursive call } loop(0); // internalerror: too much recursion class error: too much recursion class person{ constructor(){} set name(name){ this.name = name; // recursive call } } const tony = new person(); tony.name = "tonisha"; // internalerror: too much recursion when a value is assigned to the property name (this.name = name;) javascript needs to set that property.
...And 2 more matches
BigInt - JavaScript
be careful coercing values back and forth, however, as the precision of a bigint may be lost when it is coerced to a number.
... type information when tested against typeof, a bigint will give "bigint": typeof 1n === 'bigint' // true typeof bigint('1') === 'bigint' // true when wrapped in an object, a bigint will be considered as a normal "object" type: typeof object(1n) === 'object' // true operators the following operators may be used with bigints (or object-wrapped bigints): +, *, -, **, %.
... an operation with a fractional result will be truncated when used with a bigint.
...And 2 more matches
RegExp - JavaScript
the following three expressions create the same regular expression: /ab+c/i new regexp(/ab+c/, 'i') // literal notation new regexp('ab+c', 'i') // constructor the literal notation results in compilation of the regular expression when the expression is evaluated.
... use literal notation when the regular expression will remain constant.
...use the constructor function when you know the regular expression pattern will be changing, or you don't know the pattern and obtain it from another source, such as user input.
...And 2 more matches
String - JavaScript
the first is the charat() method: return 'cat'.charat(1) // returns "a" the other way (introduced in ecmascript 5) is to treat the string as an array-like object, where individual characters correspond to a numerical index: return 'cat'[1] // returns "a" when using bracket notation for character access, attempting to delete or assign a value to these properties will not succeed.
... let s_prim = 'foo' let s_obj = new string(s_prim) console.log(typeof s_prim) // logs "string" console.log(typeof s_obj) // logs "object" string primitives and string objects also give different results when using eval().
...for example: let s1 = '2 + 2' // creates a string primitive let s2 = new string('2 + 2') // creates a string object console.log(eval(s1)) // returns the number 4 console.log(eval(s2)) // returns the string "2 + 2" for these reasons, the code may break when it encounters string objects when it expects a primitive string instead, although generally, authors need not worry about the distinction.
...And 2 more matches
Symbol - JavaScript
typeof symbol() === 'symbol' typeof symbol('foo') === 'symbol' typeof symbol.iterator === 'symbol' symbol type conversions some things to note when working with type conversion of symbols.
... when trying to convert a symbol to a number, a typeerror will be thrown (e.g.
... when using loose equality, object(sym) == sym returns true.
...And 2 more matches
WeakRef - JavaScript
when an object no longer has any strong references to it, the javascript engine's garbage collector may destroy the object and reclaim its memory.
...when, how, and whether garbage collection occurs is down to the implementation of any given javascript engine.
...this is primarily to avoid making the behavior of any given javascript engine's garbage collector apparent in code — because if it were, people would write code relying on that behavior, which would break when the garbage collector's behavior changed.
...And 2 more matches
Media container formats (file types) - Web media technologies
when specifying the mpeg-4 media type (audio/mp4 or video/mp4), you can add the codecs parameter to the mime type string to indicate which codecs are used for the audio and/or video tracks, and to optionally provide details about the profile, level, and/or other codec configuration specifics.
...you are typically better off using webm, though there are times when ogg is useful to offer, such as when you wish to support older versions of firefox and chrome which don't yet support webm.
... base ogg media mime types audio video audio/ogg video/ogg the application/ogg mime type can be used when you don't necessarily know whether the media contains audio or video.
...And 2 more matches
Animation performance and frame rate - Web Performance
while performance is sensitive to the particular system and its load, performance tools can help you understand the work the browser's doing to render your site, and help you prevent and diagnose problems when they occur.
...they can also give better performance, as they give the browser more control over when to render frames, and to drop frames if necessary.
... the rendering waterfall the process a browser uses to paint changes to a page when an element is animating css properties can be described as a waterfall consisting of the following steps: recalculate style: when a property for an element changes, the browser must recalculate computed styles.
...And 2 more matches
Lazy loading - Web Performance
lazy loading is a strategy to identify resources as non-blocking (non-critical) and load these only when needed.
... a practical example would be when, you land on the home page of an e-commerce site which has a link to a cart page/section and all its resources (js, css, images...) are downloaded only when the user navigates to that cart page.
... <img src="image.jpg" loading="lazy" alt="..." /> <iframe src="video-player.html" loading="lazy"></iframe> the load event fires when the eagerly-loaded content has all been loaded; at that time, it's entirely possible (or even likely) that there may be lazily-loaded images that are within the visual viewport that haven't yet loaded.
...And 2 more matches
Privacy, permissions, and information security
whenever working with data, always stop and think: is there any way this can be used to even through many steps identify a specific person?
...everyone has some idea what it means to keep something private, but when talking about the privacy of data, it becomes murky.
...d of man-in-the-middle attacks http strict transport security (hsts) hsts is used by servers to let them protect themselves from protocol downgrade and cookie hijack attacks by letting sites tell clients that they can only use https to communicate with the server http/2 while http/2 technically does not have to use encryption, most browser developers are only supporting it when used with https, so it can be thought of in that regard as being security-related permissions api provides a way to determine the status of permissions for the current browser context transport layer security (tls); formerly known as secure sockets layer (ssl) tls provides security and privacy by encrypting data during transport over the network.
...And 2 more matches
Graphic design for responsive sites - Progressive web apps (PWAs)
textual content is not a problem, as text boxes are innately responsive, but the picture starts to get ugly when you start including graphics and complex layouts on your pages — especially when those graphics and layouts need to adapt to different displays!
...so when the page is loaded on a mobile device, the mobile will only download the mobile assets, and not the desktop resource assets.
...the issue here is that raster images, when rendered on high res devices, are in danger of appearing tiny because the same number of pixels is being shown in a much smaller screen space.
...And 2 more matches
begin - SVG: Scalable Vector Graphics
WebSVGAttributebegin
the begin attribute defines when an animation should begin or when an element should be discarded.
... six elements are using this attribute: <animate>, <animatecolor>, <animatemotion>, <animatetransform>, <discard>, and <set> animate, animatecolor, animatemotion, animatetransform, set for <animate>, <animatecolor>, <animatemotion>, <animatetransform>, and <set>, begin defines when the element should begin, i.e.
...the element animation will begin when the user presses the specified key.
...And 2 more matches
Scripting - SVG: Scalable Vector Graphics
WebSVGScripting
preventing default behavior in event code when writing drag and drop code, sometimes you'll find that text on the page gets accidently selected while dragging.
... or if you want to use the backspace key in your code, you want to override the browser's default behavior when the backspace key is pressed, which is to go back to the previous page.
... using eventlisteners with objects the methods addeventlistener() and removeeventlistener() are very useful when writing interactive svg.
...And 2 more matches
mimeTypes.rdf corruption - SVG: Scalable Vector Graphics
symptoms previously you were able to open and display svg content with mozilla, but for no apparent reason its behaviour changes and now it always pops up the "open or save file" dialog when you try to open local svg files, and displays the "additional plugins are required to display all the media on this page" bar when you try to view html with embedded svg.
... note: the "additional plugins are required" bar can appear for legitimate reasons when the svg or its embedding html is broken or served incorrectly over the network (see the svg faq).
... if the blue square with the white cross displays when you load this scripting across embed demo, then you are not experiencing this problem.
...And 2 more matches
Index - XSLT: Extensible Stylesheet Language Transformations
WebXSLTIndex
to achieve the functionality of an if-then-else statement, however, use the <xsl:choose> element with one <xsl:when> and one <xsl:otherwise> children.
... 40 <xsl:otherwise> element, reference, xslt, otherwise the <xsl:otherwise> element is used to define the action that should be taken when none of the <xsl:when> conditions apply.
...when used as a top-level element, the parameter is global .
...And 2 more matches
Interacting with page scripts - Archive of obsolete content
note that the function's closure will be exported, too: // content-script.js var salutation = "hello, "; function greetme(user) { return salutation + user; } exportfunction(greetme, unsafewindow, {defineas: "greetme"}); finally, the "page.html" file adds a button and a page script that calls the exported function when the user pushes the button: <html> <head> </head> <body> <input id="test" type="button" value="click me"/> <script> var test = document.getelementbyid("test"); test.addeventlistener("click", function() { alert(window.greetme("page script")); }, false); </script> </body> </html> exportfunction() works by structured cloning the arguments and return va...
... here "main.js" creates a page-mod that attaches "listen.js" to the web page: var data = require("sdk/self").data; var pagemod = require("sdk/page-mod"); pagemod.pagemod({ include: "http://my-domain.org/talk.html", contentscriptfile: data.url("listen.js") }); the web page "talk.html" embeds a script that uses window.postmessage() to send the content script a message when the user clicks a button: <!doctype html> <html> <head></head> <body> <script> function sendmessage() { window.postmessage("message from page script", "http://my-domain.org/"); } </script> <button onclick="sendmessage()">send message</button> </body> </html> finally, the content script "listen.js" uses window.addeventlistener() to listen for messages from ...
...t, "main.js" will create a page-mod that will attach "content-script.js" to the target web page, and will then load the target web page: var tabs = require("sdk/tabs"); var mod = require("sdk/page-mod"); var self = require("sdk/self"); var pageurl = self.data.url("page.html") var pagemod = mod.pagemod({ include: pageurl, contentscriptfile: self.data.url("content-script.js"), contentscriptwhen: "ready" }) tabs.open(pageurl); the target web page "page.html" includes a button and a page script: <html> <head> <meta charset="utf-8"> </head> <body> <input id="message" 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 se...
...also, there's no need to clone the message when using custom dom events in this direction.
Communicating using "port" - Archive of obsolete content
essage);" + "});" var pagemod = require('sdk/page-mod').pagemod({ include: ['*'], contentscript: pagemodscript, onattach: function(worker) { worker.port.on('click', function(html) { worker.port.emit('warning', 'do not click this again'); }); } }); in the add-on above there are two user-defined messages: click is sent from the page-mod to the add-on, when the user clicks an element in the page warning sends a silly string back to the page-mod port.emit() the port.emit() function sends a message from the "main.js", or another add-on module, to a content script, or vice versa.
...the button sends the content script a message called "get-first-para" when it is clicked: pageworker = require("sdk/page-worker").page({ contentscriptfile: require("sdk/self").data.url("listener.js"), contenturl: "http://en.wikipedia.org/wiki/chalk" }); require("sdk/ui/button/action").actionbutton({ id: "get-first-para", label: "get-first-para", icon: "./icon-16.png", onclick: function() { console.log("sending 'get-first-para'"); pageworker.port.em...
...when it receives this message, the script logs the first paragraph of the document and then calls removelistener() to stop listening.
...when messages are sent their payloads are automatically serialized, and when messages are received their payloads are automatically deserialized, so you don't need to worry about serialization.
Private Properties - Archive of obsolete content
moreover, to create each thumbnail only when it's first required: function getthumbnail(image) { let thumbnail = image._thumbnail; if (!thumbnail) { thumbnail = createthumbnail(image); image._thumbnail = thumbnail; } return thumbnail; } this approach is straightforward, but relies on the use of prefixes.
...when an object is used as a key, it's converted to a string using its tostring method.
...the second problem is more severe: the thumbnail cache maintains a strong reference to each thumbnail object, so they will never be freed, even when their corresponding image has gone out of scope.
...when a thumbnail's image goes out of scope, the weakmap ensures that its entry in the thumbnail cache will eventually be garbage collected.
SDK API Lifecycle - Archive of obsolete content
at the same time, developers maintaining and extending the sdk's apis need to be able to introduce new apis that aren't yet fully proven, and to retire old apis when they're no longer optimal or supported by the underlying platform.
...it has two main components: a stability index that defines how stable each module is a deprecation process that defines when and how stable sdk apis can be changed or removed from future versions of the sdk while giving developers enough time to update their code.
... the amo validator will throw errors when deprecated modules are used, and these add-ons will therefore fail amo review.
... all warnings should include links to further information about what to use instead of the deprecated module and when the module will be completely removed.
simple-storage - Archive of obsolete content
you can choose to be notified when you go over quota, and you should respond by reducing the amount of data in storage.
...it will be called when your storage goes over quota.
... therefore, when you're notified that you're over quota, you should respond by removing data from the storage space until your quotausage is less than or equal to 1.
... events overquota the module emits this event when your add-on's storage goes over its quota.
platform/xpcom - Archive of obsolete content
registering and unregistering by default, factories and services are registered with xpcom automatically when they are created, and unregistered automatically when the add-on that created them is unloaded.
... by default, factories and services are unregistered automatically when the add-on that registered them is unloaded.
... initializes pending in initialize() adds our implementation of the nsirequest interface although request also implements nsisupports, there is no need to add it here, because the base class unknown declares support for nsisupports and this is accounted for when retrieving objects.
... by default, the factory is registered when it is created and unregistered when the add-on that created it is unloaded.
remote/child - Archive of obsolete content
events attach triggered when a new content frame is opened (for example, the user opened a new tab).
... at this point you can't access frame's content yet, but you can add event listeners: const { frames } = require("sdk/remote/child"); frames.on("attach", function(frame) { console.log("new frame"); frame.addeventlistener("domcontentloaded", function(e) { console.log(e.target.location.href); }); }); detach triggered when a frame is removed (for example, the user closed a tab).
...listeners are automatically removed when this frame is destroyed.
... events detach event emitted when this frame disconnects from the application.
Add a Context Menu Item - Archive of obsolete content
the item is displayed whenever something in the page is selected.
... when it's clicked, the selection is sent to the main add-on code, which just logs it: var contextmenu = require("sdk/context-menu"); var menuitem = contextmenu.item({ label: "log selection", context: contextmenu.selectioncontext(), contentscript: 'self.on("click", function () {' + ' var text = window.getselection().tostring();' + ' self.postmessage(text);' + '});', onmessage: function (selectiontext) { console.log(selectiontext); } }); try it: run the add-on, load a web page, select some text and right-click.
...the context-menu module provides a number of simple built-in contexts, including this selectioncontext(), which means: display the item when something on the page is selected.
...pressing the key selects the option when the context menu is open: var contextmenu = require("sdk/context-menu"); var menuitem = contextmenu.item({ label: "log selection", context: contextmenu.selectioncontext(), contentscript: 'self.on("click", function () {' + ' var text = window.getselection().tostring();' + ' self.postmessage(text);' + '});', accesskey: "l", onmessage: ...
Overview - Archive of obsolete content
additionally, we use the notifications module to notify the user when the add-on's storage quota is full.
...it identifies page elements which are eligible for annotation, highlights them on mouseover, and tells the main add-on code when the user clicks a highlighted element.
...when the user moves the mouse over an annotated element the matcher tells the main add-on code, which displays the annotation panel.
... because we are recording potentially sensitive information, we want to prevent the user creating annotations when in private browsing mode.
Miscellaneous - Archive of obsolete content
example for firefox: services.startup.quit(services.startup.eforcequit|services.startup.erestart); mouse and keyboard detecting mouse wheel events when scrolling the mouse wheel on an element, the dommousescroll event fires.
...when the mouse wheel is clicked, event.button will be equal to 1.
...note that it returns the empty string (""), not false, when nothing is selected.
... the cursor after the inserted text element.setselectionrange(selectionend, selectionend); } inserttext(document.getelementbyid("example"), "the text to be inserted"); disabling javascript programmatically // disable js in the currently active tab from the context of browser.xul gbrowser.docshell.allowjavascript = false; if this isn't your browser, you should save the value and restore it when finished.
JavaScript Daemons Management - Archive of obsolete content
in such a condition it is difficult and unnatural to keep track of all events started and then to stop them when appropriate through the cleartimeout() function.
... when a method requires the presence of another method (it is relatively rare), there is a comment which explains why.
... onstart optional the function which will be synchronously invoked whenever the start event occurs.
... daemon global object properties daemon.context an empty object used as the default this object when the thisobject is not specified during the construction of the daemon.
Common Pitfalls - Archive of obsolete content
there are some common pitfalls that should be avoided when writing either extensions or core mozilla code.
...this will shield you from loading <tt>javascript:</tt> or <tt>chrome:</tt> uris when you shouldn't.
... how to create a uri object in almost all cases, when creating a uri object you want to use the newuri method on the nsiioservice interface, like so: javascript: try { var ioserv = components.classes["@mozilla.org/network/io-service;1"] .getservice(components.interfaces.nsiioservice); var uriobj = ioserv.newuri(uristring, uricharset, baseuri); } catch (e) { // may want to catch ns_error_malformed_uri for some applications } c++: nsresult rv; nscomptr<nsiioservice> ioserv = do_getservice("@mozilla.org/network/io-service;1"); ns_ensure_success(rv, rv); nscomptr<nsiuri> uriobj; rv = ioserv->newuri(uristring, uricharset, baseuri, getter_addrefs(uriobj)); if (ns_failed(rv)) { // may want to handle ns_error_malformed_uri for // some appl...
...the one exception to all of the above, that is the one case in which creating a specific uri class via createinstance is acceptable, is when one is implementing a protocol handler's newuri method.
Inline options - Archive of obsolete content
so like for the type="file", once a user browses and picks a file, when it updates the label it will trigger the oninputchanged attribute.
... some discussion on the subject at stackoverflow: how to use addeventlistener on inputchanged of inline options display notifications if you want to use the settings ui for anything more than storing preferences, then you will probably need to initialize them when they first appear.
...r example: var observer = { observe: function(asubject, atopic, adata) { if (atopic == "addon-options-displayed" && adata == "my_addon@my_domain") { var doc = asubject; var control = doc.getelementbyid("myaddon-pref-control"); control.value = "test"; } } }; services.obs.addobserver(observer, "addon-options-displayed", false); // don't forget to remove your observer when your add-on is shut down.
... note: starting in gecko 13.0, you can also listen for the addon-options-hidden notification, which has the same subject and data as above, to find out when the ui is about to be removed.
Migrating from Internal Linkage to Frozen Linkage - Archive of obsolete content
unicharutils has been modified to provide a frozen-linkage comparator: nsstring mystring = somestring; - if (mystring.equals(otherstring, nscaseinsensitivestringcomparator())) + if (mystring.equals(otherstring, caseinsensitivecompare)) return ns_ok; // woot, we're equal in all things but case when using unicharutils from frozen-linkage code, link against the unicharutil_external_s static library.
...instead of passing getter_copies(astring) to a method expecting a character pointer out parameter, you will need to use a temporary variable and copy the result.missing headers some headers are included from idl files only when mozilla_internal_api is defined (actually, they shouldn't be there at all).
...uint32 len = nscrt::strlen(str); + pruint32 len = ns_strlen(str); - #include "nscrt.h" + #include "nsmemory.h" + #include "nscrtglue.h" prunichar* anotherstr = (prunichar*) ns_alloc(100 * sizeof(prunichar)); - prunichar *str = nscrt::strdup(anotherstr); - nscrt::free(str); + prunichar *str = ns_strdup(anotherstr); + ns_free(str); linking for information about the correct libraries to link to when using frozen linkage, see xpcom glue.
...#define tointeger(prv, radix) tointeger(reinterpret_cast<print32*>(prv), radix) this allows you to pass a pointer to an nsresult to the tointeger method, when it normally accepts a print32.
Chapter 6: Firefox extensions and XUL applications - Archive of obsolete content
when venkman first launches, it can only debug the file currently open in your web browser.
...when you run it, you should see a red bar, showing that it failed.
... nearly all components inherit from nsisupports (fixme: why 'nearly' ?), so adding a trailing space when you search serves as a delimiter on the inheritance position, and makes it easier to specify what you’re looking for (see figures 6, 7).4 this results in the file nsilocalfile.idl.
...also be aware of a potential problem when using paths not representing entities.5 this requires a full path as an argument.
Adding sidebars - Archive of obsolete content
a deck can be very useful when you have a large piece of xul code that only changes in a small way depending on different circumstances.
...trees are another strong option when you need to show a great amount of information in a compact presentation.
...trees are specially powerful when combined with data templates, a topic that will be covered later on.
...this topic will be covered later when we look at different kinds of datasources and templates.
Appendix C: Avoiding using eval in Add-ons - Archive of obsolete content
additionally, parsing json retrieved from a remote location becomes a security vulnerability when parsed with the eval function.
...this is important to know in particular when you later want to call removeeventlistener: you'll have to pass the resulting function from the first .bind() call.
... note: there are still some scenarios where incompatibilities may arise, such as trying to cancel the function call under a certain set of conditions when other add-ons have overridden the same function.
... accessing properties via computed names not that common anymore, but still existing, are add-ons or other javascript programs that access object properties using eval when the property name is not a literal, but computed on the fly.
Observer Notifications - Archive of obsolete content
in a chrome browser overlay file, we register an observer to listen to the notification topic "xulschoolhello-test-topic" when the window loads.
...therefore, the registered observer is unregistered when the browser window is unloaded.
... when the notifytest method is called, all observers registered with xulschoolhello-test-topic will get notified and display two alerts.
...also, be careful not to add the same observer to a notification topic more than once, otherwise the same code in the observer will be run several times when a notification is sent.
XPCOM Objects - Archive of obsolete content
this._prefservice = cc["@mozilla.org/preferences-service;1"].getservice(ci.nsiprefbranch); this._prefvalue = this._prefservice.getboolpref("somepreferencename"); this._prefservice.queryinterface(ci.nsiprefbranch2); this._prefservice.addobserver("somepreferencename", this, false); this._prefservice.queryinterface(ci.nsiprefbranch); this is a common piece of code you'll see when initializing components or jsm that rely on preferences.
...when is a parameter not an in parameter?
... creating your own components javascript xpcom components as we've said before, we recommend using jsm whenever you can.
... var countermodule = { // registerself, unregisterself, getclassobject, canunload }; the only thing you may need to change here is when you need to use the category manager.
Security best practices in extensions - Archive of obsolete content
web content handling in general the best way to ensure that the browser is not compromised when you load content is to make sure it does not have those privileges.
...when users clear logins using the "clear recent history" option, it will include your extension's data.
...if you choose to do so, beware when making edits to the bundled files so as not to break the well thought out security architecture.
...when you do include other scripts, there are a number of things you can do to ensure their integrity and safety for users.
Promises - Archive of obsolete content
let [row] = yield db.execute( "select value from nodes where key = 'timestamp' \ order by value desc limit 1"); latesttimestamp = row.getresultbyindex(0); } finally { // make sure to close the database when finished.
...the constructor returns a promise which resolves when the file’s contents have been loaded.
... * * @return {promise} a promise which resolves when the file's contents * have been written.
... * * @return {promise} a promise which resolves when the file's contents * have been written.
Search Extension Tutorial (Draft) - Archive of obsolete content
in particular, changing the location bar search keyword url in a way which is not automatically reset when the add-on is removed will result in a reset prompt for users.
...pref("browser.search.defaultenginename", "data:text/plain,browser.search.defaultenginename=example engine"); in the case or restartless extensions, the preferences need to be changed manually, and reverted when the extension is disabled if they have not been changed in the meantime.
... for (let [name, [origvalue, value]] in iterator(savedprefs)) { if (defaultprefs.getcharpref(name) == value) defaultprefs.setcharpref(name, origvalue); } } function install() {} function uninstall() {} changing the default search engine this change comes in two parts: 1) installing a new search engine (and removing it when your extension is disabled), and 2) setting it as a default (and restoring the previous default when your extension is uninstalled).
... let engine = services.search.getenginebyname(engine_details.name); if (engine) searchobserver(engine, engine_details); else { // register an observer to detect when the engine has been added, if // necessary.
Creating a Microsummary - Archive of obsolete content
for example, if you use php scripts to generate pages on your site, you could write php code to output a microsummary when the view=microsummary url parameter is present.
... then just link to the microsummaries from within the pages themselves using a <link rel="microsummary"> element, f.e.: <head> <link rel="microsummary" href="index.php?view=microsummary"> </head> when firefox encounters a <link rel="microsummary"> element, it loads the url in the href attribute.
...when a <template>'s match attribute matches a node, the processor performs the transformations specified by the content of the element.
... conclusion you should now have a microsummary generator that displays the current firefox download count when you install it, bookmark the spread firefox home page, and select the microsummary from the summary drop-down menu in the add bookmark dialog.
In-Depth - Archive of obsolete content
use this when you want one or two controls to look different from the operating systems defaults.
...if you didn't install it when you first installed mozilla you may have to run the installer again.
...when you select an item in the list the bottom portion will display the actual styles that are applied.
...when it's all done you should have something that looks like this: #navigation-toolbar > .toolbar-holder > .toolbar-primary-icon { background-image: url("chrome://navigator/skin/icons/dino.png"); } put the image in that directory, fire up mozilla, and take a look at your creation.
Creating regular expressions for a microsummary generator - Archive of obsolete content
when such characters appear in a url, and we want to match them in a regular expression, we have to escape them in the expression by prepending them with a backwards slash (\).
...in order to restrict our regular expression to urls that start with our example url, we prepend a caret (^) to the regular expression: ^http://cgi\.ebay\.com/ws/ebayisapi\.dll\?viewitem&item=280018439106 when a caret is the first character of a regular expression, it signifies that the expression must be found at the beginning of the string being matched.
...d by an asterisk (.*) between "viewitem&" and "item=" to match any characters that might appear between those two strings: ^http://cgi\.ebay\.com/ws/ebayisapi\.dll\?viewitem&.*item= the period followed by an asterisk matches any combination of characters, including no characters at all, so it works even if "viewitem&" and "item=" are right next to each other (as in our example url) as well as when there are some characters between them.
... note that since generators are xml, we have to escape the special characters less-than-sign (<), greater-than-sign (>), and ampersand (&) by replacing them with their equivalent entity references (&lt;, &gt;, and &amp;, respectively) in the regular expressions when we put them in generators.
Drag and Drop Example - Archive of obsolete content
a maximum size is also specified so that it doesn't resize when new elements are dragged onto it.
... the board will need to respond to the dragdrop event so that an element is created when the user drags onto it.
...we need this so that we know what type of element to create when dragging.
...var listobserver = { ondragstart: function (event, transferdata, action) { var txt = event.target.getattribute("elem"); transferdata.data = new transferdata(); transferdata.data.adddataforflavour("text/unicode", txt); } } one function has been defined, ondragstart, which will be called by the nsdraganddrop object when necessary.
Exception logging in JavaScript - Archive of obsolete content
the ns_nointerface error is never reported when returned by a javascript object's queryinterface() method on the nsisupports interface.
... the ns_nointerface error is never reported when returned by a javascript object's getinterface() method on the nsiinterfacerequestor interface.
... all other errors are reported when the last javascript frame on the stack returns to a c++ caller without handling the exception.
...forcing logging of exceptions in inner js frames sometimes you might actually want to see all exceptions from inner javascript frames logged (in the call chain above that would be when an exception is unhandled in frame 4).
Documentation for BiDi Mozilla - Archive of obsolete content
baselevel: the base level (direction) of the paragraph.nextbidi: when a frame has been split, this points to the next frame (in logical order).
...in general, this happens whenever we are dealing with less than a whole frame.
... examples of this are in nstextframe::painttextslowly; nstextframe::paintunicodetext when a selection is displayed; nstextframe::getposition; nstextframe::getpointfromoffset.
...it is created when resolving text containing a unicode bidi control character, a bdo tag, or right-to-left alignment caused by a dir tag or css.
generateCRMFRequest() - Archive of obsolete content
after the "escrowauthoritycert" parameter, the method takes some javascript code that is invoked when the crmf request is ready.
... "authenticator" a value that the user can authenticate with in the future when their private key is not available.
...the user will be prompted for confirmation whenever a key will be escrowed.
... "crmf generation done code" this parameter is javascript to execute when the crmf generation is complete.
Microsummary topics - Archive of obsolete content
when programmatically installing generators, you should specify a unique identifier for the generator in the uri attribute of the <generator> element.
...note: when web sites install generators via window.sidebar.addmicrosummarygenerator(), firefox sets their uri attribute to urn:source:sourceurl, where sourceurl is the url from which the generator was downloaded.
...differentiating between user-initiated and microsummary-related requests when firefox updates a microsummary generated by a microsummary generator add-on, it automatically downloads the html content of the page being summarized.
... controlling the frequency of microsummary requests when firefox downloads content in order to update a microsummary, it honors cache-related http response headers.
Modularization techniques - Archive of obsolete content
if implemented, it allows the nsrepository to free up memory by unloading dlls it is no longer using when freelibraries() is called.
... the implementation takes into consideration two things when deciding whether or not a dll can be unloaded: whether any of its factories are currently in use, and whether anyone has locked the server.
... nsresult getfoo(ifoo **afoores) { if (afoores == null) { return ns_error_null_pointer; } *afoores = mfoo; ns_addref(*afoores); return ns_ok; } remember that this applies to the interfaces returned by queryinterface(), createinstance() and ns_newx(), and you must call release() on them when you are done to avoid memory leaks.
...it outputs nspr types when generating c++ headers.
Monitoring downloads - Archive of obsolete content
setting up when the extension loads, it will do some housekeeping chores.
...instead, it is closed when the garbage collector disposes of the connection object.
... handling download state changes once the code above is run, our ondownloadstatechange() method is called whenever a download's state changes.
...if you're learning to use the download manager or storage apis, they're things you might look into doing for practice: add code to update the download log window on the fly, instead of generating a static list when it's first opened.
Proxy UI - Archive of obsolete content
the preference changes selecting the proxy "mode" all product's proxy preference panels share a basic design: a radio button that selects the proxy mode, then "related proxy mode" ui when needed.
... enabling and disabling related fields when a radio button is selected, the related ui elements are enabled (and editable).
...but should be noted that if you cut and paste from ie, the semi-colons are automatically converted to commas when you save changes (ff, tb, sm).
...mouseover when online, the tooltip will include the current proxy mode: code http://mxr.mozilla.org/seamonkey/sou...ityoverlay.xul bugs bug 243624 reference network.proxy.type ...
File object - Archive of obsolete content
when a file is constructed, leading and trailing spaces are removed from the filename, so new file(" abc.txt ") just creates a file called abc.txt.
... file.creationtime a date object representing the time when the file was created.
... file.lastmodified a date object representing the time when the file was last modified.
...only has meaning when the file is a directory.
The life of an HTML HTTP request - Archive of obsolete content
(3) when data is starting to come from the webserver the nsichannel calls the onstartrequest in the documenloader.
...this argument is always pr_false when the content sink calls appendchild.
... todo: how are nsiframes reflowed after a change when they already exist?
...when the presshell [note: not true, who really does the call?] has layouted (reflowed) the frames it calls nsiframe::paint() method of all frames.
URIs and URLs - Archive of obsolete content
resources are identified by uri "uniform resource identifier" (taken from rfc 2396): uniform uniformity provides several benefits: it allows different types of resource identifiers to be used in the same context, even when the mechanisms used to access those resources may differ; it allows uniform semantic interpretation of common syntactic conventions across different types of resource identifiers; it allows introduction of new types of resource identifiers without interfering with the way that existing identifiers are used; and, it allows the identifiers to be reused in many different contexts, thus permitting ne...
...thus, a resource can remain constant even when its content---the entities to which it currently corresponds---changes over time, provided that the conceptual mapping is not changed in the process.
...gateways, proxies, caches, and name resolution services might be used to access some resources, independent of the protocol of their origin, and the resolution of some url may require the use of more than one protocol (e.g., both dns and http are typically used to access an "http" url's resource when it can't be found in a local cache).
...normally, the only time escape encodings can safely be made is when the uri is being created from its component parts; each component may have its own set of characters that are reserved, so only the mechanism responsible for generating or interpreting that component can determine whether or not escaping a character will change its semantics.
Event Handlers - Archive of obsolete content
the handler contains script that is executed when an event flows to the object the handler is attached to and if that event matches all of the criteria specified by the handler.
... the most basic handler specifies the event to listen for and an action to take when the handler fires.
...when a filter is imposed, additional conditions must be met before the event handler will fire.
...when set, the corresponding fields in the event object must match for the event to fire.
Methods - Archive of obsolete content
getvaluenumber retrieves the value of a key, when that value is an integer.
... getvaluestring retrieves the value of a key, when that value is a string.
... setvaluenumber sets the value of a key, when that value is an integer.
... setvaluestring sets the value of a key, when that value is a string.
collapse - Archive of obsolete content
« xul reference home collapse type: one of the values below determines which side of the splitter is collapsed when its grippy is clicked.
...you should put a grippy element inside the splitter when it is used for collapsing.
... before when the grippy is clicked, the element immediately before the splitter in the same parent is collapsed so that its width or height is 0.
... after when the grippy is clicked, the element immediately after the splitter in the same parent is collapsed so that its width or height is 0.
events - Archive of obsolete content
focus: occurs when the focused element changes.
... select: occurs when the selected text changed.
... clipboard: occurs when the clipboard is changed.
... undo: occurs when the undo buffer is changed.
Reading from Files - Archive of obsolete content
this means that if a character within the file occupies several bytes, it will converted into a single character when read.
...while(stream.available()) output += stream.readstring(10); the close method is used at the end to close the stream when you are finished reading from it.
... you should always strive to close a stream when you have finished reading or writing to it to ensure that it doesn't remain open longer than necessary.
...if you are expecting to read from a binary file instead of text, specify the 'binary' flag when creating the stream with nsiscriptableio.newinputstream().
Moving, Copying and Deleting Files - Archive of obsolete content
this will be the usual behaviour when copying to a different directory, but you would want to specify a filename when copying a file to another name within the same directory.
... a number of errors could occur when copying a file, for instance if the file to copy does not exist or the destination directory is not writable.
...this would be used when renaming a file within the same directory.
... when moving a file within the same directory, the destination argument may be null.
How to implement a custom XUL query processor component - Archive of obsolete content
custom query processors are xpcom components, must implement the nsixultemplatequeryprocessor interface and follow some conventions for when registering the component.
... here is an example of what our xul might look like when using a custom query processor: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <grid> <columns> <column flex="1"/> <column flex="3"/> <column flex="2"/> <column flex="1"/> </columns> <rows datasources="dummy" ref="." querytype="simpledata"> <template> <row uri="?"> <label value="?name"/> ...
...from the beginning of the name var name = avar.tostring().slice(1); return this._data[name]; }, // return an object instead of a string for convenient comparison purposes // or null to say just use string value getbindingobjectfor: function(avar) { return null; }, // called when a rule matches this item.
...der, ashoulddelaybuilding) { // todo: parse the adatasources variable // for now, ignore everything and let's just signal that we have data return this._data; }, initializeforbuilding: function(adatasource, abuilder, arootnode) { // perform any initialization that can be delayed until the content builder // is ready for us to start }, done: function() { // called when the builder is destroyed to clean up state }, compilequery: function(abuilder, aquery, arefvariable, amembervariable) { // outputs a query object.
Floating Panels - Archive of obsolete content
when set to true, the popup will not close when the user clicks outside of it, nor when the user presses the escape key.
...on mac, floating panels are invisible when another application is made active, and become visible again when the xul application is made active.
...a label for the titlebar may be set using the label attribute, as in the following example: <panel id="info-panel" noautohide="true" titlebar="normal" label="image properties"> closing a floating panel unlike other panels, a floating panel does not close when clicking outside of it.
...when the user presses it, the popup will be closed.
Multiple Rules - Archive of obsolete content
when used together in this example, the results are combined and only three results are shown.
...rules and conditions are more useful when using multiple rules.
...when multiple conditions are present, they must all match for the rule to apply.
...when using the negate attribute, the where clause will match if none of the values match.
Result Generation - Archive of obsolete content
once you have selected a starting point, you use a number of statements which indicate where to go next when navigating the graph.
...during query processing, the template builder builds up a network of information such as: possible results that are available where content should be generated information that indicates what to do when the rdf datasource changes this network of information remains for the lifetime of the template, or until it is rebuilt.
...this allows for a fairly efficient means of updating results when, for instance, a new statement is added to the rdf graph.
...a similar method can be used when removing rdf statements.
Template Logging - Archive of obsolete content
in addition, each result generated when the template is first created and initialized is logged.
...this logging of results can be very useful for debugging, but remember to remove this flag when you have finished and the template works correctly, as the logging can take up extra time that is not necessary when the template is working.
...in other words, the generated content will only change when active results are involved.
...expected <content> to be first for an rdf template, when using the full query syntax, the <content> element must always appear before any other elements.
XML Templates - Archive of obsolete content
when an xml source is desired, specify a querytype attribute on the root node of the template to the value xml.
...this is useful when recursive generation or multiple rules are used, and we'll see examples of why this is useful later.
...when a question mark character followed by a string appears in an attribute value, the label value is not directly, but instead the value of an attribute for the source xml is used.
... be aware that when xml data is included inline as in this example, the content may be displayed and may affect the layout of other parts of the window.
Things I've tried to do with XUL - Archive of obsolete content
this means that creating any sort of visual display (not necessarily "ui"; my use case is for creating a calendar time display) that sizes sanely when the user resizes the window is unfortunately very difficult.
... resize event problems going with the inability to obtain the clientwidth/clientheight of xul elements, it's impossible to handle the "resize" event yourself to grow/shrink content as needed -- as you grow the content, when you shrink the window, the content will simply be clipped (because now it has a bigger size than the window).
... xbl in listboxes using xbl bindings in listboxes is not easy because there is a big bug there: if you create from js an element you want to bind, and if it is hidden when the listbox is first rendered, the listbox does not create a frame for it, and the xbl doesn't get attached...
... multi-column listboxes when adding items to multi-column listboxes, you can't use the appenditem api: // auto-create and attach 1st cell var row = mylistbox.appenditem( label, value ); // create and attach 2nd cell var cell = document.createelement('listcell'); cell.setattribute('label', label2 ); cell.setattribute('value', value2 ); row.appendchild( cell ); // etc // ...
Toolbar customization events - Archive of obsolete content
when toolbars are customized, events are sent to their parent window.
... beforecustomization this event is delivered when the user starts the toolbar customization process; for example, by right-clicking on a toolbar and choosing "customize".
... customizationchange this event is delivered when the user makes a change to a toolbar while editing the toolbars, either by dragging an item to the toolbar or by dragging an item out of it.
... aftercustomization this event is delivered when the user closes the toolbar customization panel.
Anonymous Content - Archive of obsolete content
override the bound element the anonymous content is created automatically whenever a binding is attached to an element.
...using the children element there may be times when you want both the xbl content and the content provided by the xul file to be displayed.
...this is handy when creating custom menu widgets.
...this is an important distinction when using the dom with xbl.
Input Controls - Archive of obsolete content
note that the control attribute has been used so that the textbox is selected when the label is clicked.
...radio buttons can be used for a similar purpose when there are a set of them and only one can be selected at once.
...when the user clicks the checkbox, it switches between checked and unchecked.
... example 3 : source view <radiogroup> <radio id="orange" label="orange"/> <radio id="violet" selected="true" label="violet"/> <radio id="yellow" label="yellow"/> </radiogroup> attributes like buttons, check boxes and radio buttons are made up of a label and an image, where the image switches between checked and unchecked when it is pressed.
More Wizards - Archive of obsolete content
a script will adjust the next attributes as necessary to go to the page with the page id color when needed.
...you can change the property when invalid or valid data has been entered.
...the function checkcode() is called whenever the first page is shown as indicated by the onpageshow attribute.
... it is also called whenever a key is pressed in the textbox, to determine whether the next button should be enabled again.
Stack Positioning - Archive of obsolete content
stacks have the advantage that when one absolutely positioned element changes its position, the position of the other elements is not affected.
...when drawing the child elements, the elements are shown in the order that they appear in the stack.
... when responding to mouse events, the elements on top will capture the events first.
... when using these attributes to set width or height, both attributes for the given axis must be explicitly set, eg, if setting width, both "left" and "right" must be set.
Tree Box Objects - Archive of obsolete content
you don't need to call the rowcountchanged() function when a row has simply changed in some way, for example if a cell's label changes.
...the scrollbypages() function scrolls by a number of pages and is called automatically when the user presses the page up or page down keys while the tree is focused.
...this is a convenient method since when the user resizes a flexible tree, the page size will grow and shrink, so you don't need to calculate the page size manually.
...in fact, this is what the underlying tree code does when the user double clicks the twisty.
XBL Example - Archive of obsolete content
when getting this custom property, it will need to retrieve the value of the selectedindex attribute of the deck, which holds the number of the currently displayed page.
... similarly, when setting this property, it will need to change the selectedindex attribute of the deck.
... an oncommand handler will need to be added to the previous and next buttons so that the page is changed when the buttons are pressed.
... constructor we will also need a constructor to initialize the label element so that it displays correctly when the slideshow is first displayed.
Writing Skinnable XUL and CSS - Archive of obsolete content
the following document outlines rules that one must abide by when writing a skin.
...if it imported the global skin, then when it was overlayed into navigator, it would potentially clash (if the user's current chosen navigator skin were not inheriting from global).
...this rule also applies when designing a css file for a ui component that will be overlayed into other components.
...the matching for these rules (unless you're very careful) will be inefficient, and when only using generic tag names, can be positively grotesque.
browser - Archive of obsolete content
droppedlinkhandler type: function this function is called when links are dropped to the browser element, with the following arguments.
...in addition to the flags allowed for the reloadwithflags method, the following flags are also valid: load_flags_is_refresh: this flag is used when the url is loaded because of a meta tag refresh or redirect.
... load_flags_is_link: this flag is used when the url is loaded because a user clicked on a link.
...this is the flag used when the reload button is pressed while the shift key is held down.
checkbox - Archive of obsolete content
this is most commonly rendered as a box when the element is off and a box with a check when the element is on.
...for example, for a menuitem in a menu you can add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled type: boolean indicates whether the element is disabled or not.
...this attribute only has any effect when used inside a prefwindow.
...the tab order is the order in which the focus is moved when the user presses the "tab" key.
image - Archive of obsolete content
ArchiveMozillaXULimage
note: prior to gecko 8.0, images did not shrink down with the same ratio in both directions when specifying maximum sizes using maxheight or maxwidth.
... attributes onerror, onload, src, validate properties accessibletype, src style classes alert-icon, error-icon, message-icon, question-icon examples <image src='firefoxlogo.png' width='135' height='130'/> attributes onerror type: script code this event is sent to an image element when an error occurs loading the image.
... image.onload type: script code this event handler will be called on the image element when the image has finished loading.
...if you change the image, the event will fire again when the new image loads.
key - Archive of obsolete content
ArchiveMozillaXULkey
when a key matching the attributes on the key element is pressed, the command will be fired on the key element.
... oncommand type: script code this event handler is called when the command is activated.
... this occurs when a user selects a menu item or presses a keyboard shortcut attached to the command.
...queryselector(), queryselectorall(), removeattribute(), removeattributenode(), removeattributens(), removechild(), removeeventlistener(), replacechild(), setattribute(), setattributenode(), setattributenodens(), setattributens(), setuserdata details on key, keycode, and modifiers attributes for example, consider the following key: <key key="r" modifiers="shift"/> this key will only match when the shift key is pressed as well as the r key, and no other keys.
menuseparator - Archive of obsolete content
for example, for a menuitem in a menu you can add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled type: boolean indicates whether the element is disabled or not.
...the tab order is the order in which the focus is moved when the user presses the "tab" key.
...this is set when a label has a control attribute pointing to this element.
... this property will be null when no label is associated with the control.
notificationbox - Archive of obsolete content
events alertactive type: event fired when a notification element is shown.
... alertclose type: event fired when a notification element is closed.
...each description is an object with the following properties: accesskey - the accesskey to appear on the button callback - function to be called when the button is activated.
...the value is specified when adding the notification with appendnotification.
preference - Archive of obsolete content
a change event is fired in different ways for different xul input elements as listed below: onchange type: script code textbox when enter key is pressed radio/check box when the state is changed select list when the selected item is changed what is accessible the script context at this point can only access the following things: global values/functions i.e.
...the tab order is the order in which the focus is moved when the user presses the "tab" key.
...when instantapply is off (default on windows), this gets and sets the current value of the preference in the currently open dialog.
...dnodes(), insertbefore(), isdefaultnamespace(), isequalnode, issamenode, issupported(), lookupnamespaceuri, lookupprefix, normalize(), queryselector(), queryselectorall(), removeattribute(), removeattributenode(), removeattributens(), removechild(), removeeventlistener(), replacechild(), setattribute(), setattributenode(), setattributenodens(), setattributens(), setuserdata events change when a preference value changes, an onchange/change event is fired on the <preference> element.
scale - Archive of obsolete content
ArchiveMozillaXULscale
a scale will fire a change event whenever the scale's value is modified.
... increment type: integer the amount by which the curpos (for scroll bars) or value (for number boxes and scale) attribute changes when the arrows are clicked(or scales are dragged).
... pageincrement type: integer the amount by which the value of the curpos or value attribute changes when the tray of the scroll bar (the area in which the scroll bar thumb moves) is clicked, or when the page up or page down keys are pressed.
...the tab order is the order in which the focus is moved when the user presses the "tab" key.
scrollbar - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] when a container's contents which are larger that the size of the container, scroll bars may be placed at the side of the container to allow the user to scroll around in the container.
... the scroll bar may also be used independently when a numeric value or percentage needs to be selected by the user.
... increment type: integer the amount by which the curpos (for scroll bars) or value (for number boxes and scale) attribute changes when the arrows are clicked(or scales are dragged).
... pageincrement type: integer the amount by which the value of the curpos or value attribute changes when the tray of the scroll bar (the area in which the scroll bar thumb moves) is clicked, or when the page up or page down keys are pressed.
Getting started with XULRunner - Archive of obsolete content
this will become clearer when we see how the “chrome://” uri is used.
...*/ pref("browser.dom.window.dump.enabled", true); pref("javascript.options.showinconsole", true); pref("javascript.options.strict", true); pref("nglayout.debug.disable_xul_cache", true); pref("nglayout.debug.disable_xul_fastload", true); xulrunner specific preferences include: toolkit.defaultchromeuri specifies the default window to open when the application is launched.
... toolkit.defaultchromefeatures specifies the features passed to window.open() when the main application window is opened.
... windows from a windows command prompt opened to the myapp folder, we should be able to execute this: c:\path\to\xulrunner.exe application.ini of course, if you opted to install xulrunner then you could simply do ​%programfiles%\xulrunner.exe application.ini or on 64 bit systems ​%programfiles(x86)%\xulrunner.exe application.ini note: you can also install your application when you're finished debugging it.
XULRunner tips - Archive of obsolete content
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.*...
... making windows display correct application name and icon when buttons are grouped by default, the task bar on windows might group windows belonging to the same process into one button to save space.
...there are two approaches to display the branding of your application instead: when compiling xulrunner yourself: create a file module.ver in the directory mozilla/xulrunner/app with the contents: win32_module_description=myapplication myapplication should be replaced by whatever you want to see as title of the button.
... unknown-content-type and file-downloads dialogs from a <browser> element, you need to add the following prefs: pref("browser.download.usedownloaddir", true); pref("browser.download.folderlist", 0); pref("browser.download.manager.showalertoncomplete", true); pref("browser.download.manager.showalertinterval", 2000); pref("browser.download.manager.retention", 2); pref("browser.download.manager.showwhenstarting", true); pref("browser.download.manager.usewindow", true); pref("browser.download.manager.closewhendone", true); pref("browser.download.manager.opendelay", 0); pref("browser.download.manager.focuswhenstarting", false); pref("browser.download.manager.flashcount", 2); // pref("alerts.slideincrement", 1); pref("alerts.slideincrementtime", 10); pref("alerts.totalopentime", 4000); pref("alerts...
2006-10-20 - Archive of obsolete content
marcus claims that when he builds firefox using centos he encounters crashes (segmentation faults) under linux distributions such as gentoo, suse and fedora.
... he also points out that when he performs a local build any of those platforms (gentoo, suse and fedora) he doesn't encounter any problems on the same machine.
... nsis and my extension jan vávra is wondering how he could create a win32 installer of thunderbird that when executed, it would also install his extensions of choice.
...boris zbarsky's said: the reason why gtk1 builds are still being performed is because: when requests are made to change build boxes to newer versions the people responsible for making the change reply with "that would require an os upgrade".
NPP_Destroy - Archive of obsolete content
the browser calls this function when a plug-in instance is deleted, typically because the user has left the page containing the instance, closed the window, or quit the browser.
...upon the user's return to the page, this information is passed to the new plug-in instance when it is created with npp_new.
...ownership of the buf field of the npsaveddata structure passes from the plug-in to the browser when npp_destroy returns.
... to ensure that the browser does not crash or leak memory when the saved data is discarded, npsaveddata's buf field should be a flat structure (a simple structure with no allocated substructures) allocated with npn_memalloc.
Syndicating content with RSS - Archive of obsolete content
when you make a blog, an internet radio show, or an internet television show, you are syndicating.
...when this is the case, the html web page can let people and machines know about the feed by using the <link> element, like this: <link rel="alternate" type="application/rss+xml" href="http://example.com/feed" /> adding the <a> while use of the html <link> element is powerful, it is mostly hidden.
...it is recommended that you too use this icon when creating the special <a> link to your feed.
...here's a simple example of it being done: accept: application/rss+xml, text/html with real production software, though, it would look more like this: accept: application/rss+xml, application/xhtml+xml, text/html here's a more complete example: get / http/1.1 host: example.com accept: application/rss+xml, application/xhtml+xml, text/html when an http server (or server-side script) gets this, it should redirect the http client to the feed.
Sunbird Theme Tutorial - Archive of obsolete content
testing further changes when you make further changes to your theme, test them by restarting sunbird.
...for example, when i wrote this article i used this command in my theme directory: zip -0r testing-0.1.jar .
...for example, when i wrote this article i used this command in my <tt>chrome</tt> directory: zip -0r testing.jar .
...for example, when i wrote this article i used this command in my theme directory: zip -9 testing-0.1.jar * chrome/testing.jar make this jar file available to users.
Building a Theme - Archive of obsolete content
when writing a theme, the easiest way to determine what css selectors you need to write is to use the dom inspector which you should have installed in the setup step.
... when you load content using a chrome uri, firefox uses the chrome registry to translate these uris into the actual source files on disk (or in jar packages).
...for example, the line skin browser sample skin/browser/ means "when the user has the sample theme selected, use the directory browser/ to look up skins for the browser package." more concisely, this means that the url chrome://browser/skin/some/path/file.css will look for a file browser/some/path/file.css in your theme's root directory.
...mozilla's site also provides users easier installation, and will automatically make your newer versions available to users of your existing versions when you upload them.
Theme changes in Firefox 4 - Archive of obsolete content
note: when extracting omni.jar, you may incorrectly get false warnings from some virus protection software.
... use of the iconsize attribute on toolbar elements add-ons use the iconsize attribute to determine which icon they should display when a button is placed in a specific toolbar.
... note: add-ons always use a 24x24 pixels icon when the button is displayed in the toolbar customization palette.
...thus, it includes this rule in browser.css: #nav-bar { counter-reset: smallicons; } to use large icons for add-on buttons in the bookmarks toolbar when the related user preference is set: #navigator-toolbox[iconsize="large"] > #personaltoolbar { counter-reset: largeicons; } to use large icons everywhere, including the menu bar, regardless of the user preference: #navigator-toolbox > toolbar, #addon-bar { counter-reset: largeicons; } creating a theme that works for firefox 4 on mac os x create a new directory (for example, my_theme).
Scratchpad - Archive of obsolete content
inline documentation to show the inline documentation popup, press ctrl + shift + space when the cursor is on an identifier.
... run when you choose the run option, the selected code is executed.
...it first reloads the page, then executes the code when the page's "load" event fires.
...once you've done this, the environment menu has a browser option; once that's selected, your scope is the entire browser rather than just the page content, as you will see from examining some globals: window /* [object chromewindow] */ gbrowser /* [object xulelement] */ the scratchpad execution context is set to browser when a snippet file has // -sp-context: browser on the first line.
Object.prototype.watch() - Archive of obsolete content
in addition, using watchpoints has a serious negative impact on performance, which is especially true when used on global objects, such as window.
... the watch() method watches for a property to be assigned a value and runs a function when that occurs.
... handler a function to call when the specified property's value changes.
... description watches for assignment to a property named prop in this object, calling handler(prop, oldval, newval) whenever prop is set and storing the return value in that property.
XForms Repeat Element - Archive of obsolete content
occurs when the repeat element's appearance attribute has a value of compact.
... at="index('lineset')" position="after"/> <setvalue ref="/my:lines/my:line[index('lineset')]/@name"/> <setvalue ref="/my:lines/my:line[index('lineset')]/price">0.00</setvalue> </action> </trigger> <trigger> <label>remove current item</label> <delete ev:event="domactivate" nodeset="/my:lines/my:line" at="index('lineset')"/> </trigger> attribute based repeat when using xforms within host languages like xhtml, it is often necessary to create repeating structures within constructs such as html:table.
...to accommodate this, xforms 1.0 defines an alternative syntax that is functionally equivalent to the repeat element, using the following attributes: repeat-model repeat-bind repeat-nodeset repeat-startindex repeat-number additionally, when using xforms action setindex, its repeat attribute (which contains an idref) can point to any element carrying these repeat attributes.
...there are a number of errors that may occur, especially when these attributes are used with html:table.
Issues Arising From Arbitrary-Element hover - Archive of obsolete content
bare pseudo-classes the second piece of the problem comes when we consider the effects of a "bare" pseudo-class in a selector.
...however, rules of this type are usually seen in conjunction with markup like this: <td class="nav"> <a href="one.html" class="nav">one</a> | <a href="two.html" class="nav">two</a> | <a href="thr.html" class="nav">three</a> | <a href="fou.html" class="nav">four</a> </td> because the enclosing table cell has a class of nav, the vertical-bar characters will turn red when the user moves the mouse pointer anywhere within the table cell.
... the links will also turn red when they are hovered.
...in order to avoid this problem, authors should use the combined pseudo-class syntax described by css2: a:link:hover {color: red;} a:visited:hover {color: maroon;} note that, with this syntax, it is possible to style visited and unvisited links differently when they are hovered.
Game distribution - Game development
publishing the game there are three main options when it comes to publishing a game: self-hosting publishers stores remember that the name of your game should be unique enough to be quickly promoted later on, but also catchy enough, so people don't forget it.
... native mobile stores when it comes to the mobile market, there's the apple app store for ios, google play for android and all the rest of the competition.
... nw.js — formerly known as node-webkit, this is the first choice when it comes to building a desktop game that works on windows, mac and linux.
...when you've published the game it's time to focus on promotion — letting people know your game exists.
Building up a basic demo with PlayCanvas editor - Game development
creating an account the playcanvas editor is free — all you have to do to begin with is register your account and login: when you first sign up, you are taken straight into the editor and given a simple starter tutorial involving editing a 3d rolling ball game.
...when you are ready to continue with our tutorial, go to your canvas homepage — for example mine is https://playcanvas.com/end3r.
...when hovering over that button with your mouse the label will say 'add entity' — that's exactly what we want to do.
... now follow the same steps as we did before when coloring the cube: create a new material using the add asset (plus) button.
Call stack - MDN Web Docs Glossary: Definitions of Web-related terms
when a script calls a function, the interpreter adds it to the call stack and then starts carrying out the function.
... when the current function is finished, the interpreter takes it off the stack and resumes execution where it left off in the last code listing.
... call stack list: - greeting when everything inside the greeting() function has been executed, return to its invoking line to continue executing the rest of the js code.
...whenever we invoke a function, it is automatically added to the call stack.
Parse - MDN Web Docs Glossary: Definitions of Web-related terms
when the html parser finds non-blocking resources, such as an image, the browser will request those resources and continue parsing.
... parsing can continue when a css file is encountered, but <script> tags—particularly those without an async or defer attribute—blocks rendering, and pauses parsing of html.
... when the browser encounters css styles, it parses the text into the css object model (or cssom), a data structure it then uses for styling layouts and painting.
... javascript parsing is done during compile time or whenever the parser is invoked, such as during a call to a method.
SEO - MDN Web Docs Glossary: Definitions of Web-related terms
when you search, the search engine displays the indexed content.
...if you follow those rules closely when doing seo for a website, you give the site the best chances of showing up among the first results, increasing traffic and possibly revenue (for ecommerce and ads).
...when exploring the website, crawlers should only find the content you want indexed.
... popularity you get most traffic when other established sites link to your site.
TCP slow start - MDN Web Docs Glossary: Definitions of Web-related terms
when a new connection is made, cwnd is initialized to one tcp data or acknowledgment packet, and waits for an acknowledgement, or ack.
... when that ack is received, the congestion window is incremented until the cwnd is less than ssthresh.
... slow start also terminates when congestion is experienced.
... congestion control congestion itself is a state that happens within a network layer when the message traffic is too busy it slows the network response time.
Styling tables - Learn web development
unfortunately, it doesn't look good when rendered on the screen (see it live at punk-bands-unstyled.html): with only the default browser styling it looks cramped, hard to read, and boring.
...by default, when you set borders on table elements, they will all have spacing between them, as the below image illustrates: this doesn't look very nice (although it might be the look you want, who knows?) with border-collapse: collapse; set, the borders collapse down into one, which looks much better: we've put a border around the whole table, which is needed because we'll be putting some borders round the ta...
...ble header and footer later on — it looks really odd and disjointed when you don't have a border round the whole outside of the table and end up with gaps.
...the next article explores debugging css — how to solve problems such as layouts not looking like they should, or properties not applying when you think they should.
The box model - Learn web development
when you move on to learn about css layout in more detail, you will encounter flex, and various other inner values that your boxes can have, for example grid.
... there are a number of rules that dictate when margins do and do not collapse.
... where this can be useful is when you want to give a link to a larger hit area by adding padding.
...the navigation below is displayed in a row using flexbox and we have added padding to the <a> element as we want to be able to change the background-color when the <a> is hovered.
Multiple-column layout - Learn web development
in this case the content breaks when the spanning element is introduced and continues below creating a new set of column boxes.
...it essentially behaves the same way as content behaves in paged media — such as when you print a webpage.
... when you turn your content into a multicol container it is fragmented into columns, and the content breaks to allow this to happen.
... summary you now know how to use the basic features of multiple-column layout, another tool at your disposal when choosing a layout method for the designs you are building.
How much does it cost to do something on the Web? - Learn web development
summary when launching a website, you may spend nothing, or your costs may go through the roof.
...“packaged” hosting when you want to publish a website, you could do everything by yourself: set up a database (if needed), content management system, or cms (like wordpress, dotclear, spip, etc.), upload pre-made or your own templates.
...paid hosting you might ask, why should i pay for my hosting when there are so many free services?
... you have more freedom when you pay.
How do I start to design my website? - Learn web development
summary when starting with a web project, many people focus on the technical side.
... so when you get an idea and want to turn it into a website, there are a few questions you should answer before anything else: what exactly do i want to accomplish?
... doing this simple exercise—writing goals and sorting them—will help you out when you have decisions to make.
...once you have that clear vision, you need to decide how and when to do it.
Common questions - Learn web development
with hypertext and http, url is a key concept when it comes to the internet.
... when you're launching a website, you may spend nothing or your costs may go through the roof.
... in this article we highlight some things to think about when choosing and installing a text editor for web development.
... when designing pages for your website, it's good to have an idea of the most common layouts.
Styling web forms - Learn web development
not all widgets are created equal when css is involved at present, some difficulties remain when using css with forms.
...as before, however, browsers rely on the system default styles when displaying these widgets.
...however, when you position it with for example a transform: translatey();, it moves but leaves an ugly gap in the <fieldset> border, which is not easy to get rid of.
...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, sinc...
Dealing with files - Learn web development
when you're building a website, you need to assemble these files into a sensible structure on your local computer, make sure they can talk to one another, and get all your content looking right before you eventually upload them to a server.
... when you are working on a website locally on your computer, you should keep all the related files in a single folder that mirrors the published website's file structure on the server.
...let's create these now: index.html: this file will generally contain your homepage content, that is, the text and images that people see when they first go to your site.
...buttons that load data when clicked).
HTML basics - Learn web development
in the mists of time, when html was young (around 1991/92), doctypes were meant to act as links to a set of rules that the html page had to follow to be considered good html, which could mean automatic error checking and other useful things.
...it is also used to describe the page when you bookmark/favourite it.
...this contains all the content that you want to show to web users when they visit your page, whether that's text, images, videos, games, playable audio tracks or whatever else.
... paragraphs as explained above, <p> elements are for containing paragraphs of text; you'll use these frequently when marking up regular text content: <p>this is a single paragraph</p> add your sample text (you should have it from what should your website look like?) into one or a few paragraphs, placed directly below your <img> element.
Test your skills: Links - Learn web development
we'd also like you to give it a tooltip when moused over that tells the user that the page includes information on blue whales and sperm whales.
... note: the first link in the example has the target="_blank" attribute set on it, so that when you click on it, it opens the page in a new tab.
... note: the first three links in the example have the target="_blank" attribute set on them, so that when you click on them, they open the linked page in a new tab.
... note: the first and third links in the example have the target="_blank" attribute set on them, so that when you click on them, they open the linked page in a new tab.
HTML table basics - Learn web development
LearnHTMLTablesBasics
when done correctly, even blind people can interpret tabular data in an html table — a successful html table should enhance the experience of sighted and visually impaired users alike.
... when should you not use html tables?
... tables are not automatically responsive: when you use proper layout containers (such as <header>, <section>, <article>, or <div>), their width defaults to 100% of their parent element.
... we have already partially answered this question — it is easier to find the data you are looking for when the headers clearly stand out, and the design just generally looks better.
Object prototypes - Learn web development
these all have a number of members defined on their prototype, which is why for example when you create a string, like this: let mystring = 'this is my string.'; mystring immediately has a number of useful methods available on it, like split(), indexof(), replace(), etc.
...this section is intentionally simplified to make these concepts a little easier to understand when you first meet them.
...you won't need to use it often, but it can be really useful when you want to create a new instance and don't have a reference to the original constructor easily available for some reason.
... you will rarely see properties defined on the prototype property, because they are not very flexible when defined like this.
Framework main features - Learn web development
when used with react, the jsx from the previous snippet would be compiled into this: var subject = "world"; var header = react.createelement("header", null, react.createelement("h1", null, "hello, ", subject, "!") ); when ultimately rendered by the browser, the above snippet will produce html that looks like this: <header> <h1>hello, world!</h1> </header> handlebars the handlebars templating ...
...all of the frameworks follow the same general model: they allow developers to perform certain actions when the component mounts, when it renders, when it unmounts, and at many phases in between these.
...both react and vue utilize a virtual dom model, but they do not apply the exact same logic when diffing or rendering.
...event } from "@testing-library/react"; import "@testing-library/jest-dom/extend-expect"; import counterbutton from "./counterbutton"; it("renders a semantic with an initial state of 0", () => { const { getbyrole } = render(<counterbutton />); const btn = getbyrole("button"); expect(btn).tobeinthedocument(); expect(btn).tohavetextcontent("clicked 0 times"); }); it("increments the count when clicked", () => { const { getbyrole } = render(<counterbutton />); const btn = getbyrole("button"); fireevent.click(btn); expect(btn).tohavetextcontent("clicked 1 times"); fireevent.click(btn); expect(btn).tohavetextcontent("clicked 2 times"); }); summary at this point you should have more of an idea about the actual languages, features, and tools you'll be using as you create app...
Componentizing our React app - Learn web development
your <ul> should read like this: <ul role="list" classname="todo-list stack-large stack-exception" aria-labelledby="list-heading" > <todo /> <todo /> <todo /> </ul> when you look back at your browser, you'll notice something unfortunate: your list now repeats the first task three times!
...let’s use the names of our tasks that we had before: <todo name="eat" /> <todo name="sleep" /> <todo name="repeat" /> when your browser refreshes, you will see… the exact same thing as before.
...remember: when you're in the middle of a jsx expression, you use curly braces to inject the value of a variable.
...when you’re done, app.js will read like this: import react from "react"; import form from "./components/form"; import filterbutton from "./components/filterbutton"; import todo from "./components/todo"; function app(props) { const tasklist = props.tasks.map(task => ( <todo id={task.id} name={task.name} completed={task.completed} key={task.id} /> ) ...
Rendering a list of Vue components - Learn web development
id: uniqueid('todo-'), label: 'have fun', done: true }, { id: uniqueid('todo-'), label: 'create a to-do list', done: false } ] }; } }; now, add the v-for directive and key attribute to the <li> element in your app.vue template, like so: <ul> <li v-for="item in todoitems" :key="item.id"> <to-do-item label="my todo item" :done="true"></to-do-item> </li> </ul> when you make this change, every javascript expression between the <li> tags will have access to the item value in addition to the other component attributes.
... update the label="my todo item" attribute to :label="item.label", and the :done="false" attribute to :done="item.done", as seen in context below: <ul> <li v-for="item in todoitems" :key="item.id"> <to-do-item :label="item.label" :done="item.done"></to-do-item> </li> </ul> now when you look at your running app, it'll show the todo items with their proper names, and if you inspect the source code you'll see that the inputs all have unique ids, taken from the object in the app component.
...your app.vue template should now look like this: <template> <div id="app"> <h1>my to-do list</h1> <ul> <li v-for="item in todoitems" :key="item.id"> <to-do-item :label="item.label" :done="item.done" :id="item.id"></to-do-item> </li> </ul> </div> </template> when you look at your rendered site, it should look the same, but our refactor now means that our id is being taken from the data inside app.vue and passed into todoitem as a prop, just like everything else, so things are now more logical and consistent.
... what we really need next is the ability to allow our users to enter their own todo items into the app, and for that we'll need a text <input>, an event to fire when the data is submitted, a method to fire upon submission to add the data and rerender the list, and a model to control the data.
Implementing feature detection - Learn web development
when you save everything and try out your example, you should see the flexbox layout applied to the page if the browser supports modern flexbox, and the float layout if not.
... when you are experimenting with modernizr you might as well use the development build, which includes every possible feature detection test.
... when you are using modernizr in production, you can go to the download page you've already visited and click the plus buttons for only the features you need feature detects for.
... then when you click the build button, you'll download a custom build containing only those feature detects, making for a much smaller file size.
Introduction to cross browser testing - Learn web development
to start with, when we talk about sites "working cross browser", we are really saying that they should provide an acceptable user experience across different browsers.
... second, when we say "across an acceptable number of web browsers", we don't mean 100% of the browsers in the world — this is just about impossible.
...this situation is a lot less bad than it used to be; back when ie4 and netscape 4 were competing to be the dominant browser in the 1990s, browser companies deliberately implemented things differently to each other to try to gain competitive advantage, which made life hell for developers.
...this is inevitable when you are dealing with bleeding edge features that browsers are just getting round to implementing, or if you have to support really old browsers that are no longer being developed, which may have been frozen (i.e.
Accessibility information for UI designers and developers
when you design user interfaces with accessibility in mind, they will work for more people.
... don't rely on color alone when your interface uses color to distinguish between things, make sure the distinction is also made in other ways.
... error recovery when you detect users provide unexpected input, explain what is wrong and, if possible, how to correct it.
... this is specifically important in these cases: the user input is about legal commitments or financial transactions it updates or removes the user's data in a system when recording tests responses in those cases, ensure users can change submissions, automatically check for errors.
A bird's-eye view of the Mozilla framework
it examines what happens when the user performs a simple user interface (ui) action such as clicking a link in the contents panel of the help viewer window shown below.
...when an html, xml, svg or other type of document is loaded, the nglayout engine (also known as gecko) parses the contents into a dom tree, and handles the layout and rendering of the document pages.
...it is up to the client to call release() when it no longer needs the interface.
...t startup, generates xpcom component instances on demand using the registry, which specifies the supported interfaces, their corresponding implementation objects, and the nsifactory interface, provides api facilities clients can use to dynamically create xpcom components, and specifies the mechanism clients use to query an xpcom component for one of its interfaces, and to release the interface when it’s no longer needed.
Browser chrome tests
a simple test would look like this: function test() { ok(gbrowser, "gbrowser exists"); is(gbrowser.tabs.length, 1, "browser has 1 tab"); } the test() function is invoked by the test harness when the test is run.
... note: be careful when naming your functions and variables.
... asynchronous tests when writing async tests, you can use the add_task method with promises.
...} when writing tests, design for failure.
Continuous Integration
when you push a commit to mozilla-central or a related repository, it initiates a large chain of builds and tests across multiple types of infrastructure.
... when sheriffs see a build or test has been broken, they are empowered to take one of several actions, including backing out a patch which caused the problem and closing the tree (i.e., preventing any additional commits).
... 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.
... perfherder alerts we track changes to talos and other performance frameworks inside perfherder, and try to automatically alert when there is a sustained change exceeding a certain magnitude (specified per test).
Creating Sandboxed HTTP Connections
onstartrequest - gets called when a new request is initiated.
... onchannelredirect - when a redirect happens, a new nsichannel is created, and both the old and new ones are passed in as arguments.
...it is usually best to use a javascript wrapper that implements all the required methods and calls the specified callback function when the connection has completed.
... }) } handling cookies when sending a request, cookies that apply to the url are sent with the http request.
Makefile - variables
.ns_printing objs obj_suffix filename suffix to use when writing object files.
... xpidl_module module name to use when generating .xpt files, default to module.
... python_unit_tests list of python scripts to check exit status for make check xpc_shell_tests no_xpcshell_manifest_check inhibit validating manifest files when running xpcshell tests.
... no_ variable description no_profile_guided_optimize inhibit pgo builds no_dist_install note: values will be appended to the export variable when present.
Makefiles - Best practices and suggestions
prefer library rules whenever possible or create library rules that are missing.
... platform specific - avoid this logic whenever possible.
... for classes of hardware (unix/windows) place your makefile in a subdirectory, unix/makefile.in always include dependencies when creating a target initial make call should always be the workhorse: build, generate, deploy, install, etc.
... for ex, individual unit tests would invalidate all prior test activity whenever a test touched a timestamp file in the directory to signal success.
Simple Thunderbird build
note: parts of the build process also have problems when the source code is in a directory where the path is long (nested many levels deep).
... to also build lightning when building thunderbird (deprecated) note: the lightning calendar add-on was integrated into thunderbird starting with version 74.
... if it is in your `mozconfig` file, you should go ahead and remove it when building thunderbird 74 or later, since support for it will eventually be removed completely.
...those have caused several problems historically and tend to be poorly tested when the build system changes.
Inner and outer windows
consider that when the user is looking at a document in a browser window, not only can the document the user is currently viewing change, but the document's contents can change.
...nested windows things become slightly more complex when you consider that documents can contain other documents.
... this happens, for example, when a document contains a <frame> or <iframe>.
...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.
Limitations of chrome scripts
for example: whenever extensions try to access web content from the chrome process, the browser will return a cross process object wrapper that gives the chrome code synchronous access to the content.
... in some situations, the content process may not be initialized when an add-on asks for access to its content.
...it will return a dummy nsiloadcontext when asked, but any attempt to get a window out of it will fail.
...for example: addeventlistener("load", handler, true) // for example if you need to contact the chrome process when that happens, send it a message.
Communicating with frame scripts
ils: // chrome script messagemanager.addmessagelistener("my-addon@me.org:my-e10s-extension-message", listener); function listener(message) { console.log(message.name); console.log(message.sync); console.log(message.data); console.log(message.target); console.log(message.objects); } so combining this message listener with the message above will give console output somewhat like this, when the user clicks a <div>: "my-addon@me.org:my-e10s-extension-message" false object { details: "they clicked", tag: "div" } <xul:browser anonid="initialbrowser" ...
... synchronous messaging to send a synchronous message, the frame script uses the global sendsyncmessage() function: // frame script sendsyncmessage("my-addon@me.org:my-e10s-extension-message"); when a chrome script receives a synchronous message, it should return a value from its message listener: // chrome script messagemanager.addmessagelistener("my-addon@me.org:my-e10s-extension-message", listener); function listener(message) { return "value from chrome"; } this value is then presented to the frame script in the return value of sendsyncmessage().
...lemessagefromchrome(message) { var payload = message.data.details; // "some more details" } addmessagelistener("my-addon@me.org:message-from-chrome", handlemessagefromchrome); message-manager-disconnect if you're using a message manager to communicate with a script that may be running in a different process, you can listen for the message-manager-disconnect observer notification to know when the message manager has disconnected from the other end of the conversation, so you can stop sending it messages or expecting to receive messages.
... // on some event var browsermm = gbrowser.selectedbrowser.messagemanager; browsermm.loadframescript("chrome://my-addon@me.org/content/frame-script.js", false); messagemanagers.push(browsermm); console.log(messagemanagers.length); we can listen for message-manager-disconnect to update the array when the message managers disconnect (for example because the user closed the tab): function myobserver() { } myobserver.prototype = { observe: function(subject, topic, data) { var index = messagemanagers.indexof(subject); if (index != -1) { console.log("one of our message managers disconnected"); mms.splice(index, 1); } }, register: function() { var observerservice...
Frame script environment
if you want other principals or when interacting with untrusted page scripts, you should use a sandbox.
... events besides the regular dom events being captured/bubbling up from content the current content object the following additional events get fired in a frame script environment: unload bubbles no fires when the frame script environment is shut down, i.e.
... when a tab gets closed.
... domwindowcreated fires when a new content object is created.
Chrome-only CSS reference
MozillaGeckoChromeCSS
it only works in chrome code, and only on mac os x.:-moz-lwthemethe :-moz-lwtheme pseudo-class matches in chrome documents when the root element's lightweightthemes attribute is true and a theme is selected.:-moz-lwtheme-brighttextthe :-moz-lwtheme-brighttext pseudo-class matches in chrome documents when :-moz-lwtheme is true and a lightweight theme with a bright text color is selected.:-moz-lwtheme-darktextthe :-moz-lwtheme-darktext pseudo-class matches in chrome documents when :-moz-lwtheme is true and a lightweight the...
... 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-progressmeteractivated when the type attribute is set to progressmeter.
...erties attribute.css -moz-bool-pref() @supports functionthe -moz-bool-pref() @supports condition is available to gecko chrome and ua stylesheets to check if a boolean preference is enabled.css <display-xul> component</display-xul>firefox supports the following -moz- prefixed xul display values:overflow-clip-boxthe overflow-clip-box css property specifies relative to which box the clipping happens when there is an overflow.
... it is short hand for the overflow-clip-box-inline and overflow-clip-box-block properties.overflow-clip-box-blockthe overflow-clip-box-block css property specifies relative to which box the clipping happens when there is an overflow — in the block direction.overflow-clip-box-inlinethe overflow-clip-box-inline css property specifies relative to which box the clipping happens when there is an overflow — in the inline direction.
MozBeforePaint
whenever you're ready to refresh your animation, you call the window.requestanimationframe() method.
... once you've called this, the mozbeforepaint event will be fired one time, when it's time for animations to be updated for the window's next animation frame.
... the timestamp property of this event will be set to the time when the animation frame is sampled; this is relevant when trying to synchronize mozrequestanimationframe animations with smil animations or css transitions.
...when the animation sequence completes, removes the event listener.
Overview of Mozilla embedding APIs
they provide some basic functionality which should be leveraged when building new xpcom components.
...in addition to memory allocation and release, this service provides low memory notifications, called a memory pressure observers, which are notified when memory is low - thus allowing cached resources to be freed.
...contract-id: ns_uri_loader_contractid implemented interfaces: nsiuriloader related interfaces: nsiuricontentlistener nsunknowncontenttypehandler the unknowncontenttypehandler service is the last resort of the uriloader when no other content handler can be located.
...none interface definition: nsiservicemanager.h nsishutdownlistener this interface is used to receive notifications when the service manager is being shutdown.
Hacking with Bonsai
there is a web page, which records if the tree is open or closed what the date stamp of the last known good tree is who is on the hook for the current tree before the tree is opened, the list of checkins that happened when the tree was closed is reviewed to insure that only build related checkins took place.
...these people, when they check in, will be "on the hook" for the next day's build.
...when the tree is re-opened, the web page is updated and the hook is cleared.
... the rules no checkins when the tree is closed unless you are fixing a build problem at the request of a build person.
How Mozilla determines MIME Types
however, starting in mozilla 1.7alpha, mozilla does do content sniffing, like this: when the content-type sent by the server is one of (case-sensitively) text/plain text/plain; charset=iso-8859-1 text/plain; charset=iso-8859-1 and the server did not send a content-encoding header, mozilla will sniff the first block of data it gets and check for non-text bytes.
...when encountering a non-text byte, the helper app dialog will be shown, showing the mime type corresponding to the extension of the file.
...this is done because the generic text/xml mime type does not work for xul files, and xhtml files get a different dom when interpreted as text/xml.
...when loading an uri with a type that mozilla can not handle, a helper app dialog shows up, and the displayed information comes from these sources: ask the os for a handler of the given <extension, mime type> pair.
Assert.jsm
let assert = new assert(reporterfunc); the new assert instance, assert, uses reporterfunc to report assertion results or throws an assertionerror when an assertion fails, as default behavior.
...returns a promise that resolves when the promise either resolves or rejects.
... arguments passed in to this function are: err an error object when the assertion failed or null when it passed message message describing the assertion stack stack trace of the assertion function.
... report() all of the aforementioned functions must throw an assertionerror when a corresponding condition is not met, with a message that may be undefined if not provided.
DownloadLastDir.jsm
downloadlastdir.setfile(uri, file); to retrieve the path in firefox 26 or later, use getfileasync: downloadlastdir.getfileasync(uri, function (file) { // file is an nsifile console.log(file); }); deprecated since gecko 26.0 to retrieve the path in firefox 25 or earlier, use getfile: // file is an nsifile var file = gdownloadlastdir.getfile(uri); console.log(file); private browsing mode when browsing normally, the browser uses the browser.download.lastdir preference to store the last download directory path.
... however, when private browsing mode is enabled, the last download directory path is instead maintained in memory, and the preference is not changed.
... when the user exits private browsing mode, the last download directory value is reverted to the preference's value.
... when history is cleared when the user's browsing history is cleared, the value of the last download directory path is restored to the platform's default download directory path.
DownloadTarget
this is a dynamic property, which is updated when the download is completed or when the download.refresh() method is called.
... for single-file downloads, this property's value will always match the actual size of the file on disk, while the download.totalbytes property, when available, may indicate the size of the data as encoded for transfer instead.
... this is a dynamic property, which is updated when the download finishes or whenever the download.refresh() method is called.
... promise resolves to undefined when the state of the download has been updated.
Http.jsm
onload a function handle to call when the load is complete, it takes two parameters: the responsetext and the xhr object.
... onerror a function handle to call when an error occurs, it takes three parameters: the error, the responsetext and the xhr object.
...when null/undefined is given, no post data will be attached.
...for example, xhr might be configured to use any custom mime-type when processing a response regardless of what the server returns.
WebRequest.jsm
name type description callback function the callback argument is a function to be called when the event is triggered.
... onbeforerequest this event is triggered when a request is about to be made, and before headers are available.
... oncompleted triggered when the response has been received.
... types: ["image"] }, ["blocking"]); function redirect(e) { console.log("redirecting: " + e.url); return {redirecturl: "https://38.media.tumblr.com/tumblr_ldbj01lzip1qe0eclo1_500.gif"}; } modifying headers this code changes the user agent header so the browser identifies itself as ie 11, but only when visiting pages under "http://useragentstring.com/": let {webrequest} = cu.import("resource://gre/modules/webrequest.jsm", {}); cu.import("resource://gre/modules/matchpattern.jsm"); let pattern = new matchpattern("http://useragentstring.com/*"); let ua = "mozilla/5.0 (windows nt 6.1; wow64; trident/7.0; as; rv:11.0) like gecko"; webrequest.onbeforesendheaders.addlistener(changeuseragent, ...
XPCOMUtils.jsm
when set to true, and only if 'value' // is not specified, the concatenation of the string "service," and the // object's contractid is passed as avalue parameter of addcategoryentry.
... when the generated method is invoked on that object, it checks to see if the specified iid is listed in the array specified by the interfaces parameter; if it is, this (that is, the object itself) is returned.
... remarks when you implement an interface that inherits from another one, you should generally list all the base interfaces explicitly, except for nsisupports.
... 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); ...
Index
3 bootstrapping a new locale localization, mercurial, translate, bit bucket (see also https://developer.mozilla.org/en/create_a_new_localization) 4 encodings for localization files internationalization, localization when creating a localization for mozilla products, it’s important to be aware of the encoding of the files that you generate.
...the goal of the standard is to have an xml-based format to use when exchanging localization data between tools without the potential of data loss or corruption.
...the content here should be what you and your localization team have decided, together, to follow when localizing mozilla products and web sites.
...vn, unix first, make your project's file type decision (see localization formats for details): 40 what every mozilla translator should know internationalization, localization l10n stands for localization = l + another 10 letters + n 41 writing localizable code internationalization, localization this page tells you about best practices and guidelines when dealing with ui code with respect to localization.
Localizing with Mozilla Translator
like most cat tools, mozillatranslator employs glossaries and translation memory to leverage your work from previous translations, thus cutting time and effort when localizing new versions of mozilla applications.
... migrating contents when the directory structure changes overall, if you are a ''good'' mt user and you do things like: checking "keep original" flags for strings not needing translation, instead of just leaving the translation empty struggling to get empty lists when running "untranslated strings" and "view fuzzy" if you are up to date in localization regularly running qa checks and trying to minimize them.
... a bit of history on mt mt has been evolving from long ago, when l10n were done always on shipped en-us jars and when mozilla suite had five l10n jars: ab-cd.jar, ab-win.jar, ab-mac.jar, ab-unix.jar, and cd.jar.
... when mozilla l10n switched to ''source l10n'', one of the many problems that mt had to solve was how to fit a directory structure in what had been designed for five jars, and the ''patch'' consisted of providing a ''read from dir instead of jar'' and ''put everything inside platform neutral''.
SVN for Localizers
you should know that when we say svn we are referring to either the svn server and the svn client.
...you will have the chance to see how the localized website will look when it's pushed to prod (i.e., a website that regular visitors will see).
... when localizing websites, l10n-drivers will always add needed files to your repository or update your files with new strings in english.
... make you sure you're checking out the repository with https:// make sure you're adding a commit message when running svn commit.
Power profiling overview
strictly speaking, such a computation gives the average power but this is often referred to as just the power when context makes it clear.
... a wakeup occurs when a core or package transitions from an idle state to the active state.
... this happens when the os schedules a process to run due to some kind of event.
...when used carefully, however, they can still be useful.
NSPR's Position On Abrupt Thread Termination
when called, the process exits, closing files and reclaiming the process' storage.
... certain people have been disappointed when nspr did not provide a functional equivalent to exit just a particular thread.
...in the general course of events when programming with threads, it is very advantageous for a thread to have resources that it and only it knows about.
...when the latter is used to provide concurrency, calling exit() will terminate the entire process.
Optimizing Applications For NSPR
the casual client may not encounter a need to know the details of the shortcomings to the level described here, but if and when clients become more sophisticated, these issues will certainly surface.
...this means that when the application using nspr is dispatched, a thread within that application will run until that thread voluntarily gives up control to another thread within the process.
...on windows 3.1, when nspr detects a value in a 64 bit file offset greater than 32bit significance, it terminates with an assert.
... the nspr process creation api functions return an error when invoked on windows 3.1.
PR_AttachThread
description you use pr_attachthread when you want to use nss functions on the native thread that was not created with nspr.
... the thread object is automatically destroyed when it is no longer needed.
...a native thread not created by nspr is automatically attached the first time it calls an nspr function, and automatically detached when it exits.
... in nspr release 19980529b and earlier, it is necessary for a native thread not created by nspr to call pr_attachthread before it calls any nspr functions, and call pr_detachthread when it is done calling nspr functions.
PR_Seek
syntax #include <prio.h> print32 pr_seek( prfiledesc *fd, print32 offset, prseekwhence whence); parameters the function has the following parameters: fd a pointer to a prfiledesc object.
... offset a value, in bytes, used with the whence parameter to set the file pointer.
... whence a value of type prseekwhence that specifies how to interpret the offset parameter in setting the file pointer associated with the fd parameter.
... the value for the whence parameter can be one of the following: pr_seek_set.
PR_Seek64
syntax #include <prio.h> print64 pr_seek64( prfiledesc *fd, print64 offset, prseekwhence whence); parameters the function has the following parameters: fd a pointer to a prfiledesc object.
... offset a value, in bytes, used with the whence parameter to set the file pointer.
... whence a value of type prseekwhence that specifies how to interpret the offset parameter in setting the file pointer associated with the fd parameter.
... the value for the whence parameter can be one of the following: pr_seek_set.
NSS_3.12.2_release_notes.html
bug 432260: [[@ pkix_pl_httpdefaultclient_hdrcheckcomplete - pkix_pl_memcpy] crashes when there is no content-length header in the http response bug 436599: pkix: aia extension is not used in some bridge ca / known certs configuration bug 437804: certutil -r for cert renewal should derive the subject from the cert if none is specified.
... bug 444974: crash upon reinsertion of e-identity smartcard bug 447563: modutil -add prints no error explanation on failure bug 448431: pk11_createmergelog() declaration causes gcc warning when compiling with -wstrict-prototypes bug 449334: pk12util has duplicate options letters bug 449725: signver is still using static libraries.
... bug 450427: add comodo ecc certification authority certificate to nss bug 450536: remove obsolete xp_mac code bug 451024: certutil.exe crashes with segmentation fault inside pr_cleanup bug 451927: security/coreconf/winnt6.0.mk has invalid defines bug 452751: slot leak in pk11_findslotsbynames bug 452865: remove obsolete linker flags needed when libnss3 was linked with libsoftokn3 bug 454961: fix the implementation and use of pr_fgets in signtool bug 455348: change hyphens to underscores in debug_$(shell whoami).
... bug 459359: forwardbuilderstate object is leaked when aia path incorrect bug 459481: nss build problem with gcc 3.4.6 on os/2 documentation for a list of the primary nss documentation pages on mozilla.org, see nss documentation.
NSS 3.14.3 release notes
new pkcs #11 mechanisms ckm_nss_hmac_constant_time - constant-time hmac operation for use when verifying a padded, mac-then-encrypted block of data.
... ckm_nss_ssl3_mac_constant_time - constant-time mac operation for use when verifying a padded, mac-then-encrypted block of data using the sslv3 mac.
...this attack is mitigated when using nss 3.14.3 with an nss cryptographic module ("softoken") version 3.14.3 or later.
...nss 3.14.3 now properly compiles when used with older versions of sqlite.
NSS 3.15.4 release notes
bug 919877 - (cve-2013-1740) when false start is enabled, libssl will sometimes return unencrypted, unauthenticated data from pr_recv new in nss 3.15.4 new functionality implemented ocsp querying using the http get method, which is the new default, and will fall back to the http post method.
... added the --empty-password command-line option to certutil, to be used with -n: use an empty password when creating a new database.
... new functions cert_forcepostmethodforocsp cert_getsubjectnamedigest cert_getsubjectpublickeydigest ssl_peercertificatechain ssl_recommendedcanfalsestart ssl_setcanfalsestartcallback new types cert_rev_m_force_post_method_for_ocsp: when this flag is used, libpkix will never attempt to use the http get method for ocsp requests; it will always use post.
... when building on windows, os_target now defaults to win95.
NSS 3.15.5 release notes
the extension type value is 35655, which may change when an official extension type value is assigned by iana.
... nss automatically adds the padding extension to clienthello when necessary.
... notable changes in nss 3.15.5 bug 950129: improve the ocsp fetching policy when verifying ocsp responses bug 949060: validate the iov input argument (an array of priovec structures) of ssl_writev (called via pr_writev).
... applications should still take care when converting struct iov to priovec because the iov_len members of the two structures have different types (size_t vs.
NSS 3.16 release notes
(this requires nspr 4.10.4.) to build for the linux x32 target, set the environment variable use_x32=1 when building nss.
...it is no longer necessary to set the environment variable nss_enable_ecc=1 when building nss.
... to disable ecc, set the environment variable nss_disable_ecc=1 when building nss.
... bug 962760: libpkix should not include the common name of ca as dns names when evaluating name constraints.
NSS 3.21.3 release notes
bug 1221620 - fixed a possible left-shift of a negative integer value when parsing der.
... bug 1206283 - fixed an out-of-bound read when parsing invalid utf-16.
... bug 1241034 - fixed an out-of-bounds write when parsing invalid utf-16.
... bug 1241037 - fixed bogus surrogate detection when parsing invalid utf-16.
NSS 3.33 release notes
when nss is compiled without nss_force_fips=1 startup checks are no longer performed.
... fixes cve-2017-7805, a potential use-after-free in tls 1.2 server, when verifying client authentication.
... new in nss 3.33 new functionality when listing an nss database, using certutil -l, and the database hasn't yet been initialized with any non-empty or empty password, the text "database needs user init" will be included in the listing.
... when using certutil to set an inacceptable password in fips mode, a correct explanation of acceptable passwords will be printed.
NSS 3.34 release notes
new in nss 3.34 new functionality when listing an nss database.
... when using certutil, to set an inacceptable password in fips mode, a correct explanation of acceptable passwords will be printed.
... sslchannelinfo has two new fields (bug 1396525) sslnamedgroup originalkeagroup holds the key exchange group of the original handshake, when the session was resumed.
... prbool resumed is pr_true when the session is resumed, and pr_false otherwise.
NSS 3.35 release notes
without a prefix, the default database type will be used (dbm in versions prior to 3.35, and sql in version 3.35 and later.) when using the sql type (either explicitly, or because of the new default), with a database directory which already contains a dbm type database, nss will automatically perform a one time migration of the information contained in the dbm files to the newer sql files.
... for stronger security, when creating encrypted pkcs#7 or pkcs#12 data, the iteration count for the password based encryption algorithm has been increased to one million iterations.
... this mechanism must be enabled for 0-rtt to be accepted when nss is being used as a server.
... this function allows for callbacks to be installed, which are called when a server receives a new tls clienthello.
nss tech note5
iv is relevant only when using cbc mode of encryption.
...when all done with encrypt/decrypt ops, clean up</big> <big>pk11_freesymkey(symkey); secitem_freeitem(secparam, pr_true); pk11_freeslot(slot);</big> note: aes encryption, a fixed blocksize of 16 bytes is used.
...iv is relevant only when using cbc cipher mode.
...iv is relevant only when using cbc cipher mode.
NSS tools : modutil
the module becomes a default provider for the listed mechanisms when those mechanisms are enabled.
... -pwfile old-password-file specify a text file containing a token's existing password so that a password can be entered automatically when the -changepw option is used to change passwords.
... jar installation file format when a jar file is run by a server, by modutil, or by any program that does not interpret javascript, a special information file must be included to install the libraries.
...this makes it easier when more than one platform uses the same settings.
NSS Tools modutil
the module becomes a default provider for the listed mechanisms when those mechanisms are enabled.
... -pwfile old-password-file specify a text file containing a token's existing password so that a password can be entered automatically when the -changepw tokenname option is used to change passwords.
...e: -enable modulename [-slot slotname] disabling a specific slot or all slots within a module: -disable modulename [-slot slotname] enabling or disabling fips 140-2 compliance within the netscape communicator internal module: -fips [true | false] disabling interactive prompts for the security module database tool, to support scripted operation: -force jar installation file when a jar file is run by a server, by the security module database tool, or by any program that does not interpret javascript, a special information file must be included in the format described below.
...saves typing when there is more than one platform using the same settings.
NSS Tools pk12util
if not specified the directory defaults to $home/.netscape (when $home exists in the environment), or to ./.netscape (when $home does not exist in the environment).
... -h tokenname specify the name of the token to import into or export from -v enable debug logging when importing -k slotpasswordfile specify the text file containing the slot's password -k slotpassword specify a slot's password -w p12filepasswordfile specify the text file containing the pkcs 12 file's password -w p12filepassword specify the pkcs 12 file's password -c key-cipher specify the key encryption algorithm -c certcipher specify the pfx encryption algorithm -m | --key_len keylen specify the desired length of the symmetric key to be...
...password based encryption is used to protect private keys on export to a pkcs #12 file and also the entire package when allowed.
...for historical export control reasons "pkcs12 v2 pbe with sha1 and 40 bit rc4" is the default for the overall package encryption when not in fips mode and no package encryption when in fips mode.
NSS tools : modutil
MozillaProjectsNSStoolsmodutil
the module becomes a default provider for the listed mechanisms when those mechanisms are enabled.
... -pwfile old-password-file specify a text file containing a token's existing password so that a password can be entered automatically when the -changepw option is used to change passwords.
... jar installation file format when a jar file is run by a server, by modutil, or by any program that does not interpret javascript, a special information file must be included to install the libraries.
...this makes it easier when more than one platform uses the same settings.
64-bit Compatibility
for all intents and purposes they are also 32-bit on 64-bit platforms: intn, uintn jsintn, jsuintn, jsbool general problems with pointers when performing bitwise operations on pointer values, make sure that both operands are 64-bit.
...builtins and calls when passing arguments to lirwriter::inscall(), there are four types: argsize_f - floating point value argsize_i - 32-bit integer argsize_q - 64-bit integer argsize_p - 32-bit integer on 32-bit platforms, 64-bit integer on 64-bit platforms.
...similarly, when adding types to jsbuiltins.h, remember to use _js_ptr for pointer-width values.
...luckily there is an alias that will choose the right opcode for you - lir_ldp: struct object { void *data; }; lir->insload(lir_ldp, objins, ins->insimm(offsetof(object, data))); when you use lirwriter::insstore, the correct size is chosen for you automatically, based on the size of the input operands.
SpiderMonkey Internals
it runs automatically only when maxbytes (as passed to js_newruntime) bytes of gc things have been allocated and another thing-allocation request is made.
...the jspubtd.h file contains public typedefs, and is included automatically when needed.
...when a script (jsscript) is destroyed, all traps set in its bytecode are cleared.
...the jscontext constructor and destructor are factored out into jscntxt.cpp for minimal linking when the compiler part of js is split from the interpreter part into a separate program.
JS_DumpHeap
when null, dump all things reachable from the runtime roots.
... when non-null, dump only things reachable from the object indicated.
...must be jstrace_object when startthing is null.
... when tracing a thing, the gc needs to know about the layout of the object it is looking at.
JS_SetFunctionCallback
sets a callback to be run whenever a javascript function is invoked or exited.
... fcb jsfunctioncallback the callback to execute when javascript functions are invoked and exited.
...the call stack cannot be relied upon, because this callback may be invoked from the jit code when the stack frame and context are in an indeterminate state.
... note that debuggers should probably use js_setcallhook in preference to this function, because it is invoked when the javascript stack is guaranteed to be in a consistent state (and therefore it is valid to inspect and modify local variables, generate stack traces, and set breakpoints.) callback syntax typedef void (* jsfunctioncallback)(const jsfunction *fun,const jsscript *scr, const jscontext *cx, int entering); name type description fun const jsfunction * the javascript function being invoked or exited.
JSAPI reference
note: the foss wiki page contains a few links to other libraries and programs that can make life easier when using spidermonkey and the jsapi.
..._getstringcharszandlength added in spidermonkey 1.8.5 obsolete since jsapi 33 js_getflatstringchars obsolete since jsapi 33 js_makestringimmutable obsolete since javascript 1.8.5 js_encodecharacters obsolete since jsapi 19 js_cstringsareutf8 obsolete since jsapi 19 js_setcstringsareutf8 obsolete since jsapi 19 interning strings tells the spidermonkey engine to reuse existing string objects when possible.
...te since jsapi 37 js_lookuppropertywithflags obsolete since jsapi 31 js_lookuppropertywithflagsbyid obsolete since jsapi 31 js_newpropertyiterator obsolete since jsapi 36 js_nextproperty obsolete since jsapi 36 js_setpropertyattributes obsolete since jsapi 26 js_setucpropertyattributes obsolete since jsapi 26 the following functions behave like js_getproperty and js_getpropertybyid except when operating on e4x xml objects.
...added in spidermonkey 24 jsenumerateop jsnewenumerateop jsresolveop jsconvertop jsfinalizeop jshasinstanceop jstraceop jscheckaccessop obsolete jsxdrobjectop obsolete since jsapi 13 jsnewresolveop obsolete since jsapi 36 jsmarkop obsolete since jsapi 5 jsgetobjectops obsolete since javascript 1.8.5 jsreserveslotsop obsolete since javascript 1.8.5 these stub functions can be used when creating a custom jsclass: js_propertystub js_strictpropertystub added in spidermonkey 1.9.3 js_convertstub obsolete since jsapi 37 js_deletepropertystub obsolete since jsapi 37 js_enumeratestub obsolete since jsapi 37 js_finalizestub obsolete since jsapi 15 js_resolvestub obsolete since jsapi 37 jsextendedclass method types: in js 1.8.5, jsextendedclass has made private.
TPS Bookmark Lists
changes: an object containing new properties to be set for this bookmark when this asset list is used in a modify action.
...changes: an object containing new properties to be set for this livemark when this asset list is used in a modify action.
...changes: an object containing new properties to be set for this folder when this asset list is used in a modify action.
...changes: an object containing new properties to be set for this separator when this asset list is used in a modify action.
Mork
MozillaTechMork
except when parsing values, whitespace ('\b', '\t', '\r', '\n', '\f', ' ', and '\x7f'), line continuations ('\\' followed by a newline), and comments (c++ or c style) can be ignored.
... some notes on further terminology: when referring to cells or aliases, the first component is the key and the second component is the value.
...the values of cells and aliases, when not specified by a mid reference, are one of the cases where whitespace is significant.
...all data stored internally will be destroyed when the morkreader goes out of scope.
Using the Places livemark service
when creating livemarks during startup, you should use the nsilivemarkservice.createlivemarkfolderonly() to avoid http traffic.
... uri("http://example.com/"), uri("http://example.com/rss.xml"), -1); the parameters here are the same as for nsilivemarkservice.createlivemark(), except for the insertion of a new parameter at the beginning, which is the nsinavbookmarksservice to use when creating the livemark.
...when the update timer fires, it iterates over the list of livemarks, and will refresh a livemark *only* if it's expired.
... the expiration time for a livemark is determined by using information provided by the server when the feed was requested, specifically nsicacheentryinfo.expirationtime.
Accessing the Windows Registry Using XPCOM
introduction when implementing windows-specific functionality, it is often useful to access the windows registry for information about the environment or other installed programs.
...this can be very important when dealing with non-administrator accounts with restricted privileges.
...finally, note that you should close the key when you are done to avoid wasting system resources.
... remember to call wrk.close() when you are finished!
Receiving startup notifications
this is no longer the case, so be sure to remove that when migrating existing code.
...receiving startup notifications prior to gecko 2.0 (firefox 4) to receive startup notifications, one needs to register with the "app-startup" category using nsicategorymanager; having done so, the component will receive these startup notifications, including: xpcom-startup sent when xpcom finishes starting up.
...app-startup sent when the application has finished starting up.
...what happens next once you've registered with the category manager, at mozilla startup time (or when the embedding application's ns_initembedding() function is called), the appstartupnotifier component is instantiated, and its observe() method is called; this in turn enumerates all components in the app-startup category and sends them the appropriate notifications.
Components.utils.forceGC
the mozilla javascript engine will perform garbage collection automatically when the javascript heap grows beyond a certain size.
...in many cases a javascript application will have internal knowledge of javascript objects referencing large (trees of) xpcom objects and know when they are no longer reachable.
...users should note that garbage collection is a very expensive operation and should only be forced when it is known to be absolutely necessary.
...if you want to schedule garbage collection to occur in the future, at a time when no javascript code is running, you can use components.utils.scheduleprecisegc() instead.
Components.utils.schedulePreciseGC
the garbage collection cycle will occur sometime in the future, when no javascript code is executing.
... this is useful particularly when testing for memory leaks, because normal garbage collection is conservative when javascript code is running to ensure that in-use memory isn't inadvertently collected.
... note: garbage collection is a very expensive operation and should only be forced when it is known to be absolutely necessary.
...using scheduleprecisegc() when you call components.utils.scheduleprecisegc(), you specify a callback that is executed in once the scheduled garbage collection has been completed: components.utils.scheduleprecisegc( function() { // this code is executed when the garbage collection has completed } ); since the garbage collection doesn't occur until some time in the future (unlike, for example, components.utils.forcegc(), which causes garbage collection immediately but isn't able to collect all javascript-related memory), the callback lets you know when that's been finished.
XPConnect wrappers
less informed developers understand that wrappers exist and are somehow important, but they don't know when they should use what wrappers, or if they should be seeing a wrapper.
... basic xpconnect objects xpcwrappednative these objects are created when any natively implemented xpcom object (that is, any object implemented in c++) needs to be reflected into javascript.
...this means that when you say window.focus(), you're calling into xpcwrappednative code.
...this means that whenever you pass your javascript object into a c++ function, we create one of these wrappers.
IAccessibleHyperlink
non-text objects can have either a single link or a collection of links such as when the non-text object is an image map.
...[propget] hresult anchor( [in] long index, [out] variant anchor ); parameters index a 0 based index identifies the anchor when, as in the case of an image map, there is more than one link represented by this object.
...[propget] hresult anchortarget( [in] long index, [out] variant anchortarget ); parameters index a 0 based index identifies the anchor when, as in the case of an image map, there is more than one link represented by this object.
...alternatively this method could return an iunknown variant of a com interface representing a target object to be activated when the link is activated.
amIWebInstallListener
the default implementation displays a confirmation dialog when add-ons are ready to install and uses the observer service to notify when installations are blocked.
... methods onwebinstallblocked() called when the website is not allowed to directly prompt the user to install add-ons.
...onwebinstalldisabled() called when installation by websites is currently disabled.
... onwebinstallrequested() called when a website wants to ask the user to install add-ons.
nsIAppShell
when the number of calls that pass pr_true is subtracted from the number of calls that pass pr_false is greater than 0, performance is given precedence over preventing event starvation.
...starvationdelay is only used when favorperfoverstarvation is pr_false.
...a stable state is reached when the currently executing task/event has finished, (see: webappapis.html#synchronous-section).
...but if the nsiappshell->run() event loop is blocked when this call is made, gecko events will stop being processed until resumenative() is called (even if a plugin or library is temporarily processing events on a nested event loop).
nsIAppShellService
(and at application startup, on platforms that do not normally quit when the last window has closed, call enter once, but not exit) void enterlastwindowclosingsurvivalarea(); parameters none.
...n bool aischrome ); var webnav = services.appshell.createwindowlessbrowser(true); var docshell = webnav.queryinterface(ci.nsiinterfacerequestor).getinterface(ci.nsidocshell); var systemprincipal = cc["@mozilla.org/systemprincipal;1"].createinstance(ci.nsiprincipal); docshell.createaboutblankcontentviewer(systemprincipal); var contentwindow = docshell.contentviewer.domdocument.defaultview; // when you are done with it, destroy it if (webnav.close) { webnav.close() }; // only available in firefox 46+, and is needed for good measure webnav = null; // in firefox <= 45 setting to null will cause it to get gc'ed which will destroy it registertoplevelwindow() add a window to the application's registry of windows.
... note: when this method is successful, it fires the global notification "xul-window-registered" void registertoplevelwindow( in nsixulwindow awindow ); parameters awindow the window to register.
... note: this method will not automatically attempt to quit the application when the last window is unregistered.
nsIAppStartup
this can be used, for example, when doing performance testing of the startup process to discount numbers for tests that were interrupted by a user prompt.
... enterlastwindowclosingsurvivalarea() serves for situations when all application windows will be closed but we don't want to take this as a signal to quit the application.
... exitlastwindowclosingsurvivalarea() this method serves for situations when all application windows will be closed but we don't want to take this as a signal to quit the application.
... getstartupinfo() returns a javascript object with events from startup and the timestamps indicating when they occurred.
nsICacheSession
instead, the listener will be notified when the descriptor is available.
...nowait do not wait for the cache entry when it is in use and waits for validation.
...when called by multiple threads for write access, only one writable descriptor will be granted.
... if blockingmode is set to false, it will return ns_error_cache_wait_for_validation rather than block when another descriptor has been given write access but hasn't validated the entry yet.
nsIConsoleService
if no messages are logged, this function will return a count of 0, but allocating a placeholder word for messages, showing as a 0-length array when called from the script.
...if no messages are logged, this function will return a count of 0, but allocating a placeholder word for messages, showing as a 0-length array when called from the script.
... registerlistener() registers a listener, to notify when an error is logged.
... note: to guard against stack overflows from listeners which could log messages (this could be done inadvertently through listeners implemented in javascript), we do not call any listeners when another error is already being logged.
nsIDOMParser
when you create a domparser from a privileged script, you can pass parameters to the constructor, more on that below.
... to create a domparser when the constructor is not available (e.g., from a js xpcom component, a js module, or an xpcshell test), use: var parser = components.classes["@mozilla.org/xmlextras/domparser;1"] .createinstance(components.interfaces.nsidomparser); // optionally, call parser.init(principal, documenturi, baseuri); principals, document and base uri note: this section covers changes introduced to domparser in gecko 1.9.
...if you come across a situation when these matter, feel free to ask questions in mozilla.dev.tech.dom and update this documentation to mention these cases.
... when a domparser is instantiated by calling new domparser(), it inherits the calling code's principal (except that for chrome callers the principal is set to the null principal) and the documenturi and baseuri of the window the constructor came from.
nsIEffectiveTLDService
ns_error_unexpected or other error returned by nsiidnservice.normalize() when the hostname contains characters disallowed in uris.
... ns_error_unexpected this exception originates in the normalize() method in nsiidnservice and is thrown when ahost contains characters disallowed in uris.
... ns_error_unexpected or other error returned by nsiidnservice.normalize() when the hostname contains characters disallowed in uris.
... ns_error_unexpected this exception originates in the normalize() method in nsiidnservice and is thrown when ahost contains characters disallowed in uris.
nsIFrameMessageManager
method overview void addmessagelistener(in astring amessage, in nsiframemessagelistener alistener, [optional] in boolean listenwhenclosed); void removemessagelistener(in astring amessage, in nsiframemessagelistener alistener); void sendasyncmessage(in astring amessage, in astring json); methods addmessagelistener() adds a message listener to the local frame.
... void addmessagelistener( in astring amessage, in nsiframemessagelistener alistener [optional in boolean listenwhenclosed ); parameters amessage the name of the message for which to add a listener.
... alistener an object implementing nsiframemessagelistener whose receivemessage method will be called when the message is received.
... listenwhenclosed default is false.
nsIHttpActivityObserver
roduced gecko 1.8 inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) method overview void observeactivity(in nsisupports ahttpchannel, in pruint32 aactivitytype, in pruint32 aactivitysubtype, in prtime atimestamp, in pruint64 aextrasizedata, in acstring aextrastringdata); attributes attribute type description isactive boolean true when the interface is active and should observe http activity, otherwise false.
... methods observeactivity() called when activity occurs on the http transport.
... you should implement this method to perform whatever tasks you wish to perform when http activity occurs.
...socket transport activity when the activity type is activity_type_socket_transport and the subtype is status_sending_to, the aextrasizedata parameter contains the number of bytes sent.
nsILoginMetaInfo
metadata properties are ignored when comparing logins.
...for example, "{d4e1a1f6-5ea0-40ee-bff5-da57982f21cf}" timecreated unsigned long long the time, in unix epoch milliseconds, when the login was first created.
... timelastused unsigned long long the time, in unix epoch milliseconds, when the login was last submitted in a form or used to begin an http auth session.
... timepasswordchanged unsigned long long the time, in unix epoch milliseconds, when the login's password was last modified.
nsIMutableArray
any of these methods may throw ns_error_out_of_memory when the array must grow to complete the call, but the allocation fails.
... exceptions thrown ns_error_failure when a weak reference is requested, but the element does not support nsiweakreference.
... exceptions thrown ns_error_failure when a weak reference is requested, but the element does not support nsiweakreference.
... exceptions thrown ns_error_failure when a weak reference is requested, but the element does not support nsiweakreference.
nsINavHistoryContainerResultNode
when closed, attempting to call getchild() or access childcount results in an error.
... when you're done reading the container's children, set this to false.
...when the container is closed, the result is an exact answer if the node can be populated easily (for example, for bookmark folders).
...when the container is open, the result is always accurate.
nsIProcess
runasync() asynchronously runs the process with which the object was initialized, optionally calling an observer when the process finishes running.
... observer optional an observer that will be notified when the process exits.
... runwasync() asynchronously runs the process with which the object was initialized, optionally calling an observer when the process finishes running.
... observer optional an observer that will be notified when the process exits.
nsIProtocolHandler
uri_opening_executes_script 1<<13 uris for this protocol execute script when they are opened.
...this method is called when there's an attempt to connect to a port that is blacklisted.
...when a uri containing this port number is encountered, this method is called to ask if the protocol handler wants to override the ban.
...this corresponds to the character set that should be used when communicating this uri to an origin server.
nsIProtocolProxyService
when this flag is passed to resolve, resolve may throw the exception ns_base_stream_would_block to indicate that it failed due to this flag being present.
...this method is intended as a substitute for resolve when the result is not needed immediately.
... acallback the object to be notified when the result is available.
...when resolve/asyncresolve is called, it generates a list of proxies for the given uri, and then it applies the proxy filters.
nsIPushService
callback the callback to call when the nsipushsubscription is created.
... callback the callback to call when the nsipushsubscription is dropped.
... scope fired when a push message is sent to a system subscription.
... serviceworkerglobalscope.onpush push-subscription-change null scope fired when the push server drops a subscription, or the subscription identifier changes.
nsISelection
when the selection is collapsed(), and the content is focused and editable, the caret will blink there.
...if partlycontained is set to pr_true, the function returns true when some part of the node is part of the selection.
... if partlycontained is set to pr_false, the function only returns true when the entire node is part of the selection.
... boolean containsnode( in nsidomnode node, in boolean partlycontained ); parameters node the nsidomnode to look for partlycontained if partlycontained is set to pr_false, the function only returns true when the entire node is part of the selection.
nsISelectionController
this is still true when the caret is enabled, visible, but in its "off" blink cycle.
...this method is used internally for handling backspace key only when we're after utf-16 surrogates.
...an enabled caret will draw or blink when made visible.
...an readonly caret will draw but not blink when made visible.
nsIThreadPool
when you send events to the thread pool, the pool creates a new thread to process the event, up to the number of threads specified by the threadlimit attribute.
... listener nsithreadpoollistener an optional listener that will be notified when a thread is created or destroyed in the course of the thread pool's operation.
... the thread pool takes ownership of the listener and releases it when the shutdown() method is called.
... when this method returns, the thread pool and all its threads will have been shut down, and it is no longer be possible to dispatch events to the thread pool.
nsITransport
this interface allows the consumer of the stream to be notified when the stream can again be read.
...readsegments is only guaranteed to be implemented when this flag is not specified.
...this interface allows the consumer of the stream to be notified when the stream can again accept more data.
...writesegments and writefrom are only guaranteed to be implemented when this flag is not specified.
nsIXPCScriptable
enumerate() prbool enumerate( in nsixpconnectwrappednative wrapper, in jscontextptr cx, in jsobjectptr obj ); parameters wrapper cx obj return value newenumerate() this method is called when the want_newenumerate flag is set.
... jsenumerate_destroy this function should destroy the opaque iterator state previously allocated in statep by this function when enum_op was jsenumerate_init.
...newresolve() this method is called when the want_newresolve flag is set.
... when this method is called, xpconnect is attempting to resolve a lazy property named by id on obj.
Setting HTTP request headers
http channels when you deal with http requests and responses, typically you are doing this with an nsihttpchannel.
...(in our example, our made up http header is x-hello and not hello because we correctly added the x- in front of our name.) no longer the case: http://tools.ietf.org/html/rfc6648 notifications the question that may be coming to your mind right now is, how do you get the nsihttpchannel when an http request is made.
...we are saying we want httprequestobserver to be notified (by calling its observe method) when a "http-on-modify-request" topic takes place (which we know happens just before each http request).
...the good practice is not to have this specific http header (for example "x-site.net-extension") sent all the time but only when doing requests with this specific web sites.
XPCOM
accessing the windows registry using xpcomwhen implementing windows-specific functionality, it is often useful to access the windows registry for information about the environment or other installed programs.
...it is a possiblity that is introduced when upgrading to a new compiler without recompiling everything.
...when available, it lets you access the javascript object hidden by the wrapper.xpcom abixpcom abi is the binary interface of xpcom components.
... while xpcom components written in a scripting language (such as javascript) can be moved across platforms (such as windows and os x) without adaptation, those written in a compiled language (such as c++) require recompilation when moving to a different platform.
Xray vision
when a script accesses an object using xray vision it sees only the native version of the object.
... how you get xray vision privileged code automatically gets xray vision whenever it accesses objects belonging to less-privileged code.
... so when chrome code accesses content objects, it sees them with xray vision: // chrome code var transfer = gbrowser.contentwindow.confirm("transfer all my money?"); // calls the native implementation note that using window.confirm() would be a terrible way to implement a security policy, and is only shown here to illustrate how xray vision works.
... xrays for javascript objects until recently, built-in javascript objects that are not part of the dom, such as date, error, and object, did not get xray vision when accessed by more-privileged code.
Address Book examples
photo handlers photo handlers allow developers to customize the behavior of the contact editor when loading or saving contact photos.
...each photo handler must implement the following interface: /* * onload: function(acard, adocument): * called when the editor wants to populate the contact editor * input fields with information about acard's photo.
... * * onshow: function(acard, adocument, atargetid): * called when the editor wants to show this photo type.
... * * onsave: function(acard, adocument) * called when the editor wants to save this photo type.
Mail event system
for example, when a folder gets a new message, its total message count increases.
...when a notification is fired on a folder, all of the folder's folder listeners and the mail session itself is notified.
... sample control flow here is an example of a possible flow of control when a new message is added to a folder.
...ed onitemboolpropertychanged notifyitemunicharpropertychanged onitemunicharpropertychanged notifyitempropertyflagchanged onitempropertyflagchanged notifyitemevent onitemevent notifyfolderloaded onfolderloaded notifydeleteormovemessages ondeleteormovemessages sample code in this example, a listener will be set up to be notified when the message count changes in a folder: // our variable to know if the listener fired var listenerhasfired = false; var totalmessageslistenerhasfired = false; // the listening function that will react to changes function myonintpropertychanged(item, property, oldvalue, newvalue) { listenerhasfired=true; var propertystring = property.getunicode(); dump("onintpropertychanged has fired wit...
Main Windows
the base chrome directory of thunderbird can sometimes appear confusing when you're just beginning to look at it.
... messenger.xul the base mail window that you see when you first open thunderbird is messenger.xul: messenger.xul itself doesn’t contain a lot.
... messagewindow.xul messagewindow.xul is shown when a message is opened.
... customizetoolbar.xul and customizetoolbarsheet.xul these are two old files from when the original customizable toolbars were ported from firefox (phoenix at the time) to thunderbird (minotaur at the time).
Declaring and Using Callbacks
when void is the return type, the javascript callback must not return, or it should return undefined.
... if two arguments are passed to the callback constructor, the second is used as the this parameter: function myjscallback() { alert(this.message); }; var receiver = { message: 'hi there!' }; var callback = funcptrtype(myjscallback, receiver); // alerts with 'hi there' when the callback is invoked if three arguments are passed to the callback constructor, the third argument is used as a sentinel value which the callback returns if an exception is thrown.
... the sentinel value must be convertible to the return type of the callback: function myjscallback() { throw "uh oh"; }; var callback1 = funcptrtype(myjscallback, null, -1); // returns -1 to the native caller when the exception is thrown.
...if you don't, the gc might collect the relevant data structures, and the browser will crash when native code attempts to invoke your callback.
Declaring types
for example, to define a new 32-bit integer variable with the value 5: var i = ctypes.int32_t(5); you can then pass a pointer to this value to a c function that requires a pointer to a 32-bit integer, like this: some_c_function(i.address()); declaring new primitive types there are times when you want to create new types that are simply new names for existing primitive types.
...in order to accomplish this you can either set the type of next to ctypes.voidptr_t, or to be more accurate, use the define technique: var struct = ctypes.structtype('struct'); struct.define([{ next: struct.ptr }]); arrays to declare a new array type, you use the ctypes.arraytype() method.when declaring a new array type, you provide a ctype indicating the type of each element in the array as well as an optional array length.
... declaring an array type with unspecified length to declare a new array type without specifying a length, you simply pass in the ctype specifying the element type when calling ctypes.arraytype().
... declaring an array type with a specific length declaring an array type that specifies the array length is as simple as adding a length when calling ctypes.arraytype(), like this: const filearray = new ctypes.arraytype(file, 20); this declares filearray as an array type that can hold 20 elements.
Using js-ctypes
after you're done when you're finished using a library, you should close it by calling the library object's close() method: lib.close(); if you fail to close the library, it will be automatically closed when it is garbage collected.
... the last thing we do is call lib.close() to close the library when we're done using it.
... after that, we simply set up our parameters by using makestr() to generate the two str255 strings we need, then call stdalert(), which produces the following alert window: the last thing we do is call carbon.close() to close the library when we're done using it.
..., * const unichar *chars, * cfindex numchars * ); */ var cfstringcreatewithcharacters = libcf.declare('cfstringcreatewithcharacters', ctypes.default_abi, cfstringref, // return cfallocatorref, // alloc unichar.ptr, // *chars cfindex // numchars ); // helper functions function makecfstr(jsstr) { // js str is just a string // returns a cfstr that must be released with cfrelease when done return cfstringcreatewithcharacters(null, jsstr, jsstr.length); } // main var mycfstrs = { head: makecfstr('core foundation says...'), body: makecfstr('we just called the equivalent of the "standardalert carbon function" for 64bit osx from javascript!') }; var rez = cfusernotificationdisplaynotice(0, kcfusernotificationcautionalertlevel, null, null, null, mycfstrs.head, mycfstrs.body, n...
URLs - Plugins
safest target, even though, when used with a mailto or news url, this creates an extra blank browser instance.
... be careful when you assign a target.
...when the user clicks the button, the plug-in calls npn_geturl to go to the page.
...§ the npn_posturlnotify function has all the same capabilities and works like npn_posturl in most ways except that (1) it supports specifying headers when posting a memory buffer, and (2) it calls npp_urlnotify upon successful or unsuccessful completion of the request.
Ignore a source - Firefox Developer Tools
however, a library’s abstraction leaks during debugging sessions when you are forced to step through its stack frames in order to reach your own code.
... when a source file is ignored: any breakpoints it may have defined are disabled.
... when “pause on exceptions” is enabled in the debugger settings, the debugger won’t pause when an exception is thrown in the ignored source; instead it waits until (and if) the stack unwinds to a frame in a source that isn’t ignored.
... the debugger skips through ignored sources when stepping.
Debugger.Memory - Firefox Developer Tools
accessor properties of the debugger.memory.prototype object ifdbg is a debugger instance, then <i>dbg</i>.memory is a debugger.memory instance, which inherits the following accessor properties from its prototype: trackingallocationsites a boolean value indicating whether this debugger.memory instance is capturing the javascript execution stack when each object is allocated.
... debugger.memory handler functions similar to debugger’s handler functions, debugger.memory inherits accessor properties that store handler functions for spidermonkey to call when given events occur in debuggee code.
... concatenations: when asked to concatenate two strings, spidermonkey may elect to delay copying the strings’ data, and represent the result simply as a pointer to the two original strings.
... spidermonkey converts strings from the more complex representations to the simpler ones when it pleases.
Debugger.Script - Firefox Developer Tools
debugger.script objects for webassembly are uncovered via onnewscript when a new webassembly module is instantiated and via the findscripts method on debugger instances.
...for example: function f() {} // display name: f (the given name) var g = function () {}; // display name: g o.p = function () {}; // display name: o.p var q = { r: function () {} // display name: q.r }; note that the display name may not be a proper javascript identifier, or even a proper expression: we attempt to find helpful names even when the function is not immediately assigned as the value of some variable or property.
... when execution reaches the given instruction, spidermonkey calls the hit method ofhandler, passing a debugger.frame instance representing the currently executing stack frame.
... any number of breakpoints may be set at a single location; when control reaches that point, spidermonkey calls their handlers in an unspecified order.
Tutorial: Set a breakpoint - Firefox Developer Tools
we use debugger to set a breakpoint in a function, and then evaluate an expression whenever it is hit.
...when control reaches the start of the report function, debugger calls the breakpoint handler’s hit method, passing a debugger.frame instance.
...when you click on the div element, both debuggers’ breakpoints are hit, and both handlers run.
...keep in mind, however, that when multiple debuggers share a debuggee, the order in which their handlers run is not specified.
Deprecated tools - Firefox Developer Tools
when we deprecate a panel, we begin by getting feedback from the community to determine the impact of removing that panel.
... you may see a warning message, as in the following image, when trying to activate a deprecated panel: in addition, if you open the panel for one of these tools, you will also see a warning message about its removal.
...the editor mode can be triggered clicking on the icon on the right of the console input, or with ctrl + b (cmd + b on macos) when in editor mode, the enter key adds a new line in the input, and you can evaluate the expression using ctrl + enter (cmd + enter on macos).
... when evaluating, the input isn't cleared, which makes it possible to quickly iterrate over a snippet of code.
Measure a portion of the page - Firefox Developer Tools
when you want to use the tool, click this button.
... now when you mouse over the viewport, you'll see the mouse has a crosshair cursor with its current coordinates displayed beside it.
... when you hold the mouse button down and then drag, you'll start to draw a rectangle, with its x, y, and diagonal dimensions displayed.
... when you stop holding the mouse down, the rectangle that was displayed on screen when you released the button will stay there until you click again, allowing you time to take screenshots, note the information down, etc.
Examine and edit CSS - Firefox Developer Tools
inactive rules (not shown): if a rule is inactive (e.g., padding on a :visited pseudo-element), it is colored gray, with an info icon that gives more information when clicked.
... when on, any rules defined for printing the page will be displayed similar to the "print preview" mode that many word processing applications provide.
...for example, here the user has typed "c" and the default choice is "color": if you enter an invalid value for a property when editing it, or an unknown property name, a yellow alert icon appears besides the declaration.
... track changes when you are editing the rules in the rules view, you can see the changes you have made in the changes pane.
IndexedDB - Firefox Developer Tools
when you select an origin inside the indexed db storage type in the storage tree of the storage inspector, a table lists the details of all the databases present for that origin.
... note: the data shown in an indexeddb database is a snapshot of the data as it was when you opened the storage inspector tool.
... when an indexeddb database is selected in the storage tree, details about all the object stores are listed in the table.
... when an object store is selected in the storage tree, all the items in that object store are listed in the table.
Tips - Firefox Developer Tools
when selecting elements: shift + click to select an element but keep selecting (picker mode doesn't disengage).
... web console in all panels: esc opens the split console; useful when debugging, or inspecting nodes in the command line: $0 references the currently selected node.
... when a request is selected click "edit and resend" to modify its headers and send it again.
... check "disable http cache (when toolbox is open)" in the settings to disable the network cache while debugging network issues.
AudioBufferSourceNode.loop - Web APIs
the loop property of the audiobuffersourcenode interface is a boolean indicating if the audio asset must be replayed when the end of the audiobuffer is reached.
... when looping is enabled, the sound begins playing at the time specified as the start point when start() is called.
... when the time specified by the loopend property is reached, playback continues at the time specified by loopstart example in this example, the audiocontext.decodeaudiodata function is used to decode an audio track and put it into an audiobuffersourcenode.
...when the audio is played, it loops.
AudioBufferSourceNode - Web APIs
audiobuffersourcenode.buffer an audiobuffer that defines the audio asset to be played, or when set to the value null, defines a single channel of silence (in which every sample is 0.0).
... audiobuffersourcenode.loop a boolean attribute indicating if the audio asset must be replayed when the end of the audiobuffer is reached.
... audiobuffersourcenode.loopstart optional a floating-point value indicating the time, in seconds, at which playback of the audiobuffer must begin when loop is true.
...// this is the audionode to use when we want to play an audiobuffer var source = audioctx.createbuffersource(); // set the buffer in the audiobuffersourcenode source.buffer = myarraybuffer; // connect the audiobuffersourcenode to the // destination so we can hear the sound source.connect(audioctx.destination); // start the source playing source.start(); for a decodeaudiodata() example, see the audiocontext.decodeaudiodata() page.
BroadcastChannel - Web APIs
event handlers broadcastchannel.onmessage an eventhandler property that specifies the function to execute when a message event is fired on this object.
... broadcastchannel.onmessageerror an eventhandler called when a messageevent of type messageerror is fired—that is, when it receives a message that cannot be deserialized.
... events message fired when when a message arrives on the channel.
... messageerror fired when a message arrives that can't be deserialized.
CharacterData - Web APIs
characterdata.appenddata() appends the given domstring to the characterdata.data string; when this method returns, data contains the concatenated domstring.
... characterdata.deletedata() removes the specified amount of characters, starting at the specified offset, from the characterdata.data string; when this method returns, data contains the shortened domstring.
... characterdata.insertdata() inserts the specified characters, at the specified offset, in the characterdata.data string; when this method returns, data contains the modified domstring.
... characterdata.replacedata() replaces the specified amount of characters, starting at the specified offset, with the specified domstring; when this method returns, data contains the modified domstring.
CloseEvent - Web APIs
a closeevent is sent to clients using websockets when the connection is closed.
...note that the 1xxx codes are only websocket-internal and not for the same meaning by the transported data (like when the application-layer protocol is invalid).
...used to indicate that a connection was closed abnormally (that is, with no close frame being sent) when a status code is expected.
...this is a generic status code, used when codes 1003 and 1009 are not suitable.
Document.execCommand() - Web APIs
when an html document has been switched to designmode, its document object exposes an execcommand method to run commands that manipulate the current editable region, such as form inputs or contenteditable elements.
...when using contenteditable, execcommand() affects the currently active editable element.
...when this behavior is enabled varies between browsers, and its conditions have evolved over time.
...(not supported by internet explorer.) defaultparagraphseparator changes the paragraph separator used when new paragraphs are created in editable text regions.
Document: pointerdown event - Web APIs
the pointerdown event is fired when a pointer becomes active.
... for mouse, it is fired when the device transitions from no buttons depressed to at least one button depressed.
... for touch, it is fired when physical contact is made with the digitizer.
... for pen, it is fired when the stylus makes physical contact with the digitizer.
Document.requestStorageAccess() - Web APIs
note that this number is also incremented when automatic access grants are given through our compatibility heuristics.
... when an ephemeral or persistent storage access grant expires, the number of origins the requesting origin has storage access to is decremented by one.
... note: if the requesting origin is not classified as a tracking origin, the access request is automatically given an ephemeral storage access grant, which will go away when the page is reloaded.
... when the promise gets resolved, the resolve handler will run as if a user gesture is being processed, whether the promise was fulfilled or rejected: in the former case, code can then start to call apis that require user activation and things can move forward.
Element.requestFullscreen() - Web APIs
check browser compatibility in fullscreen for specifics on when each browser made this change.
... return value a promise which is resolved with a value of undefined when the transition to full screen is complete.
... to learn when other code has toggled full-screen mode on and off, you should establish listeners for the fullscreenchange event on the document.
... it's also important to listen for fullscreenchange to be aware when, for example, the user manually toggles full-screen mode, or when the user switches applications, causing your application to temporarily exit full-screen mode.
ExtendableEvent - Web APIs
"_top"><rect x="116" y="1" width="150" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="191" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">extendableevent</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} note: this interface is only available when the global scope is a serviceworkerglobalscope.
... it is not available when it is a window, or the scope of another kind of worker.
...the promise resolves when all resources have been fetched and cached, or else when any exception occurs.
...urrent_caches['prefetch']).then(function(cache) { return cache.addall(urlstoprefetch.map(function(urltoprefetch) { return new request(urltoprefetch, {mode: 'no-cors'}); })).then(function() { console.log('all resources have been fetched and cached.'); }); }).catch(function(error) { console.error('pre-fetching failed:', error); }) ); }); important: when fetching resources, it's very important to use {mode: 'no-cors'} if there is any chance that the resources are served off of a server that doesn't support cors.
Using Fetch - Web APIs
rs, same-origin cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached credentials: 'same-origin', // include, *same-origin, omit headers: { 'content-type': 'application/json' // 'content-type': 'application/x-www-form-urlencoded', }, redirect: 'follow', // manual, *follow, error referrerpolicy: 'no-referrer', // no-referrer, *no-referrer-when-downgrade, origin, origin-when-cross-origin, same-origin, strict-origin, strict-origin-when-cross-origin, unsafe-url body: json.stringify(data) // body data type must match "content-type" header }); return response.json(); // parses json response into native javascript objects } postdata('https://example.com/answer', { answer: 42 }) .then(data => { console.log(data); // json data p...
...(startindex, result.index); startindex = re.lastindex; } if (startindex < chunk.length) { // last line didn't end in a newline char yield chunk.substr(startindex); } } async function run() { for await (let line of maketextfilelineiterator(urloffile)) { processline(line); } } run(); checking that the fetch was successful a fetch() promise will reject with a typeerror when a network error is encountered or cors is misconfigured on the server-side, although this usually means permission issues or similar — a 404 does not constitute a network error, for example.
... response objects as you have seen above, response instances are returned when fetch() promises are resolved.
... they can also be created programmatically via javascript, but this is only really useful in serviceworkers, when you are providing a custom response to a received request using a respondwith() method: const mybody = new blob(); addeventlistener('fetch', function(event) { // serviceworker intercepting a fetch event.respondwith( new response(mybody, { headers: { 'content-type': 'text/plain' } }) ); }); the response() constructor takes two optional arguments — a body for the response,...
Using files from web applications - Web APIs
when the entire contents of the image file are loaded, they are converted into a data: url which is passed to the onload callback.
... when you have a file object you'd like to reference by url from html, you can create an object url for it like this: const objecturl = window.url.createobjecturl(fileobj); the object url is a string identifying the file object.
...while they are released automatically when the document is unloaded, if your page uses them dynamically you should release them explicitly by calling url.revokeobjecturl(): url.revokeobjecturl(objecturl); example: using object urls to display images this example uses object urls to display image thumbnails.
... finally, when the content is loaded the xmlhttprequest function send() is called to upload the file's content.
FileReaderSync.readAsArrayBuffer() - Web APIs
exceptions the following exceptions can be raised by this method: notfounderror is raised when the resource represented by the dom file or blob cannot be found, e.g.
... securityerror is raised when one of the following problematic situation is detected: the resource has been modified by a third party; too many read are performed simultaneously; the file pointed by the resource is unsafe for a use from the web (like it is a system file).
... notreadableerror is raised when the resource cannot be read due to a permission problem, like a concurrent lock.
... encodingerror is raised when the resource is a data url and exceed the limit length defined by each browser.
FileReaderSync.readAsBinaryString() - Web APIs
exceptions the following exceptions can be raised by this method: notfounderror is raised when the resource represented by the dom file or blob cannot be found, e.g.
... securityerror is raised when one of the following problematic situation is detected: the resource has been modified by a third party; too many read are performed simultaneously; the file pointed by the resource is unsafe for a use from the web (like it is a system file).
... notreadableerror is raised when the resource cannot be read due to a permission problem, like a concurrent lock.
... encodingerror is raised when the resource is a data url and exceed the limit length defined by each browser.
FileReaderSync.readAsDataURL() - Web APIs
exceptions the following exceptions can be raised by this method: notfounderror is raised when the resource represented by the dom file or blob cannot be found, e.g.
... securityerror is raised when one of the following problematic situation is detected: the resource has been modified by a third party; too many read are performed simultaneously; the file pointed by the resource is unsafe for a use from the web (like it is a system file).
... notreadableerror is raised when the resource cannot be read due to a permission problem, like a concurrent lock.
... encodingerror is raised when the resource is a data url and exceed the limit length defined by each browser.
FileReaderSync.readAsText() - Web APIs
exceptions the following exceptions can be raised by this method: notfounderror is raised when the resource represented by the dom file or blob cannot be found, e.g.
... securityerror is raised when one of the following problematic situation is detected: the resource has been modified by a third party; too many read are performed simultaneously; the file pointed by the resource is unsafe for a use from the web (like it is a system file).
... notreadableerror is raised when the resource cannot be read due to a permission problem, like a concurrent lock.
... encodingerror is raised when the resource is a data url and exceed the limit length defined by each browser.
File and Directory Entries API - Web APIs
the asynchronous api will not block and functions and the api will not return values; instead, you will need to supply a callback function to handle the response whenever it arrives.
...only for accessing files which are selected by the user in a file <input> element (see htmlinputelement as well) or when a file or directory is provided to the web site or app using drag and drop.
... getting access to a file system there are two ways to get access to file systems defined in the current specification draft: when handling a drop event for drag and drop, you can call datatransferitem.webkitgetasentry() to get the filesystementry for a dropped item.
... filesystemflags defines a set of values which are used when specifying option flags when calling certain methods in the file and directory entries api.
FontFaceSet - Web APIs
events fontfaceset.onloading an eventlistener called whenever an event of type loading is fired, indicating a font-face set has started loading.
... fontfaceset.onloadingdone an eventlistener called whenever an event of type loadingdone is fired, indicating that a font face set has finished loading.
... fontfaceset.onloadingerror an eventlistener called whenever an event of type loadingerror is fired, indicating that an error occurred whilst loading a font-face set.
... fontfaceset.check() a boolean that indicates whether a font is loaded, but doesn't initiate a load when it isn't.
Using the Frame Timing API - Web APIs
when one of those event types is added to the browser's performance timeline, the application is notified of the event via the observer's callback function that was specified when the observer was created.
...n init () { create_frame_observer(); var obs = new performanceobserver(frame_observer_2); obs.observe({entrytypes: ['frame']}); } function frame_observer_2(list) { // log the frame entries var perfentries = list.getentriesbytype("frame"); for (var i=0; i < perfentries.length; i++) { console.log("obs #2: [" + i + "] = " + perfentries[i].name); } } <body onload="init(event)"> when the browser adds a new "frame" entry to the performance timeline, both of the observer callbacks will be invoked.
... }); // only observe 'frame' events observe_frame.observe({entrytypes: ['frame']}); in the following example, the observer registers to be notified when several different performance entry types are added to the performance timeline.
...ak; case "measure": process_measure(perfentries[i]); break; case "resource": process_resource(perfentries[i]); break; default: console.log("unexpected performance entry type: " + perfentries[i].entrytype); } } }); // observe frame, mark, measure and resource events observe_frame.observe({entrytypes: ['frame', 'mark', 'measure', 'resource']}); accessing frame data when a frame observer is invoked, the observer callback is given one argument that is a performanceobserverentrylist object.
HTMLElement: pointerdown event - Web APIs
the pointerdown event is fired when a pointer becomes active.
... for mouse, it is fired when the device transitions from no buttons depressed to at least one button depressed.
... for touch, it is fired when physical contact is made with the digitizer.
... for pen, it is fired when the stylus makes physical contact with the digitizer.
HTMLElement: transitionrun event - Web APIs
the transitionrun event is fired when a css transition is first created, i.e.
...onrun examples this code adds a listener to the transitionrun event: el.addeventlistener('transitionrun', () => { console.log('transition is running but hasn\'t necessarily started transitioning yet'); }); the same, but using the ontransitionrun property instead of addeventlistener(): el.ontransitionrun = () => { console.log('transition started running, and will start transitioning when the transition delay has expired'); }; live example in the following example, we have a simple <div> element, styled with a transition that includes a delay: <div class="transition">hover over me</div> <div class="message"></div> .transition { width: 100px; height: 100px; background: rgba(255,0,0,1); transition-property: transform, background; transition-duration: 2s; transition-...
...= document.queryselector('.message'); el.addeventlistener('transitionrun', function() { message.textcontent = 'transitionrun fired'; }); el.addeventlistener('transitionstart', function() { message.textcontent = 'transitionstart fired'; }); el.addeventlistener('transitionend', function() { message.textcontent = 'transitionend fired'; }); the difference is that: transitionrun fires when the transition is created (i.e.
... transitionstart fires when the actual animation has begun (i.e.
HTMLFormElement: submit event - Web APIs
the submit event fires when a <form> is submitted.
... the submit event fires when the user clicks a submit button (<button> or <input type="submit">) or presses enter while editing a field (e.g.
...the event is not sent to the form when calling the form.submit() method directly.
... examples this example uses eventtarget.addeventlistener() to listen for form submit, and logs the current event.timestamp whenever that occurs, then prevents the default action of submitting the form.
HTMLMediaElement.autoplay - Web APIs
a media element whose source is a mediastream and whose autoplay property is true will begin playback when it becomes active (that is, when mediastream.active becomes true).
... note: sites which automatically play audio (or videos with an audio track) can be an unpleasant experience for users, so it should be avoided when possible.
...however, autoplay can be useful when creating media elements whose source will be set at a later time, under user control.
... for a much more in-depth look at autoplay, autoplay blocking, and how to respond whena autoplay is blocked by the user's browser, see our article autoplay guide for media and web audio apis.
HTMLOutputElement - Web APIs
when the problem is reported, the user agent may focus the element and change the scrolling position of the document or perform some other action that brings the element to the user's attention.
... if the element is in default mode when the descendants of the element are changed in any way, the defaultvalue property is set to the value of the textcontent property.
... value mode the element goes into value mode when the contents of the value property are set.
...when the element is in value mode, the default value is accessible only through the defaultvalue property.
HTMLSelectElement - Web APIs
htmlselectelement.autofocus a boolean reflecting the autofocus html attribute, which indicates whether the control should have input focus when the page loads, unless the user overrides it, for example by typing in a different control.
...when multiple is true, it returns "select-multiple"; otherwise, it returns "select-one".
... events listen to these events using addeventlistener() or by assigning an event listener to the oneventname property of this interface: input event fires when the value of an <input>, <select>, or <textarea> element has been changed.
...this will tell you when the value changes, and you can then update anything you need to.
HTMLTextAreaElement - Web APIs
autocomplete autofocus boolean: returns / sets the element's autofocus attribute, indicating that the control should have input focus when the page loads cols unsigned long: returns / sets the element's cols attribute, indicating the visible width of the text area.
...this constraint is evaluated only when the value changes.
...this constraint is evaluated only when the value changes.
... events listen to these events using addeventlistener() or by assigning an event listener to the oneventname property of this interface: input event fires when the value of an <input>, <select>, or <textarea> element has been changed.
Working with the History API - Web APIs
whenever the user navigates to the new state, a popstate event is fired, and the state property of the event contains a copy of the history entry's state object.
... replacestate() is particularly useful when you want to update the state object or url of the current history entry in response to some user action.
... reading the current state when your page loads, it might have a non-null state object.
...when the page reloads, the page will receive an onload event, but no popstate event.
KeyboardEvent.location - Web APIs
note: when numlock is locked, gecko always returns dom_key_location_numpad for the keys on the numeric pad.
... otherwise, when numlock is unlocked and the keyboard actually has a numeric keypad, gecko always returns dom_key_location_numpad too.
... on the other hand, if the keyboard doesn't have a keypad, such as on a notebook computer, some keys become numpad only when numlock is locked.
... when such keys fires key events, the location attribute value depends on the key.
LargestContentfulPaint - Web APIs
the timing of this paint is a good heuristic for when the main page content is available during load.
...this property returns an empty string when there is no id.
... note that in this example data is only sent to the server when the user leaves the tab.
... // catch errors since some browsers throw when using the new `type` option.
LocalFileSystem - Web APIs
successcallback the success callback that is called when the browser provides a file system.
... opt_errorcallback the error callback that is called when errors happen or when the request to obtain the file system is denied.
... successcallback the success callback that is called when the browser provides the file or directory for the supplied url.
... errorcallback the error callback that is called when errors happen or when the request to obtain the entry object is denied.
MSManipulationEvent.initMSManipulationEvent() - Web APIs
when true the event should propagate upward.
... when false the event does not propagate upward.
...when true, the default action can be canceled.
... when false, the default action cannot be canceled.
MediaKeySession - Web APIs
properties mediakeysession.closed read only returns a promise signaling when a mediakeysession closes.
...this value may change during a session lifetime, such as when an action triggers the start of a window.
... event handlers mediakeysession.onkeystatuseschange sets the eventhandler called when there has been a change in the keys in a session or their statuses.
... mediakeysession.onmessage sets the eventhandler called when the content decryption module has generated a message for the session.
MediaRecorder.ondataavailable - Web APIs
the dataavailable event is fired when the mediarecorder delivers media data to your application for its use.
...this occurs in four situations: when the media stream ends, any media data not already delivered to your ondataavailable handler is passed in a single blob.
... when mediarecorder.stop() is called, all media data which has been captured since recording began or the last time a dataavailable event occurred is delivered in a blob; after this, capturing ends.
... when mediarecorder.requestdata() is called, all media data which has been captured since recording began or the last time a dataavailable event occurred is delivered; then a new blob is created and media capture continues into that blob.
MediaStreamTrack.enabled - Web APIs
when enabled, a track's data is output from the source to the destination; otherwise, empty frames are output.
... syntax const enabledflag = track.enabled track.enabled = [true | false] value when true, enabled indicates that the track is permitted to render its actual media to the output.
... when enabled is set to false, the track only generates empty frames.
... note: when implementing a mute/unmute feature, you should use the enabled property.
MediaStreamTrack.onunmute - Web APIs
mediastreamtrack's onunmute event handler is called when the unmute event is received.
... such an event is sent when the track is again able to send data.
... when the onunmute event handler is called, the track's muted flag is false.
... syntax track.onunmute = unmutehandler; value unmutehandler is a function which is called when the mediastreamtrack receives the unmute event.
MediaStreamTrack: unmute event - Web APIs
the unmute event is sent to a mediastreamtrack when the track's source is once again able to provide media data after a period of not being able to do so.
... examples in this example, event handlers are established for the mute and unmute events in order to detect when the media is not flowing from the source for the mediastreamtrack stored in the variable musictrack.
... musictrack.addeventlistener("mute", event => { document.getelementbyid("timeline-widget").style.backgroundcolor = "#aaa"; }, false); musictrack.addeventlistener("unmute", event => { document.getelementbyid("timeline-widget").style.backgroundcolor = "#fff"; }, false); with these event handlers in place, when the track musictrack enters its muted state, the element with the id timeline-widget gets its background color changed to #aaa.
... when the track exits the muted state—detected by the arrival of an unmuted event—the background color is restored to white.
Media Capabilities API - Web APIs
mediadecodingconfiguration defines the valid values for allowed types of media when the media configuration is submitted as the parameter for mediacapabilities.decodinginfo().
... mediaencodingconfiguration defines the valid values for allowed types of media when the media configuration is submitted as the parameter for mediacapabilities.encodinginfo().
... videoconfiguration describes the required video properties that must be configured when querying a video configuration to be passed as part of a mediaconfiguration parameter to the mediacapabilities.encodinginfo() and mediacapabilities.decodinginfo() methods.
... audioconfiguration describes the required audio properties that must be configured when querying an audio configuration to be passed as part of a mediaconfiguration parameter to the mediacapabilities.encodinginfo() and mediacapabilities.decodinginfo() methods.
MutationObserverInit.attributeFilter - Web APIs
if this property exists on the options object when the mutationobserver() constructor is used to create a new mutationobserver, attribute monitoring is enabled regardless of whether or not the attributes property is true.
...lue, mutation.target.username); break; } break; } }); } var userlistelement = document.queryselector("#userlist"); var observer = new mutationobserver(callback); observer.observe(userlistelement, { attributefilter: [ "status", "username" ], attributeoldvalue: true, subtree: true }); the callback() function—which will be passed into the observe() method when starting the observer, looks at each item in the list of mutationrecord objects.
... note the use of mutationrecord.oldvalue to get the previous value of the "username" property so we have that information when doing lookups in our local array of users.
... when observe() is called, the specified options include both attributefilter and subtree, so that we monitor the attribute values for all of the nodes contained within the subtree rooted at the node with the id "userlist".
MutationObserverInit.attributeOldValue - Web APIs
syntax var options = { attributeoldvalue: true | false } value a boolean value indicating whether or not the prior value of a changed attribute should be included in the mutationobserver.oldvalue property when reporting attribute value changes.
... when using attributeoldvalue, setting the attributes option to true is optional.
... " changed to " + mutation.target[mutation.attributename] + " (was " + mutation.oldvalue + ")"); break; } }); } var targetnode = document.queryselector("#target"); var observer = new mutationobserver(callback); observer.observe(targetnode, { attributes: true, attributeoldvalue: true }); the callback() function—which will be passed into the observe() method when starting the observer, looks at each item in the list of mutationrecord objects.
... when observe() is called, the specified options are attributes and attributeoldvalue, which means that changes to attribute values will be reported, and each mutation record will include the oldvalue property specifying the attribute's previous value.
Navigator.onLine - Web APIs
the property sends updates whenever the browser's ability to connect to the network changes.
... the update occurs when the user follows links or when a script requests a remote page.
... for example, the property should return false when users click links soon after they lose internet connection.
...so while you can assume that the browser is offline when it returns a false value, you cannot assume that a true value necessarily means that the browser can access the internet.
OfflineAudioContext - Web APIs
event handlers offlineaudiocontext.oncomplete is an eventhandler called when processing is terminated, that is when the complete event (of type offlineaudiocompletionevent) is raised, after the event-based version of offlineaudiocontext.startrendering() is used.
... events listen to these events using addeventlistener() or by assigning an event listener to the oneventname property of this interface: complete fired when the rendering of an offline audio context is complete.
... when the startrendering() promise resolves, rendering has completed and the output audiobuffer is returned out of the promise.
...edbuffer) { console.log('rendering completed successfully'); var song = audioctx.createbuffersource(); song.buffer = renderedbuffer; song.connect(audioctx.destination); play.onclick = function() { song.start(); } }).catch(function(err) { console.log('rendering failed: ' + err); // note: the promise should reject when startrendering is called a second time on an offlineaudiocontext }); }); } request.send(); } // run getdata to start the process off getdata(); specifications specification status comment web audio apithe definition of 'offlineaudiocontext' in that specification.
PaymentRequest.onpaymentmethodchange - Web APIs
the paymentrequest event handler onpaymentmethodchange is invoked when the paymentmethodchange is fired, indicating that the user has changed payment methods within a given payment handler.
... for example, when using apple pay, the user can swipe to select different credit cards, debit cards, and so forth.
...}; value an event handler function which is to be called whenever the paymentmethodchange event is fired at the paymentrequest, indicating that the user has changed payment methods within the same payment handler.
... examples an example payment method change handler is shown below; this example handles changes made to the payment method when using apple pay, specifically: request.onpaymentmethodchange = ev => { const { type: cardtype } = ev.methoddetails; const newstuff = {}; if (ev.methodname === "https://apple.com/apple-pay") { switch (cardtype) { case "store": // do apple pay specific handling for store card...
Payment Request API - Web APIs
a browser can also sync these "credentials" across devices, making it easy for users to jump from desktop to mobile and back again when buying things.
... paymentrequestevent an event delivered to a payment handler when a paymentrequest is made.
... related dictionaries for the basic card specification basiccardchangedetails an object providing redacted address information that is provided as the methoddetails on the paymentmethodchange event sent to the paymentrequest when the user changes payment information.
...this is used as the value of the paymentmethod property on the paymentvalidationerrors object sent to the paymentrequest when an error occurs.
PerformanceEntry.startTime - Web APIs
the value returned by this property depends on the performance entry's type: "frame" - returns the timestamp when the frame was started.
... "mark" - returns the timestamp when the mark was created by a call to performance.mark().
... "measure" - returns the timestamp when the measure was created by a call to performance.measure().
... syntax entry.starttime; return value a domhighrestimestamp representing the first timestamp when the performance entry was created.
PerformanceObserver() - Web APIs
the observer callback is invoked when performance entry events are recorded for the entry types that have been registered, via the observe() method.
... syntax var observer = new performanceobserver(callback); parameters callback a performanceobservercallback callback that will be invoked when observed performance events are recorded.
... when the callback is invoked, its first parameter is a list of performance observer entries and the second parameter is the observer object.
... return value a new performanceobserver object which will call the specified callback when observed performance events occur.
Using Performance Timeline - Web APIs
the standard also includes interfaces that allow an application to be notified when specific performance events occur.
...; if (pe.tojson === undefined) { log ("performanceentry.tojson() is not supported"); return; } // print the performanceentry object var json = pe.tojson(); var s = json.stringify(json); log("performanceentry.tojson = " + s); } performance observers the performance observer interfaces allow an application to register an observer for specific performance event types, and when one of those event types is recorded, the application is notified of the event via the observer's callback function that was specified at the time, the observer was created.
... when the observer (callback) is invoked the callback's parameters include a performance observer entry list that only contains observed performance entries.
... that is, the list only contains entries for the event types that were specified when the observer's observe() method was invoked.
Using the Permissions API - Web APIs
depending on the value of the state property of the permissionstatus object returned when the promise resolves, it reacts differently: "granted" the "enable geolocation" button is hidden, as it isn't needed if geolocation is already active.
... "denied" the "enable geolocation" button is revealed (this code needs to be here too, in case the permission state is already set to denied for this origin when the page is first loaded).
...this works in exactly the same way as the permissions.query() method, except that it causes an existing permission to be reverted back to its default state when the promise successfully resolves (which is usually prompt).
...in the resulting dialog, find the location section and select ask when a site tries to...
Pinch zoom gestures - Web APIs
el.onpointerup = pointerup_handler; el.onpointercancel = pointerup_handler; el.onpointerout = pointerup_handler; el.onpointerleave = pointerup_handler; } pointer down the pointerdown event is fired when a pointer (mouse, pen/stylus or touch point on a touchscreen) makes contact with the contact surface.
... when this event is processed, the target's border is set to dashed to provide a clear visual indication the element has received a move event.
...oving out -> zoom in", ev); ev.target.style.background = "pink"; } if (curdiff < prevdiff) { // the distance between the two pointers has decreased log("pinch moving in -> zoom out",ev); ev.target.style.background = "lightblue"; } } // cache the distance for the next move event prevdiff = curdiff; } } pointer up the pointerup event is fired when a pointer is raised from the contact surface.
... when this occurs, the event is removed from the event cache and the target element's background color and border are restored to their original values.
Proximity Events - Web APIs
the proximity events are a handy way to know when a user is close to a device.
... these events make it possible to react to such a change, for example by shutting down the screen of a smartphone when the user is having a phone call with the device close to their ear.
... proximity events when the device proximity sensor detects a change between the device and an object, it notifies the browser of that change.
... when the browser gets such a notification, it fires a deviceproximityevent for any change, and a userproximityevent event in the case of a more rough change.
Web Push API Notifications best practices - Web APIs
this article provides a useful summary of best practices to keep in mind when developing web sites and applications that use push notifications for user engagement.
...it shows right up on your desktop even when the website is shut.
... in mobile, it shows up in the notification tray, just like app push notifications, even when the browser is not running.” — an unnamed marketing site positive uses of push but there’s a bright and useful side to push notifications, too.
...when a story i’m interested in is trending, i’d like to get a notification!
RTCPeerConnection.addTrack() - Web APIs
this is a very common way to use addtrack() when building many types of simple applications, where only one stream is needed.
... the rtcrtptransceiver associated with the sender has a rtcrtpreceiver whose track property specifies a mediastreamtrack whose kind is the same as the kind of the track parameter specified when calling rtcpeerconnection.addtrack().
... a new rtcrtpreceiver is created with a new mediastreamtrack as its track property (not the track specified as a parameter when calling addtrack()).
...it comes from the handlevideooffermsg() method there, which is called when an offer message is received from the remote peer.
RTCPeerConnection.createOffer() - Web APIs
the return value is a promise which, when the offer has been created, is resolved with a rtcsessiondescription object containing the newly-created offer.
... voiceactivitydetection optional some codecs and hardware are able to detect when audio begins and ends by watching for "silence" (or relatively low sound levels) to occur.
... this reduces network bandwidth used for audio by only sending audio data when there's actually something to broadcast.
...also, emergency calls should never cut audio when quiet.
RTCPeerConnection: iceconnectionstatechange event - Web APIs
bubbles no cancelable no interface event event handler property oniceconnectionstatechange one common task performed by the iceconnectionstatechange event listener: to trigger ice restart when the state changes to failed.
...this can happen when only the last checked candidate is successful, and the gathering and end-of-candidates signals both occur before the successful negotiation is completed.
... ice connection state during ice restarts when an ice restart is processed, the gathering and connectivity checking process is started over from the beginning, which will cause the iceconnectionstate to transition to connected if the ice restart was triggered while in the completed state.
... state transitions as negotiation ends when the negotiation process runs out of candidates to check, the ice connection transitions to one of two states.
RTCPeerConnection: icecandidate event - Web APIs
an icecandidate event is sent to an rtcpeerconnection when an rtcicecandidate has been identified and added to the local peer by a call to rtcpeerconnection.setlocaldescription().
... indicating the end of a generation of candidates when an ice negotiation session runs out of candidates to propose for a given rtcicetransport, it has completed gathering for a generation of candidates.
... if you need to perform any special actions when there are no further candidates expected, you're much better off watching the ice gathering state by watching for icegatheringstatechange events: pc.addeventlistener("icegatheringstatechange", ev => { switch(pc.icegatheringstate) { case "new": /* gathering is either just starting or has been reset */ break; case "gathering": /* gathering has begun or is ongoing */ ...
... break; case "complete": /* gathering has ended */ break; } }); as you can see in this example, the icegatheringstatechange event lets you know when the value of the rtcpeerconnection property icegatheringstate has been updated.
RTCPeerConnection: icecandidateerror event - Web APIs
the 701 error is fired only once per server url from the list of available stun or turn servers provided when creating the rtcpeerconnection.
... these errors occur only when the connection's ice gathering state is gathering.
... when this happens, the server url and the error message are passed to a function called reportconnectfail() to log or output the connection failure.
... pc.addeventlistener("icecandidateerror", (event) => { if (event.errorcode === 701) { reportconnectfail(event.url, event.errortext); } }); note that if multiple stun and/or turn servers are provided when creating the connection, this error may happen more than once, if more than one of those servers fails.
RTCPeerConnection.onicecandidate - Web APIs
the rtcpeerconnection property onicecandidate property is an eventhandler which specifies a function to be called when the icecandidate event occurs on an rtcpeerconnection instance.
... this happens whenever the local ice agent needs to deliver a message to the other peer through the signaling server.
...when this happens, the connection's icegatheringstate has also changed to complete.
... pc.onicecandidate = function(event) { if (event.candidate) { // send the candidate to the remote peer } else { // all ice candidates have been sent } } notice that the end of negotiation is detected here when the event's candidate property is null.
RTCPeerConnection.setRemoteDescription() - Web APIs
usage notes when you call setremotedescription(), the ice agent checks to make sure the rtcpeerconnection is in either the stable or have-remote-offer signalingstate.
...this happens instead of throwing an exception, thereby reducing the number of potential errors which might occur, and simplifies the processing you need to do when you receive an offer, by eliminating the need to handle the offer/answer process differently depending on whether the local peer is the caller or callee.
... exceptions when using the deprecated callback-based version of setremotedescription(), the following exceptions may occur: invalidstateerror the connection's signalingstate is "closed", indicating that the connection is not currently open, so negotiation cannot take place.
...when our promise fulfillment handler is called, indicating that this has been done, we create a stream, add it to the connection, then create an sdp answer and call setlocaldescription() to set that as the configuration at our end of the call before forwarding that answer to the caller.
RTCRtpStreamStats - Web APIs
check the browser compatibility table to know if and when the name change was implemented in specific browsers.
...see browser compatibility in rtcrtpstreamstats.kind to determine when browsers made the transition.
...a fir packet is sent by the receiving end of the stream when it falls behind or has lost packets and is unable to continue decoding the stream; the sending end of the stream receives the fir packet and responds by sending a full frame instead of a delta frame, thereby letting the receiver "catch up." the higher this number is, the more often a problem of this nature arose, which can be a sign of network congestion or an overburdened receiving device.
...also keep in mind that the values of qp can vary from codec to codec, so this value is only potentially useful when compared against the same codec.
RTCTrackEvent - Web APIs
the webrtc api interface rtctrackevent represents the track event, which is sent when a new mediastreamtrack is added to an rtcrtpreceiver which is part of the rtcpeerconnection.
... track the track event is sent to the rtcpeerconnection when a new track has been added to the connection.
... you can add a track event listener to be notified when the new track is available so that you can, for example, attach its media to a <video> element, using either rtcpeerconnection.addeventlistener() or the ontrack event handler property.
... note: it may be helpful to keep in mind that you receive the track event when a new inbound track has been added to your connection, and you call addtrack() to add a track to the far end of the connection, thereby triggering a track event on the remote peer.
ReadableStreamDefaultReader.cancel() - Web APIs
cancel is used when you've completely finished with the stream and don't need any more data from it, even if there are chunks enqueued waiting to be read.
... when the stream is done (if (done)), we run reader.cancel() to cancel the stream, signalling that we don't need to use it any more.
... function fetchstream() { const reader = stream.getreader(); let charsreceived = 0; // read() returns a promise that resolves // when a value has been received reader.read().then(function processtext({ done, value }) { // result objects contain two properties: // done - true if the stream has already given you all its data.
...always undefined when done is true.
SVGAngle - Web APIs
WebAPISVGAngle
exceptions on setting: a domexception with code no_modification_allowed_err is raised when the length corresponds to a read-only attribute, or when the object itself is read-only.
... exceptions on setting: a domexception with code no_modification_allowed_err is raised when the length corresponds to a read-only attribute, or when the object itself is read-only.
... a domexception with code no_modification_allowed_err is raised when the length corresponds to a read-only attribute, or when the object itself is read-only.
... a domexception with code no_modification_allowed_err is raised when the length corresponds to a read only attribute or when the object itself is read only.
SVGLength - Web APIs
WebAPISVGLength
exceptions on setting: a domexception with code no_modification_allowed_err is raised when the length corresponds to a read only attribute or when the object itself is read only.
... exceptions on setting: a domexception with code no_modification_allowed_err is raised when the length corresponds to a read only attribute or when the object itself is read only.
... a domexception with code no_modification_allowed_err is raised when the length corresponds to a read only attribute or when the object itself is read only.
... a domexception with code no_modification_allowed_err is raised when the length corresponds to a read only attribute or when the object itself is read only.
Screen.lockOrientation() - Web APIs
the following strings represent the possible orientation requirements you may specify: portrait-primary it represents the orientation of the screen when it is in its primary portrait mode.
... portrait-secondary it represents the orientation of the screen when it is in its secondary portrait mode.
... landscape-primary it represents the orientation of the screen when it is in its primary landscape mode.
... landscape-secondary it represents the orientation of the screen when it is in its secondary landscape mode.
ScriptProcessorNode - Web APIs
an event, implementing the audioprocessingevent interface, is sent to the object each time the input buffer contains new data, and the event handler terminates when it has filled the output buffer with data.
... the size of the input and output buffer are defined at the creation time, when the audiocontext.createscriptprocessor() method is called (both are defined by audiocontext.createscriptprocessor()'s buffersize parameter).
... events listen to these events using addeventlistener() or by assigning an event listener to the oneventname property of this interface: audioprocess fired when an input buffer of a scriptprocessornode is ready to be processed.
...ength; sample++) { // make output equal to the same as the input outputdata[sample] = inputdata[sample]; // add noise to each output sample outputdata[sample] += ((math.random() * 2) - 1) * 0.2; } } } getdata(); // wire up play button playbutton.onclick = function() { source.connect(scriptnode); scriptnode.connect(audioctx.destination); source.start(); } // when the buffer source stops playing, disconnect everything source.onended = function() { source.disconnect(scriptnode); scriptnode.disconnect(audioctx.destination); } specifications specification status comment web audio apithe definition of 'scriptprocessornode' in that specification.
Selection - Web APIs
WebAPISelection
safari and chrome (unlike firefox) currently focus the element containing selection when modifying the selection programmatically; it's possible that this may change in the future (see w3c bug 14383 and webkit bug 38696).
... the above behavior applies to selections made using the following methods: selection.collapse() selection.collapsetostart() selection.collapsetoend() selection.extend() selection.selectallchildren() selection.addrange() selection.setbaseandextent() and when the range is modified using the following methods: range.setstart() range.setend() range.setstartbefore() range.setstartafter() range.setendbefore() range.setendafter() range.collapse() range.selectnode() range.selectnodecontents() glossary other key terms used in this section.
...when making a selection with a mouse, the anchor is where in the document the mouse button is initially pressed.
...when making a selection with a mouse, the focus is where in the document the mouse button is released.
Selection API - Web APIs
globaleventhandlers.onselectstart represents the event handler that is called when a selectstart event is fired on the current object (i.e.
... when a new range of text is about to be selected by the user).
... globaleventhandlers.onselectionchange represents the event handler that is called when a selectionchange event is fired on the current object (i.e.
... when the selected text range changes).
SourceBuffer.mode - Web APIs
WebAPISourceBuffermode
the mode value is initially set when the sourcebuffer is created using mediasource.addsourcebuffer().
... if you try to set the mode property value to segments when the initial value is sequence, an exception will be thrown.
... exceptions the following exceptions may be thrown when setting a new value for this property.
... exception explanation invalidaccesserror an attempt was made to set the value to segments when the initial value is sequence.
StorageEvent - Web APIs
a storageevent is sent to a window when a storage area it has access to is changed within the context of another document.
...the key attribute is null when the change is caused by the storage clear() method.
...the newvalue is null when the change has been invoked by storage clear() method or the key has been removed from the storage.
...the oldvalue is null when the key has been newly added and therefore doesn't have any previous value.
SubtleCrypto.exportKey() - Web APIs
keys are not exported in an encrypted format: to encrypt keys when exporting them use the subtlecrypto.wrapkey() api instead.
... exceptions the promise is rejected when one of the following exceptions is encountered: invalidaccesserror raised when trying to export a non-extractable key.
... notsupported raised when trying to export in an unknown format.
... typeerror raised when trying to use an invalid format.
TextEncoder.prototype.encodeInto() - Web APIs
this is potentially more performant than the older encode() method especially when the target buffer is a view into a wasm heap.
...if you are working with c++ std::string, even though the logical length is shown to you, you need to take the extra terminator byte into account when computing rounding up to allocator bucket size.
...; let encodedresults = textencoder.encodeinto(string, utf8); resultpara.textcontent += 'bytes read: ' + encodedresults.read + ' | bytes written: ' + encodedresults.written + ' | encoded result: ' + utf8; polyfill the polyfill below may be a bit long because of the switch cases and utilization of native textencoder.prototype.encode in safari when available, but it is well worth the length because of the gains in performance.
...ltextencoderinstance; ////////////////////////////////////////////////////////////////////////////////////// function encoderreplacer(nonasciichars){ // make the utf string into a binary utf-8 encoded string var point = nonasciichars.charcodeat(0)|0; if (0xd800 <= point && point <= 0xdbff) { var nextcode = nonasciichars.charcodeat(1)|0; // defaults to 0 when nan, causing null replacement character if (0xdc00 <= nextcode && nextcode <= 0xdfff) { //point = ((point - 0xd800)<<10) + nextcode - 0xdc00 + 0x10000|0; point = (point<<10) + nextcode - 0x35fdc00|0; if (point > 0xffff) return fromcharcode( (0x1e/*0b11110*/<<3) | (point>>>18), ...
TextRange - Web APIs
WebAPITextRange
this property should only be used as one of the solutions when you need to be compatible with lower versions of ie, rather than relying on it completely in cross browser scripts.
...for example, when you hold down the mouse to select the content on the page, you create a typical textrange.
...if the selection contains more than one element, when you modify the contents of the selection, the contents will be placed in the corresponding position of the parent element instead of the child element.
...therefore, the best way is to deal with both at the same time, that is, try to use textrange mode when the standard interface is not supported, but do not regard it as the only choice.
TrackDefault.TrackDefault() - Web APIs
language a domstring specifying a default language for the sourcebuffer to use when an initialization segment does not contain language information for a new track.
... label a domstring specifying a default label for the sourcebuffer to use when an initialization segment does not contain label information for a new track.
... kinds an array (sequence) of domstrings specifying default kinds for the sourcebuffer to use when an initialization segment does not contain kind information for a new track.
... errors when this constructor is invoked, the following errors can occur: error explanation invalidaccesserror the supplied language is not a valid language code, e.g.
TransitionEvent - Web APIs
transitionevent.elapsedtime read only is a float giving the amount of time the transition has been running, in seconds, when this event fired.
... types of transitionevent transitioncancel an event fired when a css transition has been cancelled.
... transitionend an event fired when a css transition has finished playing.
... transitionrun an event fired when a css transition is created, when it is added to a set of running transitions, though not nessarilty started transitionstart an event fired when a css transition has started transitioning.
User Timing API - Web APIs
name - set to the "name" given when the mark was created.
... starttime - set to the timestamp when mark() was called.
... name - set to the "name" given when the measure was created.
... starttime - set to the timestamp when measure() was called.
VisualViewport - Web APIs
resize fired when the visual viewport is resized.
... scroll fired when the visual viewport is scrolled.
... examples hiding an overlaid box on zoom this example, taken from the visual viewport readme, shows how to write a simple bit of code that will hide an overlaid box (which might contain an advert, say) when the user zooms in.
... this is a nice way to improve the user experience when zooming in on pages.
WebGLRenderingContext.blendEquationSeparate() - Web APIs
must be either: gl.func_add: source + destination (default value), gl.func_subtract: source - destination, gl.func_reverse_subtract: destination - source, when using the ext_blend_minmax extension: ext.min_ext: minimum of source and destination, ext.max_ext: maximum of source and destination.
... when using a webgl 2 context, the following values are available additionally: gl.min: minimum of source and destination, gl.max: maximum of source and destination.
...must be either: gl.func_add: source + destination (default value), gl.func_subtract: source - destination, gl.func_reverse_subtract: destination - source, when using the ext_blend_minmax extension: ext.min_ext: minimum of source and destination, ext.max_ext: maximum of source and destination.
... when using a webgl 2 context, the following values are available additionally: gl.min: minimum of source and destination, gl.max: maximum of source and destination.
WebGLRenderingContext.compressedTexImage[23]D() - Web APIs
possible values: when using the webgl_compressed_texture_s3tc extension: ext.compressed_rgb_s3tc_dxt1_ext ext.compressed_rgba_s3tc_dxt1_ext ext.compressed_rgba_s3tc_dxt3_ext ext.compressed_rgba_s3tc_dxt5_ext when using the webgl_compressed_texture_s3tc_srgb extension: ext.compressed_srgb_s3tc_dxt1_ext ext.compressed_srgb_alpha_s3tc_dxt1_ext ext.compressed_srgb_alpha_s3tc_dx...
...t3_ext ext.compressed_srgb_alpha_s3tc_dxt5_ext when using the webgl_compressed_texture_etc extension: ext.compressed_r11_eac ext.compressed_signed_r11_eac ext.compressed_rg11_eac ext.compressed_signed_rg11_eac ext.compressed_rgb8_etc2 ext.compressed_rgba8_etc2_eac ext.compressed_srgb8_etc2 ext.compressed_srgb8_alpha8_etc2_eac ext.compressed_rgb8_punchthrough_alpha1_etc2 ext.compressed_srgb8_punchthrough_alpha1_etc2 when using the webgl_compressed_texture_pvrtc extension: ext.compressed_rgb_pvrtc_4bppv1_img ext.compressed_rgba_pvrtc_4bppv1_img ext.compressed_rgb_pvrtc_2bppv1_img ext.compressed_rgba_pvrtc_2bppv1_img when using the webgl_compressed_texture_etc1 extension: ext.compressed_rgb_etc1...
..._webgl when using the webgl_compressed_texture_atc extension: ext.compressed_rgb_atc_webgl ext.compressed_rgba_atc_explicit_alpha_webgl ext.compressed_rgba_atc_interpolated_alpha_webgl when using the webgl_compressed_texture_astc extension: ext.compressed_rgba_astc_4x4_khr ext.compressed_srgb8_alpha8_astc_4x4_khr ext.compressed_rgba_astc_5x4_khr ext.compressed_srgb8_alpha8_astc_5x4_khr ext.compressed_rgba_astc_5x5_khr ext.compressed_srgb8_alpha8_astc_5x5_khr ext.compressed_rgba_astc_6x5_khr ext.compressed_srgb8_alpha8_astc_6x5_khr ext.compressed_rgba_astc_6x6_khr ext.compressed_srgb8_alpha8_astc_6x6_khr ext.compressed_rgba_astc_8x5_khr ext.compressed_srgb8_alpha8_astc_8x5_khr ext.compressed_rgba_ast...
... ext.compressed_srgb8_alpha8_astc_10x5_khr ext.compressed_rgba_astc_10x6_khr ext.compressed_srgb8_alpha8_astc_10x6_khr ext.compressed_rgba_astc_10x10_khr ext.compressed_srgb8_alpha8_astc_10x10_khr ext.compressed_rgba_astc_12x10_khr ext.compressed_srgb8_alpha8_astc_12x10_khr ext.compressed_rgba_astc_12x12_khr ext.compressed_srgb8_alpha8_astc_12x12_khr 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...
WebGLRenderingContext.compressedTexSubImage2D() - Web APIs
possible values: when using the webgl_compressed_texture_s3tc extension: ext.compressed_rgb_s3tc_dxt1_ext ext.compressed_rgba_s3tc_dxt1_ext ext.compressed_rgba_s3tc_dxt3_ext ext.compressed_rgba_s3tc_dxt5_ext when using the webgl_compressed_texture_s3tc_srgb extension: ext.compressed_srgb_s3tc_dxt1_ext ext.compressed_srgb_alpha_s3tc_dxt1_ext ext.compressed_srgb_alpha_s3tc_dx...
...t3_ext ext.compressed_srgb_alpha_s3tc_dxt5_ext when using the webgl_compressed_texture_etc extension: ext.compressed_r11_eac ext.compressed_signed_r11_eac ext.compressed_rg11_eac ext.compressed_signed_rg11_eac ext.compressed_rgb8_etc2 ext.compressed_rgba8_etc2_eac ext.compressed_srgb8_etc2 ext.compressed_srgb8_alpha8_etc2_eac ext.compressed_rgb8_punchthrough_alpha1_etc2 ext.compressed_srgb8_punchthrough_alpha1_etc2 when using the webgl_compressed_texture_pvrtc extension: ext.compressed_rgb_pvrtc_4bppv1_img ext.compressed_rgba_pvrtc_4bppv1_img ext.compressed_rgb_pvrtc_2bppv1_img ext.compressed_rgba_pvrtc_2bppv1_img when using the webgl_compressed_texture_atc extension: ext.compressed_rgb_atc_w...
...ebgl ext.compressed_rgba_atc_explicit_alpha_webgl ext.compressed_rgba_atc_interpolated_alpha_webgl when using the webgl_compressed_texture_astc extension: ext.compressed_rgba_astc_4x4_khr ext.compressed_srgb8_alpha8_astc_4x4_khr ext.compressed_rgba_astc_5x4_khr ext.compressed_srgb8_alpha8_astc_5x4_khr ext.compressed_rgba_astc_5x5_khr ext.compressed_srgb8_alpha8_astc_5x5_khr ext.compressed_rgba_astc_6x5_khr ext.compressed_srgb8_alpha8_astc_6x5_khr ext.compressed_rgba_astc_6x6_khr ext.compressed_srgb8_alpha8_astc_6x6_khr ext.compressed_rgba_astc_8x5_khr ext.compressed_srgb8_alpha8_astc_8x5_khr ext.compressed_rgba_astc_8x6_khr ext.compressed_srgb8_alpha8_astc_8x6_khr ext.compressed_rgba_astc_8x8_khr ext.c...
... ext.compressed_srgb8_alpha8_astc_10x6_khr ext.compressed_rgba_astc_10x6_khr ext.compressed_srgb8_alpha8_astc_10x6_khr ext.compressed_rgba_astc_10x10_khr ext.compressed_srgb8_alpha8_astc_10x10_khr ext.compressed_rgba_astc_12x10_khr ext.compressed_srgb8_alpha8_astc_12x10_khr ext.compressed_rgba_astc_12x12_khr ext.compressed_srgb8_alpha8_astc_12x12_khr 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...
WebGLRenderingContext.framebufferTexture2D() - Web APIs
when using a webgl 2 context, the following values are available additionally: gl.draw_framebuffer: equivalent to gl.framebuffer.
... when using a webgl 2 context, the following values are available additionally: gl.depth_stencil_attachment: depth and stencil buffer.
...gl.color_attachment1 gl.color_attachment2 gl.color_attachment3 gl.color_attachment4 gl.color_attachment5 gl.color_attachment6 gl.color_attachment7 gl.color_attachment8 gl.color_attachment9 gl.color_attachment10 gl.color_attachment11 gl.color_attachment12 gl.color_attachment13 gl.color_attachment14 gl.color_attachment15 when using the webgl_draw_buffers extension: ext.color_attachment0_webgl (same as gl.color_attachment0) ext.color_attachment1_webgl ext.color_attachment2_webgl ext.color_attachment3_webgl ext.color_attachment4_webgl ext.color_attachment5_webgl ext.color_attachment6_webgl ext.color_attachment7_webgl ext.color_attachment8_webgl ext.color_attachment9_w...
...ebgl ext.color_attachment10_webgl ext.color_attachment11_webgl ext.color_attachment12_webgl ext.color_attachment13_webgl ext.color_attachment14_webgl ext.color_attachment15_webgl when using the webgl_depth_texture extension: gl.depth_stencil_attachment: depth and stencil buffer data storage.
WebGLRenderingContext.hint() - Web APIs
possible values: gl.generate_mipmap_hint: quality of filtering when generating mipmap images with webglrenderingcontext.generatemipmap().
... when using the oes_standard_derivatives extension: ext.fragment_shader_derivative_hint_oes: accuracy of the derivative calculation for the glsl built-in functions: dfdx, dfdy, and fwidth.
... when using a webgl 2 context, the following values are available additionally: gl.fragment_shader_derivative_hint: same as ext.fragment_shader_derivative_hint_oes mode sets the behavior.
... examples the following example hints that the quality of filtering when generating mipmap images should be most efficient instead of best quality.
WebGLRenderingContext.renderbufferStorage() - Web APIs
gl.depth_stencil when using a webgl 2 context, the following values are available additionally: gl.r8 gl.r8ui gl.r8i gl.r16ui gl.r16i gl.r32ui gl.r32i gl.rg8 gl.rg8ui gl.rg8i gl.rg16ui gl.rg16i gl.rg32ui gl.rg32i gl.rgb8 gl.rgba8 gl.srgb8_alpha8 (also available as an extension for webgl 1, see below) gl.rgb10_a2 gl.rgba8ui gl.rgba8i ...
... gl.rgb10_a2ui gl.rgba16ui gl.rgba16i gl.rgba32i gl.rgba32ui gl.depth_component24 gl.depth_component32f gl.depth24_stencil8 gl.depth32f_stencil8 when using the webgl_color_buffer_float extension: ext.rgba32f_ext: rgba 32-bit floating-point type.
... when using the ext_srgb extension: ext.srgb8_alpha8_ext: 8-bit srgb and alpha.
... when using a webgl 2 context and the ext_color_buffer_float extension: gl.r16f gl.rg16f gl.rgba16f gl.r32f gl.rg32f gl.rgba32f gl.r11f_g11f_b10f width a glsizei specifying the width of the renderbuffer in pixels.
WebGLRenderingContext.vertexAttribPointer() - Web APIs
possible values: gl.byte: signed 8-bit integer, with values in [-128, 127] gl.short: signed 16-bit integer, with values in [-32768, 32767] gl.unsigned_byte: unsigned 8-bit integer, with values in [0, 255] gl.unsigned_short: unsigned 16-bit integer, with values in [0, 65535] gl.float: 32-bit ieee floating point number when using a webgl 2 context, the following values are available additionally: gl.half_float: 16-bit ieee floating point number normalized a glboolean specifying whether integer data values should be normalized into a certain range when being cast to a float.
... when using a webgl 2 context, a gl.invalid_operation error is thrown if this vertex attribute is defined as a integer in the vertex shader (e.g.
... alternatively, you use the index that is assigned by the graphics card when compiling the vertex shader.
... integer attributes while the arraybuffer can be filled with both integers and floats, the attributes will always be converted to a float when they are sent to the vertex shader.
WebGL constants - Web APIs
buffer_usage 0x8765 passed to getbufferparameter to get the hint for the buffer passed in when it was created.
... generate_mipmap_hint 0x8192 hint for the quality of filtering when generating mipmap images with webglrenderingcontext.generatemipmap().
... compressed_rgba_atc_explicit_alpha_webgl 0x8c92 compresses rgba textures using explicit alpha encoding (useful when alpha transitions are sharp).
... compressed_rgba_atc_interpolated_alpha_webgl 0x87ee compresses rgba textures using interpolated alpha encoding (useful when alpha transitions are gradient).
Using bounded reference spaces - Web APIs
bounded-floor reference space if available by using code such as the following: async function onactivatexrbutton(event) { if (!xrsession) { navgator.xr.requestsession("immersive-vr"), { requiredfeatures: ["local-floor"], optionalfeatures: ["bounded-floor"] }).then((session) => { xrsession = session; startsessionanimation(); }); } } this function, called when the user clicks on a button to start the xr experience, works as usual, exiting at once if a session is already in place, then requesting a new session using immersive-vr mode.
... the options specified when requesting the session indicate that at a minimum, the session must be compatible with the local-floor reference space, but that it would be nice if the bounded-floor space were supported as well.
... creating the reference space simply requesting support for bounded-floor when calling the xrsystem method requestsession() isn't enough to get a bounded space.
... you need to ask for one when you call requestreferencespace() as well.
WebXR application life cycle - Web APIs
when the user requests the activation of webxr functionality by engaging with the user interface enabled above, request an xrsession using the desired mode.
... each time the callback is invoked, it should call requestanimationframe() again in order to let the browser know that the callback needs to be run again when it's time to render the next frame.
... when the time comes (such as when the user exits your app or navigates away from your site), end the xr session; otherwise, continue the loop until the user chooses to exit xr mode.
... include a handler for the xrsession event end event to be informed when the session is ending, regardless of whether your code, the user, or the browser initiated the termination of the session.
WebXR permissions and security - Web APIs
these mostly revolve around the fully-immersive immersive-vr session mode, but there are things to be aware of when setting up an ar session, as well.
... inline presentation when you request an xrsession with the mode set to inline, and any features are required or requested, the browser will only allow the session to be created if the call to requestsession() was made by code which is executing expressly due to user intent.
... note: additional requirements may be put into effect due to the specific features requested by the options object when calling requestsession().
... explicit user intent (explicit user consent) is granted when the user has specifically and expressly been asked for permission to perform an action.
Controlling multiple parameters with ConstantSourceNode - Web APIs
you may have times when you want to have multiple audio parameters be linked so they share the same value even while being changed in some way.
... toggling the oscillators on and off because oscillatornode doesn't support the notion of being in a paused state, we have to simulate it by terminating the oscillators and starting them again when the play button is clicked again to toggle them back on.
... starting the oscillators when the user clicks the play/pause toggle button while the oscillators aren't playing, the startoscillators() function gets called.
... stopping the oscillators stopping the oscillators when the user toggles the play state to pause the tones is as simple as stopping each node.
Privileged features - Web APIs
a dependent window closes when its parent window closes.
... a dependent window is minimized on the windows task bar only when its parent window is minimized.
... alwayslowered if on, the new created window floats below, under its own parent when the parent window is not minimized.
... close when set to no or 0, this feature removes the system close command icon and system close menu item.
XDomainRequest - Web APIs
event handlers xdomainrequest.onprogress a handler for when the request has made progress between the send method call and the onload event.
... xdomainrequest.ontimeout a handler for when the request times out.
... xdomainrequest.onerror a handler for when a request has errored.
... xdomainrequest.onload a handler for when the full response has been received from the server.
XRReferenceSpace.getOffsetReferenceSpace() - Web APIs
in other words, when you have an object in 3d space and need to position another object relative to that one, you can call getoffsetreferencespace(), passing into it the position and orientation you want the second object to have relative to the position and orientation of the object on which you call getoffsetreferencespace().
... then, when drawing the scene, you can use the offset reference space to not only position objects relative to one another, but to apply the needed transforms to render objects properly based upon the viewer's position.
... 0}, {x: inverseorientation[0], y: inverseorientation[1], z: inverseorientation[2], w: inverseorientation[3]}); return refspace.getoffsetreferencespace(newtransform); } this function creates an inverse orientation matrix—used to orient the viewer—from the current pitch and yaw values, then uses that matrix as the source of the orientation when calling new xrrigidtransform().
...applymousemovement() should be called when drawing a frame, immediately before fetching the viewer's pose using getviewerpose(), and the rendering should be performed in this reference space.
XRView - Web APIs
WebAPIXRView
this allows the two views, when projected in isolation into the appropriate eyes, to simulate a 3d world.
... transform read only an xrrigidtransform which describes the current position and orientation of the viewpoint in relation to the xrreferencespace specified when getviewerpose() was called on the xrframe being rendered.
...in other words, don't assume there are exactly two views on a given viewer; there can be as few as one (such as when rendering the scene in inline mode, and potentially many (especially if the field of view is very large).
...to the space in which it's located: if objectmatrix is a transform applied to the object to provide its basic position and rotation, then the model view matrix can be computed by multiplying the object's matrix by the inverse of the view transform matrix, like this: mat4.multiply(modelviewmatrix, view.transform.inverse.matrix, objectmatrix); normal matrix the model view's normal matrix is used when lighting the scene, in order to transform each surface's normal vectors to ensure that the light is reflected in the correct direction given the orientation and position of the surface relative to the light source or sources.
XRWebGLLayer.ignoreDepthValues - Web APIs
the value of ignoredepthvalues can only be set when the xrwebgllayer is instantiated, by setting the corresponding value in the xrwebgllayerinit object specified as the constructor's layerinit parameter.
...since the xr compositor uses the depth buffer by default, this value is false unless explicitly set otherwise when creating the xrwebgllayer using its constructor, xrwebgllayer().
... usage notes when the ignoredepthvalues property is false, the xr compositor uses the values found in the depth buffer, which should be accurate for the scene, in order to potentially improve the quality or the output as well as the comfort level for the viewer.
... examples if the web application which is using wexr is rendering its content without using a depth buffer—or if the depth buffer's contents are invalid—you should disable the use of the depth buffer for webxr rendering by setting ignoredepthvalues to true when creating the xrwebgllayer.
Using the group role - Accessibility
when the role is added to an element, the browser will send out an accessible group event to assistive technology products which can then notify the user about it.
...however, when a group is used in the context of list, authors must limit its children to listitem elements.
... possible effects on user agents and assistive technology when the group role is added to an element, or such an element becomes visible, the user agent should do the following: expose the element as having a group role in the operating system's accessibility api.
... assistive technology products should listen for such an event and notify the user accordingly: screen readers should announce the group when focus first lands on a control inside it, and if aria-describedby has been set, the description may be spoken.
Using the link role - Accessibility
when this role is added to an element, tab can be used to change focus to the link, and enter used to execute the link.
... possible effects on user agents and assistive technology when the link role is added to an element, or such an element becomes visible, the user agent should do the following: expose the element as having a link role in the operating system's accessibility api.
... assistive technology products should listen for such an event and notify the user accordingly: screen readers should announce the text of the link or its label when it is focused, along with the fact that it is a link.
... 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 agree to allowing popups form the domain it exists on.
Using the log role - Accessibility
when this role is added to an element, the browser will send out an accessible log event to assistive technology products which can then notify the user about it.
... by default updates contain only the changes to the live region and these are announced when the user is idle.
... possible effects on user agents and assistive technology when the log role is added to an element, or such an element becomes visible, the user agent should do the following: expose the element as having a log role in the operating system's accessibility api.
... assistive technology products should listen for such an event and notify the user accordingly: screen readers should announce changes inside a log when the user is idle, unless aria-live=”assertive” has been set and in which case the user may be interrupted.
ARIA: cell role - Accessibility
using native html <td> elements, whenever possible, is strongly encouraged.
... using the native html table element (<table>) along with the table row element (<tr>) and table cell element (<td>) whenever possible is strongly encouraged.
...employ the html <td> element instead of the aria role of cell whenever possible.
...a relevant use case for the aria table role is when the native semantics of a table are overridden by css's display property, such as by display: grid.
ARIA: document role - Accessibility
<button>close</button> </div> this example shows a dialog widget with some controls and a section with some informational text that the assistive technology user can read when tabbing to it.
... description by default, web pages are treated as documents; assistive technologies (at) enter browse or read mode when entering a new web page.
...when in gmail, most user agent interactions are usurped by the application.
... however, when the keyboard focus is set on the starting heading on a single conversation that contains the subject of the conversation, the screen reader user can use the reading mode commands to read through the messages, expand or collapse them, and manipulate them.
ARIA: form role - Accessibility
description a form landmark identifies a region of content that contains a collection of items and objects that, as a whole, combine to create a form when no other named landmark is appropriate (e.g.
...the <form> element defines a form landmark when it has an accessible name (e.g.
...use the search landmark instead of the form landmark when the form is used for search functionality.
... keyboard interactions no role specific keyboard interactions required javascript features onsubmit the onsubmit event handler handles the event raised when the form is submitted.
ARIA: rowgroup role - Accessibility
using the native <thead>, <tfoot> , and <tbody> html elements, whenever possible, is strongly encouraged.
... note: using the native html table element (<table>) along with the table header (<thead>), footer (<tfoot>), and body (<tbody>) elements whenever possible is strongly encouraged.
...employ the html <table> element instead of the aria role of table whenever possible.
...a relevant use case for the aria table role is when the css's display property overrides the native semantics of a table, such as by display: grid.
ARIA: table role - Accessibility
using a native html table element whenever possible is strongly encouraged.
... note: using a native html table element whenever possible is strongly encouraged.
...employ the html <table> element instead of the aria role of table whenever possible.
...a relevant use case for the aria table role is when css's display property overrides the native semantics of a table, such as by display: grid.
Alerts - Accessibility
the moment this happens, firefox will fire an “alert” event to assistive technologies when this div appears.
...when tabbing, you’ll hear an alert that tells you you’ve entered an invalid name.
...when tabbing out of this field, you should hear a warning that says you didn’t enter a valid e-mail address.
... in both cases, when returning focus to the field in question, your screen reader should tell you that this field is invalid.
Keyboard - Accessibility
this includes users of screen readers, but can also include users who have trouble operating a pointing device such as a mouse or trackball, or whose mouse is not working at the moment, or who simply prefer to use a keyboard for input whenever possible.
... this creates confusion for keyboard-only users when the focus order differs from the logical order of the page.
... see also tabindex global html attribute focusable element must have focus styling any element that can receive keyboard focus should have visible styling that indicates when the element is focused.
... see also using css to change the presentation of a ui component when it receives focus ...
Text labels and names - Accessibility
use a legend to label a fieldset when grouping a set of form elements together with a <fieldset> element, you should include a nested <legend> element inside it, containing a clear description of the group.
... users of assistive technology find this description helpful when trying to work out the overall purpose of the group.
... example <iframe title="mdn web docs" width="300" height="200" src="https://developer.mozilla.org"> </iframe> use alt attribute to label mglyph elements when writing equations with mathml, give each <mglyph> element an alt attribute containing a name that describes the symbol.
...nosaur:</label> <select id="dino-select"> <optgroup label="theropods"> <option>tyrannosaurus</option> <option>velociraptor</option> <option>deinonychus</option> </optgroup> <optgroup label="sauropods"> <option>diplodocus</option> <option>saltasaurus</option> <option>apatosaurus</option> </optgroup> </select> toolbars must be labeled when there is more than one toolbar if you define more than one toolbar in a web application using the aria toolbar role, you must use the aria-label attribute to label each one so that it can be described by assistive technology.
Accessibility
accessibility (often abbreviated to a11y—as in "a" then 11 characters then "y") in web development means enabling as many people as possible to use web sites, even when those people's abilities are limited in some way.
...when the web meets this goal, it is accessible to people with a diverse range of hearing, movement, sight, and cognitive ability." (w3c - accessibility) key tutorials the mdn accessibility learning area contains modern, up-to-date tutorials covering accessibility essentials: what is accessibility?
... css and javascript accessibility best practices css and javascript, when used properly, also have the potential to allow for accessible web experiences ...
... cognitive accessibility when creating web content, be aware of how you can ensure that it is accessible to people cognitive impairments.
:-moz-ui-invalid - CSS: Cascading Style Sheets
if the control has focus, and the value was valid (including empty) when it gained focus, do not apply the pseudo-class.
... if the control has focus, and the value was invalid when it gained focus, re-validate on every keystroke.
... the result is that if the control was valid when the user started interacting with it, the validity styling is changed only when the user shifts focus to another control.
... however, if the user is trying to correct a previously-flagged value, the control shows immediately when the value becomes valid.
:-moz-ui-valid - CSS: Cascading Style Sheets
if the control has focus, and the value was valid (including empty) when it gained focus, apply this pseudo-class.
... if the control has focus, and the value was invalid when it gained focus, re-validate on every keystroke.
... the result is that if the control was valid when the user started interacting with it, the validity styling is changed only when the user shifts focus to another control.
... however, if the user is trying to correct a previously-flagged value, the control shows immediately when the value becomes valid.
::backdrop - CSS: Cascading Style Sheets
when multiple elements have been placed into full-screen mode, the backdrop is drawn immediately beneath the frontmost such element, and on top of the older full-screen elements.
... /* backdrop is only displayed when dialog is opened with dialog.showmodal() */ dialog::backdrop { background: rgba(255,0,0,.25); } all full-screen elements are placed in a last-in/first out (lifo) stack in the top layer, which is a special layer in the viewport which is always rendered last (and therefore on top) before drawing the viewport's contents to the screen.
... the ::backdrop pseudo-element makes it possible to obscure, style, or completely hide everything located below the element when it's the topmost one in the top layer.
... 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.
:hover - CSS: Cascading Style Sheets
WebCSS:hover
the :hover css pseudo-class matches when the user interacts with an element with a pointing device, but does not necessarily activate it.
... it is generally triggered when the user hovers over an element with the cursor (mouse pointer).
... /* selects any <a> element when "hovered" */ a:hover { color: orange; } styles defined by the :active pseudo-class will be overridden by any subsequent link-related pseudo-class (:link, :visited, or :active) that has at least equal specificity.
... syntax :hover examples basic example html <a href="#">try hovering over this link.</a> css a { background-color: powderblue; transition: background-color .5s; } a:hover { background-color: gold; } result image gallery you can use the :hover pseudo-class to build an image gallery with full-size images that show only when the mouse moves over a thumbnail.
@supports - CSS: Cascading Style Sheets
WebCSS@supports
the following are both equivalent: @supports (transform-style: preserve) or (-moz-transform-style: preserve) or (-o-transform-style: preserve) or (-webkit-transform-style: preserve) {} @supports (transform-style: preserve-3d) or ((-moz-transform-style: preserve-3d) or ((-o-transform-style: preserve-3d) or (-webkit-transform-style: preserve-3d))) {} note: when using both and and or operators, the parentheses must be used to define the order in which they apply.
...'='<attr-modifier> = i | s examples testing for the support of a given css property @supports (animation-name: test) { … /* css applied when animations are supported without a prefix */ @keyframes { /* other at-rules can be nested inside */ … } } testing for the support of a given css property or a prefixed version @supports ((perspective: 10px) or (-moz-perspective: 10px) or (-webkit-perspective: 10px) or (-ms-perspective: 10px) or (-o-perspective: 10px)) { … /* css applied when 3d transforms, prefixed or no...
...:is()) /* this rule won't be applied in browsers which don't support :is() */ :is(ul, ol) > li { … /* css applied when the :is(…) selector is supported */ } @supports not selector(:is(a, b)) { /* fallback for when :is() is unsupported */ ul > li, ol > li { … /* the above expanded for browsers which don't support :is(…) */ } } @supports selector(:nth-child(1n of a, b)) { /* this rule needs to be inside the @supports block, otherwise it will be partially applied in browsers which don't su...
...pport the `of` argument of :nth-child(…) is supported */ :is(:nth-child(1n of ul, ol) a, details > summary) { … /* css applied when the :is(…) selector and the `of` argument of :nth-child(…) are both supported */ } } specifications specification status comment css conditional rules module level 4the definition of '@supports' in that specification.
@viewport - CSS: Cascading Style Sheets
WebCSS@viewport
min-width used in the determination of the width of the viewport when the document is first displayed.
... max-width used in the determination of the width of the viewport when the document is first displayed.
... min-height used in the determination of the height of the viewport when the document is first displayed.
... max-height used in the determination of the height of the viewport when the document is first displayed.
Mastering margin collapsing - CSS: Cascading Style Sheets
margin collapsing occurs in three basic cases: adjacent siblings the margins of adjacent siblings are collapsed (except when the latter sibling needs to be cleared past floats).
... some things to note: more complex margin collapsing (of more than two margins) occurs when the above cases are combined.
... when negative margins are involved, the size of the collapsed margin is the sum of the largest positive margin and the smallest (most negative) negative margin.
... when all margins are negative, the size of the collapsed margin is the smallest (most negative) margin.
Spanning and Balancing Columns - CSS: Cascading Style Sheets
when a spanner is introduced, it breaks the flow of columns and columns restart after the spanner, effectively creating a new set of column boxes.
...for this reason, some care should be taken when deciding to make an element a spanner and ensure this scenario is accounted for.
... additionally, if a spanning element appears later in the content it can cause unexpected or unwanted behaviour when there is not enough content to create columns after the spanner.
...filling and balancing comes into play when the amount of content does not match the amount of space provided, such as when a height is declared on the container.
Using feature queries - CSS: Cascading Style Sheets
syntax css feature queries are part of the css conditional rules module, which also contains the media query @media rule; when you use feature queries, you will find they behave in a similar way to media queries.
... how to use feature queries for progressive enhancement feature queries are an incredibly useful tool when progressively enhancing a site.
...in practice however, when using feature queries for progressive enhancement, this doesn't matter.
... when browsers don't understand a css property or value, they ignore it.
Relationship of flexbox to other layout methods - CSS: Cascading Style Sheets
the writing modes the writing modes specification defines the following values of the writing-mode property, which serve to change the direction that blocks are laid out on the page, to match the direction that blocks lay out when content is formatted in that particular writing mode.
...when space is distributed flexbox does not look at the placement of items in other rows and tries to line things up with each other.
...this article details many of the ways that grid layout differs from flex layout, and demonstrates some of the extra functionality you get when using grid layout such as layering of items on the grid.
...this also disappears when the box disappears.
Block and inline layout in normal flow - CSS: Cascading Style Sheets
in this guide, we will explore the basics of how block and inline elements behave when they are part of the normal flow.
...the behavior on block and inline elements is the same when working in a vertical writing mode, and we will explore this in a future guide on flow layout and writing modes.
... the line box size in the block direction (so the height when working in english) is defined by the tallest box inside it.
...we can see this very clearly when considering a flex layout.
Auto-placement in CSS Grid Layout - CSS: Cascading Style Sheets
in addition to the ability to place items accurately onto a created grid, the css grid layout specification contains rules that control what happens when you create a grid and do not place some or all of the child items.
...when it fills up a column it will move onto the next explicit column, or create a new column track in the implicit grid.
...we will take a look at the potential accessibility issues of grid layout in a later guide, but you should take care when creating this disconnect between the visual order and display order.
... use cases for auto-placement auto-placement is useful whenever you have a collection of items.
CSS Grid Layout and Progressive Enhancement - CSS: Cascading Style Sheets
i have used the vertical-align property on my item when in the inline-block display mode, but this property does not apply to grid items and, therefore, is ignored once the item becomes a grid item: * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; max-width: 600px; margin: 0 auto; } .wrapper li { border: 2px solid #ffa94d; border-radius: 5px; backgroun...
... the css grid layout specification details why we can overwrite the behavior of certain properties when something becomes a grid item.
... other values of display when an element has a parent set to display: grid it is blockified, as defined in the css display specification.
... multiple-column layout you can also use multiple column layout as your legacy browser plan, as the column-* properties do not apply when applied to a grid container.
Realizing common layouts using CSS Grid Layout - CSS: Cascading Style Sheets
to round off this set of guides to css grid layout, i am going to walk through a few different layouts, which demonstrate some of the different techniques you can use when designing with grid layout.
...i like this approach as when working with a multiple-column layout system we usually think of blocks in terms of the number of tracks of the grid they span, and adjust that for different breakpoints.
...now when grid encounters this item, it will assign it two tracks.
...take care when doing this however as it does take items away from their logical source order.
Understanding CSS z-index - CSS: Cascading Style Sheets
the z-index attribute lets you adjust the order of the layering of objects when rendering content.
...z-axis positions are particularly relevant when boxes overlap visually.
...however, when z-index is applied to complex hierarchies of html elements, its behaviour can be hard to understand or predict.
... stacking without the z-index property: the stacking rules that apply when z-index is not used.
Basic concepts of CSS Scroll Snap - CSS: Cascading Style Sheets
this means you can be confident that something you expect to be at the top of the screen will be when scrolling finishes.
... the proximity value will only snap to a position when it is close by, the exact distance being left to the browser to decide.
...when we snap to the start of the second and third sections, the scrolling stops 40 pixels away from the start of the section.
...without padding, the heading would overlap some of the content when snapping happens.
Basic Shapes - CSS: Cascading Style Sheets
the reference box understanding the reference box used by css shapes is important when using basic shapes, as it defines each shape's coordinate system.
... the firefox shapes inspector helpfully shows the reference box in use when you inspect a shape.
...when using a basic shape the reference box used by default is the margin-box.
... the shape will be clipped by the margin box when describing reference boxes i explained that the margin-box will clip the shape.
Recipe: Media objects - CSS: Cascading Style Sheets
the recipe download this example choices made i have chosen to use grid layout for the media object as it allows me to control the layout in two dimensions when i need to.
... this means that when we have a footer, with short content above, the footer can be pushed down to the bottom of the media object.
...by using fit-content with a maximum size of 200 pixels, when we have a small image such as the icon, the track only gets as large as the size of that image — the max-content size.
... when we nest one media object inside another we need to place it into the second track in the regular layout, and the first track when flipped.
Cubic Bezier Generator - CSS: Cascading Style Sheets
ale_size = 5; // size of 0.1 tick on the rulers var scaling; //limitation: scaling is computed once: if canvas.height/canvas.width change it won't be recalculated var dragsm = 0; // drag state machine: 0 = nodrag, others = object being dragged function initcanvas() { // get the canvas element using the dom var canvas = document.getelementbyid('bezier'); // make sure we don't execute when canvas isn't supported if (canvas.getcontext) { // use getcontext to use the canvas for drawing var ctx = canvas.getcontext('2d'); scaling = math.min(canvas.height - rulers - margin, canvas.width - rulers - margin); canvas.onmousedown = mousedown; canvas.onmouseup = mouseup; } else { alert('you need safari or firefox 1.5+ to see this demo.
...'); } } function cx(x) { return x * scaling + rulers; } function reversex(x) { return (x - rulers) / scaling; } function lx(x) { //used when drawing vertical lines to prevent subpixel blur var result = cx(x); return math.round(result) == result ?
... result + 0.5 : result; } function cy(y) { return (1 - y) * scaling + margin; } function reversey(y) { return (margin - y) / scaling + 1; } function ly(y) { // used when drawing horizontal lines to prevent subpixel blur var result = cy(y); return math.round(result) == result ?
... result + 0.5 : result; } function drawbeziercurve(x1, y1, x2, y2) { // get the canvas element using the dom var canvas = document.getelementbyid('bezier'); // make sure we don't execute when canvas isn't supported if (canvas.getcontext) { // use getcontext to use the canvas for drawing var ctx = canvas.getcontext('2d'); // clear canvas ctx.clearrect(0, 0, canvas.width, canvas.height); // draw the rulers ctx.beginpath(); ctx.strokestyle = "black"; // draw the y axis ctx.moveto(cx(0), cy(0)); ctx.lineto(cx(1), cy(0)); ctx.textalign = "right"; for (var i = 0.1; i <= 1; i = i + 0.1) { ctx.moveto(-basic_scale_size + cx(0), ly(i)); if ((i == 0.5) || (i > ...
Using CSS custom properties (variables) - CSS: Cascading Style Sheets
custom property fallback values using the var() function, you can define multiple fallback values when the given variable is not yet defined; this can be useful when working with custom elements and shadow dom.
...the second argument to the function, if provided, is a fallback value, which is used as the substitution value when the referenced custom property is invalid.
...when the values of the custom properties are parsed, the browser doesn't know where they will be used, so must, therefore, consider nearly all values as valid.
... when the browser encounters an invalid var() substitution, the initial or inherited value of the property is used.
backface-visibility - CSS: Cascading Style Sheets
the backface-visibility css property sets whether the back face of an element is visible when turned towards the user.
...though invisible in 2d, the back face can become visible when a transformation causes the element to be rotated in 3d space.
... values visible the back face is visible when turned towards the user.
... hidden the back face is hidden, effectively making the element invisible when turned away from the user.
border-color - CSS: Cascading Style Sheets
when one value is specified, it applies the same color to all four sides.
... when two values are specified, the first color applies to the top and bottom, the second to the left and right.
... when three values are specified, the first color applies to the top, the second to the left and right, the third to the bottom.
... when four values are specified, the colors apply to the top, right, bottom, and left in that order (clockwise).
cursor - CSS: Cascading Style Sheets
WebCSScursor
the cursor css property sets the type of mouse cursor, if any, to show when the mouse pointer is over an element.
...e.g., equivalent to text when hovering text.
...for example, the se-resize cursor is used when the movement starts from the south-east corner of the box.
...as | 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 { cursor: zoom-in; } /* a fallback keyword value is required when using a url */ .baz { cursor: url("hyper.cur"), auto; } specifications specification status comment css basic user interface module level 3the definition of 'cursor' in that specification.
display - CSS: Cascading Style Sheets
WebCSSdisplay
some values of display are fully defined in their own individual specifications; for example the detail of what happens when display: flex is declared is defined in the css flexible box model specification.
... valid <display-outside> values: block the element generates a block element box, generating line breaks both before and after the element when in the normal flow.
... note: browsers that support the two value syntax, on finding the outer value only, such as when display: block or display: inline is specified, will set the inner value to flow.
... note: browsers that support the two value syntax, on finding the inner value only, such as when display: flex or display: grid is specified, will set their outer value to block.
image-rendering - CSS: Cascading Style Sheets
the user agent will scale an image when the page author specifies dimensions other than its natural size.
...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 degree.
... pixelated when scaling the image up, the nearest-neighbor algorithm must be used, so that the image appears to be composed of large pixels.
... when scaling down, this is the same as auto.
image() - CSS: Cascading Style Sheets
the image() css function defines an <image> in a similar fashion to the <url> function, but with added functionality including specifying the image's directionality, specifying fallback images for when the preferred image is not supported, displaying just a part of that image defined by a media fragment, and specifying a solid color as a fallback in case none of the specified images are able to be rendered.
...the #xywh=#,#,#,# media fragment syntax is 'backwards compatible' in that a media fragment will be ignored if not understood, and won't break the source call when used with url().
... mdn understanding wcag, guideline 1.1 explanations understanding success criterion 1.1.1 | w3c understanding wcag 2.0 this feature can help improve accessibility by providing a fallback color when an image fails to load.
...what cursor do you see?</div> .box:hover { cursor: image("https://mdn.mozillademos.org/files/16411/sprite.png#xywh=32,64,16,16"); } when the user hovers over the box, the cursor will change to display the 16x16 px section of the sprite image, starting at x=32 and y=64.
Inheritance - CSS: Cascading Style Sheets
in css, inheritance controls what happens when no value is specified for a property on an element.
... inherited properties when no value for an inherited property has been specified on an element, the element gets the computed value of that property on its parent element.
...it does not get the initial value of the property (which is the color that is used for the root element when the page specifies no color).
... non-inherited properties when no value for a non-inherited property has been specified on an element, the element gets the initial value of that property (as specified in the property's summary).
margin - CSS: Cascading Style Sheets
WebCSSmargin
when one value is specified, it applies the same margin to all four sides.
... when two values are specified, the first margin applies to the top and bottom, the second to the left and right.
... when three values are specified, the first margin applies to the top, the second to the right and left, the third to the bottom.
... when four values are specified, the margins apply to the top, right, bottom, and left in that order (clockwise).
padding - CSS: Cascading Style Sheets
WebCSSpadding
when one value is specified, it applies the same padding to all four sides.
... when two values are specified, the first padding applies to the top and bottom, the second to the left and right.
... when three values are specified, the first padding applies to the top, the second to the right and left, the third to the bottom.
... when four values are specified, the paddings apply to the top, right, bottom, and left in that order (clockwise).
text-emphasis - CSS: Cascading Style Sheets
the size of the emphasis symbol, like ruby symbols, is about 50% of the size of the font, and text-emphasis may affect line height when the current leading is not enough for the marks.
...in the very rare cases when this is needed, the property text-emphasis-position.
...this is the default shape in horizontal writing modes when no other shape is given.
...this is the default shape in vertical writing modes when no other shape is given.
touch-action - CSS: Cascading Style Sheets
an application using pointer events will receive a pointercancel event when the browser starts handling a touch gesture.
... when a gesture is started, the browser intersects the touch-action values of the touched element and its ancestors, up to the one that implements the gesture (in other words, the first containing scrolling element).
...disabling double-tap to zoom removes the need for browsers to delay the generation of click events when the user taps the screen.
...multiple directions may be combined except when there is a simpler representation (for example, "pan-left pan-right" is invalid since "pan-x" is simpler, but "pan-left pan-down" is valid).
word-break - CSS: Cascading Style Sheets
<code>word-break: normal</code></p> <p class="normal narrow">this is a long and honorificabilitudinitatibus califragilisticexpialidocious taumatawhakatangihangakoauauotamateaturipukakapikimaungahoronukupokaiwhenuakitanatahu グレートブリテンおよび北アイルランド連合王国という言葉は本当に長い言葉</p> <p>2.
... <code>word-break: break-all</code></p> <p class="breakall narrow">this is a long and honorificabilitudinitatibus califragilisticexpialidocious taumatawhakatangihangakoauauotamateaturipukakapikimaungahoronukupokaiwhenuakitanatahu グレートブリテンおよび北アイルランド連合王国という言葉は本当に長い言葉</p> <p>3.
... <code>word-break: keep-all</code></p> <p class="keepall narrow">this is a long and honorificabilitudinitatibus califragilisticexpialidocious taumatawhakatangihangakoauauotamateaturipukakapikimaungahoronukupokaiwhenuakitanatahu グレートブリテンおよび北アイルランド連合王国という言葉は本当に長い言葉</p> <p>4.
... <code>word-break: break-word</code></p> <p class="breakword narrow">this is a long and honorificabilitudinitatibus califragilisticexpialidocious taumatawhakatangihangakoauauotamateaturipukakapikimaungahoronukupokaiwhenuakitanatahu グレートブリテンおよび北アイルランド連合王国という言葉は本当に長い言葉</p> css .narrow { padding: 10px; border: 1px solid; width: 500px; margin: 0 auto; font-size: 20px; line-height: 1.5; letter-spacing: 1px; } .normal { word-break: normal; } .breakall { word-break: break-all; } .keepall { word-break: keep-all; } .breakword { word-break: break-word; } specifications specification status comment css text module level 3the definition of 'word-break' in that specification...
Content categories - Developer guides
this is a loose grouping (it doesn't actually create a relationship among elements of these categories), but they help define and describe the categories' shared behavior and their associated rules, especially when you come upon their intricate details.
...ents belong to this category only under specific conditions: <audio>, if the controls attribute is present <img>, if the usemap attribute is present <input>, if the type attribute is not in the hidden state <menu>, if the type attribute is in the toolbar state <object>, if the usemap attribute is present <video>, if the controls attribute is present palpable content content is palpable when it's neither empty or hidden; it is content that is rendered and is substantive.
... submittable elements that can be used for constructing the form data set when the form is submitted.
... resettable elements that can be affected when a form is reset.
Printing - Developer guides
there may be times in which your web site or application would like to improve the user's experience when printing content.
... <link href="/path/to/print.css" media="print" rel="stylesheet" /> using media queries to improve layout detecting print requests some browsers (including firefox 6 and later and internet explorer) send beforeprint and afterprint events to let content determine when printing may have occurred.
... open and automatically close a popup window when finished if you want to be able to automatically close a popup window (for example, the printer-friendly version of a document) after the user prints its contents, you can use code like this: <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>javascript window close example </title> <script type="text/javascript"> function popuponc...
...lick() { my_window = window.open('', 'mywindow', 'status=1,width=350,height=150'); my_window.document.write('<html><head><title>print me</title></head>'); my_window.document.write('<body onafterprint="self.close()">'); my_window.document.write('<p>when you print this window, it will close afterward.</p>'); my_window.document.write('</body></html>'); } </script> </head> <body> <p>to try out the <code>afterprint</code> event, click the link below to open the window to print.
The HTML autocomplete attribute - HTML: Hypertext Markup Language
when creating a new account or changing passwords, this should be used for an "enter your new password" or "confirm new password" field, as opposed to a general "enter your current password" field that might be present.
...this works even when the autocomplete attribute would normally not apply by virtue of its type.
...each country has its own system of administrative levels, and may arrange the levels in different orders when addresses are written.
... form layout flexibility given that different countries write their address in different ways, with each field in different places within the address, and even different sets and numbers of fields entirely, it can be helpful if, when possible, your site is able to switch to the layout expected by your users when presenting an address entry form, given the country the address is located within.
<abbr>: The Abbreviation element - HTML: Hypertext Markup Language
WebHTMLElementabbr
the title attribute has a specific semantic meaning when used with the <abbr> element; it must contain a full human-readable description or expansion of the abbreviation.
... this text is often presented by browsers as a tooltip when the mouse cursor is hovered over the element.
...there are, though, a few cases where it's helpful to do so: when an abbreviation is used and you want to provide an expansion or definition outside the flow of the document's content, use <abbr> with an appropriate title.
... when an abbreviation's presence in the text needs to be semantically noted, the <abbr> element is useful.
<dialog>: The Dialog element - HTML: Hypertext Markup Language
WebHTMLElementdialog
when the open attribute is not set, the dialog shouldn't be shown to the user.
...when such a form is submitted, the dialog closes with its returnvalue property set to the value of the button that was used to submit the form.
... the ::backdrop css pseudo-element can be used to style behind a <dialog> element when the dialog is displayed with htmldialogelement.showmodal().
... examples simple example <dialog open> <p>greetings, one and all!</p> </dialog> advanced example this example opens a pop-up dialog box that contains a form, when the "update details" button is clicked.
<input type="button"> - HTML: Hypertext Markup Language
WebHTMLElementinputbutton
<input> elements of type button are rendered as simple push buttons, which can be programmed to control custom functionality anywhere on a webpage as required when assigned an event handler function (typically for the click event).
...addeventlistener() is then used to establish a function that will be run when click events occur on the button.
...this is very similar to the previous example, except that the disabled attribute is set on the <fieldset> when the first button is pressed — this causes all three buttons to be disabled until the two second timeout has passed.
...the button, when clicked, invokes a function that clears the canvas.
<input type="password"> - HTML: Hypertext Markup Language
WebHTMLElementinputpassword
when setting the value of a password control, line feed and carriage return characters are stripped out of the value.
... field inputs support the following attributes: attribute description maxlength the maximum length the value may be, in utf-16 characters minlength the minimum length in characters that will be considered valid pattern a regular expression the value must match in order to be valid placeholder an example value to display in the field when the field is empty readonly a boolean attribute which, if present, indicates that the field's contents should not be editable size the number of characters wide the input field should be maxlength the maximum number of characters (as utf-16 code units) the user can enter into the password field.
... pattern the pattern attribute, when specified, is a regular expression that the input's value must match in order for the value to pass constraint validation.
... it must be a valid javascript regular expression, as used by the regexp type, and as documented in our guide on regular expressions; the 'u' flag is specified when compiling the regular expression, so that the pattern is treated as a sequence of unicode code points, instead of as ascii.
<menuitem> - HTML: Hypertext Markup Language
WebHTMLElementmenuitem
(menu items for indirect commands gain checkboxes or radio buttons when defined against elements <input type="checkbox"> and <input type="radio">.) content categories none.
...may only be used when the type attribute is checkbox or radio.
...required when a command attribute is not present.
... radiogroup this attribute specifies the name of a group of commands to be toggled as radio buttons when selected.
<tbody>: The Table Body element - HTML: Hypertext Markup Language
WebHTMLElementtbody
the <tbody> element, along with its cousins <thead> and <tfoot>, provide useful semantic information that can be used when rendering for either screen or printer as well as for accessibility purposes.
...typical values for this include a period (.) when attempting to align numbers or monetary values.
... when printing a document, the <thead> and <tfoot> elements specify information that may be the same—or at least very similar—on every page of a multi-page table, while the <tbody> element's contents generally will differ from page to page.
... when a table is presented in a screen context (such as a window) which is not large enough to display the entire table, the user agent may let the user scroll the contents of the <thead>, <tbody>, <tfoot>, and <caption> blocks separately from one another for the same parent table.
<track>: The Embed Text Track element - HTML: Hypertext Markup Language
WebHTMLElementtrack
suitable for users who are deaf or when the sound is muted.
... chapters chapter titles are intended to be used when the user is navigating the media resource.
... label a user-readable title of the text track which is used by the browser when listing available text tracks.
...the element points to a source file containing timed text that the browser exposes when the user requests additional data.
Link types - HTML: Hypertext Markup Language
this is especially useful when opening untrusted links, in order to ensure they cannot tamper with the originating document via the window.opener property (see about rel=noopener for more details), while still providing the referer http header (unless noreferrer is used as well).
... note that when noopener is used, nonempty target names other than _top, _self, and _parent are all treated like _blank in terms of deciding whether to open a new window/tab.
... <a>, <area>, <form> <link> noreferrer prevents the browser, when navigating to another page, to send this page address, or any other value, as referrer via the referer: http header.
... <link> <a>, <area>, <form> preconnect provides a hint to the browser suggesting that it open a connection to the linked web site in advance, without disclosing any private information or downloading any content, so that when the link is followed the linked content can be fetched more quickly.
Connection management in HTTP/1.x - HTTP
network latency and bandwidth affect performance when a request needs sending.
...in http/1.1, this model is only used when the connection header is sent with a value of close.
... persistent connections short-lived connections have two major hitches: the time taken to establish a new connection is significant, and performance of the underlying tcp connection gets better only when this connection has been in use for some time (warm connection).
... persistent connections also have drawbacks; even when idling they consume server resources, and under heavy load, dos attacks can be conducted.
Content negotiation - HTTP
when a client wants to obtain a resource, the client requests it using its url.
...how a specific representation is chosen when the resource is called is determined by content negotiation and there are several ways of negotiating between the client and the server.
... the accept header is defined by the browser, or any other user-agent, and can vary according to the context, like fetching an html page or an image, a video, or a script: it is different when fetching a document entered in the address bar or an element linked via an <img>, <video> or <audio> element.
...in this negotiation, when facing an ambiguous request, the server sends back a page containing links to the available alternative resources.
Forwarded - HTTP
the forwarded header contains information from the reverse proxy servers that is altered or lost when a proxy is involved in the path of the request.
...therefore the user's privacy must be kept in mind when deploying this header.
... header type request header forbidden header name no syntax forwarded: by=<identifier>;for=<identifier>;host=<host>;proto=<http|https> directives <identifier> an identifier disclosing the information that is altered or lost when using a proxy.
... this can be either: an ip address (v4 or v6, optionally with a port, and ipv6 quoted and enclosed in square brackets), an obfuscated identifier (such as "_hidden" or "_secret"), or "unknown" when the preceding entity is not known (and you still want to indicate that forwarding of the request was made).
Retry-After - HTTP
there are three main cases this header is used: when sent with a 503 (service unavailable) response, this indicates how long the service is expected to be unavailable.
... when sent with a 429 (too many requests) response, this indicates how long to wait before making a new request.
... when sent with a redirect response, such as 301 (moved permanently), this indicates the minimum time that the user agent is asked to wait before issuing the redirected request.
...it is useful to send it along with a 503 (service unavailable) response, so that search engines will keep indexing your site when the downtime is over.
Strict-Transport-Security - HTTP
note: the strict-transport-security header is ignored by the browser when your site is accessed using http; this is because an attacker may intercept http connections and inject the header or remove it.
... when your site is accessed over https with no certificate errors, the browser knows your site is https capable and will honor the strict-transport-security header.
... when the expiration time specified by the strict-transport-security header elapses, the next attempt to load the site via http will proceed as normal instead of automatically using https.
... whenever the strict-transport-security header is delivered to the browser, it will update the expiration time for that site, so sites can refresh this information and prevent the timeout from expiring.
HTTP Messages - HTTP
WebHTTPMessages
post / http/1.1 get /background.png http/1.0 head /test.html?query=alibaba http/1.1 options /anypage.html http/1.0 a complete url, known as the absolute form, is mostly used with get when connected to a proxy.
...it is only used with connect when setting up an http tunnel.
...typically, no such headers are transmitted when there is no body in the response.
...no changes are needed in the apis used by web developers to utilize http frames; when available in both the browser and the server, http/2 is switched on and used.
Protocol upgrade mechanism - HTTP
other than the upgrade and connection headers, the rest are generally optional or handled for you by the browser and server when they're talking to each other.
...this header can be used when insecure (http) clients wish to upgrade, in order to offer some degree of protection against abuse.
... sec-websocket-version: version version the websocket protocol version the client wishes to use when communicating with the server.
... sec-websocket-accept included in the response message from the server during the opening handshake process when the server is willing to initiate a websocket connection.
Public class fields - JavaScript
syntax class classwithinstancefield { instancefield = 'instance field' } class classwithstaticfield { static staticfield = 'static field' } class classwithpublicinstancemethod { publicmethod() { return 'hello world' } } examples public static fields public static fields are useful when you want a field to exist only once per class, not on every class instance you create.
... class classwithstaticfield { static basestaticfield = 'base field' } class subclasswithstaticfield extends classwithstaticfield { static substaticfield = 'sub class field' } console.log(subclasswithstaticfield.substaticfield) // expected output: "sub class field" console.log(subclasswithstaticfield.basestaticfield) // expected output: "base field" when initializing fields, this refers to the class constructor.
... const prefix = 'prefix' class classwithcomputedfieldname { [`${prefix}field`] = 'prefixed field' } const instance = new classwithcomputedfieldname() console.log(instance.prefixfield) // expected output: "prefixed field" when initializing fields this refers to the class instance under construction.
... class baseclass { msg = 'hello world' basepublicmethod() { return this.msg } } class subclass extends baseclass { subpublicmethod() { return super.basepublicmethod() } } const instance = new subclass() console.log(instance.subpublicmethod()) // expected output: "hello worl​d" getters and setters are special methods that bind to a class property and are called when that property is accessed or set.
SyntaxError: illegal character - JavaScript
the javascript exception "illegal character" occurs when there is an invalid or unexpected token that doesn't belong at this position in the code.
...when something like this happens to your code and you're not able to find the source of the problem, it's often best to just delete the problematic line and retype it.
... var colors = ['#000', '#333', '#666']; hidden characters when copy pasting code from external sources, there might be invalid characters.
... var foo = 'bar';​ // syntaxerror: illegal character when inspecting this code in an editor like vim, you can see that there is actually a zero-width space (zwsp) (u+200b) character.
getter - JavaScript
the get syntax binds an object property to a function that will be called when that property is looked up.
... note the following when working with the get syntax: it can have an identifier which is either a number or a string; it must have exactly zero parameters (see incompatible es5 change: literal getter and setter functions must now have exactly zero or one arguments for more information); it must not appear in an object literal with another get or with a data entry for the same property ({ get x() { }, get x() { } } a...
...defineproperty while using the get keyword and object.defineproperty() have similar results, there is a subtle difference between the two when used on classes.
... when using get the property will be defined on the instance's prototype, while using object.defineproperty() the property will be defined on the instance it is applied to.
setter - JavaScript
the set syntax binds an object property to a function to be called when there is an attempt to set that property.
... description in javascript, a setter can be used to execute a function whenever a specified property is attempted to be changed.
... note the following when working with the set syntax: it can have an identifier which is either a number or a string; it must have exactly one parameter (see incompatible es5 change: literal getter and setter functions must now have exactly zero or one arguments for more information); it must not appear in an object literal with another set or with a data entry for the same property.
...when current is assigned a value, it updates log with that value: const language = { set current(name) { this.log.push(name); }, log: [] } language.current = 'en'; console.log(language.log); // ['en'] language.current = 'fa'; console.log(language.log); // ['en', 'fa'] note that current is not defined, and any attempts to access it will result in undefined.
Array.prototype.map() - JavaScript
thisargoptional value to use as this when executing callback.
... when not to use map() since map builds a new array, using it when you aren't using the returned array is an anti-pattern; use foreach or for-of instead.
... {key: 3, value: 30}] let reformattedarray = kvarray.map(obj => { let robj = {} robj[obj.key] = obj.value return robj }) // reformattedarray is now [{1: 10}, {2: 20}, {3: 30}], // kvarray is still: // [{key: 1, value: 10}, // {key: 2, value: 20}, // {key: 3, value: 30}] mapping an array of numbers using a function containing an argument the following code shows how map works when a function requiring one argument is used with it.
... mapped array contains undefined when undefined or nothing is returned: let numbers = [1, 2, 3, 4] let filterednumbers = numbers.map(function(num, index) { if (index < 3) { return num } }) // index goes from 0, so the filternumbers are 1,2,3 and undefined.
BigInt64Array() constructor - JavaScript
syntax new bigint64array(); new bigint64array(length); new bigint64array(typedarray); new bigint64array(object); new bigint64array(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros.
... typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array.
... object when called with an object argument, a new typed array is created as if by the typedarray.from() method.
... buffer, byteoffset, length when called with a buffer, and optionally a byteoffset and a length argument, a new typed array view is created that views the specified arraybuffer.
BigUint64Array() constructor - JavaScript
syntax new biguint64array(); new biguint64array(length); new biguint64array(typedarray); new biguint64array(object); new biguint64array(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros.
... typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array.
... object when called with an object argument, a new typed array is created as if by the typedarray.from() method.
... buffer, byteoffset, length when called with a buffer, and optionally a byteoffset and a length argument, a new typed array view is created that views the specified arraybuffer.
FinalizationRegistry.prototype.unregister() - JavaScript
syntax registry.unregister(unregistertoken); parameters unregistertoken the token used with the register method when registering the target object.
... notes when a target object has been reclaimed, it is no longer registered in the registry.
...be sure to call `release` when you're done with it.
...be sure to call `release` when you're done with it.
Float32Array() constructor - JavaScript
syntax new float32array(); // new in es2017 new float32array(length); new float32array(typedarray); new float32array(object); new float32array(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros.
... typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array.
... object when called with an object argument, a new typed array is created as if by the typedarray.from() method.
... buffer, byteoffset, length when called with a buffer, and optionally a byteoffset and a length argument, a new typed array view is created that views the specified arraybuffer.
Float64Array() constructor - JavaScript
syntax new float64array(); // new in es2017 new float64array(length); new float64array(typedarray); new float64array(object); new float64array(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros.
... typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array.
... object when called with an object argument, a new typed array is created as if by the typedarray.from() method.
... buffer, byteoffset, length when called with a buffer, and optionally a byteoffset and a length argument, a new typed array view is created that views the specified arraybuffer.
Int16Array() constructor - JavaScript
syntax new int16array(); // new in es2017 new int16array(length); new int16array(typedarray); new int16array(object); new int16array(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros.
... typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array.
... object when called with an object argument, a new typed array is created as if by the typedarray.from() method.
... buffer, byteoffset, length when called with a buffer, and optionally a byteoffset and a length argument, a new typed array view is created that views the specified arraybuffer.
Int32Array() constructor - JavaScript
syntax new int32array(); // new in es2017 new int32array(length); new int32array(typedarray); new int32array(object); new int32array(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros.
... typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array.
... object when called with an object argument, a new typed array is created as if by the typedarray.from() method.
... buffer, byteoffset, length when called with a buffer, and optionally a byteoffset and a length argument, a new typed array view is created that views the specified arraybuffer.
Int8Array() constructor - JavaScript
syntax new int8array(); // new in es2017 new int8array(length); new int8array(typedarray); new int8array(object); new int8array(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros.
... typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array.
... object when called with an object argument, a new typed array is created as if by the typedarray.from() method.
... buffer, byteoffset, length when called with a buffer, and optionally a byteoffset and a length argument, a new typed array view is created that views the specified arraybuffer.
Intl.NumberFormat() constructor - JavaScript
options optional an object with some or all of the following properties: compactdisplay only used when notation is "compact".
... "engineering" return the exponent of ten when divisible by three "compact" string representing exponent, defaults is using the "short" form.
... signdisplay when to display the sign for the number; defaults to "auto" "auto" sign display for negative numbers only "never" never display sign "always" always display sign "exceptzero" sign display for positive and negative numbers, but not zero style the formatting style to use , the default is "decimal".
...ct", compactdisplay: "long" }).format(987654321); // → 988 millions new intl.numberformat('en-gb', { notation: "compact", compactdisplay: "short" }).format(987654321); // → 988m displaying signs display a sign for positive and negative numbers, but not zero: new intl.numberformat("en-us", { style: "percent", signdisplay: "exceptzero" }).format(0.55); // → '+55%' note that when the currency sign is "accounting", parentheses might be used instead of a minus sign: new intl.numberformat('bn', { style: 'currency', currency: 'usd', currencysign: 'accounting', signdisplay: 'always' }).format(-3500); // → '($3,500.00)' specifications specification ecmascript internationalization api (ecma-402)the definition of 'intl.numberformat constructor'...
RegExp.prototype.test() - JavaScript
description use test() whenever you want to know whether a pattern is found in a string.
...; const result = /^hello/.test(str); console.log(result); // true the following example logs a message which depends on the success of the test: function testinput(re, str) { let midstring; if (re.test(str)) { midstring = 'contains'; } else { midstring = 'does not contain'; } console.log(`${str} ${midstring} ${re.source}`); } using test() on a regex with the "global" flag when a regex has the global flag set, test() will advance the lastindex of the regex.
... note: as long as test() returns true, lastindex will not reset—even when testing a different string!
... when test() returns false, the calling regex's lastindex property will reset to 0.
TypedArray.from() - JavaScript
thisarg optional value to use as this when executing mapfn.
...hence, when working with proxy objects, it calls handler.set to create new elements rather than handler.defineproperty().
... when the source parameter is an iterator, the typedarray.from() first collects all the values from the iterator, then creates an instance of thisarg using the count, then sets the values on the instance.
... when array.from() gets an array-like which isn't an iterator, it respects holes.
Uint16Array() constructor - JavaScript
syntax new uint16array(); // new in es2017 new uint16array(length); new uint16array(typedarray); new uint16array(object); new uint16array(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros.
... typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array.
... object when called with an object argument, a new typed array is created as if by the typedarray.from() method.
... buffer, byteoffset, length when called with a buffer, and optionally a byteoffset and a length argument, a new typed array view is created that views the specified arraybuffer.
Uint32Array() constructor - JavaScript
syntax new uint32array(); // new in es2017 new uint32array(length); new uint32array(typedarray); new uint32array(object); new uint32array(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros.
... typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array.
... object when called with an object argument, a new typed array is created as if by the typedarray.from() method.
... buffer, byteoffset, length when called with a buffer, and optionally a byteoffset and a length argument, a new typed array view is created that views the specified arraybuffer.
Uint8Array() constructor - JavaScript
syntax new uint8array(); // new in es2017 new uint8array(length); new uint8array(typedarray); new uint8array(object); new uint8array(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros.
... typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array.
... object when called with an object argument, a new typed array is created as if by the typedarray.from() method.
... buffer, byteoffset, length when called with a buffer, and optionally a byteoffset and a length argument, a new typed array view is created that views the specified arraybuffer.
Uint8ClampedArray() constructor - JavaScript
syntax new uint8clampedarray(); // new in es2017 new uint8clampedarray(length); new uint8clampedarray(typedarray); new uint8clampedarray(object); new uint8clampedarray(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros.
... typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array.
... object when called with an object argument, a new typed array is created as if by the typedarray.from() method.
... buffer, byteoffset, length when called with a buffer, and optionally a byteoffset and a length argument, a new typed array view is created that views the specified arraybuffer.
isNaN() - JavaScript
origin of nan values nan values are generated when arithmetic operations result in undefined or unrepresentable values.
...when the argument to the isnan function is not of type number, the value is first coerced to a number.
...thus for non-numbers that when coerced to numeric type result in a valid non-nan numeric value (notably the empty string and boolean primitives, which when coerced give numeric values zero or one), the "false" returned value may be unexpected; the empty string, for example, is surely "not a number." the confusion stems from the fact that the term, "not a number", has a specific meaning for numbers represented as ieee-754 floating-point values.
... the function should be interpreted as answering the question, "is this value, when coerced to a numeric value, an ieee-754 'not a number' value?" ecmascript 2015 contains the number.isnan() function.
Spread syntax (...) - JavaScript
function myfunction(v, w, x, y, z) { } const args = [0, 1]; myfunction(-1, ...args, 2, ...[3]); apply for new operator when calling a constructor with new it's not possible to directly use an array and apply() (apply() does a [[call]] and not a [[construct]]).
... only for iterables objects themselves are not iterable, but they become iterable when used in an array, or with iterating functions such as map(), reduce(), and assign().
... when merging 2 objects together with the spread operator, it is assumed another iterating function is used when the merging occurs.
... spread syntax (other than in the case of spread properties) can be applied only to iterable objects: const obj = {'key1': 'value1'}; const array = [...obj]; // typeerror: obj is not iterable spread with many values when using spread syntax for function calls, be aware of the possibility of exceeding the javascript engine's argument length limit.
async function - JavaScript
await expressions suspend progress through an async function, yielding control and subsequently resuming progress only when an awaited promise-based asynchronous operation is either fulfilled or rejected.
... some time later, when the first promise has either been fulfilled or rejected, control moves back into foo.
... some time later, when the second promise has either been fulfilled or rejected, control re-enters foo.
...as a result, we must be mindful of error handling behavior when dealing with concurrent asynchronous operations.
function* - JavaScript
generators in javascript -- especially when combined with promises -- are a very powerful tool for asynchronous programming as they mitigate -- if not entirely eliminate -- the problems with callbacks, such as callback hell and inversion of control.
...when the iterator's next() method is called, the generator function's body is executed until the first yield expression, which specifies the value to be returned from the iterator or, with yield*, delegates to another generator function.
... a return statement in a generator, when executed, will make the generator finish (i.e.
... when a generator is finished, subsequent next() calls will not execute any of that generator's code, they will just return an object of this form: {value: undefined, done: true}.
switch - JavaScript
syntax switch (expression) { case value1: //statements executed when the //result of expression matches value1 [break;] case value2: //statements executed when the //result of expression matches value2 [break;] ...
... case valuen: //statements executed when the //result of expression matches valuen [break;] [default: //statements executed when none of //the values match the value of the expression [break;]] } expression an expression whose result is matched against each case clause.
...when break is encountered, the program breaks out of switch and executes the statement following switch.
...javascript will drop you back to the default if it can't find a match: var foo = 5; switch (foo) { case 2: console.log(2); break; // it encounters this break so will not continue into 'default:' default: console.log('default') // fall-through case 1: console.log('1'); } it also works when you put default before all other cases.
Trailing commas - JavaScript
trailing commas (sometimes called "final commas") can be useful when adding new elements, parameters, or properties to javascript code.
...when iterating arrays for example with array.prototype.foreach() or array.prototype.map(), array holes are skipped.
...furthermore, when using a rest parameters, trailing commas are not allowed: function f(,) {} // syntaxerror: missing formal parameter (,) => {}; // syntaxerror: expected expression, got ',' f(,) // syntaxerror: expected expression, got ',' function f(...p,) {} // syntaxerror: parameter after rest parameter (...p,) => {} // syntaxerror: expected closing parenthesis, got ',' trailing com...
...mas in destructuring a trailing comma is also allowed on the left-hand side when using destructuring assignment: // array destructuring with trailing comma [a, b,] = [1, 2]; // object destructuring with trailing comma var o = { p: 42, q: true, }; var {p, q,} = o; again, when using a rest element, a syntaxerror will be thrown: var [a, ...b,] = [1, 2, 3]; // syntaxerror: rest element may not have a trailing comma trailing commas in json trailing commas in objects were only introduced in ecmascript 5.
Critical rendering path - Web Performance
for example, .foo {} is faster than .bar .foo {} because when the browser finds .foo, in the second scenario, it has to walk up the dom to check if .foo has an ancestor .bar.
...when it comes to css, selector performance optimization, improvements will only be in microseconds.
...the device-width changes when a user rotates their phone between landscape and portrait mode.
...while painting is a very fast process, and therefore likely not the most impactful place to focus on in improving performance, it is important to remember to allow for both layout and re-paint times when measuring how long an animation frame may take.
Understanding latency - Web Performance
latency is generally considered to be the amount of time it takes from when a request is made by the user to the time it takes for the response to get back to that user.
... latency can be measured one way, for example, the amount of time it takes to send a request for resources, or the length of the entire round-trip from the browser’s request for a resource to the moment when the requested resource arrives at the browser.
... when a request is in a queue, waiting for a network connection it is considered blocked.
... blocking happens when there are too many simultaneous connections made to a single server over http.
How to make PWAs installable - Progressive web apps (PWAs)
start_url: the index document to launch when starting the app.
... when the user visits the pwa with a supporting mobile browser, it should display a notification (such as a banner or dialog box) indicating that it's possible to install the app as a pwa.
... when confirmed, the app will be installed on the home screen.
... splash screen in some browsers, a splash screen is also generated from the information in the manifest, which is shown when the pwa is launched and while it's being loaded started up.
Progressive web apps (PWAs)
but instead of relying only on user actions, we can do more, using push messages and notifications to automatically re-engage and deliver new content whenever it is available.introduction to progressive web appsthis article provides an introduction to progressive web apps (pwas), discussing what they are and the advantages they offer over regular web apps.making pwas work offline with service workersin this article we took a simple look at how you can make your pwa work offline with service workers.
... is built that way, and what benefits it brings.pwa developer guidein the articles listed here, you'll find guides about every aspect of development specific to the greation of progressive web applications (pwas).structural overview of progressive web appsin this structural overview, we'll look at the features that make up a standard web application, as well as some design patterns you can follow when building your pwa.
... introduction to progressive web apps progressive web app structure making pwas work offline with service workers how to make pwas installable how to make pwas re-engageable using notifications and push progressive loading technology guides client-side storage — a lengthy guide showing how and when to use web storage, indexeddb, and service workers.
... mobile first — often when creating responsive application layouts, it makes sense to create the mobile layout as the default, and build wider layouts on top.
gradientUnits - SVG: Scalable Vector Graphics
value userspaceonuse | objectboundingbox default value objectboundingbox animatable yes userspaceonuse this value indicates that the attributes represent values in the coordinate system that results from taking the current user coordinate system in place at the time when the gradient element is referenced (i.e., the user coordinate system for the element referencing the gradient element via a fill or stroke property) and then applying the transform specified by attribute gradienttransform.
...when the object's bounding box is not square, the gradient normal which is initially perpendicular to the gradient vector within object bounding box space may render non-perpendicular relative to the gradient vector in user space.
... value userspaceonuse | objectboundingbox default value objectboundingbox animatable yes userspaceonuse cx, cy, r, fx, fy, and fr represent values in the coordinate system that results from taking the current user coordinate system in place at the time when the gradient element is referenced (i.e., the user coordinate system for the element referencing the gradient element via a fill or stroke property) and then applying the transform specified by attribute gradienttransform.
...when the object's bounding box is not square, the rings that are conceptually circular within object bounding box space will render as elliptical due to application of the non-uniform scaling transformation from bounding box space to user space.
Mixed content - Web security
when a user visits a page served over https, their connection with the web server is encrypted with tls and is therefore safeguarded from most sniffers and man-in-the-middle attacks.
... passive content list this section lists all types of http requests which are considered passive content: <img> (src attribute) <audio> (src attribute) <video> (src attribute) <object> subresources (when an <object> performs http requests) mixed active content mixed active content is content that has access to all or parts of the document object model of the https page.
...the webpage may have public data visible to the world or private data visible only when authenticated.
... warnings in web console the firefox web console displays a mixed content warning message in the net pane when a page on your website has this issue.
How to turn off form autocompletion - Web security
this means that the criterion can be passed (by adding the relevant autocomplete attributes to individual form fields) even when autocompletion for the form itself has been turned off.
...when form data is cached in session history, the information filled in by the user is shown in the case where the user has submitted the form and clicked the back button to go back to the original form page.
... the autocomplete attribute and login fields modern browsers implement integrated password management: when the user enters a username and password for a site, the browser offers to remember it for the user.
... when the user visits the site again, the browser autofills the login fields with the stored values.
Transport Layer Security - Web security
this article provides an overview of tls and the kinds of decisions you need to make when securing your content.
... history when https was introduced, it was based on secure sockets layer (ssl) 2.0, a technology introduced by netscape.
...some web servers use renegotiation to either ensure that client certificates are encrypted, or to request client certificates only when certain resources are requested.
... from version 74 onwards, firefox will return a secure connection failed error when connecting to servers using the older tls versions (bug 1606734).
Compiling a New C/C++ Module to WebAssembly - WebAssembly
when you’ve written a new code module in a language like c/c++, you can compile it into webassembly using a tool like emscripten.
...there are a number of options available when compiling with emscripten, but the main two scenarios we'll cover are: compiling to wasm and creating html to run our code in, plus all the javascript "glue" code needed to run the wasm in the web environment.
...allocation, memory leaks, and a host of other problems calling a custom function defined in c if you have a function defined in your c code that you want to call as needed from javascript, you can do this using the emscripten ccall() function, and the emscripten_keepalive declaration (which adds your functions to the exported functions list (see why do functions in my c/c++ source code vanish when i compile to javascript, and/or i get no functions to process?)).
...(note that we need to compile with no_exit_runtime, which is necessary as otherwise when main() exits the runtime would be shut down — necessary for proper c emulation, e.g., atexits are called — and it wouldn't be valid to call compiled code.) emcc -o hello3.html hello3.c -o3 -s wasm=1 --shell-file html_template/shell_minimal.html -s no_exit_runtime=1 -s "extra_exported_runtime_methods=['ccall']" if you load the example in your browser again, you'll see the same thing ...
Communicating With Other Scripts - Archive of obsolete content
here "main.js" creates a page-mod that attaches "listen.js" to the web page: var data = require("sdk/self").data; var pagemod = require("sdk/page-mod"); pagemod.pagemod({ include: "http://my-domain.org/talk.html", contentscriptfile: data.url("listen.js") }); the web page "talk.html" embeds a script that uses window.postmessage() to send the content script a message when the user clicks a button: <!doctype html> <html> <head></head> <body> <script> function sendmessage() { window.postmessage("message from page script", "http://my-domain.org/"); } </script> <button onclick="sendmessage()">send message</button> </body> </html> finally, the content script "listen.js" uses window.addeventlistener() to listen for messages from ...
...t, "main.js" will create a page-mod that will attach "content-script.js" to the target web page, and will then load the target web page: var tabs = require("sdk/tabs"); var mod = require("sdk/page-mod"); var self = require("sdk/self"); var pageurl = self.data.url("page.html") var pagemod = mod.pagemod({ include: pageurl, contentscriptfile: self.data.url("content-script.js"), contentscriptwhen: "ready" }) tabs.open(pageurl); the target web page "page.html" includes a button and a page script: <html> <head> <meta charset="utf-8"> </head> <body> <input id="message" 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 se...
...also, there's no need to clone the message when using custom dom events in this direction.
port - Archive of obsolete content
the button sends the content script a message called "get-first-para" when it is clicked: // main.js pageworker = require("sdk/page-worker").page({ contentscriptfile: require("sdk/self").data.url("listener.js"), contenturl: "http://en.wikipedia.org/wiki/chalk" }); require("sdk/ui/button/action").actionbutton({ id: "get-first-para", label: "get-first-para", icon: "./icon-16.png", onclick: function() { console.log("sending 'get-first-para'"); pagewo...
...when it receives this message, the script logs the first paragraph of the document and then calls removelistener() to stop listening.
...when messages are sent their payloads are automatically serialized, and when messages are received their payloads are automatically deserialized, so you don't need to worry about serialization.
Working with Events - Archive of obsolete content
this is a function which will be called whenever the event occurs.
... for example: the actionbutton object emits an event when the button is clicked.
...); tabs.removelistener("ready", listener1); } function listener2() { console.log("listener 2"); } tabs.on("ready", listener1); tabs.on("ready", listener2); tabs.open("https://www.mozilla.org"); tabs.open("https://www.mozilla.org"); we should see output like this: info: tabevents: listener 1 info: tabevents: listener 2 info: tabevents: listener 2 listeners will be removed automatically when the add-on is unloaded.
hotkeys - Archive of obsolete content
usage to define a hotkey combination, create a hotkey object, passing it the combination and a function to be called when the user presses that combination.
... globals constructors hotkey(options) creates a hotkey whose onpress listener method is invoked when key combination defined by hotkey is pressed.
... onpress function function that is invoked when the key combination hotkey is pressed.
passwords - Archive of obsolete content
you don't supply this value when storing an add-on credential: it is automatically generated for you.
... oncomplete is called when the operation has completed successfully and onerror is called when the function encounters an error.
... the options parameter may also include oncomplete and onerror callback functions, which are called when the function has completed successfully and when it encounters an error, respectively.
request - Archive of obsolete content
oncomplete function this function will be called when the request has received a response (or in terms of xhr, when readystate == 4).
... when the server completes the request, the request object emits a "complete" event.
... properties url headers content contenttype response events complete the request object emits this event when the request has completed and a response has been received.
ui/frame - Archive of obsolete content
messages logged from a frame script using the console will not appear in the terminal when you run the add-on using jpm run.
... events attach this event is emitted whenever a new frame instance is constructed and the browser has started to load its document: for example, when the user opens a new browser window, if that window has a toolbar containing this frame.
... detach this event is emitted when a frame instance is unloaded: for example, when the user closes a browser window, if that window has a toolbar containing this frame.
cfx - Archive of obsolete content
--profile-memory=profilememory if this option is given and profilememory is any non-zero integer, then cfx dumps detailed memory usage information to the console when the tests finish.
...you can also embed arguments in the xpi using the --static-args option: if you do this the arguments will be passed to your add-on whenever it is run.
...when used with the xpi command, the json is packaged with the xpi's harness options and will therefore be used whenever the program in the xpi is run.
console - Archive of obsolete content
especially when debug logging shows up in a production environment, the noise can make it harder, not easier, to debug issues.
... when you run your add-on using jpm run (without --profile set) or jpm test, the global extensions.sdk.console.loglevel preference is automatically set to "info".
... when you install an add-on into firefox, the logging level will be "error" by default (that is, unless you have set one of the two preferences).
Chrome Authority - Archive of obsolete content
the object returned by require("chrome"), when unpacked with the destructuring assignment feature available in the mozilla js environment, will provide the usual components.* aliases: cc an alias for components.classes.
... when the manifest implementation is complete the runtime loader will actually prevent modules from require()ing modules that are not listed in the manifest.
... for example, none of the following code will be matched by the manifest scanner, leading to exceptions at runtime, when the require() call is prohibited from importing the named modules: // all of these will fail!
Getting Started (jpm) - Archive of obsolete content
for example, in ubuntu: jpm run -b /usr/bin/firefox when firefox launches, in the top-right corner of the browser you'll see an icon with the firefox logo.
... packaging the add-on when you've finished the add-on and are ready to distribute it, you'll need to package it as an xpi file.
... summary in this tutorial we've built and packaged an add-on using three commands: jpm init to initialize an empty add-on template jpm run to run a new instance of firefox with the add-on installed, so we can try it out jpm xpi to package the add-on into an xpi file for distribution these are the three main commands you'll use when developing sdk add-ons.
Tutorials - Archive of obsolete content
listen for page load use the tabs module to get notified when new web pages are loaded, and access their content.
... modify web pages modify web pages based on url create filters for web pages based on their url: whenever a web page whose url matches the filter is loaded, execute a specified script in it.
... listen for load and unload get notifications when your add-on is loaded or unloaded by firefox, and pass arguments into your add-on from the command line.
Dialogs and Prompts - Archive of obsolete content
describing dialog windows dialogs in mozilla whenever you want to create a dialog in your application, use <dialog> (instead of usual <window>) as root element in the xul file.
... be sure to use ondialog* attributes on dialog element instead of putting oncommand on the button with dlgtype, because button's oncommand is executed only when the button is pressed, and ondialog* handlers are executed for keyboard and other events too.
...ntent/mydialog.js"/> <grid> <columns><column/><column/></columns> <rows> <row align="center"><label value="name:"/><textbox id="name"/></row> <row align="center"><label value="description:"/><textbox id="description"/></row> <row align="center"><spacer/><checkbox id="enabled" label="check to enable"/></row> </rows> </grid> </dialog> mydialog.js: // called once when the dialog displays function onload() { // use the arguments passed to us by the caller document.getelementbyid("name").value = window.arguments[0].inn.name; document.getelementbyid("description").value = window.arguments[0].inn.description; document.getelementbyid("enabled").checked = window.arguments[0].inn.enabled; } // called once if and only if the user clicks ok function onok() { ...
Toolbar - Archive of obsolete content
adding a toolbar button there are two tutorials available: an elaborate step by step tutorial for beginners: custom toolbar button a tutorial describing the steps needed to add a toolbar button assuming you already have a working extension and know the basics of extension development: creating toolbar buttons adding button by default when you create and deploy your extension and include a toolbar button for it by overlaying the customize toolbarpalette, it is not available by default.
... notes insert your button by default only once, at first run, or when an extension update adds a new button.
...these elements have special behaviors when placed next to eachother, and will break if separated by another element.
Appendix E: DOM Building and Insertion (HTML & XUL) - Archive of obsolete content
heck'}], ['html:label', {for:'mycheck'}, 'here is text of label, click this text will check the box' ] ] ] ]; document.body.appendchild(jsontodom(json, document, {})); jquery templating for extensions which already use jquery, it is possible to use its builtin dom building functions for templating, though care must be taken when passing non-static strings to methods such as .append() and .html().
...when using the jquery constructor, only empty tags should be specified in order to avoid invoking the dom parser.
...in these cases, multiple attributes should be used, one for each variable: function clickify(elem, address) { elem.setattribute("href", address); elem.setattribute("onclick", "openwindow(this.getattribute('href'))"); } escaping functions when the code fragment in question is not an event handler attribute and there is no feasible way to pass the data through other means, they must be escaped with functions such as uneval, string.quote, json.stringify, or number.
Mozilla Documentation Roadmap - Archive of obsolete content
mdc should be your first stop when looking for documentation.
...problems using irc include: finding help when you have a big timezone difference with the united states, and no records of previously asked questions and their answers.
...also, remember to give credit when it's due.
MozOrientation - Archive of obsolete content
warning: this experimental api was removed in gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3), when support for the standard deviceorientationevent was implemented.
...the value is -1 when the device is undergoing standard earth gravity (9.8m/sec2) but not moving.
... in weightlessness, all values would be zero when the device is not moving, regardless of orientation, and would only change when being accelerated.
JXON - Archive of obsolete content
extra javascript translations this is the same as the json translation, but with these extras: property names are only escaped when necessary <root><while>true</while><wend>false</wend><only-if/></root> becomes { "while": true, wend: false, "only-if": null } within a string, closing elements "</" are escaped as "<\/" <root><![cdata[<script>alert("yes");</script>]]></root> becomes { script: "<script>alert(\"yes\")<\/script>" } dates are created as new date objects <root>2006-12-25</roo...
... the choice of using a true value instead of a null value to represent empty nodes is due to the fact that when in an xml document there is an empty node the reason is often to express a boolean, as in this case: <car> <type>ferrari</type> <bought /> </car> if the value were null it would be more cumbersome to launch a code like this: if (myobject.car.bought) { // do something } note: according to our third algorithm and our fourth algorithm, just cdatasection nodes which contain nothing but wh...
... an important consideration is that, when using the third or the fourth algorithm, an xml document can be used to create any type of javascript object.
Defining Cross-Browser Tooltips - Archive of obsolete content
the classic example is a "tooltip" of an image; when the user pauses the mouse pointer over an image, the contents of the alt attribute are displayed as a "tooltip." gecko-based browsers such as mozilla, netscape 6+, and compuserve 7 do not support this behavior.
... in other words, alt text should only be displayed when a user agent cannot display the primary content of the element (e.g., a text-mode browser that cannot display images).
...for instance, visual browsers frequently display the title as a "tool tip" (a short message that appears when the pointing device pauses over an object).
MCD, Mission Control Desktop, AKA AutoConfig - Archive of obsolete content
hence, when working on multiuser workstations, each user gets automatically thunderbird configured for his profile.
...aultpref("mail.smtp.defaultserver", "smtp1" ); defaultpref("mail.smtpservers", "smtp1" ); // close the try, and call the catch() } catch(e) { displayerror("lockedpref", e); } test autoconfig debug to check that our autoconfig works fine, we just set to env variable to check the read of thunderbird.cfg file: $ export nspr_log_modules=mcd:5 $ export nspr_log_file=/tmp/thunderbird-log.txt when thunderbird has started, you should read: $ cat /tmp/thunderbird-log.txt -1209403040[808a788]: general.config.filename = thunderbird.cfg -1209403040[808a788]: evaluating .cfg file thunderbird.cfg with obscurevalue 0 clean then, to be sure to start with a fresh thunderbird account, don't do this if you already have one and want to preserve your emails and preferences!
...unfortunately file system writes and/or mail format differs between windows and unix, and folders soon become unreadable or even corrupted when read/written from one system to the other.
Enabling the behavior - retrieving tinderbox status - Archive of obsolete content
to make it work we have to add javascript code that changes its status when the tinderbox status changes.
...we use new to create a new instance of it, set the instance's onload property to updatetinderboxstatus(), the function we want to execute when the document finishes loading, call its open method with the type of http request we want to make and the url of the document to retrieve, and then call its send method to send the request.
... xmlhttprequest will retrieve the document located at the given url and call the updatetinderboxstatus() function when it is done.
Making it into a static overlay - Archive of obsolete content
a xul overlay is a xul file containing elements to be inserted into another xul file when the other xul file is rendered into an application interface.
...dynamic overlays also make it possible to modify a xul file without actually changing the code of the file itself, which is necessary when installing an extension like ours.
...when navigator.xul is rendering into the browser's application interface, this causes any attributes or child elements of the statusbar element in the overlay file to be added to the interface's dom and thus show up in the interface as if they were defined on the same element in navigator.xul.
Dehydra Object Reference - Archive of obsolete content
dehydra only sets boolean flags when they are true.
...applicable when accessing member variables or nonstatic member functions of aggregate types, e.g.
...note that when constructing the return value of a function (e.g.
Developing New Mozilla Features - Archive of obsolete content
and you'll miss the early discussion phase when you can add your perspective to the design work.
... if you’ve got a large patch, let the likely reviewers know when they might expect to see it if your timeframe is tight, check out the mozilla roadmap for milestone dates and see if your feature will arrive at a time of furious activity.
...we’ve opted to spend the time improving code consistency before check-in when the pain is limited to the developers and the reviewers rather than everyone in the tree.
Drag and drop events - Archive of obsolete content
firefox 3 adds two new events that allow you to determine when drag operations begin and end.
... drag sent when a drag operation begins.
... dragend sent when a drag operation ends.
JavaScript crypto - Archive of obsolete content
two smart card related events are generated: smartcard-insert when smartcards are inserted, and smartcard-remove when smartcards are removed.
... turning this flag on will illuminate a large number of password prompts for your token when looking up certs in communicator.
... note: this function provides a convenient way to erase the ssl session state at the browser level, but in order to really guarantee that the state is erased, it is more secure to do it on the server side whenever possible.
First run - Archive of obsolete content
jetpack lets you specify arbitrary content that will be shown to your users when they install your jetpack.
...first-run page when users install your jetpack, they will be greeted with a new page notifying them that installation was successful.
... it's the same manifest you use when defining settings for your jetpack.
First Run - Archive of obsolete content
jetpack lets you specify arbitrary content that will be shown to your users when they install your jetpack.
...first-run page when users install your jetpack, they will be greeted with a new page notifying them that installation was successful.
...it's the same manifest you use when defining settings for your jetpack.
Microsummary XML grammar reference - Archive of obsolete content
when a generator is examined to determine whether or not it is able to summarize a page, the regular expressions provided by the child elements are evaluated against the url of the page.
... notes: regardless of the absolute or conditional update interval specified by this element, firefox will never update microsummaries more frequently than once per minute; because firefox checks for expired microsummaries every 15 seconds, it is possible for a microsummary update to begin up to 15 seconds later than its interval indicates; firefox respects the browser cache when updating microsummaries, so it will not reload a page to update its microsummary if the cache contains a fresh copy of the page.
... the <condition> element the optional <condition> element specifies an xpath boolean expression along with a conditional interval of time, in minutes, that must elapse between updates if the expression evaluates to true when evaluated against the page being summarized.
Nanojit - Archive of obsolete content
figuring out how to compile it is left as an exercise for the reader; the following works when run in the object directory of an --enable-debug spidermonkey shell: g++ -ddebug -g3 -wno-invalid-offsetof -fno-rtti -include js-confdefs.h -i dist/include/ -i..
... guards guards are special lir instructions, similar to conditional branches, with the difference that when they are called, instead of going to a particular address, they leave the jit code entirely, and stop the trace.
...certain assumptions are made when a particular jit code is generated.
Bundles - Archive of obsolete content
the bundle can hold additional resources currently limited to: application ini settings application icon script for the application chrome, not the web content installing a bundle when prism opens a webapp bundle it will unpack it into the webapps/{webapp-id} folder.
...when prism is launched with a "-webapp [bundle]" command line, the bundle must first be unpacked before the web application is launched.
...the extension looks for <link> tags in the webpage that point to a webapp bundle: <link rel="webapp" href="prismdemo.webapp" title="prism demo"> when the extension finds such a <link> tag, it will notify the user.
HostWindow - Archive of obsolete content
when not displayed the entire location bar section is hidden.
...when the sidebar is displayed, the splitter can be used to change the width or quickly collapse it.
...when not displayed the entire sidebar area, including the splitter are hidden.
Reading textual data - Archive of obsolete content
you can fallback to the default character encoding stored in preferences (intl.charset.default, a localized pref value) when reading from a file, the question is harder to answer.
...siconverterinputstream); is.init(fis, charset, 1024, replacementchar); now you can read string from is: var str = {}; var numchars = is.readstring(4096, str); if (numchars != 0 /* eof */) var read_string = str.value; to read the entire stream and do something with the data: var str = {}; while (is.readstring(4096, str) != 0) { processdata(str.value); } don't forget to close the stream when you're done with it (is.close()).
... if you do not want any replacement, you can specify 0x0000 as replacement character; that way, readstring will throw an exception when reaching unsupported bytes.
Remote debugging - Archive of obsolete content
when a bug is reproducible by a community member, but not on a developer's computer, a last-resort strategy is to debug it on the community member's computer.
...when firefox crashes, a core will be placed in /cores.
...when transferring a mac or linux core dump, you'll also have to transfer the firefox executable (and maybe more).
Space Manager Detailed Design - Archive of obsolete content
it is meant to be called only when the layout module is being terminated.
...there are several cases it has to handle, as specified in the source file comments: // when comparing a rect to a band there are seven cases to consider.
... algorithm 3: removeregion when a float is removed, the space manager is notified by a call to removeregion,passing in the frame that is being removed.
Space Manager High Level Design - Archive of obsolete content
when elements are floated to the left or right in a layout, they take up space and influence where other elements can be placed.
...when a float is incrementally reflowed, the space manager is notified if the float's region has changed.
...when done with the child, restore the space managers coordinates by translating by the negative of the child block's origin.
Creating XPI Installer Modules - Archive of obsolete content
these archives are redundant with the subdirectories: mozilla now installs both the compressed and uncompressed versions of the ui, though you can change this when you build mozilla yourself.
...when your package includes its own theme, localization packs, or other components it's convenient (but not necessary to create a subdirectory structure that reflects the role of the different parts.
...the archive, named barley.xpi, should contain the following two files: barley.jar install.js this zip file, when opened from mozilla using file -> open, will initialize its own installation and display a message like the following: when you click ok, mozilla installs the new package.
XPJS Components Proposal - Archive of obsolete content
when a xpjs component module is first installed - or at autoregistration time - the xpjsmanager will load the .js file into a fresh js environment, let its top level script run to do whatever initialization it wants to do, and then it will call the module's nsregisterself function (passing the filespec of the .js file).
...in c if a module gets unloaded when there are still references to objects created by the module then a crash is likely to happen soon after.
... so when will it be ready?
sizemode - Archive of obsolete content
note: when a window is minimized, the sizemode attribute is not updated.
...listen to the sizemodechange event dispatched to the dom window to get notified when the window state changes.
... issues with this attribute (at least on firefox 3): sizemode is only updated when the value of the persist attribute on the root element (such as <window>) contains sizemode.
toolbarbutton.title - Archive of obsolete content
« xul reference home title type: string this functionality only applies when toolbarbutton is used in the customize toolbar dialog.
... the text that is displayed as a button's label when it's in the customize toolbar palette.
... this does not affect the button's label when it is in a toolbar, which remains determined by the label attribute.
Dynamically modifying XUL-based user interface - Archive of obsolete content
each xul window has its own distinct document, and there may even be a few different documents in a single window, when there is an <iframe>, <browser>, or a <tabbrowser> element.
...(read more about this in working with windows in chrome code.) when your script is included using a <script> tag, the document property references the dom document that includes the script.
...widgets defined in xbl may choose to define some content which is inserted to the bound element, when the binding is attached.
Extensions - Archive of obsolete content
an extension may modify the context menu to show additional items that either appear always, or appear only when certain content is selected.
...in this example, the thumbnailsshowhideitems function will be called when the popup is about to be shown.
...for instance, the 'onlink' property is set to true when a link was context-clicked.
Additional Navigation - Archive of obsolete content
the others won't be able to match when evaluating the triple.
...he data network after only the member has been evaluated: (?start = http://www.xulplanet.com/rdf/myphotos, ?photo = http://www.xulplanet.com/ndeakin/images/t/palace.jpg) (?start = http://www.xulplanet.com/rdf/myphotos, ?photo = http://www.xulplanet.com/ndeakin/images/t/canal.jpg) (?start = http://www.xulplanet.com/rdf/myphotos, ?photo = http://www.xulplanet.com/ndeakin/images/t/obselisk.jpg) when evaluating the triple, the template builder will iterate over the three potential results found so far.
...another thing that you cannot have is a triple where both variables would be unknown as in the following: <query> <content uri="?start"/> <member container="?start" child="?photo"/> <triple subject="?category" predicate="http://purl.org/dc/elements/1.1/title" object="?title"/> </query> in this case when the template builder gets to the triple, neither the ?category nor the ?title variables can be filled in so the builder doesn't know what to generate.
Additional Template Attributes - Archive of obsolete content
this isn't particularly useful although there is a very slight optimization since the builder does not need to scan the action body looking for the member variable when compiling the queries and rules.
... you might also use these attributes just to make the code clearer when using very complex queries.
... one possible advantage is when using the simple rdf query syntax where you don't specify variables; instead you use the special 'rdf:*' syntax for the member variable and the container is implied.
Building Hierarchical Trees - Archive of obsolete content
when the user opens the tree row, the next level of rows are generated from the template and displayed in the tree.
... similarly, when the user closes a tree row, the rows inside it are removed, such that they will have to be generated again the next time the row is opened.
...when the user opens the row, the template will be re-examined for results using the photo as the starting point instead of the top level ref value.
Adding Style Sheets - Archive of obsolete content
changing the styles however, there will be times when the default look of elements will not give the look that is desired.
...an example would be when a script changes the style, or where a difference in layout might change the meaning of the element.
...it is always a good idea to be as precise as possible when specifying what gets styled.
Advanced Rules - Archive of obsolete content
rule conditions when a tree, menu or other element with a datasource generates content, the template builder first finds the resource referred to by the ref attribute.
...when it gets to the triple, it will look for an assertion in the rdf datasource for a city's weather prediction.
...the difference is that a binding is not examined when attempting to check the conditions.
Box Objects - Archive of obsolete content
when an element is hidden, it is removed from the display and the layout objects are removed for it.
...unlike with navigating the dom tree, hidden elements are not included when navigating by box objects.
...example 3 : source view <hbox> <button label="button 1" oncommand="alert('next is: ' + this.boxobject.nextsibling.label);"/> <button label="button 2" hidden="true"/> <button label="button 3" oncommand="alert('next is: ' + this.boxobject.nextsibling.label);"/> <button label="button 4" collapsed="true"/> </hbox> box ordering attributes when a xul box is laid out on a window, the elements are ordered according to a number of properties, for instance the orientation, their ordinal group and their direction.
Creating a Skin - Archive of obsolete content
when you have lots of buttons, with states for hover, active and disabled, this saves space that would normally be occupied by mutliple images.
...the last rule applies to buttons when the mouse is hovering over them.
...when changing the global skin, you would need to merge the changes into the existing rules.
Creating an Installer - Archive of obsolete content
this function takes two arguments, the first is a list of packages to install, and the second is a callback function which will be called when the installation is complete.
... here is an example: function donefn ( name , result ){ alert("the package " + name + " was installed with a result of " + result); } var xpi = new object(); xpi["calendar"] = "calendar.xpi"; installtrigger.install(xpi,donefn); first, we define a callback function donefn() which will be called when the install is complete.
... when this section of script is executed, the file calendar.xpi will be installed.
Features of a Window - Archive of obsolete content
for example: var mywin = window.open("chrome://findfile/content/findfile.xul", "findfile", "chrome"); specifying the width and height you should have noticed that whenever elements were added to a window, the window's width expanded to fit the new elements.
...you have to be careful when specifying a width and height that the window is not too small or too big.
... centerscreen the window will be centered on the screen when it is opened.
List Controls - Archive of obsolete content
when the user selects an item in the list, the entire row is selected.
...the second, menupopup, creates the popup window which appears when the button is clicked.
...when one is selected, it appears as the choice in the menulist.
More Button Features - Archive of obsolete content
note that the two attributes are not specified when the default value can be used.
...you probably wouldn't use this very often, but you might use it when creating custom elements.
...button with menupopup you can place a menupopup inside the button to cause a menu to drop down when the button is pressed, much like the menulist.
Open and Save Dialogs - Archive of obsolete content
when the dialog is closed, you can use the interface functions to get the file that was selected.
... the first is the default directory that is displayed when the dialog is opened.
...(returnok will be returned when the user entered the name of a new file.) you should check the return value and then get the file object from the file picker using the file property.
Progress Meters - Archive of obsolete content
you typically see it when downloading files or when performing a lengthy operation.
... determinate progress meters are used when you know the length of time that an operation will take.
... indeterminate progress meters are used when you do not know the length of time of an operation.
Simple Menu Bars - Archive of obsolete content
menupopup the popup box that appears when you click on the menu title.
...you should keep this is mind when creating menus.
...it will pop up when the user clicks on the parent menu title.
Tree Selection - Archive of obsolete content
handling the select event first, let's see how we can determine when an item is selected.
...when the user selects an item from the tree, the event handler is called.
...the view doesn't need to implement this object itself, the tree will assign a selection object to the view's selection property when the view is attached to a tree.
Trees and Templates - Archive of obsolete content
adding datasources to trees when using a tree, you will often use a template to build its content, to handle a large amount of hierarchial data.
...xul knows how to add child elements when the templates or rules contain tree elements or menu elements.
...an interesting part of rdf datasources is that the resource values are only determined when the data is needed.
Using Visual Studio as your XUL IDE - Archive of obsolete content
compared to a simple text-editor, visual studio gives you some special features when writing xul: intellisense / autocompletion for elements and attributes validation syntax coloring (okay, more sophisticated editors like notepad++ provide this as well) before you can use all of this, you have to adjust visual studio a little.
...make sure that visual studio is not running, when you do this.
...5.3 javascript related you will get validation errors for javascript code whenever using the keywords "const" and "let".
Using nsIXULAppInfo - Archive of obsolete content
this is not useful for scripts on webpages, which should continue using the navigator object when it's not possible to rely on feature-detection.
... note: nsixulappinfo provides information about the application and the platform, be careful to use the right one, especially when dealing with xulrunner-based applications.
...be careful to use the information you need, especially when dealing with xulrunner-based applications.
XUL controls - Archive of obsolete content
unlike with the 'menu' type, a separate action may be performed when the main part of the button is pressed.
... progressmeter reference <radio> a radio button is used when only one of a set of options may be selected at a time.
...unlike with the 'menu' type, a separate action may be performed when the main part of the button is pressed.
broadcaster - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] a broadcaster is used when you want multiple elements to share one or more attribute values, or when you want elements to respond to a state change.
...an onbroadcast event will be sent to the observers when a change is made.
... for menuitems or buttons that just want to have their disabled status set when the feature should be disabled, you should use a command element instead.
description - Archive of obsolete content
attributes crop, disabled, tabindex value properties accessibletype, crop, disabled, tabindex, value style classes header, indent, monospace, plain, small-margin examples this is a long section of text that will word wrap when displayed <description> this is a long section of text that will word wrap when displayed.
...for example, for a menuitem in a menu you can add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled type: boolean indicates whether the element is disabled or not.
...the tab order is the order in which the focus is moved when the user presses the "tab" key.
label - Archive of obsolete content
ArchiveMozillaXULlabel
when the user clicks on the label, the associated element is given focus.
...for example, for a menuitem in a menu you can add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled type: boolean indicates whether the element is disabled or not.
... href type: string defines a url to open when this element is clicked.
listcell - Archive of obsolete content
for example, for a menuitem in a menu you can add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled type: boolean indicates whether the element is disabled or not.
...note that both an image and a label are added when this style is set.
... the label will take up extra space even when no label text is set.
listitem - Archive of obsolete content
for example, for a menuitem in a menu you can add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } current type: boolean this attribute will be set to true if the listitem is the current item.
...this attribute only has any effect when used inside a prefwindow.
...the tab order is the order in which the focus is moved when the user presses the "tab" key.
radiogroup - Archive of obsolete content
this attribute only has any effect when used inside a prefwindow.
...the tab order is the order in which the focus is moved when the user presses the "tab" key.
...the listbox, richlistbox, radiogroup, etc., not the list item that was selected) when it is changed either via this property, the selectedindex property, or changed by the user.
treecol - Archive of obsolete content
for example, for a menuitem in a menu you can add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } cycler type: boolean if true, then the column is a cycler column.
... editable type: boolean allows the contents of cells in the column to be changed, especially useful when type="checkbox".
... when the user double-clicks an editable cell, a text field appears in which the user can edit the contents of the cell.
Building XULRunner with Python - Archive of obsolete content
it doesn't need to be installed for the build but will be useful later when installing python packages which look for entries in the windows' registry.
... def onload(): btntest = document.getelementbyid("btntest") btntest.addeventlistener('command', ontest, false) def ontest(): window.alert('button activated') window.addeventlistener('load', onload, false) one possible gotcha is that the default python path used to find modules that areimported explicitly includes the xulrunner executable directory and the directory that is current when xulrunner launches.
...a zombie will keep old code open and cause confusion when you make changes and run xulrunner again.
CommandLine - Archive of obsolete content
handling command line arguments with xulrunner for multiple instances application it's fairly easy to retrieve application specific command line arguments in xulrunner when it's not a single instance application.
... alocation); var catman = components.classes["@mozilla.org/categorymanager;1"] .getservice(nsicategorymanager); catman.deletecategoryentry("command-line-handler", cld_category); }, canunload : function (acompmgr) { return true; } }; function nsgetmodule(acompmgr, afilespec) { return apphandlermodule; } create an observer that will get notified when arguments change: chrome/content/cmdline.js function commandlineobserver() { this.register(); } commandlineobserver.prototype = { observe: function(asubject, atopic, adata) { var cmdline = asubject.queryinterface(components.interfaces.nsicommandline); var test = cmdline.handleflagwithparam("test", false); alert("test = " + test); }, register: function() { var observer...
...anged", false); }, unregister: function() { var observerservice = components.classes["@mozilla.org/observer-service;1"] .getservice(components.interfaces.nsiobserverservice); observerservice.removeobserver(this, "commandline-args-changed"); } } var observer = new commandlineobserver(); // because we haven't yet registered a commandlineobserver when the application is // launched the first time, we simulate a notification here.
application/http-index-format specification - Archive of obsolete content
this data should be presented to the user when they are viewing data drawn from the file.
...this data should be presented to the user when they are viewing data drawn from the file.
... filename the name of file that can be used to retrieve the file when combined with the full path provided by the 300 line.
Gecko Compatibility Handbook - Archive of obsolete content
use consistent case when writing html id and class name attributes and css styles for those ids and classes.
... many problems can occur when a web page uses browser detection to determine which proprietary features to use for a particular browser.
...unfortunately, this is invalid html and can cause problems both when parsing the page and when applying the css styles.
2006-10-26 - Archive of obsolete content
gavin replies that "[t]he log file shows a "no space left on device" error when trying to link the final executable." learn the traffic magic of search engine cloaking mark describes the magic of search engine cloaker.
... (what it is, how to use it) cross-post-and followup fx2 announcment to support-firefox request for when the announcement about firefox 2's release to be posted on the mozilla.dev.apps.firefox newsgroup.
... bug in firefox when import passwords from seamonkey a possible bug find - perhaps a version error instead?
2006-10-27 - Archive of obsolete content
gavin replies that "[t]he log file shows a "no space left on device" error when trying to link the final executable." learn the traffic magic of search engine cloaking mark describes the magic of search engine cloaker.
... (what it is, how to use it) cross-post-and followup fx2 announcment to support-firefox request for when the announcement about firefox 2's release to be posted on the mozilla.dev.apps.firefox newsgroup.
... bug in firefox when import passwords from seamonkey a possible bug find - perhaps a version error instead?
2006-10-27 - Archive of obsolete content
gavin responded to tony's posting saying that the log file shows a "no space left on device" error when trying to link the final executable.
...onfigure --prefix=/export/home/alex/thunderbird --enable-application=browser --disable-tests --disable-debug -disable-auto-deps --disable-freetype2 -enable-official-branding --enable-default-toolkit=gtk2 --enable-optimize=-xo5 --enable-static --disable-shared --enable-xft --enable-svg the build tools that he used to build firefox 2 are listed in his posting along with the error that he receives when he tries to build it.
...click here to view the errorthat he receives when trying to update-packaging.
NPN_GetURL - Archive of obsolete content
safest target, even though, when used with a mailto or news url, this creates an extra blank the browser instance.
...when the plug-in instance is part of a regular browser window, and it uses a _blank target with a mailto or news url, another blank window is opened along with the mail or news window.
... when the plug-in uses a _self target, no other instance is created; the plug-in usually continues to operate successfully in its own window.
NPWindow - Archive of obsolete content
clipping to the cliprect prevents the plug-in from overwriting the status bar, scroll bars, and other page elements when partially scrolled off the screen.
...(the drawable is provided in a graphicsexpose event, when the paint is requested.) description the npwindow structure represents the native window or a drawable, and contains information about coordinate position, size, whether the plug-in is windowed or windowless, and some platform-specific information.
... the browser calls npp_setvalue whenever the drawable changes.
NPAPI plugin reference - Archive of obsolete content
npn_invalidaterect invalidates the specified portion of the plugin's drawing area, adding it to the region that needs to be redrawn when the plugin next repaints its contents.
...this can be used to handle variations in different browsers (or versions thereof) when implementing your plug-in.
... npp_setwindow tells the plug-in when a window is created, moved, sized, or destroyed.
The First Install Problem - Archive of obsolete content
problem definition the first install problem is the name given to the conditions arising when a plugin or embeddable software installs itself on a system first, before any other gecko-based browser.
...(note that the file name must still begin with "np", just as it must when the file is loaded from the .\plugins directory.) example: [hkey_local_machine\software\mozillaplugins\@mycompany.com/myapplication,version=5.01] path=c:\mycompany\myapplication\netscape\npmyapp.dll "xptpath" -- string value -- absolute path to xpt module required for scripting plug-in, if applicable example: [hkey_local_machine\software\mozillaplugins...
...the same mimetype description that apears when you type "about:plugins" as a url in mozilla's location bar.
XEmbed Extension for Mozilla Plugins - Archive of obsolete content
also, when included with builds of mozilla that are based on gtk 1.2 or gtk 2.x, the xt code that hosts the plugins is at best hacky and has been the source for many minor problems including inconsistent focus behavior as well as occasional crashes.
...key differences all of the interfaces that you would normally expect to exist in the plugins will still exist when using xembed plugins.
...however, before you do so you should make sure that the browser also supports xembed when the plugin is first initialized.
Plugins - Archive of obsolete content
site author guide for click-to-activate plugins these guidelines will help website authors use plugins when they are blocked by default with the firefox click-to-activate feature.
...this can be useful when trying to determine if a plug-in is consuming too many resources.
... plugins: the first install problem the first install problem is the name given to the conditions arising when a plugin or embeddable software installs itself on a system first, before any other gecko-based browser.
Settings - Archive of obsolete content
pause on exceptions when this option is enabled, execution of the script will automatically pause whenever a javascript exception is thrown.
...you don't generally want to pause execution when an exception that is thrown is caught, since that generally indicates that your program is handling it properly.
... show panes on startup when this option is enabled, the debugger's variables pane is visible when you first start the debugger.
Using IO Timeout And Interrupt On NT - Archive of obsolete content
when a thread calls an io function, the thread issues an overlapped io request using the overlapped buffer in its <tt>prthread</tt> structure.
...a possible solution is to add a <tt>pr_disableinterrupt()</tt> function to turn off interrupts when accessing such file descriptors.
...when we stop supporting nt 3.51, we can look into using nt 4's <tt>cancelio()</tt> function to cancel outstanding overlapped io requests when we get io timeout or interrupt errors.
Using SSH to connect to CVS - Archive of obsolete content
if you don't already run ssh-agent on your computer, it's probably easiest to start it up whenever you set up your environment to checkout and build mozilla.
...since it's important that you kill the agent when you're finished with it, the last three lines start a child environment that, when exited, will result in the agent's process being killed.
... mozillabuild if you're using mozillabuild, ssh-agent should be started when you run the start-msvc???.bat file.
Developing cross-browser and cross-platform pages - Archive of obsolete content
an important practice when doing cross-browser, cross-platform pages and dhtml development involves the ability to determine the capabilities of the browser which loads your web page.
... // bad sample if (navigator.appversion.charat(0) == "8") { if (navigator.appname == "netscape") { isns8 = true; alert("netscape 8"); }; } else if (navigator.appversion.indexof("msie") != -1) { isie = true; alert("internet explorer"); }; while this kind of checking in the above code can work in a crude sense, sharp readers may wonder what happens when internet explorer 8 is released or when an opera 8.x user visits the page or even when an user with any non-netscape browser starting with a "8" character in the appversion string visits that page.
... using object/feature support detection approach: best and overall most reliable when you use object/feature support detection, you only implement those features whose support you have first tested and verified on the visiting browser.
-ms-content-zoom-chaining - Archive of obsolete content
the -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.
...a bounce effect is shown when the user hits a zoom limit during page manipulation.
... chained the nearest zoomable parent element begins zooming when the user hits a zoom limit during page manipulation.
-ms-scroll-translation - Archive of obsolete content
initial valuenoneapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete syntax values vertical-to-horizontal vertical to horizontal translation, as described in remarks, will take place when appropriate.
... if your javascript is listening for scroll wheel document object model (dom) events, the events that occur when the user scrolls vertically will always be vertical scroll events, not horizontal scroll events.
... similarly, the events that occur when the user scrolls horizontally will always be horizontal scroll events.
The global XML object - Archive of obsolete content
this property tells e4x to ignore comment nodes when serializing and filtering.
...this property tells e4x to ignore processing instructions in xml when serializing and filtering.
...when true, toxmlstring() includes newlines and indenting for the serialization of e4x objects.
Generator comprehensions - Archive of obsolete content
when the input to the comprehension is itself a small array the overhead involved is insignificant — but when the input is a large array or an expensive (or indeed infinite) generator the creation of a new array can be problematic.
...ld create a full array in memory containing the doubled values: var doubles = [for (i in it) i * 2]; a generator comprehension on the other hand would create a new iterator which would create doubled values on demand as they were needed: var it2 = (for (i in it) i * 2); console.log(it2.next()); // the first value from it, doubled console.log(it2.next()); // the second value from it, doubled when a generator comprehension is used as the argument to a function, the parentheses used for the function call means that the outer parentheses can be omitted: var result = dosomething(for (i in it) i * 2); the significant difference between the two examples being that by using the generator comprehension, you would only have to loop over the 'obj' structure once, total, as opposed to once when c...
...omprehending the array, and again when iterating through it.
GetObject - Archive of obsolete content
for example: var cadobject; cadobject = getobject("c:\\cad\\schema.cad"); when this code is executed, the application associated with the specified pathname is started, and the object in the specified file is activated.
...for example: myobject.line(9, 90); myobject.inserttext(9, 100, "hello, world."); myobject.saveas("c:\\drawings\\sample.drw"); note: use the getobject function when there is a current instance of the object, or if you want to create the object with a file already loaded.
...with a single-instance object, getobject always returns the same instance when called with the zero-length string ("") syntax, and it causes an error if the pathname argument is omitted.
Building up a basic demo with Three.js - Game development
when creating new objects in the demo, we add them all inside the scene to become visible on the screen.
...to initialize it, we have to set its field of view and aspect ratio: the former is used to set how much is seen, and the latter is important for the objects on the screen to have the right proportions when rendered, and not look stretched.
...what might happen when you add a torus, wrapped in the phong material?
Async scripts for asm.js - Game development
in gecko, async compilation allows the javascript engine to compile the asm.js off the main thread when the game is loading and cache the generated machine code so that the game doesn't need to be compiled on subsequent loads (starting in firefox 28).
... putting async into action getting async compilation is easy: when writing your javascript, just use the async attribute like so: <script async src="file.js"></script> or, to do the same thing via script: var script = document.createelement('script'); script.src = "file.js"; document.body.appendchild(script); (scripts created from script default to async.) the default html shell emscripten generates produces the latter.
... when is async not async?
Unconventional controls - Game development
when everything is installed and the controller is connected to your computer we can proceed with implementing support in our little demo.
...when those variables are up-to-date, we can use them in the draw() function to move the ship: function draw() { ctx.clearrect(0, 0, canvas.width, canvas.height); // ...
...the last value is grabstrength, which is a float between 0 and 1 — when reaching 1 (fist fully clenched), we show an alert for now (in a full game this could be replaced with the shooting logic.) that's it — everything you needed for a working leap motion example in javascript is here already.
Bounce off the walls - Game development
we have another problem however — when the ball hits each wall it sinks into it slightly before changing direction: this is because we're calculating the collision point of the wall and the center of the ball, while we should be doing it for its circumference.
... the ball should bounce right after if touches the wall, not when it's already halfway in the wall, so let's adjust our statements a bit to include that.
... update the last code you added to this: if(x + dx > canvas.width-ballradius || x + dx < ballradius) { dx = -dx; } if(y + dy > canvas.height-ballradius || y + dy < ballradius) { dy = -dy; } when the distance between the center of the ball and the edge of the wall is exactly the same as the radius of the ball, it will change the movement direction.
Finishing up - Game development
we can also reset the ball and the paddle positions when the player begins with their next life.
...(interval); // needed for chrome to end game with this, we can add slightly more complex logic to it as given below: lives--; if(!lives) { alert("game over"); document.location.reload(); clearinterval(interval); // needed for chrome to end game } else { x = canvas.width/2; y = canvas.height-30; dx = 2; dy = -2; paddlex = (canvas.width-paddlewidth)/2; } now, when the ball hits the bottom edge of the screen, we're subtracting one life from the lives variable.
...it will sync the framerate accordingly and render the shapes only when needed.
Player paddle and controls - Game development
this works, but not quite as we expected it to — when the ball hits the paddle, the paddle falls off the screen!
...we can set the body of the paddle to be immovable, so it won't move when the ball hits it.
...add the following new line to the update() function, as shown: function update() { game.physics.arcade.collide(ball, paddle); paddle.x = game.input.x; } now on every new frame the paddle's x position will adjust accordingly to the input's x position, however when we start the game, the position of the paddle is not in the middle.
Control flow - MDN Web Docs Glossary: Definitions of Web-related terms
parts of a script may also be set to execute when events occur.
... for example, the above excerpt might be inside a function that runs when the user clicks the submit button for the form.
... control flow means that when you read a script, you must not only read from start to finish but also look at program structure and how it affects order of execution.
Delta - MDN Web Docs Glossary: Definitions of Web-related terms
the term delta is commonly used when communicating changes in speed, position, or acceleration of a physical or virtual object.
... it's also used when describing changes in the volume or frequency of sound waves.
... for example, when describing how far an object on the screen moves left-to-right, one might use the term delta x or Δx.
First contentful paint - MDN Web Docs Glossary: Definitions of Web-related terms
first contentful paint (fcp) is when the browser renders the first bit of content from the dom, providing the first feedback to the user that the page is actually loading.
... the question "is it happening?" is "yes" when the first contentful paint completes.
... the first contentful paint time stamp is when the browser first rendered any text, image (including background images), non-white canvas or svg.
First input delay - MDN Web Docs Glossary: Definitions of Web-related terms
first input delay (fid) measures the time from when a user first interacts with your site (i.e.
... when they click a link, tap on a button, or use a custom, javascript-powered control) to the time when the browser is actually able to respond to that interaction.
... the time between when content is painted to the page and when all the functionality becomes responsive to human interaction often varies based on the the size and complexity of the javascript needing to be downloaded, parsed, and executed on the main thread, and on the device speed or lack thereof (think low end mobile devices).
Grid Lines - MDN Web Docs Glossary: Definitions of Web-related terms
grid lines are created when you define tracks in the explicit grid using css grid layout.
... lines are also created in the implicit grid when implicit tracks are created to hold content positioned outside of the explicit grid, however these lines cannot be addressed by a number.
...when placing an item, you can then use these names instead of the line number, as demonstrated below.
IDL - MDN Web Docs Glossary: Definitions of Web-related terms
the content attribute is always a string even when the expected value should be an integer.
...the idl attribute is always going to use (but might transform) the underlying content attribute to return a value when you get it and is going to save something in the content attribute when you set it.
...when using idl attributes, you read or set values of the desired type, so input.maxlength is always going to return a number and when you set input.maxlength ,it wants a number.
Prefetch - MDN Web Docs Glossary: Definitions of Web-related terms
prefetching is when content is downloaded in the background, this is based on the assumption that the content will likely be requested, enabling the content to load instantly if and when the user requests it.
...they are most relevant when there are a plethora of links to external websites that may be clicked on, like search engine results, dns prefetching resolves domain names in advance thereby speeding up load times by reducing the time associated with domain lookup at request time.
... the prefetch hints are sent in http headers: link: ; rel=dns-prefetch, ; as=script; rel=preload, ; rel=prerender, ; as=style; rel=preload prefetch attribute value browsers will prefetch content when the prefetch <link> tag directs it to, giving the developer control over what resources should be prefetched.
Speculative parsing - MDN Web Docs Glossary: Definitions of Web-related terms
the upside is that when a speculation succeeds, there's no need to reparse the part of the incoming file that was already scanned for scripts, style sheets and images.
... the downside is that there's more work lost when the speculation fails.
... avoiding losing tree builder output speculative tree building fails when document.write() changes the tree builder state such that the speculative state after the </script> tag no longer holds when all the content inserted by document.write() has been parsed.
Accessible multimedia - Learn web development
note that we also check to see if the currenttime is more than the total media duration, or if the media is not playing, when the fwd button is pressed.
... if either conditions are true, we simply stop the video, to avoid the user interface going wrong if they attempt to fast forward when the video is not playing, or fast forward past the end of the video.
...for example, some users may not be able to hear the audio because they are in noisy environments (like a crowded bar when a sports game is being shown) or might not want to disturb others if they are in a quiet place (like a library.) this is not a new concept — television services have had closed captioning available for quite a long time: whereas many countries offer english films with subtitles written in their own native languages, and different language subtitles are often available on dvds, for example ...
Type, class, and ID selectors - Learn web development
target an element if it has more than one class applied you can apply multiple classes to an element and target them individually, or only select the element when all of the classes in the selector are present.
... this can be helpful when building up components that can be combined in different ways on your site.
...the grey border is applied when the box has a class of notebox.
CSS building blocks - Learn web development
css selectors there are a wide variety of css selectors available, allowing for fine-grained precision when selecting elements to style.
...overflow is what happens when there is too much content to be contained comfortably inside a box.
... debugging css sometimes when writing css you will encounter an issue where your css doesn't seem to be doing what you expect.
Positioning - Learn web development
introducing z-index all this absolute positioning is good fun, but there is another thing we haven't considered yet — when elements start to overlap, what determines which elements appear on top of which other elements?
...what about when we have more than one?
...when we add position: sticky to the <dt> element, along with a top value of 0, supporting browsers will stick the headings to the top of the viewport as they reach that position.
How CSS is structured - Learn web development
the implementation of an inline style in an html document might look like this: <!doctype html> <html> <head> <meta charset="utf-8"> <title>my css experiment</title> </head> <body> <h1 style="color: blue;background-color: yellow;border: 1px solid black;">hello world!</h1> <p style="color:red;">this is my first css example</p> </body> </html> avoid using css in this way when possible.
...inside the folder, copy the text below to create two files: index.html: <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>my css experiments</title> <link rel="stylesheet" href="styles.css"> </head> <body> <p>create your test html here</p> </body> </html> styles.css: /* create your test css here */ p { color: red; } when you find css that you want to experiment with, replace the html <body> contents with some html to style, and then add your test css code to your css file.
... when a property is paired with a value, this pairing is called a css declaration.
What is CSS? - Learn web development
browsers are the main type of user agent we think of when talking about css, however, it is not the only one.
...the individual property pages on mdn give you a quick way to look up properties and their values when you forget, or want to know what else you can use as a value.
...alternatively, you should get used to searching for "mdn css-feature-name" in your favourite search engine whenever you need to find out more information about a css feature.
Web fonts - Learn web development
when you find each font, press on the download button, and save the file inside the same directory as the html and css files you saved earlier.
... when you've chosen the font families, press the [number] families selected bar at the bottom of the page.
... url('fonts/cicle_fina-webfont.woff2') format('woff2'), url('fonts/cicle_fina-webfont.woff') format('woff'), url('fonts/cicle_fina-webfont.ttf') format('truetype'), url('fonts/cicle_fina-webfont.svg#ciclefina') format('svg'); font-weight: normal; font-style: normal; } this is referred to as "bulletproof @font-face syntax", after a post by paul irish from early on when @font-face started to get popular (bulletproof @font-face syntax).
What do common web layouts contain? - Learn web development
when designing pages for your website, it's good to have an idea of the most common layouts.
...(even many desktop-users prefer viewing things in small windows rather than full-screen.) the real fun begins when you start mixing them all together: … these are just examples and you're quite free to lay things out as you want.
...remember that word "float"--it will ring a bell when you start learning about css.
What is a URL? - Learn web development
note: when specifying urls to load resources as part of a page (such as when using the <script>, <audio>, <img>, <video>, and the like), you should generally only use http and https urls, with few exceptions (one notable one being data:; see data urls).
...you don't need to include the protocol (the browser uses http by default) or the port (which is only required when the targeted web server is using some unusual port), but all the other parts of the url are necessary.
... when a url is used within a document, such as in an html page, things are a bit different.
What is a Domain Name? - Learn web development
the registrar will let you know when the domain name is properly registered.
... whenever your registrar creates or updates any information for a given domain, the information must be refreshed in every dns database.
... as we already saw, when you want to display a webpage in your browser it's easier to type a domain name than an ip address.
What is a web server? - Learn web development
at the most basic level, whenever a browser needs a file that is hosted on a web server, the browser requests the file via http.
... when the request reaches the correct (hardware) web server, the (software) http server accepts the request, finds the requested document, and sends it back to the browser, also through http.
... when requesting a file via http, clients must provide the file's url.
What software do I need to build a website? - Learn web development
in this article we lay out which software components you need when you're editing, uploading, or viewing a website.
...inux vi (all unix) gedit (gnome) kate (kde) leafpad (xfce) emacs vim visual studio code brackets shiftedit sublime text chrome os shiftedit here is a screenshot of an advanced text editor: here is a screenshot of an online text editor: uploading files on the web when your website is ready for public viewing, you'll have to upload your webpages to your web server.
...there are dozens of browser options for your personal use, but when you're developing a website you should test it at least with the following major browsers, to make sure your site works for most people: mozilla firefox google chrome microsoft internet explorer apple safari if you're targeting a specific group (e.g., technical platform or country), you may have to test the site with additional browsers, like opera, konqueror, or uc browser.
Sending forms through JavaScript - Learn web development
a form is not always a form with progressive web apps, single page apps, and framework based apps, it's common to use html forms to send data without loading a new document when response data is received.
...when the user tries to send the data, the application takes control and transmits the data asynchronously in the background, updating only the parts of the ui that require changes.
...ddeventlistener( 'load', function () { // these variables are used to store the form data const text = document.getelementbyid( "thetext" ); const file = { dom : document.getelementbyid( "thefile" ), binary : null }; // use the filereader api to access file content const reader = new filereader(); // because filereader is asynchronous, store its // result when it finishes to read the file reader.addeventlistener( "load", function () { file.binary = reader.result; } ); // at page load, if a file is already selected, read it.
Test your skills: Advanced styling - Learn web development
can you add some kind of styling back in so that users can tell when the search box is being hovered or focused?
... next, give the radio buttons a reasonable base style — the style they have when the page first loads.
... now give the radio buttons a different style for when they are selected.
CSS basics - Learn web development
img[src] selects <img src="myimage.png"> but not <img> pseudo-class selector the specified element(s), but only when in the specified state.
... (for example, when a cursor hovers over a link.) a:hover selects <a>, but only when the mouse pointer is hovering over the link.
... margin: 0 auto; when you set two values on a property like margin or padding, the first value affects the element's top and bottom side (setting it to 0 in this case); the second value affects the left and right side.
Add a hitmap on top of an image - Learn web development
image maps, and their drawbacks when you nest an image inside <a>, the entire image links to one webpage.
... the image must make it clear what happens when people follow image links.
...alt text only displays when the image is unavailable.
Image gallery - Learn web development
attach an onclick handler to each <img> inside the thumb-bar <div> so that when they are clicked, the corresponding image is displayed in the displayed-img <img> element.
... attach an onclick handler to the <button> so that when it is clicked, a darken effect is applied to the full-size image.
... when it is clicked again, the darken effect is removed again.
Test your skills: Events - Learn web development
events 1 in our first events-related task, you need to create a simple event handler that causes the text inside the button (btn) to change when it is clicked on, and change back when it is clicked again.
...to pass this assessment you need to build an event handler that moves the circle around the provided canvas when the wasd keys are pressed on the keyboard.
...</div>), which when invoked by clicking any of the buttons will set the background of the button-bar to the color contained in the button's data-color attribute.
Client-side web APIs - Learn web development
when writing client-side javascript for web sites or applications, you will quickly encounter application programming interfaces (apis).
... manipulating documents when writing web pages and apps, one of the most common things you'll want to do is manipulate web documents in some way.
... client-side storage modern web browsers feature a number of different technologies that allow you to store data related to web sites and retrieve it when necessary allowing you to persist data long term, save sites offline, and more.
Adding features to our bouncing balls demo - Learn web development
setcontrols() this method will add an onkeydown event listener to the window object so that when certain keyboard keys are pressed, we can move the evil circle around.
... the following code block should be put inside the method definition: let _this = this; window.onkeydown = function(e) { if (e.key === 'a') { _this.x -= _this.velx; } else if (e.key === 'd') { _this.x += _this.velx; } else if (e.key === 'w') { _this.y -= _this.vely; } else if (e.key === 's') { _this.y += _this.vely; } } so when a key is pressed, the event object's keycode property is consulted to see which key is pressed.
... in the inner if statement, you no longer want to make the objects change color when a collision is detected — instead, you want to set any balls that collide with the evil circle to not exist any more (again, how do you think you'd do that?).
CSS performance optimization - Learn web development
tell the browser when the style sheet should be applied by adding a media attribute with the media query.
... when the browser sees a style sheet it knows that it only needs to apply it for a specific scenario, it still downloads the stylesheet, but doesn't render block.
...when an element is promoted as a layer, also known as composited, animating transform properties is done in the gpu, resulting in improved performance, especially on mobile.
Server-side web frameworks - Learn web development
these allow you to specify the structure of an output document, using placeholders for data that will be added when a page is generated.
...{{ variable_name }}), which will be replaced by values passed in from the view function when a page is rendered.
...opinionated frameworks tend to be more productive when you're trying to solve common problems, because they lead you in the right direction, however they are sometimes less flexible.
Ember Interactivity: Footer functionality, conditional rendering - Learn web development
eplace this line: <strong>0</strong> todos left with this, which populates the incomplete number with the length of the incomplete array: <strong>{{this.todos.incomplete.length}}</strong> todos left next, replace this: <button type="button" class="clear-completed"> with this: <button type="button" class="clear-completed" {{on 'click' this.todos.clearcompleted}}> so now when the button is clicked, the clearcompleted() action we added earlier is run.
...the "todos left" indicator always says "x todos left", even when there is only one todo left, which is bad grammar!
... get todocountisone() { return this.incomplete.length === 1; } then go back over to footer.hbs and update the previous template section we edited to the following: <strong>{{this.todos.incomplete.length}}</strong> {{#if this.todos.todocountisone}} todo {{else}} todos {{/if}} left now save and test, and you'll see the correct pluralization used when you only have one todo item present!
Starting our Svelte Todo list app - Learn web development
ing content: <h1>svelte to-do list</h1> change the title element in public/index.html to contain the text svelte to-do list: <title>svelte to-do list</title> open src/app.svelte and replace its contents with the following: <script> import todos from './components/todos.svelte' </script> <todos /> in development mode, svelte will issue a warning in the browser console when specifying a prop that doesn't exist in the component; in this case we have a name prop being specified when we instantiate the app component inside src/main.js, which isn't used inside app.
... when the task is being edited, the list item has an input and two button to cancel or save modifications.
...being a compiler, svelte can statically analyze our html templates to provide accessibility warnings when components are being compiled.
Creating our first Vue component - Learn web development
vue templates are currently only allowed a single root element — one element needs to wrap everything inside the template section (this will change when vue 3 comes out).
...this means that when no done prop is passed to a todoitem component, the done prop will will have a value of false (bear in mind that this is not required — we only need default on non-required props).
... see a warning along these lines in the console: [vue warn]: missing required prop: "label" found in ---> <todoitem> at src/components/todoitem.vue <app> at src/app.vue <root> this is because we marked the label as a required prop, but we never gave the component that prop — we've defined where inside the template we want it used, but we haven't passed it into the component when calling it.
Accessibility/LiveRegionDevGuide
the text offsets associated with a text changed event are used when supporting this property.
...when atomic is set to "false", the start index and end index/run length are used as given.
...when atomic is set to "true", the entire region should be presented.
Adding a new event
this method is basically used for duplicating an internal event class instance of a dom event when the dom event is stored by content.
... when you create a dom event class, its name should be same as the name defined in its standard specification.
... when you need to check if the caller content or chrome, you can use implicitjscontext attribute in dom/bindings/bindings.conf.
Adding phishing protection data providers
phishing protection technology lets firefox help protect users by comparing the urls the user visits to a list of known scam sites, and presenting a warning to the user when they visit a site on the list.
...when installing a new provider, you should use the next unused number.
... optional preferences browser.safebrowsing.provider.idnum.reporturl an url used for reporting when users visit phishing pages and whether or not they decided to heed the warning or to ignore it.
Debugging JavaScript
web console this is the first place to go when you're debugging a web page; open the web console using the web console option in the web developer menu.
... 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 fire...
...in debug builds this also dumps a stack trace to the console, even when the debugger is not running.
Debugging OpenGL
opengl debug mode when running a debug build, you can enable the opengl debug mode by defining the environment variable moz_gl_debug.
...this makes debugging crashes caused by an opengl call much easier, since the stack you see will match where the call was issued, rather than some time in the future when it happens to run and crash.
... if an opengl error occurred when executing the call, an error message is output.
HTTP logging
when the problem has been reproduced, exit firefox and look for the generated log files, which you can find at /tmp/log.txt.
... when you specify rotate, on every start all the files (including any previous non-rotated log file) are deleted to avoid any mixture of information.
...this is a useful tool when you want to peek at http traffic.
Debugging
also available are assorted tools that you can use when debugging.
... debugging a minidump windows crash reports include a minidump, which contains a lot of information about the application when it crashed.
... nserror lookup useful for when your code gets a complicated numeric error code and you can't figure out what it means.
ESLint
this automatic linting can happen either while coding, in a code editor, or when using the command line.
... setting up eslint ./mach eslint --setup running eslint eslint can be run via: ./mach lint -l eslint you can limit running it to a specific directory with: ./mach lint -l eslint browser/components or work directory changes: ./mach lint -l eslint -w or outgoing commits only: ./mach lint -l eslint -o see ./mach eslint --help for more options when running eslint.
... for example: in windows 10, if you have installed node.js on "c:\nodejs", then the command should look like: export path=$path:/c/nodejs enabling eslint for a new directory remove the directory from .eslintignore (in the base directory of the repository) fix errors that occur when running ./mach eslint path/to/dir, see also the no-undef rules below.
Multiple Firefox profiles
when the properties dialog box pops up, you should see a "target" text field that you can edit, and it should show the current file path.
... now whenever you double click that icon, the profile manager should appear, allowing you to choose which profile you'd like to use.
... when the properties dialog box pops up, you should see a "target" text field that you can edit, and it should show the current file path.
Frame script environment
events besides the regular dom events being captured/bubbling up from content the current content object the following additional events get fired in a frame script environment: unload fires when the frame script environment is shut down, i.e.
... when a tab gets closed.
... domwindowcreated fires when a new content object is created.
Message manager overview
process scripts are most likely to be useful when an extension wants to run some code only once in the content process, to access some global service: for example, to register an observer or a content policy.
... frame message managers in multiprocess firefox, when chrome code needs to interact with web content, it needs to: factor the code that needs direct access to content into separate scripts, which are called "frame scripts" use a frame message manager to load these frame scripts into the content process use the frame message manager api to communicate with the frame script some older articles on multiprocess firefox and the message manager might refer to "content scripts" instead of "frame scripts".
... communicate with frame scripts using message-passing apis there are various types of frame message managers, as depicted in this diagram: this diagram shows the setup when there are 2 browser windows open, one with 2 tabs open and one with 1 tab open.
Process scripts
when you need to run code in the content process in order to access web content, then you should use frame scripts.
...if you do, you must call removedelayedprocessscript() when your extension is disabled or removed the message-passing apis are the same: sendasyncmessage() is available in both directions, while sendsyncmessage() is available from content to chrome only process scripts are system-privileged, and have access to the components object.
... retrieving the content frame message manager for a content window when an observer notification in a process script contains a content document or window it can be useful to not use talk through the child/parent process message managers but through the window's content frame message manager, e.g.
Message manager overview
process scripts are most likely to be useful when chrome code wants to run some code only once in the content process, to access some global service: for example, to register an observer or a content policy.
... frame message managers in multiprocess firefox, when chrome code needs to interact with web content, it needs to: factor the code that needs direct access to content into separate scripts, which are called "frame scripts" use a frame message manager to load these frame scripts into the content process use the frame message manager api to communicate with the frame script some older articles on multiprocess firefox and the message manager might refer to "content scripts" instead of "frame scripts", but this usage is deprecated because the add-on sdk uses "content script" to refer to a similar but different kind of script.
...since javascript modules are singletons they will only be executed once per process even when they are loaded in multiple frame scripts.
Firefox and the "about" protocol
all contributors to the firefox project about:debugging switches to the developer tools debugging page, which allows you to debug add-ons, tabs and service workers about:devtools summarizes the developer tools and provides links to documentation for each tool about:downloads displays all downloads done within firefox about:home start page of firefox when opening a new window about:license displays licensing information about:logo firefox logo about:memory provides a way to display memory usage, save it as report and run the gc and cc about:mozilla special page showing a message from "the book of mozilla" about:networking displays networking information about:newtab start page...
... when opening a new tab about:performance displays memory and performance information about firefox subprocesses/add-ons/tabs about:plugins displays information about installed plugins about:policies lists out the firefox for enterprise policies about:preferences firefox settings (also available through firefox menu > options) about:privatebrowsing start page when opening a private window about:profiles display and manage firefox profiles about:protections privacy protections report consisting of enhanced tracking protection, firefox monitor and firefox lockwise data about:restartrequired a page users are sent to when firefox requires a restart due to an update about:reader indicates a w...
...o the sync feature about:telemetry displays telemetry data collected and sent to mozilla while firefox is running (in case the user enabled telemetry) about:url-classifier displays the status of the url classifier services that firefox uses (for example for safe browsing) about:webrtc information about webrtc usage about:welcome page first displayed when firefox is installed about:welcomeback information page displayed after firefox is reset these urls are defined in docshell/base/nsaboutredirector.cpp within the kredirmap array.
mozbrowserasyncscroll
the mozbrowserasyncscroll event is fired when the content of a browser <iframe> is scrolled.
...this indicates that the content is over-scrolled, which occurs when the page "rubber-bands" after being scrolled all the way to the bottom.
...that means that the value retrieved through the event object can be different than the real current position of the scroll when the event is processed.
mozbrowserloadend
the mozbrowserloadend event is fired when the browser <iframe> has finished loading all its assets, or has failed to load.
... this can be used when the embedder wants to stop spinning a loading indicator, or update the ui in some other way to indicate loading is complete.
...when the front page of https://developer.mozilla.org is loaded, for example, the e.detail.backgroundcolor value reported is rgb(0, 83, 159).
How to get a process dump with Windows Task Manager
introduction when tracking down the causes of process hangs, it is often helpful to obtain a process dump while the process is experiencing a hang.
...(to get a process dump for thunderbird or some other product, substitute the product name where ever you see firefox in these instructions.) caution the memory dump that will be created through this process is a complete snapshot of the state of firefox when you create the file, so it contains urls of active tabs, history information, and possibly even passwords depending on what you are doing when the snapshot is taken.
... it is advisable to create a new, blank profile to use when reproducing the hang and capturing the memory dump.
How to investigate Disconnect failures
an example of such a failure disconnect failures happens when one side is closing the connection and mozmill is unable to send the information over the bridge or when firefox crashes.
... usually disconnects happens when a modal dialog freezes and we cannot close it sp we close firefox with the modal frozen.
... check if firefox crashed: windows: [user]/appdata\roaming\mozilla\firefox\crash reports ubuntu: [user/home]/.mozilla/firefox/crash reports and there we can check by timestamp if firefox crashed when we had the disconnect.
PBackground
pbackground is a mechanism available since gecko 30 (see bug 956218) that builds on top of ipdl to provide a solution to common problems that arise when handling multiple threads in the chrome process, for example communication between workers and multiple child processes and other parent-process worker threads.
... when used at run time, every protocol has two actors — a parent and a child.
... for example, when we are uploading textures from the content process we don't need to go through the main thread of the parent process.
Infallible memory allocation
when instantiating objects, the new operator creates them infallibly by default.
... when in doubt, use the infallible allocator and don't null check.
...when using these, you must check to ensure the resulting value isn't null before attempting to use the returned memory.
JavaScript Tips
xul tips when inserting code with an xul overlay, wrap functions and variables inside an object with a unique name to avoid conflicting with existing or future function and variable names.
... when passing an object to an xpcom method it is helpful if the object you pass is an xpcom object, so that the c++ method access a c++ object.
...lass: var weakobserver = { queryinterface: function queryinterface(aiid) { if (aiid.equals(components.interfaces.nsiobserver) || aiid.equals(components.interfaces.nsisupportsweakreference) || aiid.equals(components.interfaces.nsisupports)) return this; throw components.results.ns_nointerface; }, observe: function observe(asubject, atopic, astate) { } } when declaring xpcom methods, try to use the same names for method parameters as are used in the interface definition.
Addon
operations are generally deferred when a restart is necessary to accomplish them.
...this is passed to window.opendialog() when presenting the about dialog.
...umber reviewcount read only integer reviewurl read only string totaldownloads read only integer weeklydownloads read only integer dailyusers read only integer repositorystatus read only integer callbacks datadirectorycallback() a callback which is passed a directory path, and, when an error has occured, an error object.
DownloadSummary
promise resolves to undefined when the view on the underlying list has been registered.
... promise resolves to undefined when the view has been registered and the onsummarychanged notification has been sent.
... promise resolves to undefined when the view has been removed.
Following the Android Toasts Tutorial from a JNI Perspective
when something is declared, we are stating the sig and the name.
... when declaring methods, the signatures of the types go right next to each other without any spacing.
...the go-to resource for learning about the api when writing scripts for fennec.
PerfMeasurement.jsm
note: these values are all zeroed (or set to -1, for events not being measured) when you initialize the perfmeasurement object, then they are not zeroed again unless you explicitly call the reset() method.
... variable type description eventsmeasured eventmask a bit mask of the event types recorded; this can differ from the events requested if the platform doesn't support all of the event types you specified when creating the perfmeasurement object.
...start() starts measuring the performance indicators that were specified when the perfmeasurement object was created.
Using JavaScript code modules
for example: components.utils.import("resource://app/my_module.jsm"); alert(foo()); // displays "foo" alert(bar.size + 3); // displays "6" alert(dummy); // displays "dummy is not defined" because 'dummy' was not exported from the module note: when you're testing changes to a code module, be sure to change the application's build id (e.g., the version) before your next test run; otherwise, you may find yourself running the previous version of your module's code.
... sharing objects using code modules an extremely important behavior of components.utils.import() is that modules are cached when loaded and subsequent imports do not reload a new version of the module, but instead use the previously cached version.
... this means that a given module will be shared when imported multiple times.
Application Translation with Mercurial
either translate a different product now or contact the person responsible for localization from the team's page (see above) so he can notify you by mail when the next strings for translation become available.
...install it into your default firefox profile (you will have more than one profile when following this guide).
...we also create a commit message which will describe the changes in the patch and later get used when the patched gets checked in ('added') to the official repository with the localized files.
Bootstrapping a new locale
when a localization team is registered and your hg repository is set up for a locale, you can then clone the existing mozilla release branch (i.e.
... this will familiarize you with our "hg" commands and will get us something that we can import easily when you are done.
... ../mozilla/configure --disable-compile-environment --enable-application=browser whenever you need a build directory, these are the steps that you need to do to initialize it.
Initial setup
they're not required for you to begin contributing, but will be required when you are preparing to produce an official release.
...use this bug template when filing your hg account registration bug.
...it will also notify us when you're having problems unique to your localization team's work.
Localization sign-off reviews
we look for these changes and file bugs when they're found in a new revision.
... access key changes we ensure that when access keys are changed that they are consistent with the keyboard layout for that particular locale and not blended between two or more distinct layouts.
...to put it simply, when we receive your request, we expect that you have spent time testing your work and making sure all strings have been localized and that your changes are relatively functional.
Localization technical reviews
to put it simply, when we receive your request, we expect that you have spent time testing your work and making sure all strings have been localized and that your language pack is relatively functional.
...when you update your localization for the next release, you'll need to put it through a different form of qa review called a sign-off review.
... visit the wiki page for sign-off reviews to learn what's involved when maintaining a localized mozilla product.
Localization formats
so, if a localizer wanted to use one of the many powerful gettext tools, like po-editor, the msgid provides no context for translation or for other localizers to verify translations when qa-ing.
...when english content is used as the value of the msgid, there is no need to place that content in a special repository.
... but, in the download day example, when changes were made to en-us, the web-developer had to push those changes to all the repositories of all the locales.
Mozilla Web Services Security Model
please do not depend on anything in it being correct for security.) to prevent the browser from being used as a tool for web sites to obtain priveleges that belong to the browser's user (such as being behind a firewall or getting the benefits of the user's cookies), web browsers restrict what web pages can do when accessing things in other domains.
...for example, when accessing a web service at http://www.example.com/dir1/dir2/service, if the access file at http://www.example.com/web-scripts-access.xml contains a delegate element, mozilla will instead use http://www.example.com/dir1/dir2/web...ipt-access.xml to determine whether access is permitted.
...rity"> <delegate/> <allow type="none"/> </webscriptaccess> and in the services directory: <webscriptaccess xmlns="http://www.mozilla.org/2002/soap/security"> <allow type="soapv"/> <allow type="soap"/> </webscriptaccess> good examples (needed.) references new security model for web services, the original proposal for the web-scripts-access.xml file format web services roadmap, documenting when web services features, including the security model, were first supported additional reading documentation of crossdomain.xml, a similar format used by macromedia flash player ...
Measuring performance using the PerfMeasurement.jsm code module
now we want to benchmark a function that is pretty fast (but not fast enough), so we run it several thousand times: for (let i = 0; i < 10000; i++) { set_up_some_state(); monitor.start(); code_to_be_benchmarked(); monitor.stop(); clean_up_afterward(); } we call the perfmeasurement object's start() method when we want to start recording, and stop() when we want to stop recording.
... when you're done benchmarking, you can read out each of the counters you asked for as properties: let report = "cpu cycles: " + monitor.cpu_cycles + "\n" + "cache refs: " + monitor.cache_references + "\n" + "cache misses: " + monitor.cache_misses + "\n"; monitor.reset(); alert(report); the reset() method clears all of the enabled counters, as you might expect.
... when you're done with your measurements, just let the monitor object go out of scope.
Profiling with Xperf
there seems to be a bug in xperf and symbols; it is very sensitive to when the symbol path is edited.
...also, when recording the stack, i've found that a heap trace is often missing module information (i believe this is a bug in xperf).
...in the viewer, when summary data is viewed for heap events (heap allocations outstanding, etc.
Refcount tracing and balancing
an object's serial number is simply a unique number, starting at one, that is assigned to the object when it is allocated.
...when this is set, along with xpcom_mem_log_classes and xpcom_mem_refcnt_log, a stack track will be generated for only the specific objects that you list.
...when it finds an object that got freed (it knows because its refcount goes to 0), it removes it from the list.
Productization guide
for example, a search provider can deliver a very good quality of search results — but only in a specific country or language, and we have to take this into account when considering default search engines for a locale.
...for example, we ship firefox with 6 or 7 search engine plug-ins to make users’ lives easier when they’re looking for information, translation, products, multimedia, spelling and definitions, etc.
... another example: when the user clicks on a mailto: link, we suggest a couple of possible handlers chosen from the applications installed on their computer.
Profile Manager
an individual profile can be linked to a specific installation of firefox, so that version of firefox will be launched when that profile is selected.
... when launched, profile manager will look in some default locations for installed versions of firefox (or other application you're using profile manager with).
... when you restore a profile, the backup is retained, so you can restore from the same backup at a later date.
L20n HTML Bindings
when all dom nodes are localized, the document element will fire a documentlocalized event, which you can listen to: document.addeventlistener('documentlocalized', function() { // the dom has been localized and the user sees it in their language yourapp.init(); }); exposing context data you can expose important bits of data to the localization context in form of context data.
... monolingual mode l20n can also operate in the so-called monolingual mode, when there is only one locale available.
... the monolingual mode may be useful when you first start a new project, when you want to test something quickly or when using server-side language negotiation.
Midas
when midas is enabled, the document becomes editable by the user.
...it is beneficial to be familiar with these objects when working with an editable document.
... inserthorizontalrule null/string (when string is the line's id) this command will insert a horizontal rule (line) at the insertion point.
PR_CWait
when the wait has finished, the thread regains control of the monitor's lock with the same entry count as before the wait began.
... the thread waiting on the monitor resumes execution when the monitor is notified (assuming the thread is the next in line to receive the notify) or when the interval specified in the timeout parameter has been exceeded.
... when the thread resumes execution, it is the caller's responsibility to test the state of the monitored data to determine the appropriate action.
PR_OpenSharedMemory
when parameter create is (pr_shm_excl | pr_shm_create) and the shared memory already exists, the function returns null with the error set to pr_file_exists_error.
... when parameter create is pr_shm_create and the shared memory already exists, a handle to that memory segment is returned.
... when parameter create is 0, and the shared memory exists, a pointer to a prsharedmemory structure is returned.
PR_Wait
when the wait is over, the thread regains control of the monitor's lock with the same entry count it had before the wait began.
... a thread waiting on the monitor resumes when the monitor is notified or when the timeout specified by the ticks parameter elapses.
...the thread should act on the data only when the expression is true.
NSS Certificate Download Specification
when nss's certificate decoder encounters one of these collections of multiple certificates they are handled in the following way: the first certificate is processed in a context specific manner, depending upon how it is being imported.
...when it is downloaded the user will be shown a sequence of dialogs that will guide them through the process of accepting the certificate authority and deciding if they wish to trust sites certified by the ca.
... object identifiers the base of all netscape object ids is: netscape object identifier ::= { 2 16 840 1 113730 } the hexadecimal byte value of this oid when der encoded is: 0x60, 0x86, 0x48, 0x01, 0x86, 0xf8, 0x42 the following oids are mentioned in this document: netscape-data-type object identifier :: = { netscape 2 } netscape-cert-sequence object identifier :: = { netscape-data-type 5 } ...
JSS FAQ
MozillaProjectsNSSJSSJSS FAQ
when will jss have jsse support?
... ssl_badcerthook sets a callback that is called when nss's routine fails to authenticate the certificate.
...when will jss have jsse support?
NSS 3.12.6 release notes
this value should only be used during the transition period when few servers have been upgraded.
... in ocsp.h cert_cacheocspresponsefromsidechannel: this function is intended for use when ocsp responses are provided via a side-channel, i.e.
... bug 542538: nss: add function for recording ocsp stapled replies bug 544191: use system zlib on mac os x bug 544584: segmentation fault when enumerating the nss database bug 544586: various nss-sys-init patches from fedora bug 545273: remove unused function sec_init bug 546389: nsssysinit binary built inside source tree documentation for a list of the primary nss documentation pages on mozilla.org, see nss documentation.
NSS 3.14.2 release notes
bug 816853 - when using libpkix for certificate validation, applications may now supply additional application-defined trust anchors to be used in addition to those from loaded security tokens, rather than as an alternative to.
... bug 373108 - fixed a bug where, under certain circumstances, when applications supplied invalid/out-of-bounds parameters for aes encryption, a double free may occur.
... bug 618418 - c_decrypt/c_decryptfinal now correctly validate the pkcs #7 padding when present.
NSS 3.15 release notes
new functions in ssl.h ssl_peerstapledocspresponse - returns the server's stapled ocsp response, when used with a tls client socket that negotiated the status_request extension.
... ssl_setstapledocspresponses - set's a stapled ocsp response for a tls server socket to return when clients send the status_request extension.
... new macros in ssl.h ssl_enable_ocsp_stapling - used with ssl_optionset to configure tls client sockets to request the certificate_status extension (eg: ocsp stapling) when set to pr_true notable changes in nss 3.15 secitem_reallocitem is now deprecated.
NSS 3.21 release notes
nssutil_mkmodulespecex - take a shared library string, module name string, module parameters string, nss specific parameters string, and nss configuration parameter string and returns a module string which the caller must free when it is done.
... ckm_tls_mac - computes tls finished mac in secoidt.h nss_use_alg_in_ssl_kx - policy flag indicating that keys are used in tls key exchange in sslerr.h ssl_error_rx_short_dtls_read - error code for failure to include a complete dtls record in a udp packet ssl_error_no_supported_signature_algorithm - error code for when no valid signature and hash algorithm is available ssl_error_unsupported_signature_algorithm - error code for when an unsupported signature and hash algorithm is configured ssl_error_missing_extended_master_secret - error code for when the extended master secret is missing after having been negotiated ssl_error_unexpected_extended_master_secret - error code for receiving an extended mast...
...er secret when previously not negotiated in sslt.h ssl_enable_extended_master_secret - configuration to enable the tls extended master secret extension (rfc 7627) ssl_preinfo_version - used with sslpreliminarychannelinfo to indicate that a tls version has been selected ssl_preinfo_cipher_suite - used with sslpreliminarychannelinfo to indicate that a tls cipher suite has been selected ssl_preinfo_all - used with sslpreliminarychannelinfo to indicate that all preliminary information has been set notable changes in nss 3.21 nss now builds with elliptic curve ciphers enabled by default (bug 1205688) nss now builds with warnings as errors (bug 1182667) the following ca certificates were removed cn = verisign class 4 public primary certification authority - g3 ...
NSS 3.24 release notes
to enable these checks, you must define symbol nss_force_fips when building nss.
...note: this approach is only useful when the arena use is tightly bounded, for example, if it is only used in a single function.
...to enable the functionality in optimized builds, you must define the symbol nss_allow_sslkeylogfile when building nss.
NSS 3.28 release notes
the tls 1.3 (draft) protocol can be enabled, by defining nss_enable_tls_1_3=1 when building nss.
... ssl_sendadditionalkeyshares configures a tls 1.3 client so that it generates additional key shares when sending a clienthello.
...nss will now only generate signatures with the combinations of hash and signature scheme that are defined in tls 1.3, even when negotiating tls 1.2.
NSS 3.38 release notes
when creating a certificate request (csr) using certutil -r, an existing orphan private key can be reused.
... when using certutil -o to print the chain for a given certificate nickname, the new parameter --simple-self-signed may be provided, which can avoid ambiguous output in some scenarios.
... when repeatedly importing the same certificate into an sql database, the existing nickname will be kept.
NSS 3.46 release notes
17006) bug 1542077 - mp_set_ulong and mp_set_int should return errors on bad values bug 1572791 - read out-of-bounds in der_decodetimechoice_util from sslexp_delegatecredential bug 1560593 - cleanup.sh script does not set error exit code for tests that "failed with core" bug 1566601 - add wycheproof test vectors for aes-kw bug 1571316 - curve25519_32.c:280: undefined reference to `pr_assert' when building nss 3.45 on armhf-linux bug 1516593 - client to generate new random during renegotiation bug 1563258 - fips.sh fails due to non-existent "resp" directories bug 1561598 - remove -wmaybe-uninitialized warning in pqg.c bug 1560806 - increase softoken password max size to 500 characters bug 1568776 - output paths relative to repository in nss coverity bug 1453408 - modutil -changepw fa...
...ils in fips mode if password is an empty string bug 1564727 - use a pss spki when possible for delegated credentials bug 1493916 - fix ppc64 inline assembler for clang bug 1561588 - remove -wmaybe-uninitialized warning in p7env.c bug 1561548 - remove -wmaybe-uninitialized warning in pkix_pl_ldapdefaultclient.c bug 1512605 - incorrect alert description after unencrypted finished msg bug 1564715 - read /proc/cpuinfo when at_hwcap2 returns 0 bug 1532194 - remove or fix -ddebug_$user from make builds bug 1565577 - visual studio's cl.exe -?
... hangs on windows x64 when building nss since changeset 9162c654d06915f0f15948fbf67d4103a229226f bug 1564875 - improve rebuilding with build.sh bug 1565243 - support tc_owner without email address in nss taskgraph bug 1563778 - increase maxruntime on mac taskcluster tools, ssl tests bug 1561591 - remove -wmaybe-uninitialized warning in tstclnt.c bug 1561587 - remove -wmaybe-uninitialized warning in lgattr.c bug 1561558 - remove -wmaybe-uninitialized warning in httpserv.c bug 1561556 - remove -wmaybe-uninitialized warning in tls13esni.c bug 1561332 - ec.c:28 warning: comparison of integers of different signs: 'int' and 'unsigned long' bug 1564714 - print certutil commands during setup bug 1565013 - hacl image builder times out while fetching gpg key bug 1563786 - update hacl-star doc...
NSS 3.53 release notes
notable changes in nss 3.53 when using the makefiles, nss can be built in parallel, speeding up those builds to more similar performance as the build.sh/ninja/gyp system.
...vsx vector instructions bug 1639033 - fix various compile warnings in nss bug 1640041 - fix a null pointer in security/nss/lib/ssl/sslencode.c:67 bug 1640042 - fix a null pointer in security/nss/lib/ssl/sslsock.c:4460 bug 1638289 - avoid multiple definitions of sha{256,384,512}_* symbols when linking libfreeblpriv3.so in firefox on ppc64le bug 1636389 - relocate deprecated seed algorithm bug 1637083 - lib/ckfw: no such file or directory.
... bug 1561331 - additional modular inverse test bug 1629553 - rework and cleanup gmake builds bug 1438431 - remove mkdepend and "depend" make target bug 290526 - support parallel building of nss when using the makefiles bug 1636206 - hacl* update after changes in libintvector.h bug 1636058 - fix building nss on debian s390x, mips64el, and riscv64 bug 1622033 - add option to build without seed this bugzilla query returns all the bugs fixed in nss 3.53: https://bugzilla.mozilla.org/buglist.cgi?resolution=fixed&classification=components&query_format=advanced&product=nss&target_milestone=3.53 compatibility nss 3.53 shared libraries are backward compatible with all older nss 3.x shared libraries.
NSS Developer Tutorial
try to stay consistent when you modify existing code.
...when modifying existing code, try to stay consistent.
... when a block of code consists of a single statement, nss doesn’t require curly braces, so both of these examples are fine: if (condition) { action(); } or: if (condition) action(); although the use of curly braces is more common.
nss tech note7
when the keys are no longer needed, they need to be destroyed.
...use pk11_freesymkey() to release a reference to a symmetric key (pk11symkey *); the symmetric key is destroyed when its reference count becomes zero.
...(this api pretty much consists of what was needed to implement ssl and s/mime, plus a few enhancements over the years to support jss.) when using the pk11_ interfaces, the same principal applies: use the highest available function.
Notes on TLS - SSL 3.0 Intolerant Servers
this is the main symptom of the problem when mozilla based browsers encounter tls/ssl 3.0 intolerant servers.
... netscape 6.1 or mozilla 0.9.2 and later these browsers shipped with the tls option on but also included a graceful rollback mechanism on the client side when they encounter known tls/ssl 3.0 intolerant servers.
... when you find a secure site which simply does not display any page content or drops the connection, check to see if the preference option edit | preferences | privacy and security | ssl | enable tls is turned on.
NSS tools : pk12util
-v enable debug logging when importing.
...pkcs12 v2 pbe with sha1 and 40 bit rc4 is the default for the overall package encryption when not in fips mode.
... when in fips mode, there is no package encryption.
NSS tools : pk12util
-v enable debug logging when importing.
...pkcs12 v2 pbe with sha1 and 40 bit rc4 is the default for the overall package encryption when not in fips mode.
... when in fips mode, there is no package encryption.
Necko Architecture
an nsistreamlistener is told when the uri transaction has "started," when data is available (in the case of reading data), and when it has "stopped." it is up to the nsistreamlistener implementation to decide what to do with these various notifications.
...if you initiate an asynchronous transfer, you receive callbacks that notify you when things are happening.
...when you receive the ondataavailable() callback, you are handed an nsiinputsteam which you can read the data from (you will more than likely need to be able to handle multiple ondataavailable() callbacks, buffering the data you receive as necessary).
Rhino history
when netscape stopped work on "javagator," as it was called, somehow rhino escaped the axe (rumor had it that the executives "forgot" it existed).
...this produced the best performance (often beating the c implementation of javascript when run on a jit), but suffered from two faults.
...compilation is faster and when scripts are no longer in use they can be collected like any other java object.
Rhino overview
string.prototype.split for version 1.2 only, split performs the perl4 special case when given a single space character as an argument (skips leading whitespace, and splits on whitespace).
... when javascript code attempts a restricted action, the security domain can be retrieved in the following manner.
...when the class was defined and loaded, the appropriate security domain was associated with it, and can be retrieved by calling this method.
Creating JavaScript jstest reftests
when importing test262, the test file's in-file metadata is translated from test262 format to a format readibly by the jstest harness.
...multiple calls to expectexitcode will tell the post-processing scripts that the test actually passed if any of the exit codes are found when the test terminates.
...to make the situation even more complex, newer c++ compilers will abort the browser with a typical exit code of 5 by throwing a c++ exception when an out of memory error occurs.
JS::CallArgs
this method must not be called when the function is being called as a constructor via new.
...whenever possible.
...then, when an eventual release making that change occurs, porting efforts will require changing methods' signatures but won't require invasive changes to the methods' implementations, potentially under time pressure.
JS::CompileOptions
to counter this attack, html5 specifies that script errors should be sanitized ("muted") when the script is not same-origin with the global for which it is loaded.
... canlazilyparse bool true if the source code can be parsed lazily (check only syntax for first time, and fully parse when it's really needed).
... owningcompileoptions roots / copies / reference counts of all its values, and unroots / frees / releases them when it is destructed.
JS::PersistentRooted
note that you must not use an persistentrooted in an object owned by a js object: whenever one object whose lifetime is decided by the gc refers to another such object, that edge must be traced only if the owning js object is traced.
...when a gc begins, the referent of the persistentrooted is treated as live, unconditionally (because a persistentrooted is a *root*), even if the js object that owns it is unreachable.
...it's up to the implementor of the type containing heap<t> or tenuredheap<t> members to make sure their referents get marked when the object itself is marked.
JSAutoByteString
*/ /* when leaving this scope, the string returned by js_encodestring is freed.
...*/ /* when leaving this scope, the string returned by js_encodestringtoutf8 is freed.
...*/ /* when leaving this scope, buff is freed.
JSNewEnumerateOp
when an ordinary object is enumerated, that object and each object on its prototype chain is tested for an enumerate op, and those ops are called in order.
... an object is "enumerated" when it's the target of a for-in loop or js_enumerate.
... jsenumerate_destroy destroy the opaque iterator state previously allocated in *statep by a call to this function when enum_op was jsenumerate_init or jsenumerate_init_all.
JSNewResolveOp
jsnewresolveop is the type of the jsclass.resolve callback when the jsclass_new_resolve bit is set in the jsclass.flags field.
...when using jsclass_new_resolve_gets_start, the resolve hook must therefore null *objp to signify "not resolved".
... jsresolve_classname obsolete since javascript 1.8.8 class name used when constructing.
JS_AddFinalizeCallback
added in spidermonkey 38 name description jsfinalize_group_start called when preparing to sweep a group of compartments, before anything has been swept.
... jsfinalize_group_end called when preparing to sweep a group of compartments.
... jsfinalize_collection_end called at the end of collection when everything has been swept.
JS_GetGCParameter
when the gc is in "high frequency" mode (see above) then, the heap will be allowed to grow between collections according to these four parameters.
... jsgc_allocation_threshold_factor / "allocationthresholdfactor" these thresholds (as percentages) are compared with the zone threshold (above) to decide when to begin an incremental collection.
... jsgc_allocation_threshold_factor_avoid_interrupt is used when a gc is already in progress for other zones and we may wish to avoid interrupting it.
JS_LookupProperty
when executing javascript code that uses properties, spidermonkey looks up properties using slightly different rules depending on the syntactic context in which the property name appears.
... (the javascript engine simply passes these flags through to the object when it calls the object's jsclass.resolve callback, so objects of a custom jsclass may interpret these flags however they like.) if flags is 0, js_lookuppropertywithflags uses the default lookup rules, the ones used by js_lookupproperty.
...objects may pretend that the property does not exist when this flag is set.
JS_THREADSAFE
} garbage collection requests help make garbage collection safe when multiple threads are using the jsapi.
...when one thread calls js_gc or otherwise finds that garbage collection is necessary, it must wait for all other threads that are in requests to pause before garbage collection can occur.
... instead, data must be copied when it is sent from one thread to another.
SpiderMonkey 1.8.8
you can download full source code here: insert-actual-link-when-the-release-happens (md5 checksum: insert-actual-hash-here).
... the jsresolve_classname and jsresolve_with resolve flags (passed to jsclass.resolve when jsclass.flags contains jsclass_new_resolve) have been removed.
... in the long run we anticipate removing the environment variable-based overriding when we drop support for versions of visual studio prior to 2010.
TPS Tests
any phases declared here but not implemented later will cause the test to fail when it hits that phase.
...when a tps test fails, the log is dumped to tps.log in the virtualenv.
... when one of the cleanup phases fails (often possible if firefox crashes or tps hangs), there's no guarantee that the data was properly cleaned up, and so the next tps test you run may fail due to the leftover data.
Setting up an update server
if you update the installation without moving it, attempts at further incremental builds will not work properly, and a clobber will be needed when building next.
...don't forget to restore the backup when you are done.
...be sure to remove the commas when you paste this number into the xml file.
XForms Accessibility
in general, when elements are similar to html elements, they are exposed to msaa/atk in a similar way.
... alert this message will be shown when the form control cannot properly bind to instance data or when the instance data value is invalid or out of the specified range of selectable values (see the spec, the docs).
... message used in combination with event listeners to display a message to the user when the specified event occurs (see the spec, the docs).
Places Expiration
this ensures expiration doesn't lag behind without hitting performances when there is no need for it.
...in some cases, like when a clear history is executed just before shutdown, a larger step is executed instead.
... on maintenance when places maintenance runs (about once a week, on daily idle), an orphans expiration step is executed, this ensures database cleanup.
Aggregating the In-Memory Datasource
when it won't work although this magic is terribly convenient to use, it won't work in the case that you want to "override" some of the in-memory datasource's methods.
... in short, the only case where this technique is useful is when you're implementing a datasource to get "read-only reflection".
...private: nscomptr<nsisupports> minner; }; construct the datasource delegate when your object is constructed (or, at worst, when somebody qi's for it): rv = nscomponentmanager::createinstance( krdfinmemorydatasourcecid, this, /* the "outer" */ nscomtypeinfo<nsisupports>::getiid(), getter_addrefs(minner)); note passing this as the "outer" parameter.
Binary compatibility
it is a possiblity that is introduced when upgrading to a new compiler without recompiling everything.
...if and when mozilla upgrades the compiler they use, your component will have to be rebuilt against the same compiler.
... when you see a @status frozen, note that this means it should work as long as the component and xpcom are built with the same compiler abi.
XPCOM changes in Gecko 2.0
the component is loaded only when the xpcom component manager needs to create a component.
...this prefix needs to be dropped when migrating to chrome.manifest.
...previously, whenever gecko detected that the application version had changed, or one or more extensions was added, removed, enabled, or disabled, it was necessary to throw away all existing component registrations, then restart the application (what we call the "extension manager restart") during its startup process.
XPCOM guide
MozillaTechXPCOMGuide
leaks.creating xpcom componentsthis guide is about gecko, and about creating xpcom components for gecko-based applications.how to build an xpcom component in javascriptif you are looking for add-on sdk solution for xpcom javascript components then check out platform/xpcom module first.inheriting from implementation classesgiven that idl interfaces map to abstract classes in c++, a common problem when dealing with idl is when you have an idl inheritance hierarchy, and a corresponding c++ implementation hierarchy, you run into multiple inheritance.
... 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 progress 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.
... it is not that sequence of characters, though: the characters may not all be available when you read from the stream.
Interfacing with the XPCOM cycle collector
it only traverses objects that return a helper object when qi'ed to nsicyclecollectionparticipant.
...or ns_decl_cycle_collection_class_ambiguous(nsfoo, nsibar) if nsfoo inherits from multiple interfaces, where nsibar is the interface which is returned when you queryinterface nsfoo to nsisupports.
... when you have something in the js object pointer you need to use mozilla::holdjsobjects to tell the gc to trace it and keep the object alive: ...
Components.Constructor
] ]); parameters contractid a string containing the contract id of the component interfacename if given, nsisupports.queryinterface() will be called on each newly-created instance with the interface named by this string initializer if given, a string containing the name of a function which will be called on the newly-created instance, using the arguments provided to the created function when called description components.constructor() is a handy shortcut for creating instances of xpcom components.
...(this benefit is also partly a result of having to travel through the layer between the javascript engine and xpcom fewer times.) the behavior of functions returned by components.constructor() varies depending upon the arguments given to components.constructor() when called.
...the arguments used with the initialization method are the arguments passed to the components.constructor()-created function when called: var binaryinputstream = components.constructor("@mozilla.org/binaryinputstream;1", "nsibinaryinputstream", "setinputstream"); try { // throws, because number of arguments isn't equal to the number of // arguments nsibinaryinputstream.setinputstream takes var bis = new binaryinputstream(); ...
nsDependentCString
nsdependentcstring(const char*) - source constructs an nsdependentstring when you don't know the length in advance.
...call this version when you know the length of 'data'.
...call this version when 'data' is null-terminated.
RefPtr
when should i use nscomptr versus refptr?
...it's unclear to me when the compiler will reject an attempt to use nscomptr to hold a concrete class pointer and when it will not (will it only rejecte it if a qi is involved in the construction or or assignment to the nscomptr (common in implementation details of nscomptr) but not when an instance of the concrete class is assigned directly?).
... and it's not clear what happens when the compiler does accept this pattern.
mozIStorageStatement
finalize will be called for you when the reference count on the statement goes to zero.
... note: consumers will have to use same escape char when doing statements such as: ...like '?1' escape '/'....
... step() identical to calling executestep(), and then calling reset() when no more rows are returned.
mozIStorageStatementCallback
methods handlecompletion() called when a statement finishes executing.
... handleerror() called when an error occurs while executing a statement.
... handleresult() called when results from the statement are available.
mozIStorageVacuumParticipant
the vacuum manager will try to correct the page size when the browser is idle, using this value as a target.
... methods onbeginvacuum() called when a vacuum operation begins.
...onendvacuum() called when a vacuum operation ends.
mozIVisitInfoCallback
inherits from: nsisupports last changed in gecko 9.0 (firefox 9.0 / thunderbird 9.0 / seamonkey 2.6) method overview void handleerror(in nsresult aresultcode, in moziplaceinfo aplaceinfo); void handleresult(in moziplaceinfo aplaceinfo); void oncomplete(in nsresult aresultcode, in moziplaceinfo aplaceinfo);obsolete since gecko 8.0 methods handleerror() called when a moziplaceinfo couldn't be processed.
... handleresult() called for each visit added, title change, or guid change when passed to moziasynchistory.updateplaces().
... oncomplete() obsolete since gecko 8.0 (firefox 8.0 / thunderbird 8.0 / seamonkey 2.5) called for each visit added, title change, or guid change when passed to moziasynchistory.updateplaces().
nsIAlertsService
textclickable optional if true, if the user clicks on it, the listener is notified; when hovered the notification background becomes lighter and the cursor turns to a pointer.
... topic: "alertfinished" when the alert disappears, "alertclickcallback" if the user clicks the text or "alertshow" (since gecko 22) when the alert is shown.
... getservice(components.interfaces.nsialertsservice); try { alertsservice.showalertnotification("chrome://mozapps/skin/downloads/downloadicon.png", "alert title", "alert text goes here.", false, "", null, ""); } catch (e) { // this can fail on mac os x } listening for callbacks you can be notified when the notification window disappears or the user clicks on the message by passing an object implementing nsiobserver as the alertlistener parameter: var listener = { observe: function(subject, topic, data) { alert("subject=" + subject + ", topic=" + topic + ", data=" + data); } } var alertsservice = components.classes["@mozilla.org/alerts-service;1"].
nsICacheListener
inherits from: nsisupports last changed in gecko 14 (firefox 14 / thunderbird 14 / seamonkey 2.11) method overview void oncacheentryavailable(in nsicacheentrydescriptor descriptor, in nscacheaccessmode accessgranted, in nsresult status); void oncacheentrydoomed(in nsresult status); methods oncacheentryavailable() this method is called when the requested access (or appropriate subset) is acquired.
... oncacheentrydoomed() this method is called when the processing started by nsicachesession.doomentry() is completed.
... void oncacheentrydoomed( in nsresult status ); parameters status the status is ns_ok when the entry was doomed, or ns_error_not_available when there is no such entry.
nsICompositionStringSynthesizer
to create an instance for this: var domwindowutils = window.windowutils; var compositionstringsynthesizer = domwindowutils.createcompositionstringsynthesizer(); for example, when you create a composition whose composing string is "foo-bar-buzz" and "bar" is selected to convert, then, first, you need to start composition: domwindowutils.sendcompositionevent("compositionstart", "", ""); next, dispatch composition string with crause information and caret information (optional): // set new composition string with .setstring().
...(optional) compositionstringsynthesizer.setcaret("foo-bar".length, 0); // dispatch dom events to modify the focused editor compositionstringsynthesizer.dispatchevent(); when you modify the composing string, you don't need to recreate the instance anymore.
....length, compositionstringsynthesizer.attr_convertedtext); compositionstringsynthesizer.appendclause("bar".length, compositionstringsynthesizer.attr_selectedconvertedtext); compositionstringsynthesizer.appendclause("-buzz".length, compositionstringsynthesizer.attr_convertedtext); compositionstringsynthesizer.setcaret("foo-bar".length, 0); compositionstringsynthesizer.dispatchevent(); finally, when you commits composition with the last composition string "foo-bar-buzz": // deprecated in 36, first, dispatch commit string without clause information compositionstringsynthesizer.setstring("foo-bar-buzz"); compositionstringsynthesizer.dispatchevent(); // then, dispatch compositionend with the commit string domwindowutils.sendcompositionevent("compositionend", "foo-bar-buzz", ""); starting ge...
nsIContentViewer
void show(); void stop(); void unload(); obsolete since gecko 1.8 attributes attribute type description container nsisupports domdocument nsidomdocument enablerendering boolean obsolete since gecko 2.0 historyentry nsishentry get the history entry that this viewer will save itself into when destroyed.
...close() should be called when the load of a new page for the next content viewer begins, and destroy() should be called when the next content viewer replaces this one.
...if it is non-null, the document will not be destroyed, and the following actions will happen when destroy() is called: sanitize() will be called on the viewer's document the content viewer will set the contentviewer property on the history entry, and release its reference (ownership reversal).
nsIDNSService
to access the service, use: var dnsservice = components.classes["@mozilla.org/network/dns-service;1"] .createinstance(components.interfaces.nsidnsservice); note: starting in gecko 7.0, the "happy eyeballs" strategy is used to reduce lengthy timeouts when attempting backup connections during attempts to connect from clients that have broken ipv6 connectivity.
...a specified nsidnslistener is invoked when the resolution process is completed.
... alistener the listener to be notified when the result is available.
nsIDOMChromeWindow
notifydefaultbuttonloaded() when a document has been loaded, the document can notify the default button of the document to the window by using this method.
... when this method is called on windows, gecko moves the mouse cursor to center of the button if the auto cursor snap setting is enabled on the system.
... however, when the window isn't active at that time, the cursor isn't moved.
nsIDOMMozNetworkStatsManager
when total data usage reaches threshold bytes, a "networkstats-alarm" system message is sent to the application, where the optional parameter data must be a cloneable object.
... networkstatsalarmoptions networkstatsalarmoptions is a dictionary object used to filter an alarm request made when calling addalarm().
... networkstatsgetoptions networkstatsgetoptions is a dictionary object used to filter a network statistics request made when calling getsamples().
nsIDragService
this is called when an external drag occurs.
...that is, when the image is drawn, it is offset up and left the amount so that the cursor appears at that location within the image.
...this is called when an external drag occurs void startdragsession(); parameters none.
nsIEnvironment
an empty string will be returned when the env variable does not exist or when the value itself is an empty string - please use exists() to probe whether the env variable exists or not.
...note: * for unix/linux platforms we follow the unix definition: an environment variable exists when getenv() returns a non-null value.
... an environment variable does not exist when getenv() returns null.
nsIFilePicker
constants mode constants these constants are used to specify the type of file picker to create when calling init().
... void appendfilters( in long filtermask ); parameters note: if appendfilters is the first (or only) call to set the file filters the filter with the smallest code will be used as default filter when displaying the nsifilepicker dialog.
... when selecting multiple files: ....
nsIFileStreams
if open_on_read is defined, and the file was recreated after the first delete, the file will be deleted again when it is closed again.
... close_on_eof 1<<2 if this is set, the file will close automatically when the end of the file is reached.
... reopen_on_rewind 1<<3 if this is set, the file will be reopened whenever seek(0) occurs.
nsIFrameScriptLoader
frame scripts are essentially per-tab, so they don't get reloaded when the user navigates.
... if you want a frame script to do something whenever a new document is loaded, you can listen for the document-element-inserted notification.
...if you used aallowdelayedload, you should call this as part of your cleanup (for example, when your add-on is disabled or uninstalled).
nsIGeolocationProvider
watch() attaches a callback listener to be notified when a location change is observed.
... void watch( in nsigeolocationupdate callback ); parameters callback an nsigeolocationupdate to be notified when position changes.
... your location provider should call this routine whenever new position data is available.
nsIHttpServer
* * @param callback * an asynchronous callback used to notify the user when this server is * stopped and all pending requests have been fully served * @throws ns_error_null_pointer * if callback is null * @throws ns_error_unexpected * if this server is not running */ void stop(in nsihttpserverstoppedcallback callback); /** * associates the local file represented by the string file with all requests * which match request.
...nother directory); if null, any current mapping for the given path is * removed * @throws ns_error_invalid_arg * if dir is non-null and does not exist or is not a directory, or if path * does not begin with and end with a forward slash */ void registerdirectory(in string path, in nsifile dir); /** * associates files with the given extension with the given content-type when * served by this server, in the absence of any file-specific information * about the desired content-type.
... behavior when not given a string matching * the media-type production in rfc 2616 section 3.7 is undefined.
nsIIdleService
the observer will get an 'idle' notification when the user is idle for that interval (or longer), and receive a 'back' (gecko 3 to 15) or 'active' (gecko 16+) notification when the user starts using their computer again.
... methods addidleobserver() add an observer to be notified when the user idles for some period of time, and when they get back from that.
...when the user goes idle, the observer topic is 'idle' and when they get back, the observer topic is 'back' in gecko 15 and earlier or 'active' in gecko 16 and later.
nsIJSON
when the original instance requiring this function is removed, this method will be removed.
... when the original instance requiring this function is removed, this method will be removed.
... when the original instance requiring this function is removed, this method will be removed.
nsIMicrosummaryObserver
0 inherits from: nsisupports last changed in gecko 1.9 (firefox 3) warning: microsummary support was removed in gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3) method overview void oncontentloaded(in nsimicrosummary microsummary); void onelementappended(in nsimicrosummary microsummary); void onerror(in nsimicrosummary microsummary); methods oncontentloaded() called when an observed microsummary updates its content.
... onelementappended() called when an element is appended to a microsummary set.
... onerror() called when an observed microsummary encounters an error during an update.
nsINetworkLinkService
8.0 / thunderbird 8.0 / seamonkey 2.5) implemented by: @mozilla.org/network/network-link-service;1 as a service: var networklinkservice = components.classes["@mozilla.org/network/network-link-service;1"] .getservice(components.interfaces.nsinetworklinkservice); attributes attribute type description islinkup boolean this is set to true when the system is believed to have a usable network connection.
... the link is only up when network connections can be established.
... linkstatusknown boolean this is set to true when we believe that islinkup is accurate.
nsIPrefService
when using a get method a user set value will be returned if one exists, otherwise a default value will be returned.
...when using a get method a default value will always be returned.
...many of the branch methods do nothing on a default branch because the operations only make sense when applied to user set preferences.
nsIPrintingPrompt
historically, platform toolkits with native dialogs have implemented them in the gfx layer usually they were displayed when a new devicecontextspec specific to that platform was created.
... printsettings printsettings for print "job" opendialogobserver an observer that will be notifed when the dialog is opened.
... notifyonopen this indicates that the observer will be notified when the progress dialog has been opened.
nsISHistory
when the document finishes loading the value -1 is returned.
...listeners are notified when pages are loaded or purged from history.
...listeners are notified when pages are loaded from history.
nsISeekableStream
inherits from: nsisupports last changed in gecko 1.7 method overview void seek(in long whence, in long long offset); void seteof(); long long tell(); constants constant value description ns_seek_set 0 specifies that the offset is relative to the start of the stream.
...void seek( in long whence, in long long offset ); parameters whence specifies how to interpret the 'offset' parameter in setting the stream offset associated with the implementing stream, according to the table of constants above.
... offset specifies a value, in bytes, that is used in conjunction with the 'whence' parameter to set the stream offset of the implementing stream.
nsIServerSocketListener
netwerk/base/public/nsiserversocket.idlscriptable this interface is notified whenever a server socket accepts a new connection.
... inherits from: nsisupports last changed in gecko 1.7 method overview void onsocketaccepted(in nsiserversocket aserv, in nsisockettransport atransport); void onstoplistening(in nsiserversocket aserv, in nsresult astatus); methods onsocketaccepted() this method is called when a client connection is accepted.
... onstoplistening() this method is called when the listening socket stops for some reason.
nsISessionStore
will always be false when in private browsing mode.
... return value exceptions thrown ns_error_invalid_arg when aindex does not map to a closed window.
... if the preference browser.sessionstate.enabled is false when this method is called, then you will get an exception about "awindows[i] has no properties".
nsISocketTransport
status_connected_to 0x804b0004 status_sending_to 0x804b0005 status_waiting_for 0x804b000a status_receiving_from 0x804b0006 connection flags values for the connectionflags attribute constant value description bypass_cache 0 when making a new connection bypass_cache will force the necko dns cache entry to be refreshed with a new call to nspr if it is set before opening the new stream.
... anonymous_connect 1 when this flag is set, the socket will not apply any credentials when establishing a connection.
... disable_ipv6 2 when this flag is set, the socket will ignore any ipv6 addresses the host may offer and will only attempt to connect to ipv4 addresses.
nsIStreamConverter
netwerk/streamconv/public/nsistreamconverter.idlscriptable provides an interface to implement when you have code that converts data from one type to another.
...use this method when you want to proxy (and convert) nsistreamlistener callbacks asynchronously.
...use this method when you have a stream you want to convert.
nsISupports proxies
when one is busy, the other is blocked.
... warning about proxy_async: you must take very special care when using this flag.
...when you are finished with a proxy object, you should call ns_release on it.
nsIThread
when this function returns, the thread will be shut down and will no longer be available to receive events.
... exceptions thrown ns_error_unexpected the method was called when this thread wasn't the current thread.
... exceptions thrown ns_error_unexpected this method was called when this thread wasn't the current thread.
nsITimer
the timer period will ideally be at least the time between when processing for last firing the callback completes and when the next firing occurs, but note that this is not guaranteed: the timer can fire at any time.
... void initwithcallback( in nsitimercallback acallback, in unsigned long adelay, in unsigned long atype ); parameters acallback an nsitimercallback interface to call when timer expires.
... void initwithfunccallback( in nstimercallbackfunc acallback, in voidptr aclosure, in unsigned long adelay, in unsigned long atype ); parameters acallback a nstimercallbackfunc interface compatible function to call when timer fires.
nsIUTF8ConverterService
aallowsubstitution when true, allow the decoder to substitute invalid input sequences by replacement characters.
...exceptions thrown ns_error_uconv_noconv when there is no decoder for acharset or error code of nsiunicodedecoder in case of conversion failure.
...exceptions thrown ns_error_uconv_noconv when there is no decoder for acharset or error code of nsiunicodedecoder in case of conversion failure.
nsIWebNavigation
when a page is loaded from session history, all content is loaded from the cache (if available) and page state (such as form values and scroll position) is restored.
...when a page is loaded from session history, all content is loaded from the cache (if available) and page state (such as form values and scroll position) is restored.
...there may be cases where the user will be asked to confirm the reload (for example, when it is determined that the request is non-idempotent).
nsIWebSocketListener
onbinarymessageavailable() called when a binary message has been received.
... onmessageavailable() called when a text message has been received.
... onserverclose() called when the server sends a close message.
nsIWifiListener
netwerk/wifi/nsiwifilistener.idlscriptable this interface is implemented by clients interested in receiving notifications when the list of available wifi access points changes.
... 1.0 66 introduced gecko 1.9.1 inherits from: nsisupports last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) method overview void onchange([array, size_is(alen)] in nsiwifiaccesspoint accesspoints, in unsigned long alen); void onerror(in long error); methods onchange() called when the list of available access points changes.
... onerror() called when an error occurs while updating the wifi access point list.
nsPIPromptService
this is the system sound name which should be played when the dialog is shown.
...if this is not 0, the all buttons are disabled when the dialog is shown.
...this is the sound event id which should be played when the dialog is shown.
NS_CStringContainerInit
with ns_cstringcontainerinit, the coder is required to call ns_cstringcontainerfinish when done with the nscstringcontainer object.
... therefore, it is generally better to use nsembedcstring, to instantiate a nsacstring object, since it automatically releases allocated memory when the object goes out of scope.
... // call this function to release any memory owned by |str| when done.
NS_CStringContainerInit2
when the string object is no longer needed, it should be passed to ns_cstringcontainerfinish to free any extra memory that the string object may have allocated.
... it is generally better to use one of the helper classes, such as nscstring, instead of coding directly to ns_cstringcontainerinit2 because those classes take care of cleaning up the string object when it goes out of scope.
... when ns_cstringcontainerinit2 is told to copy adata, the copy it creates is null-terminated.
NS_StringContainerInit
with ns_stringcontainerinit, the coder is required to call ns_stringcontainerfinish when done with the nsstringcontainer object.
... therefore, it is generally better to use nsembedstring, to instantiate a nsastring object, since it automatically releases allocated memory when the object goes out of scope.
... // be sure to call this function to release any memory owned by |str| when done.
Warnings
this happens when you have an order by clause that does not use an index.
... when you do not use an index, all the results from the query have to first be fetched, and then those results are sorted.
... however, when the index is used, the data can be obtained row by row from the database, which will be much faster.
Frequently Asked Questions
comparing an nscomptr to a raw xpcom interface pointer declaring an nscomptr to a forward-declared class not linking to xpcom not including nscomptr.h different settings of nscap_feature_debug_ptr_types runtime errors ns_assertion "queryinterface needed" may be caused by a class that derives from a given interface, when you forgetting to also specify the interface name in the ns_impl_isupports / ns_impl_threadsafe_isupports macro.
... for example, the assertion occurs when you convert the pointer to the object to a raw pointer to that interface, then assign the raw pointer to another nscomptr for that interface.
...whenever an nscomptr takes on a new value, it always releases its old value, if any.
Using nsIDirectoryService
when you have it, queryinterface for the nsidirectoryservice interface.
...om this interface there is a function, registerprovider which will allow you to register a nsidirectoryserviceprovider, which implements the getfile callback function: var provider = { getfile : function(prop, persistant) { // return an nsifile }, } components.classes["@mozilla.org/file/directory_service;1"] .getservice(components.interfaces.nsidirectoryservice).registerprovider(provider); when the callback is called, it will be passed the string key, and should return an nsifile.
...when the service is asked for a file location, it goes through its list of providers asking each if it knows the requested location until it finds one that does.
nsCOMPtr versus RefPtr
general rule of thumb for nscomptr versus refptr the general rule of thumb is to use nscomptr<t> when t is an interface type, and refptr<t> when t is a concrete type.
... do_queryinterface versus do_queryobject the do_queryinterface helper is only available when assigning to nscomptr.
...however, when the destination type is an xpcom interface, it's probably better to static_cast to a class that unambiguously inherits from nsisupports and use do_queryinterface in such cases.
wrappedJSObject
when available, it lets you access the javascript object hidden by the wrapper.
... regular xpconnect wrappers which you can encounter, for example, when using xpcom components implemented in js.
... while this behavior is nice for production code as it forces you to clearly define the interfaces that should be used to access the component, it's inconvenient to write the interfaces (and recompile each time you change them) when working on a prototype of the component.
Autoconfiguration in Thunderbird
for more complicated setups, for example when the login name does not appear in the email address, the xml file can also be generated by the isp.
... guessing if all other mechanisms failed, thunderbird tries to guess the configuration, by trying common server names like imap.<domain>, smtp.<domain>, mail.<domain> etc., and, when a mail server answers, checking whether it supports ssl, starttls and encrypted passwords (cram-md5).
...please use https whenever possible.
Creating a gloda message query
let mylistener = { /* called when new items are returned by the database query or freshly indexed */ onitemsadded: function mylistener_onitemsadded(aitems, acollection) { }, /* called when items that are already in our collection get re-indexed */ onitemsmodified: function mylistener_onitemsmodified(aitems, acollection) { }, /* called when items that are in our collection are purged from the system */ onitemsremoved...
...: function mylistener_onitemsremoved(aitems, acollection) { }, /* called when our database query completes */ onquerycompleted: function mylistener_onquerycompleted(acollection) { } }; let collection = query.getcollection(mylistener); message attributes look at the pretty messages!
... want a glodamessage when you already have an nsimsgdbhdr?
DB Views (message lists)
bview - (implementation) nsmsgquicksearchdbview - (implementation) nsmsgxfvirtualfolderdbview - (implementation) nsmsggroupview - (implementation) usually, a view object has parallel arrays, which map directly to lines in the message list: m_keys message header key m_flags 32 bits, combination of message header flags and view-only flags (e.g., collapsed) m_level the indentation level when in threaded mode.
... m_folders cross-folder views only (nsmsgsearchdbview and its descendant, nsmsgxfvirtualfolderdbview) most of the time, the thread pane is driven by an nsmsgthreadeddbview object (even when we're in a flat sort).
... nsmsggroupview is used when grouping is turned on.
LDAP Support
mail compose typedown in mail compose, when typing a partial mail address, a typedown window appears listing possible matches against address books and ldap directories.
... these relationships ensure: generality is maintained when mapping from ldap attributes to address book.
... consistent round tripping when editing address book attributes which are stored on an ldap server.
Using popup notifications
these non-modal notifications let the user make decisions when they have a moment to do so, instead of being forced to deal with them at possibly inconvenient times.
... for example, this popup notification is displayed when a web site requests geolocation information: this lets the user decide whether or not to share their location when it's convenient to do so, instead of being compelled to do it at once.
...first secondary option", accesskey: "1", callback: function() { alert("first secondary option selected."); } }, { label: "second secondary option", accesskey: "2", callback: function() { alert("second secondary option selected."); } } ] ); when this notification is presented, and the user clicks on the menu button in the panel, the display looks like this: when the user chooses one of your secondary actions from the drop-down menu, the corresponding callback is invoked.
XPI
when downloaded or dropped into an extension manager, xpinstall automatically interacts with the installation instructions contained in the xpi, and installs the contained software.
... note: starting in gecko 2.0, xpi files are no longer unpacked when extensions are installed.
... when xpi files are served via http, the application/x-xpinstall mime type should be matched with the xpi file extension.
Version, UI, and Status Information - Plugins
the user might appreciate seeing the percentage completed of the current operation or the url of a button or other link object when the cursor is over it, all of which the browser shows.
...to do so, it must find the major and minor version numbers, which are determined when the plug-in and navigator are compiled, and compare them.
... bool has_windowless() { npbool supportswindowless = false; nperror ret = npn_getvalue(instance, npnvsupportswindowless, &supportswindowless); return ret == nperr_no_error && supportswindowless; } reloading a plug-in when the browser starts up, it loads all the plug-ins it finds in the plugins directory for the platform.
Browser Toolbox - Firefox Developer Tools
for example, here's what the frame selection popup lists when there are two browser windows open, one with one content tab, and one with two: debugging popups it's hard to debug popups, because the browser hides them as soon as you click outside them.
... now when you open any popup, it will stay open until you press the esc key.
...when you close the browser toolbox, the setting will be cleared.
Use watchpoints - Firefox Developer Tools
when debugging javascript code, it can be useful to know when properties on objects are read or modified.
...a get watchpoint pauses whenever a property is read; a set watchpoint pauses whenever a property value changes; a get or set watchpoint pauses whenever a property value is accessed in either way.
... view a watchpoint when the watched property is accessed in the way specified by the watchpoint type (get or set), the debugger pauses, enabling you to see line of code responsible, and to inspect anything else you wish at that time.
Source map errors - Firefox Developer Tools
you may encounter this when trying to open one of the original sources in the debugger.
... the message looks a little different in this case: in this case, the error will also be displayed in the source tab in the debugger: networkerror when attempting to fetch resource a bug in firefox prevents it from loading source maps for web extensions.
... source-map-fehler: typeerror: networkerror when attempting to fetch resource.
Using the Debugger map scopes feature - Firefox Developer Tools
this feature is useful when debugging source-mapped code.
... when you click the increment button on the page and hit the breakpoint, an additional section is added to the right-hand panel below the call stack to display variables mapped from the original scope, like this: as useful as this is, it would be even nicer if you could view the original code (before it was packages into the "bundle.js" file.
... using this feature is expensive in terms of resources, but it certainly makes your life easier when you have to debug source code that has been packaged webpack or a similar tool.
Network Monitor - Firefox Developer Tools
the network monitor shows you all the network requests firefox makes (for example, when it loads a page, or due to xmlhttprequests), how long each request takes, and details of each request.
...when it first opens, the network monitor does not show request information.
...once the tool is monitoring network requests, the display looks like this: when it is actively monitoring activity, the network monitor records network requests any time the toolbox is open, even if the network monitor itself is not selected.
Animating CSS properties - Firefox Developer Tools
they can also give better performance, as they give the browser more control over when to render frames, and to drop frames if necessary.
... the css rendering waterfall the process the browser uses to update the page when a css property has changed can be described as a waterfall consisting of the following steps: recalculate style: every time a css property for an element changes, the browser must recalculate computed styles.
...it's unlikely you'll see a smooth animation here, especially when you add in user interaction.
Style Editor - Firefox Developer Tools
the media sidebar the style editor displays a sidebar on the right-hand side whenever the current sheet contains any @media rules.
... first, set up your preprocessor so it watches the original source and automatically regenerates the css when the source changes.
... now when you make changes to the source file in the style editor the css is regenerated and you can see the changes right away.
ANGLE_instanced_arrays - Web APIs
despite the name "angle", this extension works on any device if the hardware supports it and not just on windows when using the angle library.
... constants this extension exposes one new constant, which can be used in the gl.getvertexattrib() method: ext.vertex_attrib_array_divisor_angle returns a glint describing the frequency divisor used for instanced rendering when used in the gl.getvertexattrib() as the pname parameter.
... ext.vertexattribdivisorangle() modifies the rate at which generic vertex attributes advance when rendering multiple instances of primitives with ext.drawarraysinstancedangle() and ext.drawelementsinstancedangle().
AbortController - Web APIs
the abortcontroller interface represents a controller object that allows you to abort one or more web requests as and when desired.
... when the fetch request is initiated, we pass in the abortsignal as an option inside the request's options object (see {signal}, below).
... }).catch(function(e) { reports.textcontent = 'download error: ' + e.message; }) } note: when abort() is called, the fetch() promise rejects with a domexception named aborterror.
AbortSignal - Web APIs
abort invoked when the dom request(s) the signal is communicating with is/are aborted.
... when the fetch request is initiated, we pass in the abortsignal as an option inside the request's options object (see {signal}, below).
... }).catch(function(e) { reports.textcontent = 'download error: ' + e.message; }) } note: when abort() is called, the fetch() promise rejects with an aborterror.
AbstractRange - Web APIs
this is useful when you need to specify a range that will only be used once, since it avoids the performance and resource impact of the more complex range interface.
... contents of elements when trying to access the contents of an element, keep in mind that the element itself is a node, but so is any text inside it.
... the contents of the text nodes are then determined by the offsets into those text nodes given when calling setstart() and setend().
Animation.onfinish - Web APIs
this event is sent when the animation finishes playing.
... the finish event occurs when the animation completes naturally, as well as when the animation.finish() method is called to immediately cause the animation to finish up.
...hide(endingui); // when the credits are later faded in, // we re-add the pointer events when they're done bringui.onfinish = function() { endingui.style.pointerevents = 'auto'; }; specifications specification status comment web animationsthe definition of 'animation.onfinish' in that specification.
Animation.onremove - Web APIs
this event is sent when the animation is removed (i.e., put into an active replace state).
...', evt => { let anim = divelem.animate( { transform: `translate(${ evt.clientx}px, ${evt.clienty}px)` }, { duration: 500, fill: 'forwards' } ); anim.commitstyles(); //anim.persist() anim.onremove = function() { console.log('animation removed'); } console.log(anim.replacestate); }); here we have a <div> element, and an event listener that fires the event handler code whenever the mouse moves.
... a console message is logged each time an animation it removed, invoked when the remove event is fired.
Animation.startTime - Web APIs
the animation.starttime property of the animation interface is a double-precision floating-point value which indicates the scheduled time when an animation's playback should begin.
... an animation’s start time is the time value of its documenttimeline when its target keyframeeffect is scheduled to begin playback.
... syntax var animationstartedwhen = animation.starttime; animation.starttime = newstarttime; value a floating-point number representing the current time in milliseconds, or null if no time is set.
AudioBufferSourceNode.start() - Web APIs
syntax audiobuffersourcenode.start([when][, offset][, duration]); parameters when optional the time, in seconds, at which the sound should begin to play, in the same time coordinate system used by the audiocontext.
... if when is less than (audiocontext.currenttime, or if it's 0, the sound begins to play at once.
...using this parameter is functionally identical to calling start(when, offset) and then calling stop(when+duration).
AudioContext.close() - Web APIs
the returned promise resolves when all audiocontext-creation-blocking resources have been released.
... example the following snippet is taken from our audiocontext states demo (see it running live.) when the stop button is clicked, close() is called.
... when the promise resolves, the example is reset to its beginning state.
AudioContext.createMediaStreamDestination() - Web APIs
the mediastream is created when the node is created and is accessible via the mediastreamaudiodestinationnode's stream attribute.
... when the button is clicked, the oscillator starts, and the mediarecorder is started.
... when the button is stopped, the oscillator and mediarecorder both stop.
AudioContextLatencyCategory - Web APIs
by using these strings rather than a numeric value when specifying a latency to a audiocontext, you can allow the user agent to select an appropriate latency for your use case that makes sense on the device on which your content is being used.
... audiocontextlatencycategory can be used when constructing a new audiocontext by passing one of these values as the latencyhint option in the audiocontext() constructor's options dictionary.
... values value description "balanced" the user agent should balance audio output latency and power consumption when selecting a latency value.
AudioContextOptions - Web APIs
the audiocontextoptions dictionary is used to specify configuration options when constructing a new audiocontext object to represent a graph of web audio nodes.
... it is only used when calling the audiocontext() constructor.
... constants standard values for latencyhint the latencyhint property can be number specifying a preferred maximum latency in seconds or a string from the audiocontextlatencycategory enumerated string, which selects a standard value for a given type of audio usage: value description "balanced" the user agent should balance audio output latency and power consumption when selecting a latency value.
AudioNode - Web APIs
WebAPIAudioNode
for example, if your graph has a latency of 500ms, when the source node plays a sound, it will take half a second until that sound can be heard on your speakers (or even longer because of latency in the underlying audio device).
... keep in mind that microsoft edge does not yet appear to support the constructors; it will throw a "function expected" error when you use the constructors.
... audionode.channelcount represents an integer used to determine how many channels are used when up-mixing and down-mixing connections to any inputs to the node.
AudioProcessingEvent - Web APIs
the web audio api audioprocessingevent represents events that occur when a scriptprocessornode input buffer is ready to be processed.
... playbacktime read only double the time when the audio will be played, as defined by the time of audiocontext.currenttime inputbuffer read only audiobuffer the buffer containing the input audio data to be processed.
...) { // make output equal to the same as the input outputdata[sample] = inputdata[sample]; // add noise to each output sample outputdata[sample] += ((math.random() * 2) - 1) * 0.2; } } } getdata(); // wire up play button playbutton.onclick = function() { source.connect(scriptnode); scriptnode.connect(audioctx.destination); source.start(); } // when the buffer source stops playing, disconnect everything source.onended = function() { source.disconnect(scriptnode); scriptnode.disconnect(audioctx.destination); } ...
AudioScheduledSourceNode: ended event - Web APIs
the ended event of the audioscheduledsourcenode interface is fired when the source node has stopped playing.
... bubbles no cancelable no interface event event handler property audioscheduledsourcenode.onended usage notes this event occurs when a audioscheduledsourcenode has stopped playing, either because it's reached a predetermined stop time, the full duration of the audio has been performed, or because the entire buffer has been played.
... examples in this simple example, an event listener for the ended event is set up to enable a "start" button in the user interface when the node stops playing: node.addeventlistener('ended', () => { document.getelementbyid("startbutton").disabled = false; }) you can also set up the event handler using the audioscheduledsourcenode.onended property: node.onended = function() { document.getelementbyid("startbutton").disabled = false; } for an example of the ended event in use, see our audio-buffer example on github.
AudioScheduledSourceNode.start() - Web APIs
syntax audioscheduledsourcenode.start([when [, offset [, duration]]]); parameters when optional the time, in seconds, at which the sound should begin to play.
...a value of 0 (or omitting the when parameter entirely) causes the sound to start playback immediately.
... rangeerror the value specified for when is negative.
AudioTrackList.onaddtrack - Web APIs
the audiotracklist property onaddtrack is an event handler which is called when the addtrack event occurs, indicating that a new audio track has been added to the media element whose audio tracks the audiotracklist represents.
... usage notes the addtrack event is called whenever a new track is added to the media element whose audio tracks are represented by the audiotracklist object.
... this happens when tracks are added to the element when the media is first attached to the element; one addtrack event will occur for each audio track in the media resource.
AudioWorkletNodeOptions - Web APIs
the audioworkletnodeoptions dictionary of the web audio api is used to specify configuration options when constructing a new audioworkletnode object for custom audio processing.
... it is only used when calling the audioworkletnode() constructor.
... usage notes when creating an audioworkletnode, these options can have various effects.
AuthenticatorAttestationResponse.attestationObject - Web APIs
the attestationobject property of the authenticatorattestationresponse interface returns an arraybuffer containing the new public key, as well as signature over the entire attestationobject with a private key that is stored in the authenticator when it is manufactured.
...when used in attestation, it contains an optional field, attestedcredentialdata.
... this field is not included when used in the authenticatorassertionresponse.
BaseAudioContext.createBuffer() - Web APIs
examples first, a couple of simple trivial examples, to help explain how the parameters are used: var audioctx = new audiocontext(); var buffer = audioctx.createbuffer(2, 22050, 44100); if you use this call, you will get a stereo buffer (two channels), that, when played back on an audiocontext running at 44100hz (very common, most normal sound cards run at this rate), will last for 0.5 seconds: 22050 frames / 44100hz = 0.5 seconds.
... var audioctx = new audiocontext(); var buffer = audioctx.createbuffer(1, 22050, 22050); if you use this call, you will get a mono buffer (one channel), that, when played back on an audiocontext running at 44100hz, will be automatically *resampled* to 44100hz (and therefore yield 44100 frames), and last for 1.0 second: 44100 frames / 44100hz = 1 second.
...// this is the audionode to use when we want to play an audiobuffer var source = audioctx.createbuffersource(); // set the buffer in the audiobuffersourcenode source.buffer = myarraybuffer; // connect the audiobuffersourcenode to the // destination so we can hear the sound source.connect(audioctx.destination); // start the source playing source.start(); specifications specification status comment web audio ...
BaseAudioContext.decodeAudioData() - Web APIs
successcallback a callback function to be invoked when the decoding successfully finishes.
... errorcallback an optional error callback, to be invoked if an error occurs when the audio data is being decoded.
...when the stop() method is called on the source, the source is cleared out.
BaseAudioContext - Web APIs
event handlers baseaudiocontext.onstatechange an event handler that runs when an event of type statechange has fired.
... this occurs when the audiocontext's state changes, due to the calling of one of the state change methods (audiocontext.suspend, audiocontext.resume, or audiocontext.close).
...audiobuffers are created using audiocontext.createbuffer or returned by audiocontext.decodeaudiodata when it successfully decodes an audio track.
BatteryManager - Web APIs
event handlers batterymanager.onchargingchange a handler for the chargingchange event; this event is sent when the battery charging state is updated.
... batterymanager.onchargingtimechange a handler for the chargingtimechange event; this event is sent when the battery charging time is updated batterymanager.ondischargingtimechange a handler for the dischargingtimechange event; this event is sent when the battery discharging time is updated.
... batterymanager.onlevelchange a handler for the levelchange event; this event is sent when the battery level is updated.
BeforeUnloadEvent - Web APIs
the beforeunload event is fired when the window, the document and its resources are about to be unloaded.
... when a non-empty string is assigned to the returnvalue event property, a dialog box appears, asking the users for confirmation to leave the page (see example below).
... when no value is provided, the event is processed silently.
BluetoothRemoteGATTCharacteristic - Web APIs
this value gets updated when the value of the characteristic is read or updated via a notification or indication.
... bluetoothremotegattcharacteristic.startnotifications() returns a promise when navigator.bluetooth is added to the active notification context.
... bluetoothremotegattcharacteristic.stopnotifications() returns a promise when navigator.bluetooth is removed from the active notification context.
Body.arrayBuffer() - Web APIs
WebAPIBodyarrayBuffer
when pressed, the getdata() function is run.
...when the fetch is successful, we read an arraybuffer out of the response using arraybuffer(), decode the audio data using audiocontext.decodeaudiodata, set the decoded data as the audio buffer source's buffer (source.buffer), then connect the source up to the audiocontext.destination.
... once getdata() has finished running, we start the audio source playing with start(0), then disable the play button so it can't be clicked again when it is already playing (this would cause an error.) function getdata() { source = audioctx.createbuffersource(); var myrequest = new request('viper.ogg'); fetch(myrequest).then(function(response) { return response.arraybuffer(); }).then(function(buffer) { audioctx.decodeaudiodata(buffer, function(decodeddata) { source.buffer = decodeddata; source.connect(audioctx.destination); }); }); }; // wire up buttons to stop and play audio play.onclick = function() { getdata(); source.start(0); play.setattribute('disabled', 'disabled'); } reading files the response() constructor accepts files and blobs, so it m...
Body.text() - Web APIs
WebAPIBodytext
example in our fetch text example (run fetch text live), we have an <article> element and three links (stored in the mylinks array.) first, we loop through all of these and give each one an onclick event handler so that the getdata() function is run — with the link's data-page identifier passed to it as an argument — when one of the links is clicked.
... when getdata() is run, we create a new request using the request() constructor, then use it to fetch a specific .txt file.
... when the fetch is successful, we read a usvstring (text) object out of the response using text(), then set the innerhtml of the <article> element equal to the text object.
Cache.delete() - Web APIs
WebAPICachedelete
if set to true, the ?value=bar part of http://foo.com/?value=bar would be ignored when performing a match.
... ignoremethod: a boolean that, when set to true, prevents matching operations from validating the request http method (normally only get and head are allowed.) it defaults to false.
... ignorevary: a boolean that, when set to true, tells the matching operation not to perform vary header matching.
Cache.keys() - Web APIs
WebAPICachekeys
if set to true, the ?value=bar part of http://foo.com/?value=bar would be ignored when performing a match.
... ignoremethod: a boolean that, when set to true, prevents matching operations from validating the request http method (normally only get and head are allowed.) it defaults to false.
... ignorevary: a boolean that, when set to true, tells the matching operation not to perform vary header matching.
Cache.matchAll() - Web APIs
WebAPICachematchAll
if set to true, the ?value=bar part of http://foo.com/?value=bar would be ignored when performing a match.
... ignoremethod: a boolean that, when set to true, prevents matching operations from validating the request http method (normally only get and head are allowed.) it defaults to false.
... ignorevary: a boolean that when set to true tells the matching operation not to perform vary header matching — i.e.
CacheStorage.match() - Web APIs
for example, if set to true, the ?value=bar part of http://foo.com/?value=bar would be ignored when performing a match.
... ignoremethod: a boolean that, when set to true, prevents matching operations from validating the request http method (normally only get and head are allowed.) it defaults to false.
... ignorevary: a boolean that, when set to true, tells the matching operation not to perform vary header matching.
Basic animations - Web APIs
in normal circumstances, we only see these results appear on the canvas when the script finishes executing.
...the requestanimationframe method provides a smoother and more efficient way for animating by calling the animation frame when the system is ready to paint the frame.
... the number of callbacks is usually 60 times per second and may be reduced to a lower rate when running in background tabs.
Channel Messaging API - Web APIs
gechannel.port2 properties (which both return messageport objects.) the app that created the channel uses port1, and the app at the other end of the port uses port2 — you send a message to port2, and transfer the port over to the other browsing context using window.postmessage along with two arguments (the message to send, and the object to transfer ownership of, in this case the port itself.) when these transferable objects are transferred, they are 'neutered' on the previous context — the one they previously belonged to.
... for instance a port, when is sent, cannot be used anymore by the original context.
... when you want to stop sending messages down the channel, you can invoke messageport.close to close the ports.
console - Web APIs
WebAPIConsole
outputting a single object the simplest way to use the logging methods is to output a single object: var someobject = { str: "some text", id: 5 }; console.log(someobject); the output looks something like this: [09:27:13.475] ({str:"some text", id:5}) outputting multiple objects you can also output multiple objects by simply listing them when calling the logging method, like this: var car = "dodge charger"; var someobject = { str: "some text", id: 5 }; console.info("my first car was a", car, ".
...the object is: ({str:"some text", id:5}) using string substitutions when passing a string to one of the console object's methods that accepts a string (such as log()), you may use these substitution strings: %o or %o outputs a javascript object.
...e: console.time("answer time"); alert("click to continue"); console.timelog("answer time"); alert("do a bunch of other stuff..."); console.timeend("answer time"); will log the time needed by the user to dismiss the alert box, log the time to the console, wait for the user to dismiss the second alert, and then log the ending time to the console: notice that the timer's name is displayed both when the timer is started and when it's stopped.
DOMPointInit.x - Web APIs
WebAPIDOMPointInitx
the dompointinit dictionary's x property is used to specify the x component of a point in 2d or 3d space when either creating or serializing a dompoint or dompointreadonly.
... if this property is missing when the dompointinit object is passed into frompoint(), the value is assumed to be 0 by default.
... dompointinit is used as an input when calling either dompointreadonly.frompoint() or dompoint.frompoint(), and is returned by the dompointreadonly.tojson() and dompoint.tojson() methods.
DedicatedWorkerGlobalScope.onmessage - Web APIs
the onmessage property of the dedicatedworkerglobalscope interface represents an eventhandler to be called when the message event occurs and bubbles through the worker — i.e.
... when a message is sent to the worker using the worker.postmessage method.
...messages are passed to the worker when the value inside the form input first changes.
DeprecationReportBody - Web APIs
a deprecation report is generated when a deprecated feature (e.g.
... anticipatedremoval a date object (rendered as a string) representing the date when the feature is expected to be removed from the current browser.
...this typically matches the message a browser will display in its devtools console when a deprecated feature is used, if one is available.
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.
...the first one is the deviceorientationevent, which is sent when the accelerometer detects a change to the orientation of the device.
... the second event is the devicemotionevent, which is sent when a change in acceleration was added.
Document: transitionstart event - Web APIs
the transitionstart event is fired when a css transition has actually started, i.e., after any transition-delay has ended.
... the difference is transitionstart and transitionrun is that transitionrun fires when the transition is created (i.e.
... at the start of any delay) and transitionstart fires when the actual animation has begun (i.e.
DocumentOrShadowRoot.getSelection() - Web APIs
example function foo() { var selobj = document.getselection(); alert(selobj); var selrange = selobj.getrangeat(0); // do stuff with the range } notes string representation of the selection object in javascript, when an object is passed to a function expecting a string (like window.alert()), the object's tostring() method is called and the returned value is passed to the function.
... this can make the object appear to be a string when used with other functions when it is really an object with properties and methods.
... in the above example, selobj.tostring() is automatically called when it is passed to window.alert().
Element.attachShadow() - Web APIs
this can be one of: open: elements of the shadow root are accessible from javascript outside the root, for example using element.shadowroot: element.shadowroot; // returns a shadowroot obj closed: denies access to the node(s) of a closed shadow root from javascript outside it: element.shadowroot; // returns null delegatesfocus a boolean that, when set to true, specifies behavior that mitigates custom element issues around focusability.
... when a non-focusable part of the shadow dom is clicked, the first focusable part is given focus, and the shadow host is given any available :focus styling.
... return text.trim().split(/\s+/g).length; } var count = 'words: ' + countwords(wcparent); // create a shadow root var shadow = this.attachshadow({mode: 'open'}); // create text node and add word count to it var text = document.createelement('span'); text.textcontent = count; // append it to the shadow root shadow.appendchild(text); // update count when element content changes setinterval(function() { var count = 'words: ' + countwords(wcparent); text.textcontent = count; }, 200) } } // define the new element customelements.define('word-count', wordcount, { extends: 'p' }); specifications specification status comment domthe definition of 'attachshadow()' in that specification.
Element: auxclick event - Web APIs
the auxclick event is fired at an element when a non-primary pointing device button (any mouse button other than the primary—usually leftmost—button) has been pressed and released both within the same element.
... when listening for auxclick events originating on elements that do not support input or navigation, you will often want to explicitly prevent other default actions mapped to the down action of the middle mouse button.
...t: 100%; overflow: hidden; } body { height: inherit; display: flex; justify-content: center; align-items: center; margin: 0; } button { border: 0; background-color: white; font-size: 8vw; display: block; width: 100%; height: 100%; } h1 { letter-spacing: 0.5rem; } result note: if you are using a three-button mouse, you'll notice that the onauxclick handler is run when any of the non-left mouse buttons are clicked (usually including any "special" buttons on gaming mice).
Element.classList - Web APIs
WebAPIElementclassList
o.length, resstr="", is=0; i !== len; ++i) if(is){ this[i-1]=this[i] }else{ if(this[i] !== val){ resstr+=this[i]+" "; }else{ is=1; } } if (!is) continue; delete this[len], proto.length -= 1, proto.value = resstr; } skippropchange = 1, ele.classname = proto.value, skippropchange = 0; }; window.domtokenlist = domtokenlist; function whenpropchanges(){ var evt = window.event, prop = evt.propertyname; if ( !skippropchange && (prop==="classname" || (prop==="classlist" && !defineproperty)) ) { var target = evt.srcelement, protoobjproto = target[" uclp"], strval = "" + target[prop]; var tokens=strval.trim().split(wsre), restokenlist=target[prop==="classlist"?" ucl":"classlist"]; var ...
... indexs if(prop !== "classlist") return; skippropchange = 1, target.classlist = restokenlist, target.classname = strval; skippropchange = 0, restokenlist.length = tokens.length - sub; } } function polyfillclasslist(ele){ if (!ele || !("innerhtml" in ele)) throw typeerror("illegal invocation"); ele.detachevent( "onpropertychange", whenpropchanges ); // prevent duplicate handler infinite loop allowtokenlistconstruction = 1; try{ function protoobj(){} protoobj.prototype = new domtokenlist(); } finally { allowtokenlistconstruction = 0 } var protoobjproto = protoobj.prototype, restokenlist = new protoobj(); a: for(var toks=ele.classname.trim().split(wsre), ci=0, clen=toks.length, sub=0; ci !=...
...{ // for accessing the hidden prototype enumerable: 0, configurable: 0, writeable: 0, value: protoobj.prototype }); defineproperty(protoobjproto, " ucl", { enumerable: 0, configurable: 0, writeable: 0, value: ele }); } else { ele.classlist=restokenlist, ele[" ucl"]=restokenlist, ele[" uclp"]=protoobj.prototype; } ele.attachevent( "onpropertychange", whenpropchanges ); } try { // much faster & cleaner version for ie8 & ie9: // should work in ie8 because element.prototype instanceof node is true according to the specs window.object.defineproperty(window.element.prototype, "classlist", { enumerable: 1, get: function(val){ if (!hasownprop.call(this, "classlist")) polyfillclasslist...
Element: contextmenu event - Web APIs
the contextmenu event fires when the user attempts to open a context menu.
... bubbles yes cancelable yes interface mouseevent event handler property oncontextmenu examples in this example, the default action of the contextmenu event is canceled using preventdefault() when the contextmenu event is fired at the first paragraph.
... as a result, the first paragraph will do nothing when right-clicked, while the second paragraph will show the standard context menu offered by your browser.
Element.innerHTML - Web APIs
WebAPIElementinnerHTML
document.documentelement.innerhtml = "<pre>" + document.documentelement.innerhtml.replace(/</g,"&lt;") + "</pre>"; operational details what exactly happens when you set value of innerhtml?
... however, there are ways to execute javascript without using <script> elements, so there is still a security risk whenever you use innerhtml to set strings over which you have no control.
... for example: const name = "<img src='x' onerror='alert(1)'>"; el.innerhtml = name; // shows the alert for that reason, it is recommended that you do not use innerhtml when inserting plain text; instead, use node.textcontent.
Element.setPointerCapture() - Web APIs
note: when pointer capture is set, pointerover, pointerout, pointerenter, and pointerleave events are only generated when crossing the boundary of the capture target.
... example this example sets pointer capture on a <div> when you press down on it.
... this lets you slide the element horizontally, even when you pointer moves outside of its boundaries.
FileSystemEntry.moveTo() - Web APIs
when moving a directory, the move is always recursive; you can't leave out subfolders.
... successcallback optional a function which is called when the move operation is succesfully completed.
... example this example shows how a temporary log file might be moved into a more permanent "log" directory when it exceeds a megabyte in size.
FileSystemFileEntry.file() - Web APIs
syntax filesystemfileentry.file(successcallback[, errorcallback]); parameters successcallback a callback function which is called when the file has been created successfully; the file is passed into the callback as the only parameter.
... errorcallback optional if provided, this must be a method which is called when an error occurs while trying to create the file.
...the filereader's load event handler is set up to deliver the loaded string to the successcallback specified when the readfile() method was called; similarly, its error handler is set up to call the errorcallback specified.
FileSystemFlags - Web APIs
the filesystemflags dictionary defines a set of values which are used when specifying option flags when calling certain methods in the file and directory entries api.
... note that these option flags currently don't have any useful meaning when used in the scope of web content, where security precautions prevent the creation of new files or the replacement of existing ones.
... [1] when create is false, the value of exclusive is irrelevant and ignored.
FontFace.display - Web APIs
WebAPIFontFacedisplay
the display property of the fontface interface determines how a font face is displayed based on whether and when it is downloaded and ready to use.
... when this property is used, font loading has a timeline with three periods.
...when the font face loads, the fallback will be swaped for the downloaded font.
FontFace - Web APIs
WebAPIFontFace
it allows control of the source of the font face, being a url to an external resource, or a buffer; it also allows control of when the font face is loaded and its current status.
... fontface.display a cssomstring that determines how a font face is displayed based on whether and when it is downloaded and ready to use.
... fontface.loaded read only returns a promise that resolves with the current fontface object when the font specified in the object's constructor is done loading or rejects with a syntaxerror.
FormDataEvent - Web APIs
this happens when the form is submitted, but can also be triggered by the invocation of a formdata() constructor.
... this allows a formdata object to be quickly obtained in response to a formdata event firing, rather than needing to put it together yourself when you wish to submit form data via a method like xmlhttprequest (see using formdata objects).
... formdataevent.formdata contains the formdata object representing the data contained in the form when the event was fired.
Using the Geolocation API - Web APIs
when the position is determined, the defined callback function is executed.
... navigator.geolocation.getcurrentposition((position) => { dosomething(position.coords.latitude, position.coords.longitude); }); the above example will cause the dosomething() function to execute when the location is obtained.
... handling errors the error callback function, if provided when calling getcurrentposition() or watchposition(), expects a geolocationpositionerror object instance as its first parameter.
GlobalEventHandlers.onanimationcancel - Web APIs
an animationcancel event is sent when a css animation unexpectedly aborts, that is, any time it stops running without sending an animationend event.
... this can happen, for example, when the animation-name is changed such that the animation is removed, or when the animating node is hidden—either directly or because any of its containing nodes are hidden—using css.
... syntax var animcancelhandler = target.onanimationcancel; target.onanimationcancel = function value a function to be called when an animationcancel event occurs indicating that a css animation has begun on the target, where the target object is an html element (htmlelement), document (document), or window (window).
GlobalEventHandlers.onanimationiteration - Web APIs
the animationiteration event is sent when a css animation reaches the end of an iteration.
... an iteration ends when a single pass through the sequence of animation instructions is completed by executing the last animation step.
... syntax var animiterationhandler = target.onanimationiteration; target.onanimationiteration = function value a function to be called when an animationiteration event occurs indicating that a css animation has reached the end of an iteration while running on the target, where the target object is an html element (htmlelement), document (document), or window (window).
GlobalEventHandlers.onclick - Web APIs
the click event is raised when the user clicks on an element.
... note: when using the click event to trigger an action, also consider adding this same action to the keydown event, to allow the use of that same action by people who don't use a mouse or a touch screen.
... examples detecting clicks this example simply changes the color of an element when it's clicked upon.
GlobalEventHandlers.onload - Web APIs
the load event fires when a given resource has loaded.
... syntax target.onload = functionref; value functionref is the handler function to be called when the window’s load event fires.
...doctype html> <html> <head> <title>onload test</title> // es5 <script> function load() { console.log("load event detected!"); } window.onload = load; </script> // es2015 <script> const load = () => { console.log("load event detected!"); } window.onload = load; </script> </head> <body> <p>the load event fires when the document has finished loading!</p> </body> </html> notes the load event fires at the end of the document loading process.
GlobalEventHandlers.onpointerdown - Web APIs
the globaleventhandlers event handler onpointerdown is used to specify the event handler for the pointerdown event, which is fired when the pointing device is initially pressed.
... this is functionally equivalent to the mousedown event when generated due to user activity with a mouse or mouse-compatible device.
... we also have a handler for pointerup events: targetbox.onpointerup = handleup; function handleup(evt) { targetbox.innerhtml = "tap me, click me, or touch me!"; evt.preventdefault(); } this code's job is to just restore the original text into the target box after the user's interaction with the element ends (for example, when they release the mouse button, or when they lift the stylus or finger from the screen).
Audio() - Web APIs
determining when playback can begin there are three ways you can tell when enough of the audio file has loaded to allow playback to begin: check the value of the readystate property.
...it is sent to the <audio> element when there's enough audio available to begin playback, although interruptions may occur).
...it is sent when it's estimated that the audio should be able to play to the end without interruption.
HTMLButtonElement - Web APIs
htmlbuttonelement.autofocus is a boolean indicating whether or not the control should have input focus when the page loads, unless the user overrides it, for example by typing in a different control.
... htmlbuttonelement.formnovalidate is a boolean indicating that the form is not to be validated when it is submitted.
... htmlbuttonelement.name is a domstring representing the name of the object when submitted with a form.
HTMLCollection - Web APIs
an htmlcollection in the html dom is live; it is automatically updated when the underlying document is changed.
... an alternative to accessing collection[i] (which instead returns undefined when i is out-of-bounds).
... an alternative to accessing collection[name] (which instead returns undefined when name does not exist).
inert - Web APIs
WebAPIHTMLElementinert
the boolean inert attribute, when present, may make the browser "ignore" the element from assistive technologies, page search and text selection.
... this can be useful when building uis such as modals where you would want to "trap" the focus inside the modal when it's visible.
... according to the spec: when a node is inert, then the user agent must act as if the node was absent for the purposes of targeting user interaction events, may ignore the node for the purposes of text search user interfaces (commonly known as "find in page"), and may prevent the user from selecting text in that node.
HTMLElement: transitionend event - Web APIs
the transitionend event is fired when a css transition has completed.
... bubbles yes cancelable yes interface transitionevent event handler property ontransitionend the transitionend event is fired in both directions - as it finishes transitioning to the transitioned state, and when it fully reverts to the default or non-transitioned state.
...'transitionrun fired'; }); el.addeventlistener('transitionstart', function() { message.textcontent = 'transitionstart fired'; }); el.addeventlistener('transitioncancel', function() { message.textcontent = 'transitioncancel fired'; }); el.addeventlistener('transitionend', function() { message.textcontent = 'transitionend fired'; }); the transitionend event is fired in both directions: when the box finishes turning and the opacity hits 0 or 1, depending on the direction.
HTMLElement: transitionstart event - Web APIs
the transitionstart event is fired when a css transition has actually started, i.e., after any transition-delay has ended.
...r('.message'); transition.addeventlistener('transitionrun', function() { message.textcontent = 'transitionrun fired'; }); transition.addeventlistener('transitionstart', function() { message.textcontent = 'transitionstart fired'; }); transition.addeventlistener('transitionend', function() { message.textcontent = 'transitionend fired'; }); the difference is that: transitionrun fires when the transition is created (i.e.
... transitionstart fires when the actual animation has begun (i.e.
HTMLImageElement.decode() - Web APIs
the decode() method of the htmlimageelement interface returns a promise that resolves when the image is decoded and it is safe to append the image to the dom.
... usage notes one potential use case for decode(): when loading very large images (for example, in an online photo album), you can present a low resolution thumbnail image initially and then replace that image with the full-resolution image by instantiating a new htmlimageelement, setting its source to the full-resolution image's url, then using decode() to get a promise which is resolved once the full-resolution image is ready for use.
... examples the following example shows how to use the decode() method to control when an image is appended to the dom.
HTMLImageElement.src - Web APIs
syntax htmlimageelement.src = newsource; let src = htmlimageelement.src; value when providing only a single image, rather than a set of images from which the browser selects the best match for the viewport size and display pixel density, the src attribute is a usvstring specifying the url of the desired image.
... examples specifying a single image html <img src="https://udn.realityripple.com/samples/d6/7ab36d79bb.jpg" width="160" alt="slices of grapefruit, looking yummy."> result using src with an image set when using a set of images with the srcset property, the src serves as either a fallback for older browsers, or as the 1x size of the image.
... html result specifying a fallback for viewport-based selection when using viewport-bases selection of an image from a srcset by also specifying the sizes property, the src property serves as the fallback to be used on browsers that don't support viewport-based selection.
HTMLInputElement: invalid event - Web APIs
the invalid event fires when a submittable element has been checked for validity and doesn't satisfy its constraints.
...when a form is submitted, invalid events are fired at each form control that is invalid.
...in this example, when an invalid event fires because of an invalid value in the input, the invalid value is logged.
HTMLMediaElement: ended event - Web APIs
the ended event is fired when playback or streaming has stopped because the end of the media was reached or because no further data is available.
... this event occurs based upon htmlmediaelement (<audio> and <video>) fire ended when playback of the media reaches the end of the media.
... cancelable no interface event target element default action none event handler property globaleventhandlers.onended specification html5 media this event is also defined in media capture and streams and web audio api examples these examples add an event listener for the htmlmediaelement's ended event, then post a message when that event handler has reacted to the event firing.
HTMLMediaElement.play() - Web APIs
it returns a promise which is resolved when playback has been successfully started.
... return value a promise which is resolved when playback has been started, or is rejected if for any reason playback cannot be started.
... when this example is executed, it begins by collecting references to the <video> element as well as the <button> used to toggle playback on and off.
HTMLScriptElement - Web APIs
if the async attribute is absent but the defer attribute is present, then the script is executed when the page has finished parsing.
... note: when inserted using the document.write() method, <script> elements execute (typically synchronously), but when inserted using innerhtml or outerhtml, they do not execute at all.
... htmlscriptelement.referrerpolicy is a domstring that reflects the referrerpolicy html attribute indicating which referrer to use when fetching the script, and fetches done by that script.
HTMLSourceElement - Web APIs
the htmlsourceelement.src property has a meaning only when the associated <source> element is nested in a media element that is a <video> or an <audio> element.
... it has no meaning and is ignored when it is nested in a <picture> element.
... note: if the src property is updated (along with any siblings), the parent htmlmediaelement's load method should be called when done, since <source> elements are not re-scanned automatically.
The HTML DOM API - Web APIs
among the things added to document by the html standard are: support for accessing various information provided by the http headers when loading the page, such as the location from which the document was loaded, cookies, modification date, referring site, and so forth.
...in addition, promiserejectionevent represents the event delivered when a javascript promise is rejected.
... with this in place, the "send" button is always enabled whenever the user name input field has a value, and disabled when it's empty.
Dragging and Dropping Multiple Items - Web APIs
// [item1] data=url1, index=0 // [item2] data=url3, index=1 fortunately, you don't normally need to clear items often; it's more common to just add the items only when you know they are needed.
... common cases where dragging multiple items is used is when dragging multiple files or bookmarks.
... the dodrop event hander is called when dropping an item.
History - Web APIs
WebAPIHistory
back() this asynchronous method goes to the previous page in session history, the same action as when the user clicks the browser's back button.
... forward() this asynchronous method goes to the next page in session history, the same action as when the user clicks the browser's forward button; this is equivalent to history.go(1).
...if you specify an out-of-bounds value (for instance, specifying -1 when there are no previously-visited pages in the session history), this method silently has no effect.
Ajax navigation example - Web APIs
"</title>"; ?> </head> <body> <?php include "include/before_content.php"; ?> <p>this paragraph is shown only when the navigation starts from <strong>first_page.php</strong>.</p> <div id="ajax-content"> <?php } ?> <p>this is the content of <strong>first_page.php</strong>.</p> <?php if ($as_json) { echo json_encode(array("page" => $page_title, "content" => ob_get_clean())); } else { ?> </div> <p>this paragraph is shown only when the navigation starts from <strong>first_page.php</strong>...
..."</title>"; ?> </head> <body> <?php include "include/before_content.php"; ?> <p>this paragraph is shown only when the navigation starts from <strong>second_page.php</strong>.</p> <div id="ajax-content"> <?php } ?> <p>this is the content of <strong>second_page.php</strong>.</p> <?php if ($as_json) { echo json_encode(array("page" => $page_title, "content" => ob_get_clean())); } else { ?> </div> <p>this paragraph is shown only when the navigation starts from <strong>second_page.php</stro...
..."</title>"; ?> </head> <body> <?php include "include/before_content.php"; ?> <p>this paragraph is shown only when the navigation starts from <strong>third_page.php</strong>.</p> <div id="ajax-content"> <?php echo $page_content; ?> </div> <p>this paragraph is shown only when the navigation starts from <strong>third_page.php</strong>.</p> <?php include "include/after_content.php"; echo "</body>\n</html>"; } ?> css/style.css: #ajax-loader { position: fixed; display: table; ...
IDBDatabase.onclose - Web APIs
the onclose event handler of the idbdatabase interface handles the close event, which is fired when the database is unexpectedly closed.
... this can happen, for example, when the application is shut down or access to the disk the database is stored on is lost while the database is open.
...}; value a function which is called when the close event is fired.
IDBIndex - Web APIs
WebAPIIDBIndex
the records in an index are automatically populated whenever records in the referenced object store are inserted, updated, or deleted.
...when the object store changes, all indexes that refers to the object store are automatically updated.
... idbindex.multientry read only affects how the index behaves when the result of evaluating the index's key path yields an array.
IDBLocaleAwareKeyRange - Web APIs
the idblocaleawarekeyrange interface of the indexeddb api is a firefox-specific version of idbkeyrange — it functions in exactly the same fashion, and has the same properties and methods, but it is intended for use with idbindex objects when the original index had a locale value specified upon its creation (see createindex()'s optionalparameters) — that is, it has locale aware sorting enabled.
...this is because when you use bound(), it checks if lower bound < upper bound, and throws an exception if that’s not the case.
... developers should always use idblocaleawarekeyrange when dealing with locale-aware indexes.
IDBObjectStore.name - Web APIs
exceptions there are a several exceptions which can occur when you attempt to change an object store's name.
... invalidstateerror either the object store has been deleted or the current transaction is not an upgrade transaction; you can only rename indexes during upgrade transactions; that is, when the mode is "versionchange".
...ta(); }; function adddata() { // create a new object ready to insert into the idb var newitem = [ { tasktitle: "walk dog", hours: 19, minutes: 30, day: 24, month: "december", year: 2013, notified: "no" } ]; // open a read/write db transaction, ready for adding the data var transaction = db.transaction(["todolist"], "readwrite"); // report on the success of the transaction completing, when everything is done transaction.oncomplete = function(event) { note.innerhtml += '<li>transaction completed.</li>'; }; transaction.onerror = function(event) { note.innerhtml += '<li>transaction not opened due to error.
IDBObjectStore.put() - Web APIs
this is for adding new records, or updating existing records in an object store when the transaction's mode is readwrite.
... example the following example requests a given record title; when that request is successful the onsuccess function gets the associated record from the idbobjectstore (made available as objectstoretitlerequest.result), updates one property of the record, and then puts the updated record back into the object store in another request with put().
... objectstoretitlerequest.result; // update the notified value in the object to "yes" data.notified = "yes"; // create another request that inserts the item back into the database const updatetitlerequest = objectstore.put(data); // log the transaction that originated this request console.log("the transaction that originated this request is " + updatetitlerequest.transaction); // when this new request succeeds, run the displaydata() function again to update the display updatetitlerequest.onsuccess = () => { displaydata(); }; }; specification specification status comment indexed database api 2.0the definition of 'put()' in that specification.
IDBTransaction.onabort - Web APIs
the onabort event handler of the idbtransaction interface handles the abort event, fired, when the current transaction is aborted via the idbtransaction.abort method.
...note the transaction.onabort = function(event) { }; block, reporting when the transaction has been aborted.
...t to the object store var objectstorerequest = objectstore.add(newitem[0]); objectstorerequest.onsuccess = function(event) { // report the success of the request (this does not mean the item // has been stored successfully in the db - for that you need transaction.onsuccess) note.innerhtml += '<li>request successful.</li>'; }; transaction.onabort = function() { // report when the transaction was successfully aborted console.log("transaction aborted!"); }; // abort the transaction we just did transaction.abort(); }; specification specification status comment indexed database api 2.0the definition of 'onabort' in that specification.
IDBTransaction.oncomplete - Web APIs
the oncomplete event handler of the idbtransaction interface handles the complete event, fired when the transaction successfully completes.
...previously in a readwrite transaction idbtransaction.oncomplete was fired only when all data was guaranteed to have been flushed to disk.
...note the transaction.oncomplete = function(event) { }; block, which reports back when the transaction was successful.
IDBTransactionSync - Web APIs
when an application creates an idbtransactionsync object, it blocks until the browser is able to reserve the require database objects.
...when this method is called, the browser ignores all the changes performed to the objects of this database since this transaction was created.
...when this method is called, the browser durably stores all the changes performed to the objects of the database since this transaction was created.
KeyboardEvent: code values - Web APIs
these tables show those variations when known.
... kvk_f2 (0x78) "f2" "f2" kvk_pagedown (0x79) "pagedown" "pagedown" kvk_f1 (0x7a) "f1" "f1" kvk_leftarrow (0x7b) "arrowleft" "arrowleft" kvk_rightarrow (0x7c) "arrowright" "arrowright" kvk_downarrow (0x7d) "arrowdown" "arrowdown" kvk_uparrow (0x7e) "arrowup" "arrowup" code values on linux (x11) (when scancode is available) note that x has too many keys and some of them are not testable with usual keyboard.
... "" 0x00c3 "f17" "" 0x00c4 "f18" "" 0x00c5 "f19" "" 0x00c6 "f20" "" 0x00c7 "f21" "" 0x00c8 "f22" "" 0x00c9 "f23" "" 0x00ca "f24" "" 0x00cb ~ 0x00e0 "unidentified" "" 0x00e1 "browsersearch" "" code values on android and firefox os (when scancode is available) scancode gecko 0x0001 "escape" 0x0002 "digit1" 0x0003 "digit2" 0x0004 "digit3" 0x0005 "digit4" 0x0006 "digit5" 0x0007 "digit6" 0x0008 "digit7" 0x0009 "digit8" 0x000a "digit9" 0x000b "digit0" 0x000c "minus" ...
KeyboardEvent.code - Web APIs
this property is useful when you want to handle keys based on their physical positions on the input device rather than the characters associated with those keys; this is especially common when writing code to handle input for games that simulate a gamepad-like environment using keys on the keyboard.
... be aware, however, that you can't use the value reported by keyboardevent.code to determine the character generated by the keystroke, because the keycode's name may not match the actual character that's printed on the key or that's generated by the computer when the key is pressed.
...most real games would watch for keydown events, start motion when that happens, and stop the motion when the corresponding keyup occurs, instead of relying on key repeats.
KeyboardEvent.getModifierState() - Web APIs
modifier keys on gecko when getmodifierstate() returns true on gecko?
...event.getmodifierstate("accel") returns true when at least one of keyboardevent.ctrlkey or keyboardevent.metakey is true.
... in old implementations and outdated specifications, it returned true when a modifier which is the typical modifier key for the shortcut key is pressed.
MediaElementAudioSourceNode - Web APIs
mediaelement read only the htmlmediaelement used when constructing this mediastreamaudiosourcenode.
...when the mouse pointer is moved, the updatepage() function is invoked, which calculates the current gain as a ratio of mouse y position divided by overall window height.
...t'); pre.innerhtml = myscript.innerhtml; // create a mediaelementaudiosourcenode // feed the htmlmediaelement into it var source = audioctx.createmediaelementsource(myaudio); // create a gain node var gainnode = audioctx.creategain(); // create variables to store mouse pointer y coordinate // and height of screen var cury; var height = window.innerheight; // get new mouse pointer coordinates when mouse is moved // then set new gain value document.onmousemove = updatepage; function updatepage(e) { cury = (window.event) ?
MediaRecorder.start() - Web APIs
when the source stream ends, state is set to inactive and data gathering stops.
...this may be the case, for example, with sources obtained using getusermedia() when the user denies permission to use an input device.
... this also happens when a mediastreamtrack within the stream is marked as isolated due to the peeridentity constraint on the source stream.
MediaRecorderErrorEvent.error - Web APIs
when a media​recorder​error​event occurs, you can determine to some extent what went wrong by examining the error property within the media​recorder​error​event received by the mediarecorder's error event handler, onerror.
...this may be the case, for example, with sources obtained using getusermedia() when the user denies permission to use an input device.
... this also happens when a mediastreamtrack within the stream is marked as isolated due to the peeridentity constraint on the source stream.
MediaStreamAudioSourceNode - Web APIs
mediastream read only the mediastream used when constructing this mediastreamaudiosourcenode.
... the first track, then, is the track whose id comes first when the tracks' ids are all sorted by unicode code point.
...r.frequency.value = 1000; biquadfilter.gain.value = range.value; // connect the audiobuffersourcenode to the gainnode // and the gainnode to the destination, so we can play the // music and adjust the volume using the mouse cursor source.connect(biquadfilter); biquadfilter.connect(audioctx.destination); // get new mouse pointer coordinates when mouse is moved // then set new gain value range.oninput = function() { biquadfilter.gain.value = range.value; } }) .catch(function(err) { console.log('the following gum error occured: ' + err); }); } else { console.log('getusermedia not supported on your browser!'); } // dump script to pre element pre.innerhtml = myscript.innerhtml; ...
MediaStream Recording API - Web APIs
the data is delivered by a series of dataavailable events, already in the format you specify when creating the mediarecorder.
... set mediarecorder.ondataavailable to an event handler for the dataavailable event; this will be called whenever data is available for you.
... recording stops automatically when the source media stops playing.
MediaTrackConstraints.groupId - Web APIs
this makes it possible to use the group id to ensure that the audio and input devices are on the same headset by retrieving the group id of the input device and specifying it when asking for an output device, perhaps.
...that means that a given track will only return one value for the groupid when you call getcapabilities(), and keep in mind that this value will change for each browsing session.
... because of this, there's no use for the group id when calling mediastreamtrack.applyconstraints(), since there is only one possible value, and you can't use it to ensure the same group is used across multiple browsing sessions when calling getusermedia().
MediaTrackSettings.groupId - Web APIs
this lets you determine what value was selected to comply with your specified constraints for this property's value as described in the mediatrackconstraints.groupid property you provided when calling either getusermedia().
... since this property isn't stable across browsing sessions, its usefulness when calling getusermedia() is generally limited to ensuring that tasks performed during the same browsing session use devices from the same group (or that they don't use devices from the same group).
... there is no situation in which the groupid is useful when calling applyconstraints(), since the value can't be changed.
MediaTrackSettings - Web APIs
this value is specific to the source of the track's data and is not usable for setting constraints; it can, however, be used for initially selecting media when calling mediadevices.getusermedia().
...this value is specific to the source of the track's data and is not usable for setting constraints; it can, however, be used for initially selecting media when calling mediadevices.getusermedia().
... "environment" a camera facing away from the user (when the user is looking at the screen).
Using the Media Capabilities API - Web APIs
more and more finely-detailed information about the display's properties, so that informed decisions can be made when choosing the best format to play on the user's device.
...one feature of this is the ability to detect when the device switches gpus, so you can make appropriate adjustments based on the new gpu's capabilities.
... the framerate is the number of frames which are played per second of time when playing the video.
MessageEvent - Web APIs
in channel messaging or when sending a message to a shared worker).
...if the onmessage event is attached using addeventlistener, the port is manually started using its start() method: myworker.port.start(); when the port is started, both scripts post messages to the worker and handle messages sent from it using port.postmessage() and port.onmessage, respectively: first.onchange = function() { myworker.port.postmessage([first.value,second.value]); console.log('message posted to worker'); } second.onchange = function() { myworker.port.postmessage([first.value,second.value]); console.log('message ...
... onconnect = function(e) { var port = e.ports[0]; port.addeventlistener('message', function(e) { var workerresult = 'result: ' + (e.data[0] * e.data[1]); port.postmessage(workerresult); }); port.start(); // required when using addeventlistener.
MessagePort.onmessage - Web APIs
the onmessage event handler of the messageport interface is an eventlistener, called whenever an messageevent of type message is fired on the port — that is, when the port receives a message.
...when the iframe has loaded, we pass messagechannel.port2 to the iframe using messageport.postmessage along with a message.
... the handlemessage handler then responds to a message being sent back from the iframe using onmessage, putting it into a paragraph — messagechannel.port1 is listened to, to check when the message arrives.
MouseEvent.metaKey - Web APIs
the mouseevent.metakey read-only property is a boolean that indicates whether the meta key was pressed or not when a given mouse event occurs.
... be aware that many operating systems bind special functionality to the meta key, so this property may be false even when the key is actually pressed.
... example this example logs the metakey property when you trigger a click event.
msFirstPaint - Web APIs
msfirstpaint is a read-only property which gets the time when the document loaded by the window object began to be displayed to the user.
... put another way, msfirstpaint utilizes the browser to measure when the first content completes being painted in the window.
... syntax p = object.msfirstpaint; value an integer value that represents the time when the document began to be displayed or 0 if the document could not be loaded.
MutationObserver.MutationObserver() - Web APIs
the dom mutationobserver() constructor — part of the mutationobserver interface — creates and returns a new observer which invokes a specified callback when dom events occur.
... return value a new mutationobserver object, configured to call the specified callback when dom mutations occur.
...*/ break; } }); } the callback() function is invoked when the observer sees changes matching the configuration of the observation request specified when calling observe() to begin watching the dom.
MutationObserver - Web APIs
constructor mutationobserver() creates and returns a new mutationobserver which will invoke a specified callback function when dom changes occur.
... observe() configures the mutationobserver to begin receiving notifications through its callback function when dom changes matching the given options occur.
... // select the node that will be observed for mutations const targetnode = document.getelementbyid('some-id'); // options for the observer (which mutations to observe) const config = { attributes: true, childlist: true, subtree: true }; // callback function to execute when mutations are observed const callback = function(mutationslist, observer) { // use traditional 'for loops' for ie 11 for(let mutation of mutationslist) { if (mutation.type === 'childlist') { console.log('a child node has been added or removed.'); } else if (mutation.type === 'attributes') { console.log('the ' + mutation.attributename + ' att...
MutationObserverInit.attributes - Web APIs
if true, the callback specified when observe() was used to start observing the node or subtree will be called any time one or more attributes have changed on observed nodes.
... " changed to " + mutation.target[mutation.attributename] + " (was " + mutation.oldvalue + ")"); break; } }); } var targetnode = document.queryselector("#target"); var observer = new mutationobserver(callback); observer.observe(targetnode, { attributes: true, attributeoldvalue: true }); the callback() function—which will be passed into the observe() method when starting the observer, looks at each item in the list of mutationrecord objects.
... when observe() is called, the specified options are attributes and attributeoldvalue, which means that changes to attribute values will be reported, and each mutation record will include the oldvalue property specifying the attribute's previous value.
MutationObserverInit - Web APIs
properties at a minimum, one of childlist, attributes, and/or characterdata must be true when you call observe().
... attributeoldvalue optional set to true to record the previous value of any attribute that changes when monitoring the node or nodes for attribute changes; see monitoring attribute values in mutationobserver for details on watching for attribute changes and value recording.
... characterdataoldvalue optional set to true to record the previous value of a node's text whenever the text changes on nodes being monitored.
Navigator.requestMediaKeySystemAccess() - Web APIs
consider that when deciding when to call requestmediakeysystemaccess(); you don't want those requests to happen at inconvenient times.
... as a general rule, this function should be called only when it's about time to create and use a mediakeys object by calling the returned mediakeysystemaccess object's createmediakeys() method.
... return value a promise that, when resolved, delivers a mediakeysystemaccess object to your fulfillment handler function.
Navigator - Web APIs
WebAPINavigator
the null value is returned when this is unknown.
... navigator.credentials returns the credentialscontainer interface which exposes methods to request credentials and notify the user agent when interesting events occur such as successful sign in or sign out.
...when this value is "yes", your web site or application should not track the user.
Node.baseURI - Web APIs
WebAPINodebaseURI
the base url is used to resolve relative urls when the browser needs to obtain an absolute url, for example when processing the html <img> element's src attribute or xml xlink:href attribute.
... details the base url of a document the base url of a document defaults to the document's address (as displayed by the browser and available in window.location), but it can be changed: when an html <base> tag is found in the document when the document is new (created dynamically) see the base urls section of the html living standard for details.
... if the document contains xml:base attributes (which you shouldn't do in html documents), the element.baseuri takes the xml:base attributes of element's parents into account when computing the base url.
Node.prefix - Web APIs
WebAPINodeprefix
<x:div onclick="console.log(this.prefix)"/> notes this will only work when a namespace-aware parser is used, i.e.
... when a document is served with an xml mime type.
... obsolete specifies the behavior when it's set to null.
Notification.Notification() - Web APIs
badge: a usvstring containing the url of the image used to represent the notification when there isn't enough space to display the notification itself.
... actions: an array of notificationactions representing the actions available to the user when the notification is presented.
... example in our emogotchi demo (see source code), we run a spawnnotification() function when we want to trigger a notification.
Notification - Web APIs
notification.badge read only the url of the image used to represent the notification when there is not enough space to display the notification itself.
...it is triggered when the user closes the notification.
...it is triggered when the notification is displayed.
Notifications API - Web APIs
these are outside the top-level browsing context viewport, so therefore can be displayed even when the user has switched tabs or moved to a different app.
...first, the user needs to grant the current origin permission to display system notifications, which is generally done when the app or site initialises, using the notification.requestpermission() method.
... serviceworkerglobalscope includes the serviceworkerglobalscope.onnotificationclick handler, for firing custom functions when a notification is clicked.
OfflineAudioContext.startRendering() - Web APIs
the complete event (of type offlineaudiocompletionevent) is raised when the rendering is finished, containing the resulting audiobuffer in its renderedbuffer property.
... when the startrendering() promise resolves, rendering has completed and the output audiobuffer is returned out of the promise.
...audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var song = audioctx.createbuffersource(); song.buffer = renderedbuffer; song.connect(audioctx.destination); play.onclick = function() { song.start(); } }).catch(function(err) { console.log('rendering failed: ' + err); // note: the promise should reject when startrendering is called a second time on an offlineaudiocontext }); }); } request.send(); } // run getdata to start the process off getdata(); specifications specification status comment web audio apithe definition of 'startrendering()' in that specification.
PaymentRequest.onshippingoptionchange - Web APIs
the onshippingoptionchange event of the paymentrequest interface is fired whenever the user changes a shipping option.
...to make sure an updated option is included when sending payment information to the server, you should add event listeners for a paymentrequest object after instantiation, but before the call to show().
...var request = new paymentrequest(supportedinstruments, details, options); // when user selects a shipping address request.addeventlistener('shippingaddresschange', e => { e.updatewith(((details, addr) => { var shippingoption = { id: '', label: '', amount: { currency: 'usd', value: '0.00' }, selected: true }; // shipping to us is supported if (addr.country === 'us') { shippingoption.id = 'us'; shippingoption.label = 'standard shipping in us'; shippingoption.amount.value = '0.00'; details.total.amount.value = '55.00'; // shipping to jp is supported } else if (addr.country === 'jp') { shippingoption.id = 'jp'; shippingoption.label = 'int...
PaymentRequest.show() - Web APIs
the promise is resolved when the user accepts the payment request (such as by clicking a "pay" button in the browser's payment sheet).
... notsupportederror the promise rejects with a notsupportederror if the user agent does not support the payment methods specified when the paymentrequest constructor was called.
...the show() method returns a promise that resolves to a paymentresponse object when the user interaction is complete.
PaymentRequestUpdateEvent - Web APIs
the paymentrequestupdateevent interface is used for events sent to a paymentrequest instance when changes are made to shipping-related information for a pending paymentrequest.
... those events are: shippingaddresschange secure context dispatched whenever the user changes their shipping address.
... shippingoptionchange secure context dispatched whenever the user changes a shipping option.
PaymentResponse.retry() - Web APIs
return value a promise which is resolved when the payment is successfully completed.
...if a retry is needed, the loop calls retry(), then loops back to check the response when it comes in.
... the loop exits only when the user either cancels the payment request or the request is successful.
Performance.onresourcetimingbufferfull - Web APIs
the onresourcetimingbufferfull property is an event handler that will be called when the resourcetimingbufferfull event is fired.
... this event is fired when the browser's resource timing performance buffer is full.
... syntax callback = performance.onresourcetimingbufferfull = buffer_full_cb; return value callback an eventhandler that is invoked when the resourcetimingbufferfull event is fired.
PerformanceEventTiming - Web APIs
// keep track of whether (and when) the page was first hidden, see: // https://github.com/w3c/page-visibility/issues/29 // note: ideally this check would be performed in the document <head> // to avoid cases where the visibility state changes before this code runs.
... (navigator.sendbeacon && navigator.sendbeacon('/analytics', body)) || fetch('/analytics', {body, method: 'post', keepalive: true}); } // use a try/catch instead of feature detecting `first-input` // support, since some browsers throw when using the new `type` option.
...this typically happens when a // page is loaded in a background tab.
PointerEvent.isPrimary - Web APIs
a pointer representing pen input is considered the primary pen input if its pointerdown event was dispatched when no other active pointers representing pen input existed.
... a pointer representing touch input is considered the primary touch input if its pointerdown event was dispatched when no other active pointers representing touch input existed.
... when two or more pointer device types are being used concurrently, multiple pointers (one for each pointertype) are considered primary.
PromiseRejectionEvent - Web APIs
the promiserejectionevent interface represents events which are sent to the global script context when javascript promises are rejected.
... events rejectionhandled fired when a javascript promise is rejected, and after the rejection is handled by the promise's rejection handling code.
... unhandledrejection fired when a javascript promise is rejected but there is no rejection handler to deal with the rejection.
RTCConfiguration.certificates - Web APIs
the rtcconfiguration dictionary's optional certificates property is an array of rtccertificate objects providing the security certificates available for use when authenticating duing the connection process.
...]; let certificates = rtcconfiguration.certificates; value an array of rtccertificate objects, each specifying one security certificate available for use when connecting to a remote peer.
... using certificates when you wish to provide your own certificates for use by an rtcpeerconnection instead of having the rtcpeerconnection generate them automatically, you do so by calling the static rtcpeerconnection.generatecertificate() function.
RTCDataChannel.label - Web APIs
it's entirely up to the design decisions made when building your site or app.
... a data channel's label is set when the channel is created by calling rtcpeerconnection.createdatachannel().
... syntax var name = adatachannel.label; value a string identifier assigned by the web site or app when the data channel was created, as specified when rtcpeerconnection.createdatachannel() was called to create the channel.
RTCDataChannel.maxRetransmits - Web APIs
the read-only rtcdatachannel property maxretransmits returns the maximum number of times the browser should try to retransmit a message before giving up, as set when the data channel was created, or null, which indicates that there is no maximum.
... this can only be set when the rtcdatachannel is created by calling rtcpeerconnection.createdatachannel(), using the maxretransmits field in the specified options.
... syntax var tries = adatachannel.maxretransmits; value the maximum number of times the browser will try to retransmit a message before giving up, or null if not set when rtcpeerconnection.createdatachannel() was called.
RTCDataChannel.onerror - Web APIs
the rtcdatachannel.onerror property is an eventhandler which specifies a function to be called when the error event is received.
... when an error occurs on the data channel, the function receives as input an errorevent object describing the error which occurred.
... syntax rtcdatachannel.onerror = function; value a function which the browser will call to handle the error event when it occurs on the data channel.
RTCIceCandidate.usernameFragment - Web APIs
this value is specified when creating the rtcicecandidate by setting the corresponding usernamefragment value in the rtcicecandidateinit object when creating a new candidate with new rtcicecandidate().
... when the web app receives a message from the signaling server that includes a candidate to be added to the rtcpeerconnection, you can (and generally should) simply call addicecandidate().
...the function below, ssnewcandidate(), is called when a message, signalmsg, arrives from the signaling server that contains an ice candidate to be added to the rtcpeerconnection.
RTCIceTransport.ongatheringstatechange - Web APIs
the ongatheringstatechange event handler for the rtcicetransport interface specifies an event handler that is to be called when the gatheringstatechange event occurs on the transport.
... this event is delivered whenever the transport's gatheringstate property changes.
... syntax rtcicetransport.ongatheringstatechange = statechangehandler; value a function to be called when the rtcicetransport object's gathering state changes.
RTCPeerConnection() - Web APIs
rtcconfiguration dictionary bundlepolicy optional specifies how to handle negotiation of candidates when the remote peer is not compatible with the sdp bundle standard.
...you may find in some cases that connections can be established more quickly by allowing the ice agent to start fetching ice candidates before you start trying to connect, so that they're already available for inspection when rtcpeerconnection.setlocaldescription() is called.
... rtcpmuxpolicy optional the rtcp mux policy to use when gathering ice candidates, in order to support non-multiplexed rtcp.
RTCPeerConnection.addTransceiver() - Web APIs
init optional an object that conforms to the rtcrtptransceiverinit dictionary which provides any options that you may wish to specify when creating the new transceiver.
... sendencodings optional a list of encodings to allow when sending rtp media from the rtcrtpsender.
... streams optional a list of mediastream objects to add to the transceiver'srtcrtpreceiver; when the remote peer's rtcpeerconnection's track event occurs, these are the streams that will be specified by that event.
RTCPeerConnection.getStats() - Web APIs
successcallback a callback function to call when the stats have been retrieved.
... failurecallback a function to call when an error occurs while attempting to collect statistics.
... // sorted to the top above object.keys(report).foreach(statname => { if (statname !== "id" && statname !== "timestamp" && statname !== "type") { statsoutput += `<strong>${statname}:</strong> ${report[statname]}<br>\n`; } }); }); document.queryselector(".stats-box").innerhtml = statsoutput; }); }, 1000); this works by calling getstats(), then, when the promise is resolved, iterates over the rtcstats objects on the returned rtcstatsreport.
RTCPeerConnection.iceGatheringState - Web APIs
this lets you detect, for example, when collection of ice candidates has finished.
... you can detect when the value of this property changes by watching for an event of type icegatheringstatechange.
...you can detect when this value changes by watching for an event of type icegatheringstatechange.
RTCPeerConnection: icegatheringstatechange event - Web APIs
the icegatheringstatechange event is sent to the onicegatheringstatechange event handler on an rtcpeerconnection when the state of the ice candidate gathering process changes.
... when ice firststarts to gather connection candidates, the value changes from new to gathering to indicate that the process of collecting candidate configurations for the connection has begun.
... when the value changes to complete, all of the transports that make up the rtcpeerconnection have finished gathering ice candidates.
RTCPeerConnection.onaddstream - Web APIs
the rtcpeerconnection.onaddstream event handler is a property containing the code to execute when the addstream event, of type mediastreamevent, is received by this rtcpeerconnection.
... such an event is sent when a mediastream is added to this connection by the remote peer.
...these events, of type mediastreamevent, are sent when streams are added to the connection by the remote peer.
RTCPeerConnection.onconnectionstatechange - Web APIs
the rtcpeerconnection.onconnectionstatechange property specifies an eventhandler which is called to handle the connectionstatechange event when it occurs on an instance of rtcpeerconnection.
... this happens whenever the aggregate state of the connection changes.
... syntax rtcpeerconnection.onconnectionstatechange = eventhandler; value a function which is called by the browser when the connectionstatechange event occurs on the rtcpeerconnection.
RTCPeerConnection.onnegotiationneeded - Web APIs
the rtcpeerconnection interface's onnegotiationneeded property is an eventlistener which specifies a function which is called to handle the negotiationneeded event when it occurs on an rtcpeerconnection instance.
... this event is fired when a change has occurred which requires session negotiation.
...when that succeeds, the offer is passed into setlocaldescription() to set the local description for the connection.
RTCRtpEncodingParameters - Web APIs
codecpayloadtype when describing a codec for an rtcrtpsender, codecpayloadtype is a single 8-bit byte (or octet) specifying the codec to use for sending the stream; the value matches one from the owning rtcrtpparameters object's codecs parameter.
... this value can only be set when creating the transceiver; after that, this value is read only.
...its value can only be set when the transceiver is first created.
RTCRtpSendParameters.encodings - Web APIs
codecpayloadtype when describing a codec for an rtcrtpsender, codecpayloadtype is a single 8-bit byte (or octet) specifying the codec to use for sending the stream; the value matches one from the owning rtcrtpparameters object's codecs parameter.
... this value can only be set when creating the transceiver; after that, this value is read only.
...its value can only be set when the transceiver is first created.
RTCRtpTransceiverInit - Web APIs
the rtcrtptransceiverinit dictionary is used when calling the webrtc function rtcpeerconnection.addtransceiver() to provide configuration options for the new transceiver.
... sendencodings optional a list of encodings to allow when sending rtp media from the rtcrtpsender.
... streams optional a list of mediastream objects to add to the transceiver'srtcrtpreceiver; when the remote peer's rtcpeerconnection's track event occurs, these are the streams that will be specified by that event.
ReadableStream.ReadableStream() - Web APIs
underlyingsource can contain the following: start(controller) this is a method, called immediately when the object is constructed.
... pull(controller) optional this method, also defined by the developer, will be called repeatedly when the stream's internal queue of chunks is not full, up until it reaches its high water mark.
... when a button is pressed, the generation is stopped, the stream is closed using readablestreamdefaultcontroller.close(), and another function is run, which reads the data back out of the stream.
ReadableStream.pipeTo() - Web APIs
the pipeto() method of the readablestream interface pipes the current readablestream to a given writablestream and returns a promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered.
... options optional the options that should be used when piping to the writable stream.
... return value a promise that resolves when the piping process has completed.
ResizeObserverEntry - Web APIs
properties resizeobserverentry.borderboxsize read only an object containing the new border box size of the observed element when the callback is run.
... resizeobserverentry.contentboxsize read only an object containing the new content box size of the observed element when the callback is run.
... resizeobserverentry.contentrect read only a domrectreadonly object containing the new size of the observed element when the callback is run.
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?
... such a solution tends to only work for limited use cases, be bad for performance (continually calling the above methods would result in a big performance hit), and often won't work when the browser window size is not changed.
...when the viewport size is changed, the box's rounded corners change in proportion to the size of the box.
Using the Resource Timing API - Web APIs
performance.setresourcetimingbuffersize() = not supported"); } } the performance interface has a onresourcetimingbufferfull event handler that gets called (with an event of type event.type of "resourcetimingbufferfull") when the browser's resource performance entry buffer is full.
...to trigger "resource" fetch events var image1 = new image(); image1.src = "https://developer.mozilla.org/static/img/opengraph-logo.png"; var image2 = new image(); image2.src = "http://mozorg.cdn.mozilla.net/media/img/firefox/firefox-256.e2c1fc556816.jpg" // set a callback if the resource buffer becomes filled performance.onresourcetimingbufferfull = buffer_full; } coping with cors when cors is in effect, many of the timing properties' values are returned as zero unless the server's access policy permits these values to be shared.
... the properties which are returned as 0 by default when loading a resource from a domain other than the one of the web page itself: redirectstart, redirectend, domainlookupstart, domainlookupend, connectstart, connectend, secureconnectionstart, requeststart, and responsestart.
Resource Timing API - Web APIs
when cors is in effect, many of these values are returned as zero unless the server's access policy permits these values to be shared.
... the properties which are returned as 0 by default when loading a resource from a domain other than the one of the web page itself: redirectstart, redirectend, domainlookupstart, domainlookupend, connectstart, connectend, secureconnectionstart, requeststart, and responsestart.
... if the current context is a worker, the workerstart property can be used to obtain a domhighrestimestamp when the worker was started.
Response.redirected - Web APIs
instead, you should actually instead do the filtering when you call fetch().
...in the code below, a textual message is inserted into an element when a redirect occurred during the fetch operation.
...se { elem.innerhtml = ""; } return response.blob(); }).then(function(imageblob) { let imgobjecturl = url.createobjecturl(imageblob); document.getelementbyid("img-element-id").src = imgobjecturl; }); disallowing redirects because using redirected to manually filter out redirects can allow forgery of redirects, you should instead set the redirect mode to "error" in the init parameter when calling fetch(), like this: fetch("awesome-picture.jpg", { redirect: "error" }).then(function(response) { return response.blob(); }).then(function(imageblob) { let imgobjecturl = url.createobjecturl(imageblob); document.getelementbyid("img-element-id").src = imgobjecturl; }); specifications specification status comment fetchthe definition of 'redirected' in that s...
SVGAElement.target - Web APIs
the svgaelement.target read-only property of svgaelement returns an svganimatedstring object that specifies the portion of a target window, frame, pane into which a document is to be opened when a link is activated.
... this property is used when there are multiple possible targets for the ending resource, like when the parent document is a mlti-frame html or xhtml document.
... syntax mylink.target = 'value'; value an svganimatedstring indicating the ending resource target that opens the document when the link is activated.
SVGAnimationElement - Web APIs
beginevent fired when the element local timeline begins to play.
... endevent fired when at the active end of the animation is reached.
... repeatevent fired when the element's local timeline repeats.
Selection.containsNode() - Web APIs
partialcontainment optional when true, containsnode() returns true when a part of the node is part of the selection.
... when false, containsnode() only returns true when the entire node is part of the selection.
... console.log(window.getselection().containsnode(document.body, true)); find the hidden word in this example, a message appears when you select the secret word.
Sensor - Web APIs
WebAPISensor
event handlers sensor.onerror called when an error occurs on one of the child interfaces of the sensor interface.
... sensor.onreading called when a reading is taken on one of the child interfaces of the sensor interface.
... sensor.onactivate called when one of the sensor interface's becomes active.
ServiceWorkerContainer.register() - Web APIs
since a service worker can't have a scope broader than its own location, only use the scope option when you need a scope that is narrower than the default.
...remember the scope, when included, uses the page's location as its base.
...since a service worker can't have a scope broader than its own location, only use the scope option when you need a scope that is narrower than the default.
ServiceWorkerGlobalScope: pushsubscriptionchange event - Web APIs
note: in earlier drafts of the specification, this event was defined to be sent when a pushsubscription has expired.
...pushsubscriptionchange", event => { event.waituntil(swregistration.pushmanager.subscribe(event.oldsubscription.options) .then(subscription => { return fetch("register", { method: "post", headers: { "content-type": "application/json" }, body: json.stringify({ endpoint: subscription.endpoint }) }); }) ); }, false); when a pushsubscriptionchange event arrives, indicating that the subscription has expired, we resubscribe by calling the push manager's subscribe() method.
... when the returned promise is resolved, we receive the new subscription.
SharedWorker - Web APIs
abstractworker.onerror is an eventlistener that is called whenever an errorevent of type error bubbles through the worker.
...if the onmessage event is attached using addeventlistener, the port is manually started using its start() method: myworker.port.start(); when the port is started, both scripts post messages to the worker and handle messages sent from it using port.postmessage() and port.onmessage, respectively: first.onchange = function() { myworker.port.postmessage([first.value,second.value]); console.log('message posted to worker'); } second.onchange = function() { myworker.port.postmessage([first.value,second.value]); console.log('message ...
... onconnect = function(e) { var port = e.ports[0]; port.addeventlistener('message', function(e) { var workerresult = 'result: ' + (e.data[0] * e.data[1]); port.postmessage(workerresult); }); port.start(); // required when using addeventlistener.
SharedWorkerGlobalScope - Web APIs
sharedworkerglobalscope.name read only the name that the sharedworker was (optionally) given when it was created using the sharedworker() constructor.
... sharedworkerglobalscope.onconnect is an eventhandler representing the code to be called when the connect event is raised — that is, when a messageport connection is opened between the associated sharedworker and the main thread.
... connect fired on shared workers when a new client connects.
SubtleCrypto.deriveKey() - Web APIs
exceptions the promise is rejected when one of the following exceptions are encountered: invalidaccesserror raised when the master key is not a key for the requested derivation algorithm or if the cryptokey.usages value of that key doesn't contain derivekey.
... notsupported raised when trying to use an algorithm that is either unknown or isn't suitable for derivation, or if the algorithm requested for the derived key doesn't define a key length.
... syntaxerror raised when keyusages is empty but the unwrapped key is of type secret or private.
SubtleCrypto.encrypt() - Web APIs
exceptions the promise is rejected when the following exceptions are encountered: invalidaccesserror raised when the requested operation is not valid for the provided key (e.g.
... operationerror raised when the operation failed for an operation-specific reason (e.g.
...while it's possible to add authentication to ctr and cbc modes, they do not provide it by default and when implementing it manually one can easily make minor, but serious mistakes.
SubtleCrypto.sign() - Web APIs
WebAPISubtleCryptosign
exceptions the promise is rejected when the following exception is encountered: invalidaccesserror raised when the signing key is not a key for the request signing algorithm or when trying to use an algorithm that is either unknown or isn't suitable for signing.
...it can be a good choice however when the signer and verifier are the same entity.
...an extra property, defining the salt length, is passed into the sign() and verify() functions when they are invoked.
SubtleCrypto.wrapKey() - Web APIs
exceptions the promise is rejected when one of the following exceptions is encountered: invalidaccesserror raised when the wrapping key is not a key for the requested wrap algorithm.
... notsupported raised when trying to use an algorithm that is either unknown or isn't suitable for encryption or wrapping.
... typeerror raised when trying to use an invalid format.
TextTrack.mode - Web APIs
WebAPITextTrackmode
safari additionally requires the default boolean attribute to be set to true when implementing your own video player controls in order for the subtitles cues to be shown.
...when a text track is loaded in the disabled state, the corresponding webvtt file is not loaded until the state changes to either showing or hidden.
... when the mode is showing, text tracks are performed.
TextTrackList.onaddtrack - Web APIs
the texttracklist property onaddtrack is an event handler which is called when the addtrack event occurs, indicating that a new text track has been added to the media element whose text tracks the texttracklist represents.
... usage notes the addtrack event is called whenever a new track is added to the media element whose video tracks are represented by the texttracklist object.
... this happens when tracks are added to the element when the media is first attached to the element; one addtrack event will occur for each video track in the media resource.
Touch.target - Web APIs
WebAPITouchtarget
summary returns the element (eventtarget) on which the touch contact started when it was first placed on the surface, even if the touch point has since moved outside the interactive area of that element or even been removed from the document.
...the touch.target property is an element (eventtarget) on which a touch point is started when contact is first placed on the surface.
...when the touchstart event handler for this element is invoked, each touch point's touch.target property is accessed via the event's touchevent.targettouches list.
TrackDefault - Web APIs
trackdefault.language read only returns the default language to use when an initialization segment does not contain language information for a new track.
... trackdefault.label read only returns the default label to use when an initialization segment does not contain label information for a new track.
... trackdefault.kinds read only returns the default kinds used when an initialization segment does not contain kind information for a new track.
sourceCapabilities - Web APIs
when a single user interaction with an input device generates a series of different input events, the sourcecapabilities property for all of them will point to the same instance of inputdevicecapabilities.
... for example, when a user lifts their finger off of a touchscreen, several uievents may be generated including touchend, mousedown, click, and focus.
... a device is considered "responsible" for an event only when that interaction is part of the abstraction provided by the web platform.
VideoTrackList.onaddtrack - Web APIs
the videotracklist property onaddtrack is an event handler which is called when the addtrack event occurs, indicating that a new video track has been added to the media element whose video tracks the videotracklist represents.
... usage notes the addtrack event is called whenever a new track is added to the media element whose video tracks are represented by the videotracklist object.
... this happens when tracks are added to the element when the media is first attached to the element; one addtrack event will occur for each video track in the media resource.
WebGLRenderingContext.checkFramebufferStatus() - Web APIs
when using a webgl 2 context, the following values are available additionally: gl.draw_framebuffer: equivalent to gl.framebuffer.
... when using a webgl 2 context, the following values can be returned additionally: gl.framebuffer_incomplete_multisample: the values of gl.renderbuffer_samples are different among attached renderbuffers, or are non-zero if the attached images are a mix of renderbuffers and textures.
... when using the ovr_multiview2 extension, the following value can be returned additionally: ext.framebuffer_incomplete_view_targets_ovr: if baseviewindex is not the same for all framebuffer attachment points where the value of framebuffer_attachment_object_type is not none, the framebuffer is considered incomplete.
WebGLRenderingContext.framebufferRenderbuffer() - Web APIs
when using a webgl 2 context, the following values are available additionally: gl.draw_framebuffer: equivalent to gl.framebuffer.
... when using a webgl 2 context, the following values are available additionally: gl.color_attachment1 gl.color_attachment2 gl.color_attachment3 gl.color_attachment4 gl.color_attachment5 gl.color_attachment6 gl.color_attachment7 gl.color_attachment8 gl.color_attachment9 gl.color_attachment10 gl.color_attachment11 gl.color_attachment12 gl...
....color_attachment13 gl.color_attachment14 gl.color_attachment15 when using the webgl_draw_buffers extension: ext.color_attachment0_webgl (same as gl.color_attachment0) ext.color_attachment1_webgl ext.color_attachment2_webgl ext.color_attachment3_webgl ext.color_attachment4_webgl ext.color_attachment5_webgl ext.color_attachment6_webgl ext.color_attachment7_webgl ext.color_attachment8_webgl ext.color_attachment9_webgl ext.color_attachment10_webgl ext.color_attachment11_webgl ext.color_attachment12_webgl ext.color_attachment13_webgl ext.color_attachment14_webgl ext.color_attachment15_webgl renderbuffertarget a glenum specifying the binding point (target) for the render buffer.
WebGLRenderingContext.getActiveUniform() - Web APIs
it is generally used when querying unknown uniforms either for debugging or generic library creation.
... the type attribute of the return value will be one of the following: gl.float gl.float_vec2 gl.float_vec3 gl.float_vec4 gl.int gl.int_vec2 gl.int_vec3 gl.int_vec4 gl.bool gl.bool_vec2 gl.bool_vec3 gl.bool_vec4 gl.float_mat2 gl.float_mat3 gl.float_mat4 gl.sampler_2d gl.sampler_cube when using a webgl 2 context, the following values are possible additionally: gl.unsigned_int gl.unsigned_int_vec2 gl.unsigned_int_vec3 gl.unsigned_int_vec4 gl.float_mat2x3 gl.float_mat2x4 gl.float_mat3x2 gl.float_mat3x4 gl.float_mat4x2 gl.float_mat4x3 gl.sampler_2d gl.sampler_3d gl.sampler_cube gl.sampler_2d_shadow gl.sampler_2d_array gl.sampler_2d_a...
...rray_shadow gl.sampler_cube_shadow gl.int_sampler_2d gl.int_sampler_3d gl.int_sampler_cube gl.int_sampler_2d_array gl.unsigned_int_sampler_2d gl.unsigned_int_sampler_3d gl.unsigned_int_sampler_cube gl.unsigned_int_sampler_2d_array when gl.linkprogram is called, webgl creates a list of active uniforms.
WebGLRenderingContext.getTexParameter() - Web APIs
when using a webgl 2 context, the following values are available additionally: gl.texture_3d: a three-dimensional texture.
... additionally available when using the ext_texture_filter_anisotropic extension ext.texture_max_anisotropy_ext glfloat maximum anisotropy for a texture any float values.
... additionally available when using a webgl 2 context gl.texture_base_level glint texture mipmap level any int values.
WebGLRenderingContext.texParameter[fi]() - Web APIs
when using a webgl 2 context, the following values are available additionally: gl.texture_3d: a three-dimensional texture.
... additionally available when using the ext_texture_filter_anisotropic extension ext.texture_max_anisotropy_ext maximum anisotropy for a texture a glfloat value.
... additionally available when using a webgl 2 context gl.texture_base_level texture mipmap level any int values.
Basic scissoring - Web APIs
clearing the drawing buffer when scissoring applies this is a simple demonstration of a rendering with scissor().
...in other cases, the fragments may be discarded altogether (so the pixel value is not updated), or it may interact with the already existing pixel value (such as when doing color blending for non-opaque elements in the scene).
...only when the webgl state has been satisfactorily tweaked, we execute the drawing command (in this case, clear()) that starts the processing of fragments down the graphics pipeline.
Scissor animation - Web APIs
in contrast, the color of the square (set with clearcolor) is only updated when a new square is created.
...the clear color state of webgl remains at the set value, until we change it again when a new square is created.
... position[1] -= velocity; // when the sqaure hits the bottom of the drawing buffer, // we override it with new square of different color and // velocity.
Adding 2D content to a WebGL context - Web APIs
there are two shader functions run when drawing webgl content: the vertex shader and the fragment shader.
...but when we do our math, we will need it to be a vec4, so rather than convert it to a vec4 every time we do math, we'll just use a vec4 from the beginning.
... // how many bytes inside the buffer to start from gl.bindbuffer(gl.array_buffer, buffers.position); gl.vertexattribpointer( programinfo.attriblocations.vertexposition, numcomponents, type, normalize, stride, offset); gl.enablevertexattribarray( programinfo.attriblocations.vertexposition); } // tell webgl to use our program when drawing gl.useprogram(programinfo.program); // set the shader uniforms gl.uniformmatrix4fv( programinfo.uniformlocations.projectionmatrix, false, projectionmatrix); gl.uniformmatrix4fv( programinfo.uniformlocations.modelviewmatrix, false, modelviewmatrix); { const offset = 0; const vertexcount = 4; gl.drawarrays(gl.triangle_strip, offs...
Using textures in WebGL - Web APIs
// when the image finished loading copy it into the texture.
...when the image has finished downloading // we'll update the texture with the contents of the image.
...a 2d <canvas> becomes tainted, for example, when a cross-domain image is drawn on it.
Writing WebSocket client applications - Web APIs
establishing a websocket relies on the http upgrade mechanism, so the request for the protocol upgrade is implicit when we address the web server as ws://www.example.com or wss://www.example.com.
... document.getelementbyid("text").value = ""; } receiving messages from the server websockets is an event-driven api; when messages are received, a message event is sent to the websocket object.
... closing the connection when you've finished using the websocket connection, call the websocket method close(): examplesocket.close(); it may be helpful to examine the socket's bufferedamount attribute before attempting to close the connection to determine if any data has yet to be transmitted on the network.
The WebSocket API (WebSockets) - Web APIs
closeevent the event sent by the websocket object when the connection closes.
... messageevent the event sent by the websocket object when a message is received from the server.
... signalr: signalr will use websockets under the covers when it's available, and gracefully fallback to other techniques and technologies when it isn't, while your application code stays the same.
Migrating from webkitAudioContext - Web APIs
= "arraybuffer"; xhr.send(); xhr.onload = function() { context.decodeaudiodata(xhr.response, function onsuccess(decodedbuffer) { // decoding was successful, do something useful with the audio buffer }, function onfailure() { alert("decoding the audio buffer failed"); }); }; note that the decodeaudiodata() method is asynchronous, which means that it will return immediately, and then when the decoding finishes, one of the success or failure callback functions will get called depending on whether the audio decoding was successful.
... if you need to know when playback of the node is finished (which is the most significant use case of playbackstate), there is a new ended event which you can use to know when playback is finished.
... console.log(context.activesourcecount); could be rewritten like that: // array to track the playing source nodes: var sources = []; // when starting the source, put it at the end of the array, // and set a handler to make sure it gets removed when the // audiobuffersourcenode reaches its end.
Window.devicePixelRatio - Web APIs
this is useful when dealing with the difference between rendering on a standard display versus a hidpi or retina display, which use more screen pixels to draw the same objects, resulting in a sharper image.
...other values may be returned as well in the case of unusually low resolution displays or, more often, when a screen has a higher pixel depth than simply double the standard resolution of 96 or 76 dpi.
...ale, scale); ctx.fillstyle = "#bada55"; ctx.fillrect(10, 10, 300, 300); ctx.fillstyle = "#ffffff"; ctx.font = '18px arial'; ctx.textalign = 'center'; ctx.textbaseline = 'middle'; var x = size / 2; var y = size / 2; var textstring = "i love mdn"; ctx.filltext(textstring, x, y); monitoring screen resolution or zoom level changes in this example, we'll set up a media query and watch it to see when the device resolution changes, so that we can check the value of devicepixelratio to handle any updates we need to.
Window: storage event - Web APIs
the storage event of the window interface fires when a storage area (localstorage) has been modified in the context of another document.
... bubbles no cancelable no interface storageevent event handler property onstorage examples log the samplelist item to the console when the storage event fires: window.addeventlistener('storage', () => { // when local storage changes, dump the list to // the console.
... console.log(json.parse(window.localstorage.getitem('samplelist'))); }); the same action can be achieved using the onstorage event handler property: window.onstorage = () => { // when local storage changes, dump the list to // the console.
WindowEventHandlers.onhashchange - Web APIs
the hashchange event fires when a window's hash changes (see window.location and htmlhyperlinkelementutils.hash).
... examples using an event handler this example uses an event handler (window.onhashchange) to check the new hash value whenever it changes.
... function locationhashchanged() { if (location.hash === '#cool-feature') { console.log("you're visiting a cool feature!"); } } window.onhashchange = locationhashchanged; using an event listener this example uses an event listener to log a notification whenever the hash has changed.
WindowOrWorkerGlobalScope.fetch() - Web APIs
a fetch() promise only rejects when a network error is encountered (which is usually when there’s a permissions issue or similar).
...may be one of no-referrer, no-referrer-when-downgrade, same-origin, origin, strict-origin, origin-when-cross-origin, strict-origin-when-cross-origin, or unsafe-url.
...status: ${response.status}`); } return response.blob(); }) .then(function(response) { let objecturl = url.createobjecturl(response); myimage.src = objecturl; }); in the fetch with init then request example (see fetch request init live), we do the same thing except that we pass in an init object when we invoke fetch(): const myimage = document.queryselector('img'); let myheaders = new headers(); myheaders.append('content-type', 'image/jpeg'); const myinit = { method: 'get', headers: myheaders, mode: 'cors', cache: 'default' }; let myrequest = new request('flowers.jpg'); fetch(myrequest, myinit).then(function(response) { // ...
WindowOrWorkerGlobalScope.queueMicrotask() - Web APIs
the microtask is a short function which will run after the current task has completed its work and when there is no other code waiting to be run before control of the execution context is returned to the browser's event loop.
... syntax scope.queuemicrotask(function); parameters function a function to be executed when the browser engine determines it is safe to call your code.
...icrotask spec: myelement.prototype.loaddata = function (url) { if (this._cache[url]) { queuemicrotask(() => { this._setdata(this._cache[url]); this.dispatchevent(new event("load")); }); } else { fetch(url).then(res => res.arraybuffer()).then(data => { this._cache[url] = data; this._setdata(data); this.dispatchevent(new event("load")); }); } }; when queuemicrotask() isn't available the code below is basically a monkey-patch for queuemicrotask() for modern engines.
Worker.onmessage - Web APIs
WebAPIWorkeronmessage
the onmessage property of the worker interface represents an eventhandler, that is a function to be called when the message event occurs.
... these events are of type messageevent and will be called when the worker's parent receives a message (i.e.
...messages are passed to the worker when the value inside the form input first changes.
WritableStream - Web APIs
the highwatermark property, which is set when creating the counting strategy (line 35), sets the maximum amount of data that the writablestream instance will handle in a single write() operation.
... the defaultwriter.ready property returns a promise that resolves when the sink (the first property of the writablestream constructor) is done writing data.
... the promise returned by the sink's write() method (line 40) tells the writablestream and its writer when to resolve defaultwriter.ready.
HTML in XMLHttpRequest - Web APIs
this limitation avoids wasting time parsing html uselessly when legacy code uses xmlhttprequest in the default mode to retrieve responsetext for text/html resources.
...when you try to set responsetype of an xmlhttprequest object after it is opened as "sync".
...use it only when it is really necessary.
XMLHttpRequest.onreadystatechange - Web APIs
an eventhandler that is called whenever the readystate attribute changes.
...the xmlhttprequest.onreadystatechange property contains the event handler to be called when the readystatechange event is fired, that is every time the readystate property of the xmlhttprequest changes.
... syntax xmlhttprequest.onreadystatechange = callback; values callback is the function to be executed when the readystate changes.
XMLHttpRequest.responseType - Web APIs
when setting responsetype to a particular value, the author should make sure that the server is actually sending a response compatible with that format.
... usage notes synchronous xhr restrictions you cannot change the value of responsetype in a synchronous xmlhttprequest except when the request belongs to a worker.
... xmlhttprequests are asynchronous by default; they are only placed in synchronous mode by passing false as the value of the optional async parameter when calling open().
XMLHttpRequest.setRequestHeader() - Web APIs
when using setrequestheader(), you must call it after calling open(), but before calling send().
... if no accept header has been set using this, an accept header with the type "*/*" is sent with the request when send() is called.
... note: for your custom fields, you may encounter a "not allowed by access-control-allow-headers in preflight response" exception when you send requests across domains.
XRRigidTransform - Web APIs
xrrigidtransform is used to specify transforms throughout the webxr apis, including: the offset and orientation relative to the parent reference space to use when creating a new reference space with getoffsetreferencespace().
... usage notes when an xrrigidtransform is interpreted, the orientation is always applied to the affected object before the position is applied.
... example this code snippet creates an xrrigidtransform to specify the offset and orientation in relation to the current reference space to use when creating a new reference space.
XRSession: squeeze event - Web APIs
the webxr event squeeze is sent to an xrsession when one of the session's input sources has completed a primary squeeze action.
... examples of comon kinds of primary action are users pressing triggers or buttons, tapping a touchpad, speaking a command, or performing a recognizable gesture when using a video tracking system or handheld controller with an accelerometer.
...if you need to track a squeeze action that isn't instantaneous, listen for the squeezestart and squeezeend events to sense when the squeeze action begins and ends.
XRSession: visibilitychange event - Web APIs
the visibilitychange event is sent to an xrsession to inform it when it becomes visible or hidden, or when it becomes visible but not currently focused.
... bubbles yes cancelable no interface xrsessionevent event handler property onvisibilitychange when the xrsession receives this event, the visibility state has already been changed.
...sing addeventlistener() to begin listening for the event: navigator.xr.requestsession("inline").then((xrsession) => { xrsession.addeventlistener("visibilitychange", e => { switch(e.session.visiblitystate) { case "visible": case "visible-blurred": mysessionvisible(true); break; case "hidden": mysessionvisible(false); break; } }); }); when a visibility state change occurs, the event is received and dispatched to a function mysessionvisible(), with a boolean parameter indicating whether or not the session is presently being displayed to the user.
XRSessionEvent - Web APIs
these events occur, for example, when the session ends or the visibility of its context changes.
... end fired at the session when it has ended, after being terminated by the application or the user agent.
... visibilitychange fired at the session whenever its visibility state changes.
XRViewerPose - Web APIs
taken together, these views can reproduce the 3d effect when displayed on the xr device.
...by calling viewport() on the webgl context, specifying the xrview as input, you can get the viewport to use when rendering in order to draw the frame for that eye into the correct part of the drawing surface.
... also, when rendering the scene for spectators or other players in a multiplayer game, the transform of the xrviewerpose can be used to determine both placement and facing direction of the other players in the game, so that they can be drawn in the correct place with the correct facing.
XRWebGLLayer.getNativeFramebufferScaleFactor() static method - Web APIs
this information can be used when creating a new xrwebgllayer to configure the xrwebgllayerinit property framebufferscalefactor in the options specified when calling the xrwebgllayer() constructor.
... return value a floating-point value which, when multiplied by the xrsession's recommended framebuffer dimensions, results in the xr device's native frame buffer resolution.
...when the returned promise resolves, we proceed by calling xrwebgllayer's getnativeframebufferscalefactor() static function to get the scale factor needed to reach the native resolution, and we then pass that into the webgllayer() constructor as the value of the framebufferscalefactor property in its layerinit dictionary, which is an xrwebgllayerinit object.
ARIA Screen Reader Implementors Guide - Accessibility
time takes second precedence: prioritize items with the same politeness level according to when the event occurs (earlier events come first).
... include labels when presenting changes: if the change occurs in something with a semantic label of some kind, speak the label.
... when no wai-aria markup is present, automatically present some changes unless the user configures all live changes to off.
Using the status role - Accessibility
when the role is added to an element, the browser will send out an accessible status event to assistive technology products which can then notify the user about it.
... possible effects on user agents and assistive technology when the status role is added to an element, or such an element becomes visible, the user agent should do the following: expose the element as having a status role in the operating system's accessibility api.
...these should be announced when the user is idle, unless aria-live=”assertive” has been set and in which case the user may be interrupted.
ARIA: img role - Accessibility
r by using an aria-label attribute, with optional alt attributes for search engines or sighted users to be written to the page should an image fail: <div role="img" aria-label="description of the overall image"> <img src="graphic1.png" alt=""> <img src="graphic2.png"> </div> if you wish to add a caption or label to your image that is visible on the page, you can do using: aria-labelledby when the text is a concise label.
... aria-describedby when the text is a longer description.
... another example where this might be suitable is when using ascii emoji combinations, like the legendary "table flip": <div role="img" aria-label="table flip"> <p> (╯°□°)╯︵ ┻━┻ </p> </div> associated wai-aria roles, states, and properties aria-label an accessible name is required.
ARIA: checkbox role - Accessibility
the developer is required to change the value of the aria-checked attribute dynamically when the checkbox is activated.
...ore { content: "[ ]"; } javascript function changecheckbox(event) { let item = document.getelementbyid('chkpref'); switch(item.getattribute('aria-checked')) { case "true": item.setattribute('aria-checked', "false"); break; case "false": item.setattribute('aria-checked', "true"); break; } } accessibility concerns when the checkbox role is added to an element, the user agent should do the following: expose the element as having a checkbox role in the operating system's accessibility api.
... when the aria-checked value changes, send an accessible state changed event.
::placeholder - CSS: Cascading Style Sheets
placeholder text will also disappear when a person enters content into an <input> element.
... with this implementation, the hint content is available even if information is entered into the input field, and the input appears free of preexisting input when the page is loaded.
... <label for="user-email">your email address</label> <span id="user-email-hint" class="input-hint">example: jane@sample.com</span> <input id="user-email" aria-describedby="user-email-hint" name="email" type="email"> placeholders in form fields are harmful — nielsen norman group windows high contrast mode placeholder text will appear with the same styling as user-entered text content when rendered in windows high contrast mode.
::slotted() - CSS: Cascading Style Sheets
WebCSS::slotted
this only works when used inside css placed within a shadow dom.
...dth: 200px; margin: 10px; }' + 'h2 { margin: 0 0 10px; }' + 'ul { margin: 0; }' + 'p { margin: 10px 0; }' + '::slotted(*) { color: gray; font-family: sans-serif; } '; shadowroot.appendchild(style); shadowroot.appendchild(templatecontent.clonenode(true)); } }) you'll see that when filling the style element with content, we select all slotted elements (::slotted(*)) and give them a different font and color.
... the element looks like this when inserted into the page: <person-details> <p slot="person-name">dr.
:focus - CSS: Cascading Style Sheets
WebCSS:focus
it is generally triggered when the user clicks or taps on an element or selects it with the keyboard's tab key.
... /* selects any <input> when focused */ input:focus { color: red; } note: this pseudo-class applies only to the focused element itself.
... syntax :focus examples html <input class="red-input" value="i'll be red when focused."><br> <input class="blue-input" value="i'll be blue when focused."> css .red-input:focus { background: yellow; color: red; } .blue-input:focus { background: yellow; color: blue; } result accessibility concerns make sure the visual focus indicator can be seen by people with low vision.
:fullscreen - CSS: Cascading Style Sheets
syntax :fullscreen usage notes the :fullscreen pseudo-class lets you configure your stylesheets to automatically adjust the size, style, or layout of content when elements switch back and forth between full-screen and traditional presentations.
...the first establishes the background color of the "toggle full-screen mode" button when the element is not in a full-screen state.
... #fs-toggle:not(:fullscreen) { background-color: #afa; } when the document is in full-screen mode, the following css applies instead, setting the background color to a pale shade of red.
:host-context() - CSS: Cascading Style Sheets
another typical use would be to allow inner elements to react to classes or attributes on any anscestor elements - for example, applying a different text color when a .dark-theme class is applied to <body>.
... note: this has no effect when used outside a shadow dom.
... /* selects a shadow root host, only if it is a descendant of the selector argument given */ :host-context(h1) { font-weight: bold; } :host-context(main article) { font-weight: bold; } /* changes paragraph text color from black to white when a .dark-theme class is applied to the document body */ p { color: #000; } :host-context(body.dark-theme) p { color: #fff; } syntax :host-context( <compound-selector-list> )where <compound-selector-list> = <compound-selector>#where <compound-selector> = [ <type-selector>?
:scope - CSS: Cascading Style Sheets
WebCSS:scope
/* selects a scoped element */ :scope { background-color: lime; } currently, when used in a stylesheet, :scope is the same as :root, since there is not at this time a way to explicitly establish a scoped element.
... when used from a dom api such as queryselector(), queryselectorall(), matches(), or element.closest(), :scope matches the element on which the method was called.
...</p> <p id="output"></p> result direct children a situation where the :scope pseudo-class prove to be useful is when you need to get direct descendant of an already retrieved element.
:valid - CSS: Cascading Style Sheets
WebCSS:valid
to add a bit of extra urgency to the invalid data, we've also given the inputs a thick red border when invalid.
... you can try it below: notice how the required text inputs are invalid when empty, but valid when they have something filled in.
... the email input on the other hand is valid when empty, as it is not required, but invalid when it contains something that is not a proper email address.
negative - CSS: Cascading Style Sheets
when defining custom counter styles, the negative descriptor lets you alter the representations of negative counter values, by providing a way to specify symbols to be appended or prepended to the counter representation when the value is negative.
... syntax /* <symbol> values */ negative: "-"; /* prepends '-' if value is negative */ negative: "(" ")"; /* surrounds value by '(' and ')' if it is negative */ values first <symbol> this symbol will be prepended to the representation when the counter is negative.
... second <symbol> if present, this symbol will be appended to the representation when the counter is negative.
@keyframes - CSS: Cascading Style Sheets
each @keyframes rule contains a style list of keyframe selectors, which specify percentages along the animation when the keyframe occurs, and a block containing the styles for that keyframe.
... when properties are left out of some keyframes properties that aren't specified in every keyframe are interpolated if possible — properties that can't be interpolated are dropped from the animation.
... when a keyframe is defined multiple times if a keyframe is defined multiple times but not all affected properties are in each keyframe, all values specified in these keyframes are considered.
-ms-high-contrast - CSS: Cascading Style Sheets
active indicates that the subsequent styling rules will be applied when the system is placed in high contrast mode with any color variation.
... black-on-white indicates that the subsequent styling rules will be applied when the system is placed in high contrast mode with a black-on-white color variation.
... white-on-black indicates that the subsequent styling rules will be applied when the system is placed in high contrast mode with a white-on-black color variation.
@media - CSS: Cascading Style Sheets
WebCSS@media
except when using the not or only logical operators, the media type is optional and the all type will be implied.
... width width of the viewport including width of scrollbar accessibility concerns to best accommodate people who adjust a site's text size, use ems when you need a <length> for your media queries.
...reen media types @media print { body { font-size: 10pt; } } @media screen { body { font-size: 13px; } } @media screen, print { body { line-height: 1.2; } } @media only screen and (min-width: 320px) and (max-width: 480px) and (resolution: 150dpi) { body { line-height: 1.4; } } introduced in media queries level 4 is a new range syntax that allows for less verbose media queries when testing for any feature accepting a range, as shown in the below examples: @media (height > 600px) { body { line-height: 1.4; } } @media (400px <= width <= 700px) { body { line-height: 1.4; } } for more examples, please see using media queries.
@namespace - CSS: Cascading Style Sheets
the @namespace rule is generally only useful when dealing with documents containing multiple namespaces—such as html5 with inline svg or mathml, or xml that mixes multiple vocabularies.
...when a default namespace is defined, all universal and type selectors (but not attribute selectors, see note below) apply only to elements in that namespace.
...when a universal, type, or attribute selector is prefixed with a namespace prefix, then that selector only matches if the namespace and name of the element or attribute matches.
Alternative style sheets - CSS: Cascading Style Sheets
when the user selects a different style, the page will immediately be re-rendered using that style sheet.
... when style sheets are referenced with a title attribute on the <link rel="stylesheeet"> or <style> element, the title becomes one of the choices offered to the user.
... it defines how these are determined, and lets the html specification define the html-specific behaviors by requiring it to define when to create a css style sheet.
CSS Animations tips and tricks - CSS: Cascading Style Sheets
the meat of this technique is in the play() function, which is called when the user clicks on the "run" button.
... here's what happens when the play() function gets called: the box's list of css classes is reset to simply "box".
... use javascript and clear the animation being used when the animationiteration event fires.
Introduction to the CSS basic box model - CSS: Cascading Style Sheets
when laying out a document, the browser's rendering engine represents each element as a rectangular box according to the standard css basic box model.
...when there is a background (background-color or background-image) set on a box, it extends to the outer edge of the border (i.e.
...when margin collapsing occurs, the margin area is not clearly defined since margins are shared between boxes.
Backwards Compatibility of Flexbox - CSS: Cascading Style Sheets
you can also check can i use for information about when prefixes were removed in browsers to make your decision.
... useful fallback techniques given that flexbox usage is initiated with value of the display property, when needing to support very old browsers which do not support flexbox at all, fallbacks can be created by overwriting one layout method with another.
...you'll see white space added between the items, which is what happens when using display: inine-block as it prefers white space like other inline items.
Ordering Flex Items - CSS: Cascading Style Sheets
in this article we will take a look at ways in which you can change the visual order of your content when using flexbox.
...when doing so take care that you are not reordering items that could be accessed by the keyboard as a user is tabbing around.
... especially when using newer layout methods you should ensure that your browser testing includes testing the site using keyboard only, rather than a mouse or touchscreen.
Introduction to formatting contexts - CSS: Cascading Style Sheets
each formatting context has specific rules about how layout behaves when in that context.
... a new bfc is created in the following situations: elements made to float using float absolutely positioned elements (including position: fixed or position: sticky) elements with display: inline-block table cells or elements with display: table-cell, including anonymous table cells created when using the display: table-* properties table captions or elements with display: table-caption block elements where overflow has a value other than visible elements with display: flow-root or display: flow-root list-item elements with contain: layout, content, or strict flex items grid items multicol containers elements with column-span set to all this is useful because a new bfc will be...
...there are some occasions in which you will find you get unwanted scrollbars or clipped shadows when you use this property purely to create a bfc.
CSS Fragmentation - CSS: Cascading Style Sheets
css fragmentation is a module of css that defines how content is displayed when it is broken (fragmented) across multiple pages, regions, or columns.
... fragmentation occurs when an inline box wraps onto multiple lines.
... it also occurs when a block spans more than one column inside a column layout container, or spans a page break when printed.
CSS Grid Layout and Accessibility - CSS: Cascading Style Sheets
in order to lay the design out in the table we often broke up the content in ways that made no sense at all when read out by a screen reader for example.
...in the introduction to that section are details of what the specification expects browsers to do when the content is visually reordered using grid layout.
... given that interoperable support for display: contents is limited and we do not yet have subgrids, there is a definite temptation when developing a site using css grid layout to flatten out the markup, to remove semantic elements in order to make it simpler to create a layout.
Grid wrapper - CSS: Cascading Style Sheets
the grid wrapper pattern is useful for aligning grid content within a central wrapper, while also allowing items to break out and align to the edge of the containing element or page when desired.
... useful fallbacks or alternative methods when using this recipe at page level it can be useful to set a max-width along with left and right auto margins to center the content horizontally: .grid { max-width: 1200px; margin: 0 auto; // horizontally centers the container } /* remove the max-width and margins if the browser supports grid */ @supports (display: grid) { .grid { display: grid; /* other grid code goes here */ ma...
... accessibility concerns although grid enables us to position items anwhere (within reason), it is important when placing items using css grid that your underlying markup follows a logical order (see css grid layout and accessibility for more details).
Using Media Queries for Accessibility - CSS: Cascading Style Sheets
values active indicates that the subsequent styling rules will be applied when the system is placed in high contrast mode with any color variation.
... black-on-white indicates that the subsequent styling rules will be applied when the system is placed in high contrast mode with a black-on-white color variation.
... white-on-black indicates that the subsequent styling rules will be applied when the system is placed in high contrast mode with a white-on-black color variation.
Media queries - CSS: Cascading Style Sheets
for example, a media query can shrink the font size on small devices, increase the padding between paragraphs when a page is viewed in portrait mode, or bump up the size of buttons on touchscreens.
...you can also use mediaquerylist.addlistener() to be notified whenever the state of a query changes.
... testing media queries programmatically describes how to use media queries in your javascript code to determine the state of a device, and to set up listeners that notify your code when the results of media queries change (such as when the user rotates the screen or resizes the browser).
Syntax - CSS: Cascading Style Sheets
WebCSSSyntax
when a value is not valid for a given property, the declaration is deemed invalid and is wholly ignored by the css engine.
...the last declaration of a block doesn't need to be terminated by a semi-colon, though it is often considered good style to do it as it prevents forgetting to add it when extending the block with another declaration.
... this leads to an important consequence: if one single basic selector is invalid, like when using an unknown pseudo-element or pseudo-class, the whole selector is invalid and therefore the entire rule is ignored (as invalid too).
border-image-repeat - CSS: Cascading Style Sheets
when one value is specified, it applies the same behavior on all four sides.
... when two values are specified, the first applies to the top and bottom, the second to the left and right.
... formal definition initial valuestretchapplies toall elements, except internal table elements when border-collapse is collapse.
border-spacing - CSS: Cascading Style Sheets
this property applies only when border-collapse is separate.
... when one <length> value is specified, it defines both the horizontal and vertical spacings between cells.
... when two <length> values are specified, the first value defines the horizontal spacing between cells (i.e., the space between cells in adjacent columns), and the second value defines the vertical spacing between cells (i.e., the space between cells in adjacent rows).
box-shadow - CSS: Cascading Style Sheets
interpolation each shadow in the list (treating none as a 0-length list) is interpolated via the color (as color) component, and x, y, blur, and (when appropriate) spread (as length) components.
...r words,<br/> you may cut me with your eyes,<br/> you may kill me with your hatefulness,<br/> but still, like air, i'll rise.</q> <p>&mdash; maya angelou</p> </blockquote> css blockquote { padding: 20px; box-shadow: inset 0 -3em 3em rgba(0,0,0,0.1), 0 0 0 2px rgb(255,255,255), 0.3em 0.3em 1em rgba(0,0,0,0.3); } result setting zero for offset and blur when the x-offset, y-offset, and blur are all zero, the box shadow will be a solid-colored outline of equal-size on all sides.
...when the border-radius is set to 0, as is the default, the corners of the shadow will be, well, corners.
color-adjust - CSS: Cascading Style Sheets
for example, when printing, a browser might opt to leave out all background images and to adjust text colors to be sure the contrast is optimized for reading on white paper.
... when printing a page, the browser might want to replace light-colored text on a dark background with dark text on a white background.
...for whatever reason, this is the desired appearance in any rendering environment, including on paper, so we also use color-adjust: exact to tell the browser not to make color or style adjustments to the box when rendering it.
cross-fade() - CSS: Cascading Style Sheets
specification syntax the cross-fade() function takes a list of images with a percentage defining how much of each image is retained in terms of opacity when it is blended with the other images.
...the 50%/50% example seen above did not need to have the percentages listed, as when a percentage value is omitted, the included percentages are added together and subtracted from 100%.
...when using background images, make sure the contrast in color is great enough that any text is legible over the image as well as if the images is missing.
flex - CSS: Cascading Style Sheets
WebCSSflex
defaults to 1 when omitted.
...defaults to 1 when omitted.
...defaults to 0 when omitted.
font-family - CSS: Cascading Style Sheets
this lets the browser select an acceptable fallback font when necessary.
...(however, this doesn't work in internet explorer 6 or earlier.) when a font is only available in some styles, variants, or sizes, those properties may also influence which font family is chosen.
... <generic-name> generic font families are a fallback mechanism, a means of preserving some of the style sheet author's intent when none of the specified fonts are available.
font-variant-caps - CSS: Cascading Style Sheets
when a given font includes capital letter glyphs of multiple different sizes, this property selects the most appropriate ones.
... in greek (el), vowels lose their accent when the whole word is in uppercase (ά/Α), except for the disjunctive eta (ή/Ή).
...when used in all uppercase titling sequences they can appear too strong.
font-variation-settings - CSS: Cascading Style Sheets
<string> <number> when rendering text, the list of variable font axis names is passed to the text layout engine to enable or disable font features.
...you should only use it when no basic properties exist to set those features (e.g.
...in some browsers, this is currently only true when the @font-face declaration includes a font-weight range.
grid-area - CSS: Cascading Style Sheets
WebCSSgrid-area
when grid-column-end is omitted, if grid-column-start is a <custom-ident>, grid-column-end is set to that <custom-ident>; otherwise, it is set to auto.
... when grid-row-end is omitted, if grid-row-start is a <custom-ident>, grid-row-end is set to that <custom-ident>; otherwise, it is set to auto.
... when grid-column-start is omitted, if grid-row-start is a <custom-ident>, all four longhands are set to that value.
hyphens - CSS: Cascading Style Sheets
WebCSShyphens
the hyphens css property specifies how words should be hyphenated when text wraps across multiple lines.
...however, suggested line break opportunities (see suggesting line break opportunities below) will override automatic break point selection when present.
... when the html <wbr> element leads to a line break, no hyphen is added.
mask-border-repeat - CSS: Cascading Style Sheets
when one value is specified, it applies the same behavior on all four sides.
... when two values are specified, the first applies to the top and bottom, the second to the left and right.
...when it eventually starts to be supported, it will serve to define how the border mask slice will repeat around the border — i.e.
overflow-wrap - CSS: Cascading Style Sheets
soft wrap opportunities introduced by the word break are considered when calculating min-content intrinsic sizes.
... break-word the same as the anywhere value, with normally unbreakable words allowed to be broken at arbitrary points if there are no otherwise acceptable break points in the line, but soft wrap opportunities introduced by the word break are not considered when calculating min-content intrinsic sizes.
... formal definition initial valuenormalapplies tonon-replaced inline elementsinheritedyescomputed valueas specifiedanimation typediscrete formal syntax normal | break-word | anywhere examples comparing overflow-wrap, word-break, and hyphens this example compares the results of overflow-wrap, word-break, and hyphens when breaking up a long word.
overscroll-behavior-block - CSS: Cascading Style Sheets
the overscroll-behavior-block css property sets the browser's behavior when the block direction boundary of a scrolling area is reached.
... by default, when the inner box is scrolled and a scroll boundary is reached, the whole page will begin to scroll, which is probably not what we want.
... html <main> <div> <div> <p><code>overscroll-behavior-block</code> has been used to make it so that when the scroll boundaries of the yellow inner box are reached, the whole page does not begin to scroll.</p> </div> </div> </main> css main { height: 3000px; width: 500px; background-color: white; background-image: repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0px, rgba(0,0,0,0) 19px, rgba(0,0,0,0.5) 20px); } main > div { height: 300px; width: 400px; overflow: auto; position: relative; top: 50px; left: 50px; overscroll-behavior-block: contain; } div > div { height: 1500px; width: 100%; background-color: yellow; background-image:...
overscroll-behavior-inline - CSS: Cascading Style Sheets
the overscroll-behavior-inline css property sets the browser's behavior when the inline direction boundary of a scrolling area is reached.
... by default, when the inner box is scrolled and a scroll boundary is reached, the whole page will begin to scroll, which is probably not what we want.
... html <main> <div> <div> <p><code>overscroll-behavior-inline</code> has been used to make it so that when the scroll boundaries of the yellow inner box are reached, the whole page does not begin to scroll.</p> </div> </div> </main> css main { height: 400px; width: 3000px; background-color: white; background-image: repeating-linear-gradient(to right, rgba(0,0,0,0) 0px, rgba(0,0,0,0) 19px, rgba(0,0,0,0.5) 20px); } main > div { height: 300px; width: 400px; overflow: auto; position: relative; top: 50px; left: 50px; overscroll-behavior-inline: contain; } div > div { height: 100%; width: 1500px; background-color: yellow; background-ima...
paint-order - CSS: Cascading Style Sheets
when one value is specified, that one is painted first, followed by the other two in their default order relative to one another.
... when two values are specified, they will be painted in the order they are specified in, followed by the unspecified one.
... note: in the case of this property, markers are only appropriate when drawing svg shapes involving the use of the marker-* properties (e.g.
will-change - CSS: Cascading Style Sheets
some of the stronger optimizations that are likely to be tied to will-change end up using a lot of a machine’s resources, and when overused like this can cause the page to slow down or consume a lot of resources.
... be aware, that will-change may actually influence the visual appearance of elements, when used with property values, that create a stacking context (e.g.
... var el = document.getelementbyid('element'); // set will-change when the element is hovered el.addeventlistener('mouseenter', hintbrowser); el.addeventlistener('animationend', removehint); function hintbrowser() { // the optimizable properties that are going to change // in the animation's keyframes block this.style.willchange = 'transform, opacity'; } function removehint() { this.style.willchange = 'auto'; } specifications specification st...
Block formatting context - Developer guides
column-span: all should always create a new formatting context, even when the column-span: all element isn't contained by a multicol container (spec change, chrome bug).
...there are some occasions in which you will find you get unwanted scrollbars or clipped shadows when you use this property purely to create a bfc.
... the value name of flow-root makes sense when you understand you are creating something that acts like the root element (<html> element in browser) in terms of how it creates a new context for the flow layout inside it.
Challenge solutions - Developer guides
in style4.css, add the following line at the beginning of the file: @import url("style4_print.css") print; heading hover color challenge make the headings turn blue when the mouse pointer is over them.
... solution the following rule achieves the desired result: h1:hover { color: blue; } javascript move box to the right challenge change the script so that the square jumps to the right by 20 em when its color changes, and jumps back afterwards.
...tattribute("disabled", "true"); settimeout(cleardemo, 2000, button); } function cleardemo (button) { var square = document.getelementbyid("square"); square.style.backgroundcolor = "transparent"; square.style.marginleft = "0em"; button.removeattribute("disabled"); } svg and css change color of inner petals challenge change the stylesheet so that the inner petals all turn pink when the mouse pointer is over any one of them, without changing the way the outer petals work.
Event developer guide - Developer guides
WebGuideEvents
two common styles are: the generalized addeventlistener() and a set of specific on-event handlers.media eventsvarious events are sent when handling media that are embedded in html documents using the <audio> and <video> elements; this section lists them and provides some helpful information about using them.mouse gesture eventsgecko 1.9.1 added support for several mozilla-specific dom events used to handle mouse gestures.
... orientation and motion data explainedwhen using orientation and motion events, it's important to understand what the values you're given by the browser mean.
... this article provides details about the coordinate systems at play and how you use them.overview of events and handlersevents and event handling provide a core technique in javascript for reacting to incidents occurring when a browser accesses a web page, including events from preparing a web page for display, from interacting with the content of the web page, relating to the device on which the browser is running, and from many other causes such as media stream playback or animation timing.touch events (mozilla experimental)the experimental touch events api described on this page was available from gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) to gecko/firefox 17.
Rich-Text Editing in Mozilla - Developer guides
starting in firefox 3, mozilla also supports internet explorer's contenteditable attribute which allows any element to become editable or non-editable (the latter for when preventing change to fixed elements in an editable environment).
... executing commands when an html document has been switched to designmode, the document object exposes the document.execcommand method which allows one to run commands to manipulate the contents of the editable region.
...when using contenteditable, calling execcommand will affect the currently active editable element.
Making content editable - Developer guides
</div> here's the above html in action: executing commands when an html element has contenteditable set to true, the document.execcommand() method is made available.
...when using contenteditable, calling execcommand() will affect the currently active editable element.
...for example, even something as simple as what happens when you press enter/return to create a new line of text inside an editable element was handled differently across the major browsers (firefox inserted <br> elements, ie/opera used <p>, chrome/safari used <div>).
HTML attribute: accept - HTML: Hypertext Markup Language
because a given file type may be identified in more than one manner, it's useful to provide a thorough set of type specifiers when you need files of specific type, or use the wild card to denote a type of any format is acceptable.
... examples when set on a file input type, the native file picker that opens up should only enable selecting files of the correct file type.
...(many mobile devices also let the user take a picture with the camera when this is used.) accept=".doc,.docx,.xml,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document" — accept anything that smells like an ms word document.
disabled - HTML: Hypertext Markup Language
the boolean disabled attribute, when present, makes the element not mutable, focusable, or even submitted with the form.
... when a supporting element has the disabled attribute applied, the :disabled pseudo-class also applies to it.
... examples when form controls are disabled, many browsers will display them in a lighter, greyed-out color by default.
HTML attribute: step - HTML: Hypertext Markup Language
WebHTMLAttributesstep
the step sets the stepping interval when clicking up and down spinner buttons, moving a slider left and right on a range, and validating the different date types.
...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.
...when using the min attribute, ensure this minimum requirement is understood by the user.
Allowing cross-origin use of images and canvas - HTML: Hypertext Markup Language
calling any of the following on a tainted canvas will result in an error: calling getimagedata() on the canvas's context calling toblob() on the <canvas> element itself calling todataurl() on the canvas attempting any of these when the canvas is tainted will cause a securityerror to be thrown.
...this tells the browser to request cross-origin access when trying to download the image data.
... starting the download the code that starts the download (say, when the user clicks a "download" button), looks like this: function startdownload() { let imageurl = "https://cdn.glitch.com/4c9ebeb9-8b9a-4adc-ad0a-238d9ae00bb5%2fmdn_logo-only_color.svg?1535749917189"; downloadedimg = new image; downloadedimg.crossorigin = "anonymous"; downloadedimg.addeventlistener("load", imagereceived, false); downloadedimg.src = imageurl; } we're using a hard-coded url here (imageurl), but that could easily come from anywhere.
Date and time formats used in HTML - HTML: Hypertext Markup Language
the adjustments to the algorithm (taking a leap year when the year can be divided by 400, and skipping leap years when the year is divisible by 100) help to bring the average even closer to the correct number of days (365.2425 days).
... when you set the value of a datetime-local input, the string is normalized into a standard form.
... note that the normalized form of this date drops the ":00" indicating the number of seconds to be zero, because the seconds are optional when zero, and the normalized string minimizes the length of the string.
<form> - HTML: Hypertext Markup Language
WebHTMLElementform
use this method when the form has no side-effects.
... dialog: when the form is inside a <dialog>, closes the dialog on submission.
... novalidate this boolean attribute indicates that the form shouldn't be validated when submitted.
<spacer> - HTML: Hypertext Markup Language
WebHTMLElementspacer
size this attribute can be used for defining size of spacer in pixels when type is horizontal or vertical.
... width this attribute can be used for defining width of spacer in pixels when type is block.
... height this attribute can be used for defining height of spacer in pixels when type is block.
<th> - HTML: Hypertext Markup Language
WebHTMLElementth
auto the default value when this attribute is not specified is auto.
... the default value when this attribute is not specified is left.
...but, if a column's width is too narrow to show a particular cell properly, it will be widened when displayed.
itemprop - HTML: Hypertext Markup Language
when a string value is a url, it is expressed using the <a> element and its href attribute, the <img> element and its src attribute, or other elements that link to or embed external resources.
... three properties with values that are strings <div itemscope> <p>my name is <span itemprop="name">neil</span>.</p> <p>my band is called <span itemprop="band">four parts water</span>.</p> <p>i am <span itemprop="nationality">british</span>.</p> </div> one property, "image", whose value is a url <div itemscope> <img itemprop="image" src="google-logo.png" alt="google"> </div> when a string value can't be easily read and understood by a person (e.g., a long string of numbers and letters), it can be displayed using the value attribute of the data element, with the more easily-understood-by-a human-version given in the element's contents (which is not part of the structured data - see example below).
... an element introducing a property can also introduce multiple properties at once, to avoid duplication when some of the properties have the same value.
Global attributes - HTML: Hypertext Markup Language
its purpose is to identify the element when linking (using a fragment identifier), scripting, or styling (with css).
... inputmode provides a hint to browsers as to the type of virtual keyboard configuration to use when editing this element or its contents.
... translate an enumerated attribute that is used to specify whether an element's attribute values and the values of its text node children are to be translated when the page is localized, or whether to leave them unchanged.
Preloading content with rel="preload" - HTML: Hypertext Markup Language
this is especially useful when preloading resources — the browser will use the type attribute value to work out if it supports that resource, and will only download it if so, ignoring it if not.
...to use it, you could do this: var preloadedscript = document.createelement("script"); preloadedscript.src = "myscript.js"; document.body.appendchild(preloadedscript); this is useful when you want to preload a script, but then defer execution until exactly when you need it.
...when you go to the next page).
Data URLs - HTTP
[convert]::tobase64string([text.encoding]::utf8.getbytes("hello")) # outputs to console: agvsbg8= bash -c "echo -n hello`|base64" # outputs to console: agvsbg8= # the backtick (`) is used to escape the piping (|) character here common problems this section describes problems that commonly occur when creating and using data urls.
...as a url, the data should be formatable with whitespace (linefeed, tab, or spaces), but there are practical issues that arise when using base64 encoding.
... lack of error handling invalid parameters in media, or typos when specifying 'base64', are ignored, but no error is provided.
Identifying resources on the Web - HTTP
there are sometimes reasons identity and location are not given by the same uri: http uses a specific http header, alt-svc when the resource requested wants the client to access it at another location.
... usage notes when using urls in html content, you should generally only use a few of these url schemes.
... when referring to subresources — that is, files that are being loaded as part of a larger document — you should only use the http and https schemes.
Content Security Policy (CSP) - HTTP
WebHTTPCSP
malicious scripts are executed by the victim's browser because the browser trusts the source of the content, even when it's not coming from where it seems to be coming from.
...your policy should include a default-src policy directive, which is a fallback for other resource types when they don't have policies of their own (for a complete list, see the description of the default-src directive).
...a browser capable of enforcing csp would send the following violation report as a post request to http://example.com/_/csp-reports, when the document is visited: { "csp-report": { "document-uri": "http://example.com/signup.html", "referrer": "", "blocked-uri": "http://example.com/css/style.css", "violated-directive": "style-src cdn.example.com", "original-policy": "default-src 'none'; style-src cdn.example.com; report-uri /_/csp-reports" } } as you can see, the report includes the full path to the violati...
Access-Control-Allow-Credentials - HTTP
the access-control-allow-credentials response header tells browsers whether to expose the response to frontend javascript code when the request's credentials mode (request.credentials) is include.
... when a request's credentials mode (request.credentials) is include, browsers will only expose the response to frontend javascript code if the access-control-allow-credentials value is true.
... when used as part of a response to a preflight request, this indicates whether or not the actual request can be made using credentials.
Content-Disposition - HTTP
when dealing with multiple files in the same field (for example, the multiple attribute of an <input type="file"> element), there can be several subparts with the same name.
...when used in combination with content-disposition: attachment, it is used as the default filename for an eventual "save as" dialog presented to the user.
...when both filename and filename* are present in a single header field value, filename* is preferred over filename when both are understood.
CSP: referrer - HTTP
"none-when-downgrade" this is the user agent's default behavior if no policy is specified.
... "origin-when-cross-origin" / "origin-when-crossorigin" send a full url when performing a same-origin request, but only send the origin of the document for other cases.
... "unsafe-url" send a full url (stripped from parameters) when performing a same-origin or cross-origin request.
CSP: script-src - HTTP
when generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace.
... content-security-policy: script-src 'sha256-b2yphkaxnvfwtrchibabymubfzdvfkkxhbwtwiddvf8=' when generating the hash, don't include the <script> tags and note that capitalization and whitespace matter, including leading or trailing whitespace.
...if 'unsafe-eval' isn't specified with the script-src directive, the following methods are blocked and won't have any effect: eval() function() when passing a string literal like to methods like: window.settimeout("alert(\"hello world!\");", 500); window.settimeout window.setinterval window.setimmediate window.execscript (ie < 11 only) strict-dynamic the 'strict-dynamic' source expression specifies that the trust explicitly given to a script present in the markup, by accompanying it with a nonce or a hash, shall be propagated to all the scripts loaded by that root script.
Expect-CT - HTTP
ct requirements can be satisfied via any one of the following mechanisms: x.509v3 certificate extension to allow embedding of signed certificate timestamps issued by individual logs a tls extension of type signed_certificate_timestamp sent during the handshake supporting ocsp stapling (that is, the status_request tls extension) and providing a signedcertificatetimestamplist when a site enables the expect-ct header, they are requesting that the browser check that any certificate for that site appears in public ct logs.
... when present with the enforce directive, the configuration is referred to as an "enforce-and-report" configuration, signalling to the user agent both that compliance to the certificate transparency policy should be enforced and that violations should be reported.
... when both the enforce directive and the report-uri directive are present, the configuration is referred to as an "enforce-and-report" configuration, signalling to the user agent both that compliance to the certificate transparency policy should be enforced and that violations should be reported.
If-None-Match - HTTP
when the condition fails for get and head methods, then the server must return http status code 304 (not modified).
... when used in combination with if-modified-since, if-none-match has precedence (if the server supports it).
...they are only useful when uploading a resource, usually with put, to check if another resource with the identity has already been uploaded before.
Large-Allocation - HTTP
examples large-allocation: 0 large-allocation: 500 troubleshooting errors the large-allocation header throws warnings or error messages when used incorrectly.
... when a post request is used to load a document, that load cannot currently be redirected into a new process.
... this error is displayed when loading a document with a large-allocation header with a non-get http method.
Transfer-Encoding - HTTP
when present on a response to a head request that has no body, it indicates the value that would have applied to the corresponding get message.
... examples chunked encoding chunked encoding is useful when larger amounts of data are sent to the client and the total size of the response may not be known until the request has been fully processed.
... for example, when generating a large html table resulting from a database query or when transmitting large images.
Firefox user agent string reference - HTTP
when firefox runs on a device that has the phone form factor, there is a mobile; token in the platform part of the ua string.
... when firefox runs on a tablet device, there is a tablet; token in the platform part of the ua string instead.
...this way, your code will work if/when firefox ships on other phone/tablet operating systems or android is used for laptops.
Vary - HTTP
WebHTTPHeadersVary
it is used by the server to indicate which headers it used when selecting a representation of a resource in a content negotiation algorithm.
... <header-name> a comma-separated list of header names to take into account when deciding whether or not a cached response can be used.
... examples dynamic serving when using the vary: user-agent header, caching servers should consider the user agent when deciding whether to serve the page from cache.
X-DNS-Prefetch-Control - HTTP
this reduces latency when the user clicks a link.
...this is what browsers do, if they support the feature, when this header is not present off disables dns prefetching.
...by speculatively prefetching dns results, latency can be reduced significantly at certain times, such as when the user clicks the link.
X-XSS-Protection - HTTP
the http x-xss-protection response header is a feature of internet explorer, chrome and safari that stops pages from loading when they detect reflected cross-site scripting (xss) attacks.
... although these protections are largely unnecessary in modern browsers when sites implement a strong content-security-policy that disables the use of inline javascript ('unsafe-inline'), they can still provide protections for users of older web browsers that don't yet support csp.
... example block pages from loading when they detect reflected xss attacks: x-xss-protection: 1; mode=block php header("x-xss-protection: 1; mode=block"); apache (.htaccess) <ifmodule mod_headers.c> header set x-xss-protection "1; mode=block" </ifmodule> nginx add_header "x-xss-protection" "1; mode=block"; specifications not part of any specifications or drafts.
Proxy Auto-Configuration (PAC) file - HTTP
it can be extracted from the url when necessary.
...this is useful, for example, when making the autoconfig file act differently based on the client ip address (the remote_addr environment variable in cgi).
... history and implementation proxy auto-config was introduced into netscape navigator 2.0 in the late 1990s, at the same time when javascript was introduced.
HTTP Public Key Pinning (HPKP) - HTTP
when the client visits the server again, it expects at least one certificate in the certificate chain to contain a public key whose fingerprint is already known via hpkp.
... enabling hpkp to enable this feature for your site, you need to return the public-key-pins http header when your site is accessed over https: public-key-pins: pin-sha256="base64=="; max-age=expiretime [; includesubdomains][; report-uri="reporturi"] pin-sha256 the quoted string is the base64 encoded subject public key information (spki) fingerprint.
...this is important for example when the former key gets compromised.
HTTP range requests - HTTP
1 206 partial content content-type: multipart/byteranges; boundary=3d6b6a416f9b5 content-length: 282 --3d6b6a416f9b5 content-type: text/html content-range: bytes 0-50/1270 <!doctype html> <html> <head> <title>example do --3d6b6a416f9b5 content-type: text/html content-range: bytes 100-150/1270 eta http-equiv="content-type" content="text/html; c --3d6b6a416f9b5-- conditional range requests when resuming to request more parts of a resource, you need to guarantee that the stored resource has not been modified since the last fragment has been received.
... if-range: wed, 21 oct 2015 07:28:00 gmt partial request responses there are three relevant statuses, when working with range requests: in case of a successful range request, the 206 partial content status is sent back from a server.
... comparison to chunked transfer-encoding the transfer-encoding header allows chunked encoding, which is useful when larger amounts of data are sent to the client and the total size of the response is not known until the request has been fully processed.
Keyed collections - JavaScript
(this can be bypassed using map = object.create(null).) these three tips can help you to decide whether to use a map or an object: use maps over objects when keys are unknown until run time, and when all keys are the same type and all values are the same type.
... use objects when there is logic that operates on individual elements.
... note: remember that set objects store unique values—so any duplicate elements from an array are deleted when converting!
Meta programming - JavaScript
here, an object that is proxied will not return undefined when getting undefined properties, but will instead return the number 42.
... terminology the following terms are used when talking about the functionality of proxies.
... invariants semantics that remain unchanged when implementing custom operations are called invariants.
Private class fields - JavaScript
this can lead to unexpected behaviour when using this.
...n 42 } static publicstaticmethod1() { return classwithprivatestaticmethod.#privatestaticmethod(); } static publicstaticmethod2() { return this.#privatestaticmethod(); } } console.assert(classwithprivatestaticmethod.publicstaticmethod1() === 42); console.assert(classwithprivatestaticmethod.publicstaticmethod2() === 42); this can lead to unexpected behaviour when using this.
... in the following example this refers to the derived class (not the base class) when we try to call derived.publicstaticmethod2(), and thus exhibits the same "provenance restriction" as mentioned above: class base { static #privatestaticmethod() { return 42; } static publicstaticmethod1() { return base.#privatestaticmethod(); } static publicstaticmethod2() { return this.#privatestaticmethod(); } } class derived extends base {} console.log(derived.publicstaticmethod1()); // 42 console.log(derived.publicstaticmethod2()); // typeerror private instance methods private instance methods are methods available on class instances whose access is restricted in the same manner as private instance fields.
Classes - JavaScript
int { constructor(x, y) { this.x = x; this.y = y; } static distance(a, b) { const dx = a.x - b.x; const dy = a.y - b.y; return math.hypot(dx, dy); } } const p1 = new point(5, 5); const p2 = new point(10, 10); p1.distance; //undefined p2.distance; //undefined console.log(point.distance(p1, p2)); // 7.0710678118654755 binding this with prototype and static methods when a static or prototype method is called without a value for this, such as by assigning a variable to the method and then calling it, the this value will be undefined inside the method.
...if you want to inherit from a regular object, you can instead use object.setprototypeof(): const animal = { speak() { console.log(`${this.name} makes a noise.`); } }; class dog { constructor(name) { this.name = name; } } // if you do not do this you will get a typeerror when you invoke speak object.setprototypeof(dog.prototype, animal); let d = new dog('mitzie'); d.speak(); // mitzie makes a noise.
... for example, when using methods such as map() that returns the default constructor, you want these methods to return a parent array object, instead of the myarray object.
ReferenceError: can't access lexical declaration`X' before initialization - JavaScript
the javascript exception "can't access lexical declaration `variable' before initialization" occurs when a lexical variable was accessed before it was initialized.
... this happens within any block statement, when let or const declarations are accessed before they are defined.
...this happens within any block statement, when let or const declarations are accessed before they are defined.
SyntaxError: test for equality (==) mistyped as assignment (=)? - JavaScript
the javascript warning "test for equality (==) mistyped as assignment (=)?" occurs when there was an assignment (=) when you would normally expect a test for equality (==).
... there was an assignment (=) when you would normally expect a test for equality (==).
... examples assignment within conditional expressions it is advisable to not use simple assignments in a conditional expression (such as if...else), because the assignment can be confused with equality when glancing over the code.
SyntaxError: missing } after function body - JavaScript
the javascript exception "missing } after function body" occurs when there is a syntax mistake when creating a function somewhere.
... there is a syntax mistake when creating a function somewhere.
... examples forgotten closing curly bracket oftentimes, there is a missing curly bracket in your function code: var charge = function() { if (sunny) { usesolarcells(); } else { promptbikeride(); }; correct would be: var charge = function() { if (sunny) { usesolarcells(); } else { promptbikeride(); } }; it can be more obscure when using iife, closures, or other constructs that use a lot of different parenthesis and curly brackets, for example.
SyntaxError: missing formal parameter - JavaScript
the javascript exception "missing formal parameter" occurs when your function declaration is missing valid parameters.
...declarations require identifier as parameters, and only when calling (invoking) the function, you provide the values the function should use.
... examples provide proper function parameters function parameters must be identifiers when setting up a function.
SyntaxError: missing ; before statement - JavaScript
the javascript exception "missing ; before statement" occurs when there is a semicolon (;) missing somewhere and can't be added by automatic semicolon insertion (asi).
...carefully check the syntax when this error is thrown.
... examples unescaped strings this error can occur easily when not escaping strings properly and the javascript engine is expecting the end of your string already.
TypeError: can't delete non-configurable array element - JavaScript
the javascript exception "can't delete non-configurable array element" occurs when it was attempted to shorten the length of an array, but one of the array's elements is non-configurable.
...when shortening an array, the elements beyond the new array length will be deleted, which failed in this situation.
...however, for example, when using object.defineproperty(), the property isn't configurable by default.
TypeError: "x" is not a function - JavaScript
the javascript exception "is not a function" occurs when there was an attempt to call a value from a function, but the value is not actually a function.
...you will have to provide a function in order to have these methods working properly: when working with array or typedarray objects: array.prototype.every(), array.prototype.some(), array.prototype.foreach(), array.prototype.map(), array.prototype.filter(), array.prototype.reduce(), array.prototype.reduceright(), array.prototype.find() when working with map and set objects: map.prototype.foreach() and set.prototype.foreach() examples a typo in the function na...
... let obj = {a: 13, b: 37, c: 42}; obj.map(function(num) { return num * 2; }); // typeerror: obj.map is not a function use an array instead: let numbers = [1, 4, 9]; numbers.map(function(num) { return num * 2; }); // array [2, 8, 18] function shares a name with a pre-existing property sometimes when making a class, you may have a property and a function with the same name.
Warning: unreachable code after return statement - JavaScript
the javascript warning "unreachable code after return statement" occurs when using an expression after a return statement, or when using a semicolon-less return statement but including an expression directly after.
... unreachable code after a return statement might occur in these situations: when using an expression after a return statement, or when using a semicolon-less return statement but including an expression directly after.
... when an expression exists after a valid return statement, a warning is given to indicate that the code after the return statement is unreachable, meaning it can never be run.
Date.prototype.toLocaleString() - JavaScript
performance when formatting large numbers of dates, it is better to create an intl.datetimeformat object and use the function provided by its format property.
...오후 12:00:00" // arabic in most arabic speaking countries uses real arabic digits console.log(date.tolocalestring('ar-eg')); // → "٢٠‏/١٢‏/٢٠١٢ ٥:٠٠:٠٠ ص" // for japanese, applications may want to use the japanese calendar, // where 2012 was the year 24 of the heisei era console.log(date.tolocalestring('ja-jp-u-ca-japanese')); // → "24/12/20 12:00:00" // when requesting a language that may not be supported, such as // balinese, include a fallback language (in this case, indonesian) console.log(date.tolocalestring(['ban', 'id'])); // → "20/12/2012 11.00.00" using options the results provided by tolocalestring() can be customized using the options argument: let date = new date(date.utc(2012, 11, 20, 3, 0, 0)); // request a weekday along with a lo...
... most notably, the ie and edge browsers insert bidirectional control characters around dates, so the output text will flow properly when concatenated with other text.
Function.prototype.apply() - JavaScript
note: when the first argument is undefined or null a similar outcome can be achieved using the array spread syntax.
... you can assign a different this object when calling an existing function.
...thus, you do not have to know the arguments of the called object when you use the apply method.
Function.name - JavaScript
a function object's read-only name property indicates the function's name as specified when it was created, or it may be rather anonymous or ''(an empty string) for functions created anonymously.
... javascript compressors and minifiers warning: be careful when using function.name and source code transformations, such as those carried out by javascript compressors (minifiers) or obfuscators.
... function foo() {}; foo.bind({}).name; // "bound foo" function names for getters and setters when using get and set accessor properties, "get" or "set" will appear in the function name.
Intl.DateTimeFormat() constructor - JavaScript
options optional an object with some or all of the following properties: datestyle the date formatting style to use when calling format().
... possible values include: "full" "long" "medium" "short" timestyle the time formatting style to use when calling format().
... possible values include: "full" "long" "medium" "short" fractionalseconddigits the number of fractional seconds to apply when calling format().
Map.prototype.forEach() - JavaScript
thisarg optional value to use as this when executing callback.
... callback is invoked with three arguments: the entry's value the entry's key the map object being traversed if a thisarg parameter is provided to foreach, it will be passed to callback when invoked, for use as its this value.
... each value is visited once, except in the case when it was deleted and re-added before foreach has finished.
Object.freeze() - JavaScript
any attempt to do so will fail, either silently or by throwing a typeerror exception (most commonly, but not exclusively, when in strict mode).
...use the pattern on a case-by-case basis based on your design when you know the object contains no cycles in the reference graph, otherwise an endless loop will be triggered.
...an array) argument so you can suppress calling deepfreeze() recursively when an object is in the process of being made immutable.
Promise.all() - JavaScript
this returned promise will resolve when all of the input's promises have resolved, or if the input iterable contains no promises.
...this returned promise is then resolved/rejected asynchronously (as soon as the stack is empty) when all the promises in the given iterable have resolved, or if any of the promises reject.
...it is typically used when there are multiple asynchronous tasks that are dependent on one another to complete successfully, as it does not wait and will reject immediately upon any of the input promises rejecting.
RangeError - JavaScript
the rangeerror object indicates an error when a value is not in the set or range of allowed values.
... description a rangeerror is thrown when trying to pass a value as an argument to a function that does not allow a range that includes the value.
... this can be encountered when: passing a value that is not one of the allowed string values to string.prototype.normalize(), or when attempting to create an array of an illegal length with the array constructor, or when passing bad values to the numeric methods number.prototype.toexponential(), number.prototype.tofixed() or number.prototype.toprecision().
RegExp() constructor - JavaScript
the following three expressions create the same regular expression: /ab+c/i new regexp(/ab+c/, 'i') // literal notation new regexp('ab+c', 'i') // constructor the literal notation results in compilation of the regular expression when the expression is evaluated.
... use literal notation when the regular expression will remain constant.
...use the constructor function when you know the regular expression pattern will be changing, or you don't know the pattern and are getting it from another source, such as user input.
RegExp.prototype.exec() - JavaScript
javascript regexp objects are stateful when they have the global or sticky flags set (e.g.
...when you do so, the search starts at the substring of str specified by the regular expression's lastindex property (test() will also advance the lastindex property).
... note that the lastindex property will not be reset when searching a different string, it will start its search at its existing lastindex .
RegExp.$1-$9 - JavaScript
the values of these properties are read-only and modified whenever successful matches are made.
...when used this way, do not prepend them with regexp.
...when parentheses are not included in the regular expression, the script interprets $n's literally (where n is a positive integer).
Set.prototype.forEach() - JavaScript
thisarg value to use as this when executing callback.
... if a thisarg parameter is provided to foreach(), it will be passed to callback when invoked, for use as its this value.
... each value is visited once, except in the case when it was deleted and re-added before foreach() has finished.
TypedArray.prototype.every() - JavaScript
value to use as this when executing callback.
... description the every method executes the provided callback function once for each element present in the typed array until it finds one where callback returns a falsy value (a value that becomes false when converted to a boolean).
... if a thisarg parameter is provided to every, it will be passed to callback when invoked, for use as its this value.
TypedArray.prototype.map() - JavaScript
thisarg optional value to use as this when executing mapfn.
... if a thisarg parameter is provided to map(), it will be passed to mapfn when invoked, for use as its this value.
... const numbers = new uint8array([1, 4, 9]); const roots = numbers.map(math.sqrt); // roots is now: uint8array [1, 2, 3], // numbers is still uint8array [1, 4, 9] mapping a typed array of numbers using a function containing an argument the following code shows how map works when a function requiring one argument is used with it.
Nullish coalescing operator (??) - JavaScript
the nullish coalescing operator (??) is a logical operator that returns its right-hand side operand when its left-hand side operand is null or undefined, and otherwise returns its left-hand side operand.
...0; console.log(vala); // "default for a" console.log(valb); // "" (as the empty string is not null or undefined) console.log(valc); // 42 assigning a default value to a variable earlier, when one wanted to assign a default value to a variable, a common pattern was to use the logical or operator (||): let foo; // foo is never assigned any value so it is still undefined let somedummytext = foo || 'hello!'; however, due to || being a boolean logical operator, the left hand-side operand was coerced to a boolean for the evaluation and any falsy value (0, '', nan, null, undefined) was n...
... let count = 0; let text = ""; let qty = count || 42; let message = text || "hi!"; console.log(qty); // 42 and not 0 console.log(message); // "hi!" and not "" the nullish coalescing operator avoids this pitfall by only returning the second operand when the first one evaluates to either null or undefined (but no other falsy values): let mytext = ''; // an empty string (which is also a falsy value) let notfalsytext = mytext || 'hello world'; console.log(notfalsytext); // hello world let preservingfalsy = mytext ??
Operator precedence - JavaScript
evaluating the left side evaluating the right side 3 function echo(name, num) { console.log("evaluating the " + name + " side"); return num; } // notice the exponentiation operator (**) console.log(echo("left", 2) ** echo("right", 3)); evaluating the left side evaluating the right side 8 the difference in associativity comes into play when there are multiple operators of the same precedence.
...in the example below, observe how associativity affects the output when multiple of the same operator are used.
...however, that does not always mean the expression within the grouping symbols ( … ) is evaluated first, especially when it comes to short-circuiting.
void operator - JavaScript
it should be noted that the precedence of the void operator should be taken into account and that parentheses can help clarify the resolution of the expression following the void operator: void 2 == '2'; // (void 2) == '2', returns false void (2 == '2'); // void (2 == '2'), returns undefined examples immediately invoked function expressions when using an immediately-invoked function expression, void can be used to force the function keyword to be treated as an expression instead of a declaration.
... javascript uris when a browser follows a javascript: uri, it evaluates the code in the uri and then replaces the contents of the page with the returned value, unless the returned value is undefined.
...to be safe, when the return value of a function is not intended to be used, it can be passed to the void operator to ensure that (for example) changing apis do not cause arrow functions' behaviors to change.
let - JavaScript
the other difference between var and let is that the latter is initialized to a value only when a parser evaluates it (see below).
... just like const the let does not create properties of the window object when declared globally (in the top-most scope).
... console.log(n); // object {a: [1,2,3]} for (let n of n.a) { // referenceerror console.log(n); } } go({a: [1, 2, 3]}); other situations when used inside a block, let limits the variable's scope to that block.
try...catch - JavaScript
unconditional catch-block when a catch-block is used, the catch-block is executed when any exception is thrown from within the try-block.
... for example, when the exception occurs in the following code, control transfers to the catch-block.
... exception object to error handler } } a common use case for this is to only catch (and silence) a small subset of expected errors, and then re-throw the error in other cases: try { myroutine(); } catch (e) { if (e instanceof rangeerror) { // statements to handle this very common expected error } else { throw e; // re-throw the error unchanged } } the exception identifier when an exception is thrown in the try-block, exception_var (i.e., the e in catch (e)) holds the exception value.
with - JavaScript
syntax with (expression) statement expression adds the given expression to the scope chain used when evaluating the statement.
...so given this example: function f(x, o) { with (o) { console.log(x); } } only when f is called is x either found or not, and if found, either in o or (if no such property exists) in f's activation object, where x names the first formal argument.
... contra: code using with may not be forward compatible, especially when used with something other than a plain object.
Transitioning to strict mode - JavaScript
differences from non-strict to strict syntax errors when adding 'use strict';, the following cases will throw a syntaxerror before the script is executing: octal syntax var n = 023; with statement using delete on a variable name delete myvariable; using eval or arguments as variable or function argument name using one of the newly reserved keywords (in prevision for ecmascript 2015): implements, interface, let, package, private, protected, publi...
...when a function was called with call or apply, if the value was a primitive value, this one was boxed into an object (or the global object for undefined and null).
... stay away from semantic differences eval: use it only if you know what you're doing arguments: always access function arguments via their name or perform a copy of the arguments object using: var args = array.prototype.slice.call(arguments) as the first line of your function this: only use this when it refers to an object you created.
JavaScript typed arrays - JavaScript
however, as web applications become more and more powerful, adding features such as audio and video manipulation, access to raw data using websockets, and so forth, it has become clear that there are times when it would be helpful for javascript code to be able to quickly and easily manipulate raw binary data.
...this is useful when dealing with different types of data, for example.
... multiple views on the same data things start to get really interesting when you consider that you can create multiple views onto the same data.
Handling media support issues in web content - Web media technologies
there is a drawback, however: because there are so many to choose from, with so many different kinds of licenses and design principles involved, each web browser developer is left to its own devices when deciding which media file types and codecs to support.
... this places a small, but reasonably easily overcome, burden on the web developer: to properly handle the situation when the user's browser can't handle a particular type of media.
... <img src="/images/stafff-photo-huge-progressive.jpg" alt="staff photo, taken in january of 1972"> when using a progressive image, the data is stored in such a way that the browser is able to render a low-quality representation of the image as soon as possible, then update the image as it loads—or after it's finished loading—to present it in full quality.
Digital video concepts - Web media technologies
what those values are depends on how you "split up" the color when converting it to numeric form.
...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).
... since the color data is being encoded at a lower resolution than the luma, when decoding the video to draw it to the screen each pixel's color is computed by calculating an appropriate color given the u and v values for the 4x2 block of 8 pixels in which the pixel resides.
Web media technologies
<track> the html <track> element can be placed within an <audio> or <video> element to provide a reference to a webvtt format subtitle or caption track to be used when playing the media.
...this lets you make real-time decisions about what formats to use and when.
...this article is a guide to autoplay, with tips on when and how to use it and how to work with browsers to handle autoplay blocking gracefully.
Recommended Web Performance Timings: How long is too long? - Web Performance
there are no clear set rules as to what constitutes a slow pace when loading pages, but there are specific guidelines for indicating content will load (1 second), idling (50ms), animating (16.7s) and responding to user input (50 to 200ms).
...as noted in the description of the critical rendering path, when received, browsers immediately start processing the html, rendering the content as it is received rather than waiting for additional assets to load.
... responsiveness goal when the user interacts with content, it is important to provide feedback and acknowledge the user's response or interaction and to do so within 100ms, preferably within 50ms.
Installing and uninstalling web apps - Progressive web apps (PWAs)
by reducing the user experience differential between the web app and native apps on the user's device, you reduce both the loss of any muscle memory they have revolving around the native interface of the device and the sensation of "something isn't quite right" that users can experience when switching between native and web-based apps.
... the installed web application regardless of which browser and device you're using, when you choose to add the app to your home screen or app launcher, it'll show up there looking just like any application.
... when you tap the web app's icon on the home screen, it opens up in a full screen web environment, without the browser's ui around it.
edgeMode - SVG: Scalable Vector Graphics
the edgemode attribute determines how to extend the input image as necessary with color values so that the matrix operations can be applied when the kernel is positioned at or near the edge of the input image.
... two elements are using this attribute: <feconvolvematrix> and <fegaussianblur> feconvolvematrix for <feconvolvematrix>, edgemode determines how to extend the input image as necessary with color values so that the matrix operations can be applied when the kernel is positioned at or near the edge of the input image.
... fegaussianblur for <fegaussianblur>, edgemode determines how to extend the input image as necessary with color values so that the matrix operations can be applied when the kernel is positioned at or near the edge of the input image.
from - SVG: Scalable Vector Graphics
WebSVGAttributefrom
when used with the to attribute, the animation will change the modified attribute from the from value to the to value.
... when used with the by attribute, the animation will change the attribute relatively from the from value by the value specified in by.
... when a list of values is defined via the values attribute, the from attribute is ignored.
keyTimes - SVG: Scalable Vector Graphics
each time in the list corresponds to a value in the values attribute list, and defines when the value is used in the animation.
...the key time associated with each value defines when the value is set; values are interpolated between the key times.
...the time associated with each value defines when the value is set; the animation function uses that value until the next time defined in the list.
overflow - SVG: Scalable Vector Graphics
the overflow attribute sets what to do when an element's content is too big to fit in its block formatting context.
... when scroll is specified on an <svg> element, a scrollbar or panner is normally shown for the svg viewport whether or not any of its content is clipped.
... although the initial value for overflow is auto, it is overwritten in the user agent style sheet for the <svg> element when it is not the root element of a stand-alone document, the <pattern> element, and the <marker> element to be hidden by default.
stroke-miterlimit - SVG: Scalable Vector Graphics
when the limit is exceeded, the join is converted from a miter to a bevel.
...h stroke --> <path stroke="pink" fill="none" stroke-width="0.05" d="m1, 9 l7,-3 l7,3 m2,0 l3.5,-3 l3.5,3 m2,0 l2,-3 l2,3 m2,0 l0.75,-3 l0.75,3 m2,0 l0.5,-3 l0.5,3 m1,19 l7,-3 l7,3 m2,0 l3.5,-3 l3.5,3 m2,0 l2,-3 l2,3 m2,0 l0.75,-3 l0.75,3 m2,0 l0.5,-3 l0.5,3 m1,29 l7,-3 l7,3 m2,0 l3.5,-3 l3.5,3 m2,0 l2,-3 l2,3 m2,0 l0.75,-3 l0.75,3 m2,0 l0.5,-3 l0.5,3" /> </svg> when two line segments meet at a sharp angle and miter joins have been specified for stroke-linejoin, it is possible for the miter to extend far beyond the thickness of the line stroking the path.
... the stroke-miterlimit ratio is used to define when the limit is exceeded, if so the join is converted from a miter to a bevel.
<a> - SVG: Scalable Vector Graphics
WebSVGElementa
value type: <string> ; default value: none; animatable: yes ping a space-separated list of urls to which, when the hyperlink is followed, post requests with the body ping will be sent by the browser (in the background).
... value type: <list-of-urls> ; default value: none; animatable: no referrerpolicy which referrer to send when fetching the url.
... value type: no-referrer|no-referrer-when-downgrade|same-origin|origin|strict-origin|origin-when-cross-origin|strict-origin-when-cross-origin|unsafe-url ; default value: none; animatable: no rel the relationship of the target object to the link object.
Namespaces crash course - SVG: Scalable Vector Graphics
in fact how does the user agent tell when xml content is something it knows about, and not just a meaningless xml file containing arbitrary element names unknown to it?
...when scripting svg, it is important to use the namespace aware methods.
...it's a good idea to use a template that includes all the commonly used namespace declarations when creating new svg files.
Getting started - SVG: Scalable Vector Graphics
due to the potentially massive size svg files can reach when used for some applications (e.g., geographical applications), the svg specification also allows for gzip-compressed svg files.
...unfortunately, it is very problematic to get gzip-compressed svg files to work reliably across all svg capable user agents when served from a microsoft iis server, and firefox cannot load gzip-compressed svg from the local computer.
... avoid gzip-compressed svg except when you are publishing to a webserver that you know will serve it correctly (see below).
SVG fonts - SVG: Scalable Vector Graphics
« previousnext » when svg was specified, support for web fonts was not widespread in browsers.
...it was not meant for compatibility with other formats like postscript or otf, but rather as a simple means of embedding glyph information into svg when rendered.
... <hkern u1="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 f...
Secure contexts - Web security
when is a context considered secure?
... a context is considered secure when it meets certain minimum standards of authentication and confidentiality defined in the secure contexts specification.
... a particular document is considered to be in a secure context when it is the active document of a top-level browsing context (basically, a containing window or tab) that is a secure context.
Using shadow DOM - Web Components
if you are attaching a shadow dom to a custom element as part of its constructor (by far the most useful application of the shadow dom), you would use something like this: let shadow = this.attachshadow({mode: 'open'}); when you've attached a shadow dom to an element, manipulating it is a matter of just using the same dom apis as you use for the regular dom manipulation: let para = document.createelement('p'); shadow.appendchild(para); // etc.
...when the icon is focused, it displays the text in a pop up information box to provide further in-context information.
... } } inside the class definition we define the element's constructor, which defines all the functionality the element will have when an instance of it is instantiated.
<xsl:stylesheet> - XSLT: Extensible Stylesheet Language Transformations
this is most often used when the stylesheet is embedded in another xml document.
... use-when determines whether the element and all the nodes that have it as ancestor are excluded from the stylesheet.
... recommendation added the attributes default-mode, expand-text, and use-when.
Compiling from Rust to WebAssembly - WebAssembly
when it comes to picking a version, choose any one you'd like; this tutorial isn't version-specific.
... whenever you want to call javascript functions, you can add them to this file, and wasm-bindgen takes care of setting everything up for you.
... this is passed to alert(), so when we call this function we will see an alert box with "hello, steve!" in it.
2015 MDN Fellowship Program - Archive of obsolete content
github: jdm twitter: @lastontheboat service workers brief project description service workers essentially act as proxy servers that sit between web applications, the browser and (when available) the network.
... github: chrisdavidmills twitter: @chrisdavidmills why increase the reach and impact of your expertise grow your skills beyond coding and managing to educating and communicating build something used by hundreds of thousands (or more) developers worldwide directly impact and grow the value of the open web when application deadline: april 1, 2015 orientation: early june (dates tbd) graduation: august 11-12, 2015 where orientation: a mozilla location (tbd).
Cross-domain Content Scripts - Archive of obsolete content
the "main.js": creates a panel whose content is supplied by "panel.html" and adds a content script "panel-script.js" to it sends the panel a "show" message when it is shown adds a button which shows the panel when it is clicked // main.js var data = require("sdk/self").data; var forecast_panel = require("sdk/panel").panel({ height: 50, contenturl: data.url("panel.html"), contentscriptfile: data.url("panel-script.js") }); forecast_panel.on("show", function(){ forecast_panel.port.emit("show"); }); require("sdk/ui/button/action").actionbutton(...
...suppose your content script includes a line like: // content-script.js: unsafewindow.mycustomapi = function () {}; if you have included the "cross-domain-content" key, when the page script tries to access mycustomapi this will result in a "permission denied" exception.
Loading Content Scripts - Archive of obsolete content
the constructors for content-script-using objects such as panel and page-mod define a group of options for loading content scripts: contentscript string, array contentscriptfile string, array contentscriptwhen string contentscriptoptions object we have already seen the contentscript option, which enables you to pass in the text of the script itself as a string literal.
... the contentscriptwhen option specifies when the content script(s) should be loaded.
Module structure of the SDK - Archive of obsolete content
except for scripts that interact directly with web content, all the javascript code you'll write or use when developing add-ons using the sdk is part of a commonjs module, including: sdk modules: the javascript modules which the sdk provides, such as panel and page-mod.
... although the sdk repository in github includes copies of these modules, they are built into firefox and by default, when you run or build an add-on using jpm run or jpm xpi, it is the versions of the modules in firefox that are used.
Program ID - Archive of obsolete content
when you package your add-on for distribution using jpm xpi, it will become the id field in the add-on's install manifest.
... when you create an xpi with jpm xpi: if the package.json does not include an id field, then the id written into the install.rdf is the value of the name field prepended with "@".
notifications - Archive of obsolete content
when the message is clicked, a string is logged to the console.
... onclick function a function to be called when the user clicks the message.
private-browsing - Archive of obsolete content
when they do this, any existing non-private windows are kept open, so the user will typically have both private and non-private windows open at the same time.
...for example, the "downloads" window might want to display all downloads while there are still some private windows open, then clean out all the private data when all private windows have closed.
simple-prefs - Archive of obsolete content
when the user clicks the button, the function listening to the on() function for this preference is called.
... globals functions on(prefname, listener) registers an event listener that will be called when a preference is changed.
/loader - Archive of obsolete content
when created with this option, loader will transparently mark all new global objects with the provided value.
...it is useful when working with object functions introduced in es5 (object.create, object.defineproperties, ..): // define properties of `source` on `target`.
content/loader - Archive of obsolete content
loader adds code to initialize and validate a set of properties for managing content scripts: contenturl contentscript contentscriptfile contentscriptwhen contentscriptoptions allow when certain of these properties are set, the loader emits a propertychange event, enabling its users to take the appropriate action.
... contentscriptwhen when to load the content scripts.
content/mod - Archive of obsolete content
it is valid only when gettargetwindow(target) returns nsidomwindow of content it represents.
...it is valid only when gettargetwindow(target) returns nsidomwindow of content it represents.
content/symbiont - Archive of obsolete content
contentscriptwhen string when to load the content scripts.
... contentscriptwhen when to load the content scripts.
core/promise - Archive of obsolete content
there are cases when promise may or may not be fulfilled in a reasonable time.
...if you pass it a promise it will return a new identical one: const { resolve } = require('sdk/core/promise'); resolve(resolve(resolve(3))).then(console.log); // => 3 this construct may look strange at first, but it becomes quite handy when writing functions that deal with both promises and values.
frame/hidden-frame - Archive of obsolete content
parameters options : object required options: name type onready function,array functions to call when the frame is ready to load content.
... events ready this event is emitted when the dom for a hidden frame content is ready.
places/history - Archive of obsolete content
error the error event is emitted whenever a search could not be completed.
... end the end event is called when all search results have returned.
system/events - Archive of obsolete content
listener : function function that will be called when an event is fired, with a single event object as argument.
... listener : function function that will be called when an event is fired.
test/utils - Archive of obsolete content
they're useful when you need to guarantee a particular state before running a test, and to clean up after your test.
...to make them asynchronous, pass a third argument done, which is a function to call when you have finished: let { before, after } = require('sdk/test/utils'); let { search } = require('sdk/places/bookmarks'); exports.testcountbookmarks = function (assert, done) { search().on('end', function (results) { assert.equal(results, 0, 'should be no bookmarks'); done(); }); }; before(exports, function (name, assert, done) { removeallbookmarksasync(function () { done(); ...
Implementing the widget - Archive of obsolete content
the widget will have two icons: one to display when it's active, one to display when it's inactive.
...nd add the following code: var widgets = require('sdk/widget'); var data = require('sdk/self').data; var annotatorison = false; function toggleactivation() { annotatorison = !annotatorison; return annotatorison; } exports.main = function() { var widget = widgets.widget({ id: 'toggle-switch', label: 'annotator', contenturl: data.url('widget/pencil-off.png'), contentscriptwhen: 'ready', contentscriptfile: data.url('widget/widget.js') }); widget.port.on('left-click', function() { console.log('activate/deactivate'); widget.contenturl = toggleactivation() ?
Troubleshooting - Archive of obsolete content
when you run jpm to test your add-on or run unit tests, it prints out the location of the firefox or xulrunner binary that it found, so you can check its output to be sure.
... check your text console when errors are generated in the sdk's apis and your code, they are logged to the text console.
Bookmarks - Archive of obsolete content
note: all annotations, tags, and so forth are kept when the bookmark's uri is changed.
...function(abookmarkid, aproperty, aisannotationproperty, avalue) { myextension.dosomething(); }, onitemvisited: function(abookmarkid, avisitid, time) {}, onitemmoved: function(aitemid, aoldparent, aoldindex, anewparent, anewindex) {}, queryinterface: xpcomutils.generateqi([components.interfaces.nsinavbookmarkobserver]) }; // an extension var myextension = { // this function is called when my add-on is loaded onload: function() { bmsvc.addobserver(myext_bookmarklistener, false); }, // this function is called when my add-on is unloaded onunload: function() { bmsvc.removeobserver(myext_bookmarklistener); }, dosomething: function() { alert("did something."); } }; see also nsinavbookmarksservice nsinavbookmarkobserver places using xpcom without chrome ...
Boxes - Archive of obsolete content
wrapping contents in html you can use a div as a container and when the div changes size, the contents will wrap or adjust the layout.
...make the box style="display: block" and the wrapping behavior will occur when the box is resized: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="yourwindow" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <hbox style="display: block"> <label value="aaa"/> <label value="bbb"/> <label value="ccc"/> <label value="ddd"/> <label value="eee"/> <label value="fff"/> <label value="ggg"/> <label value="hhh"/> <label value="iii"/> <label value="jjj"/> <label value="kkk"/> <label value="lll"/> <label value="mmm"/> <label value="nnn"/> <label value="ooo"/> <label value="p...
Embedding SVG - Archive of obsolete content
embedding in xhtml make sure you use the right namespace when embedding.
...w.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <body> <p>hello</p> <svg:svg version="1.1" baseprofile="full" width="150" height="150"> <svg:rect x="10" y="10" width="100" height="100" fill="red"/> <svg:circle cx="50" cy="50" r="30" fill="blue"/> </svg:svg> <p>world</p> </body> </html> embedding into xul make sure you use the right namespace when embedding <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <!-- xul and svg go here --> </window> example: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" ty...
File I/O - Archive of obsolete content
an exception is thrown only when methods that require the file to exist are called, e.g., isdirectory(), moveto(), and so on.
...second choice when profdef is not available.
HTML to DOM - Archive of obsolete content
safely parsing simple html to dom when using xmlhttprequest to get the html of a remote webpage, it is often advantageous to turn that html string into dom for easier manipulation.
... false; frame.webnavigation.allowsubframes = false; // listen for load frame.addeventlistener("load", function (event) { // the document of the html in the dom var doc = event.originaltarget; // skip blank page or frame if (doc.location.href == "about:blank" || doc.defaultview.frameelement) return; // do something with the dom of doc alert(doc.location.href); // when done remove frame or set location "about:blank" settimeout(function (){ var frame = document.getelementbyid("sample-frame"); // remove frame // frame.destroy(); // if using browser element instead of iframe frame.parentnode.removechild(frame); // or set location "about:blank" // frame.contentdocument.location.href = "about:blank"; },10); }, true); ...
JavaScript Debugger Service - Archive of obsolete content
jsd.scripthook = { onscriptcreated: function(script) { // your function here }, onscriptdestroyed: function(script) { // your function here } }; jsd.errorhook = { onerror: function(message, filename, lineno, colno, flags, errnum, exc) { // your function here } }; // triggered when jsd.errorhook[onerror] returns false jsd.debughook = { onexecute: function(frame, type, rv) { // your function here } }; jsd.enumeratescripts({ // the enumeratescript method will be called once for every script jsd knows about enumeratescript: function(script) { // your function here } }); a simple stack trace here, we will show how to implement a simple javascript stack trace using...
...& jsdierrorhook.report_warning) messagetype = "warning"; if (flags & jsdierrorhook.report_exception) messagetype = "uncaught-exception"; if (flags & jsdierrorhook.report_strict) messagetype += "-strict"; dump(messagetype + "\n"); return false; // trigger debughook // return true; if you do not wish to trigger debughook } }; // note that debughook does not _always_ trigger when jsd.errorhook[onerror] returns false // it is not well-known why debughook sometimes fails to trigger jsd.debughook = { onexecute: function(frame, type, rv) { stacktrace = ""; for (var f = frame; f; f = f.callingframe) { stacktrace += f.script.filename + "@" + f.line + "@" + f.functionname + "\n"; } dump(stacktrace); return components.interfaces.jsdiexecutionhook.return_continue; ...
LookupPrefix - Archive of obsolete content
this function is not necessary for gecko-based browsers when used in xhtml.
... } if (originalelement.attributes && originalelement.attributes.length) { for (var i=0; i < originalelement.attributes.length; i++) { var att = originalelement.attributes[i]; xmlnspattern.lastindex = 0; var localname = att.localname || att.name.substr(att.name.indexof(':')+1); // latter test for ie which doesn't support localname if (localname.indexof(':') !== -1) { // for firefox when in html mode localname = localname.substr(att.name.indexof(':')+1); } if ( xmlnspattern.test(att.name) && att.value === namespaceuri && lookupnamespaceuri(originalelement, localname) === namespaceuri ) { return localname; } } } if (originalelement.parentnode) { // entityreferences may have to be skipped to get to it return _lookupnamespaceprefix(namespaceur...
Sidebar - Archive of obsolete content
en at this moment: if (sidebarwindow.location.href == "chrome://yourextension/content/whatever.xul") { // call "yournotificationfunction" in the sidebar's context: sidebarwindow.yournotificationfunction(anyarguments); } testing which sidebar is open the sidebar content may contain different panels (bookmarks, history, webpanel, etc.) and sometimes one wants to only act on the sidebar when it contains a specific panel.
...for this snippet to work, you have to declare mainwindow as in the previous code block then write: mainwindow.document.getelementbyid("sidebar-splitter").hidden = true; be aware that if you change the splitter's hidden attribute, you need to reset it to a safe value when your sidebar is closed, or replaced by another sidebar.
Deploying a Plugin as an Extension - Archive of obsolete content
when this method is used, you can choose to either place the plugin into the plugins directory, or, on windows, place it into your own directory and modify the windows registry to let firefox know where to find the plugin.
...the version is used for version checking when we are updating extensions.
Extension Packaging - Archive of obsolete content
note: starting in gecko 2.0, xpi files are no longer unpacked when extensions are installed.
... when using this method you must verify that the file system permissions for the directories, and files for the extension, are set properly.
Hiding browser chrome - Archive of obsolete content
there are times in which an extension may find it useful to hide browser chrome (that is, toolbars, the location bar, and so forth), in order to reduce clutter when presenting a particular user interface.
...by chaining multiple implementations of the method together in this way, everyone that wants to hide chrome can do so when appropriate.
Interaction between privileged and non-privileged pages - Archive of obsolete content
you can optionally clean up the created element, or create it once when the web page loads then re-use it each time.
...the receiver needs to use that * when doing addeventlistener(type, ...) * @param dataxml {e4x} the data or detail */ function sendmsg(type, dataxml) { var el = targetdoc.body; el.setattribute("eventdatatopage", dataxml ?
Multiple item extension packaging - Archive of obsolete content
there is currently no feature to prevent or warn the user when installing an older version of an extension.
... when specifying em:targetapplication the minversion specified should be the highest minversion and the maxversion specified should be the lowest maxversion from all of the installable bundles contained by the multiple item package for the em:targetapplication.
Offering a context menu for form controls - Archive of obsolete content
ner("load", function() { let settargetoriginal = nscontextmenu.prototype.settarget; components.utils.reporterror(settargetoriginal); nscontextmenu.prototype.settarget = function(anode, arangeparent, arangeoffset) { settargetoriginal.apply(this, arguments); if (this.istargetaformcontrol(anode)) this.shoulddisplay = true; }; }, false); this code, which is run when the window is opened up, works by replacing the settarget() routine for the prototype of nscontextmenu with one that forces the context menu to display if the target of the menu is a form control.
... as a result, all controls in the window will support a context menu when right-clicked, since we've changed the core behavior of context menus to override their default behavior of doing nothing on form controls.
Getting Started with Firefox Extensions - Archive of obsolete content
xpis are simply zip files, but firefox recognizes the xpi extension and triggers the installation process when an xpi file is loaded.
...if the server triggers an install when clicking on a link or button, what you need to do is right click on the install link, and choose the save link as...
Useful Mozilla Community Sites - Archive of obsolete content
it's a very powerful tool you have when developing on top of the mozilla platform, and you should take advantage of it in order to create a truly successful add-on .
...just be patient and make sure your extension follows amo's policies when you nominate it.
Firefox addons developer guide - Archive of obsolete content
if you use the interface template when mentioning interfaces by name, mdc will automatically format them and generate links to their documentation, like this: nsiconsoleservice.
... todo: all fixme notes inside the documents; add abbreviation definition to acronyms; add some link to the internal mdc documentation when it makes sense; indent source code; make sure documentation is relevant for all platforms: gnu/linux, macos, windows; add anchor links to figures & listings; add credits to original authors and license; completed sometimes, interfaces names are misspelled: s/nsl/nsi; talk about fuel; titles of chapters and sub-headings should have caps for first letter of each word; we should add a part a...
List of Former Mozilla-Based Applications - Archive of obsolete content
autodesk maya 3d modeling tool switched off of gecko for help browser in version 8.5 blam feed reader switched to webkit in version 1.8.6 boxee media center software switched to webkit in version 1.0 epiphany browser switched from gecko to webkit flock social browsing flock switched from being firefox-based to chromium-based when it released a new beta on june 16, 2010 jolicloud web operating system as of march 2010, rw/w reports jolicloud is on chrome/chrome os joost tv over internet switched from xulrunner-based client to a web application liferea news aggregator switched to webkit in version 1.6 manyone browser browser originally mozilla-based but now i believ...
...e the have a web-based tool (need reference for that) miro (formerly democracy player) video switched from xulrunner to webkit in version 3.0.2 moblin browser browser when moblin became meego it switched from a custom gecko-based browser to chrome nautilus file manager hasn't used mozilla code since version 2.0 raptr client gaming client was a xulrunner app initially but now uses adobe air rift technologies software installation over internet no longer using mozilla technology -- need confirmation and details second life virtual world desktop client switched from embedded mozilla browser to a plugin architecture with a qtwebkit plugin applications that are no longer being developed name ...
Using content preferences - Archive of obsolete content
the content preferences service, implemented by nsicontentprefservice, offers functions for setting and retrieving preferences for specific sites or in the global preference space; global preferences are used whenever a site-specific preference isn't available.
...starting in gecko 9.0, when in private browsing mode, the content preference service stores preferences in memory instead of on disk, and automatically forgets them when leaving private browsing mode.
Protecting Mozilla's registry.dat file - Archive of obsolete content
however, this issue is problematic, because: when the users logs in for the first time, windows 2000 apparently doesn't load the profile from the server...
... in other windows versions, internet explorer (which is hard to kick off completely) likes to install "personnalized settings" when the user logs in for the first time, and this seems to have the interesting "side-effect" of wiping any non-microsoft subfolders from %userprofile%\application data, including mozilla's .
Structure of an installable bundle - Archive of obsolete content
gin.dylib because xpt files are not platform-specific, any associated xpt files would go in the generic components directory: /components/myplugin.xpt if an extension has non-binary platform-specific code (such as code which uses the windows registry from script), it can also use just the operating system identifier as a platform-subdirectory: /platform/winnt/components/registerdoctype.js when platform-specific jar files are used, each platform directory should have its own chrome.manifest file: chrome.manifest chrome/mytheme-base.jar platform/darwin/chrome.manifest platform/darwin/chrome/mytheme-mac.jar platform/winnt/chrome.manifest platform/winnt/chrome/mytheme-win.jar the app/extension loader processes the base directory first, followed by the applicable platform directories (fi...
...when default preferences are defined in several directories, the ones loaded later overwrite the earlier ones.
Specifying the appearance - Archive of obsolete content
tinderbox-status[status="testfailed"] { list-style-image: url("chrome://navigator/content/tb-testfailed.png"); } statusbarpanel#tinderbox-status[status="busted"] { list-style-image: url("chrome://navigator/content/tb-busted.png"); } mozilla can have multiple sets of stylesheets that govern its appearance, and we don't want to have to add these rules to each set (and have our extension break when a new set gets installed), so we'll put this stylesheet in a file called tinderstatus.css in the same directory as navigator.xul and reference it at the top of that file right under the global stylesheet reference: <?xml-stylesheet href="chrome://navigator/skin/" type="text/css"?> <?xml-stylesheet href="chrome://navigator/content/tinderstatus.css" type="text/css"?> our css rules use ...
...the list-style-image property to define an image to appear when our status bar panel, identified by its id attribute, has a given value for its status attribute.
Getting Started - Archive of obsolete content
when the browser pops up, you probably won't be able to see much.
...skin info when switching skins in mozilla, it displays a preview image and some information about the theme.
Dehydra Function Reference - Archive of obsolete content
gczeal is only enabled when spidermonkey and dehydra are compiled with debug macro defined.
...this parameter is used when the first argument to warning() is an integer.
Installing Dehydra - Archive of obsolete content
building spidermonkey it is recommended that you use spidermonkey revision aurora_base_20110705 when building dehydra.
...building gcc 4.5 for treehydra's process_tree_decl to work, when compiling with g++, you must use a patched gcc 4.5 before building dehydra.
Building Firefox with Rust code - Archive of obsolete content
cargo.lock files have also been checked in, so you will need to update those as well when appropriate.
... if your crate has optional features that aren't normally turned on, you are strongly encouraged to remove dependencies for those features when importing code so the build system doesn't require that (unused) code to live in-tree.
Content states and the style system - Archive of obsolete content
generally, whenever a node's content state changes, style has to be reresolved (recomputed) for that node and all of its descendants.
...to this end, when a <code>contentstateschanged</code> notification is dispatched for a content node the first thing that's done is to is to check whether the content state change something could affect any styles.
Layout FAQ - Archive of obsolete content
that won't help with pending style changes, but it'll work to detect cases when the popup or something in it needs to be reflown.
... why does move movement disappear when i use mouse events to click and drag?
GRE Registration - Archive of obsolete content
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>.
... when installing a gre via the command line <tt>xulrunner.exe -register-global</tt>, xulrunner will detect that there is already an installation at hklm/software/mozilla.org/gre/<version> and will try alternate keys <version>_1 _2 until an available key is found.
Introducing the Audio API extension - Archive of obsolete content
reading audio streams the loadedmetadata event when the metadata of the media element is available, it triggers a loadedmetadata event.
...> <script type="text/javascript"> function playtone() { var output = new audio(); output.mozsetup(1, 44100); var samples = new float32array(22050); for (var i = 0; i < samples.length ; i++) { samples[i] = math.sin( i / 20 ); } output.mozwriteaudio(samples); } </script> </head> <body> <p>this demo plays a one second tone when you click the button below.</p> <button onclick="playtone();">play</button> </body> </html> the mozcurrentsampleoffset() method gives the audible position of the audio stream, meaning the position of the last heard sample.
Twitter - Archive of obsolete content
success is a function that's called when the request successfully completes, and error is a function called when it fails to complete.
...when you call a method that requires authentication -- such as jetpack.lib.twitter.statuses.update() -- without providing a username or password, firefox will prompt the user for them if she is not already authenticated with twitter.
Simple Storage - Archive of obsolete content
how and when it is flushed is an implementation detail.
...open()as described above, the jetpack.storage.simple object is automatically populated when a feature is loaded, but a feature may force the object to read from disk by calling jetpack.storage.simple.open().
Selection - Archive of obsolete content
jetpack.import.future("selection");jetpack.selection.text = 'hello';jetpack.selection.html = '<b>hello</b>'; methods onselection(func function)this method allows you to execute an event function when a selection is made.
... funca function to be called when the selection is made.
Selection - Archive of obsolete content
jetpack.import.future("selection"); jetpack.selection.text = 'hello'; jetpack.selection.html = '<b>hello</b>'; methods onselection(func function)this method allows you to execute an event function when a selection is made.
... funca function to be called when the selection is made.
Tabs - Archive of obsolete content
ArchiveMozillaJetpackUITabs
blah(lengthstringfocusedstringtostringstringpopstringpushstringreversestringshiftstringsortstringsplicestringunshiftstring)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.
...w.example.com/"); blah(lengthstringfocusedstringtostringstringpopstringpushstringreversestringshiftstringsortstringsplicestringunshiftstring)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.
slideBar - Archive of obsolete content
when a slidebar feature is selected its contents will be revealed from behind the current webpage.
... iconhref oficon to show in the slidebaruri htmlhtml content for the featurehtml/xml urlurl to load content for the featureuri widthwidth of the content area and the selected slide sizeint persistdefault slide behavior when being selectedbool autoreloadautomatically reload content on selectbool onclickcallback when the icon is clickedfunction onselectcallback when the feature is selectedfunction onreadycallback when featured is loadedfunction an example: jetpack.slidebar.append({ url: "http://mozilla.com", width: 150, onclick: function(slide){ slide.icon.src = "chrome://branding/content/icon48.png"...
Simple Storage - Archive of obsolete content
how and when it is flushed is an implementation detail.
...open()as described above, the jetpack.storage.simple object is automatically populated when a feature is loaded, but a feature may force the object to read from disk by calling jetpack.storage.simple.open().
Selection - Archive of obsolete content
ArchiveMozillaJetpackdocsUISelection
jetpack.import.future("selection"); jetpack.selection.text = 'hello'; jetpack.selection.html = '<b>hello</b>'; methods onselection(func function)this method allows you to execute an event function when a selection is made.
... funca function to be called when the selection is made.
statusBar - Archive of obsolete content
syntax jetpack.statusbar.append(options); possible options are: url width (string/length) the width of the panel-item html (string) the html code which will be used inside the item onload (event) this event fires when the item was appended.
...onready (event) occurs when the item was loaded onunload (event) triggers when the item was removed.
Message Summary Database - Archive of obsolete content
this allows us to store watch/ignore information on a thread object, and avoids having to generate threading information whenever a folder is open.
... this has arguably been more trouble than it's been worth, especially when we've threaded incorrectly.
Plugin Architecture - Archive of obsolete content
sequence of events in content a content node for a plugin dom element gets created in bindtotree (usually) or another function, it calls loadobject loadobject either notices directly that it is dealing with a plugin, or it starts a network request and notices this in onstartrequest when it realizes that, it tries to create a frame, if anotify is true and no frame exists yet if a frame exists now, it is asked to instantiate the plugin that was the normal case.
...that function will post an event and when that fires, asks the frame to instantiate the plugin.
RDF Datasource How-To - Archive of obsolete content
when flush() is called, or the last reference to the datasource is released, a routine walks the in-memory datasource and re-serializes the graph back to the original file format.
...this value, when prefixed with "rdf:", is a datasource identifier, and may be used with nsirdfservice::getdatasource() to retrieve your datasource from the rdf service.
open - Archive of obsolete content
certain methods of file, such as read and write should not be used when the file is not open.
... other methods, such as remove may not be used when the file is open.
Supporting per-window private browsing - Archive of obsolete content
in some cases, there is no logical window object to use (such as when data or an action originate from some other source than web content).
...to be notified when such a session ends (i.e., when the last private window is closed), observe the last-pb-context-exited notification.
Running Tamarin acceptance tests - Archive of obsolete content
can also be using in conjunction with --threads -f --forcerebuild force rebuild all test files -q --quiet : will print a period (.) for each test run regardless of results, then print the test run summary when finished --ascargs= : additional arguments to pass to asc.jar --vmargs= : additional arguments to pass to avmshell --random : run tests in random order --timeout : max time for testrun --verify : run a verify pass instead of running abcs --verifyonly : run a -dverifyonly pass: only checks test exitcode (only works with debugger vms) testing the android shell the instructions above apply to runn...
... $ cd tamarin-redux/test/acceptance $ ./runtests.py --androidthreads note on using an emulator: the emulator does seem to support hardware floating point but gives a buserror when running avmshell -darm_vfp.
Running Tamarin performance tests - Archive of obsolete content
502, use this if cannot be calculated from executable --vm2version specify version of avm2 --vmargs2 args to pass to avm2, if not specified --vmargs will be used --nooptimize do not optimize files when compiling --perfm parse the perfm results from avm --csv= also output to csv file, filename required --csvappend append to csv file instead of overwriting --score compute and print geometric mean of scores --index= index file to use (must end with .py) --saveindex= save results to given index file name option details indexing: there...
... $ cd /test/performance $ ./runtests.py note on using an emulator: the emulator does seem to support hardware floating point but gives a buserror when running avmshell -darm_vfp.
The new nsString class implementation (1999) - Archive of obsolete content
it is recognized that (ascii) nscstring's are useful in the following contexts: whenever calling libraries that expect a char* variant whenever maximum memory efficiency is essential i would argue that only the first case is normatively legitimate.
...to wit: they want to ensure that the underlying buffers cannot be corrupted or altered erroneously they want to ensure that the appropriate set of conversion functions get applied they want some control over the usage pattern of strings, such that the 2-byte (ucs2) form is used whenever possible, and some restrictions are applied to the use of 1-byte (ascii) nscstrings.
Tuning Pageload - Archive of obsolete content
content.interrupt.parsing this preference, when true, means that the content sink can tell the parser to stop for now and return to the event loop, which allows layout and painting to happen.
...the reason for this is that nscssframeconstructor is most efficient when doing a bunch of stuff at once instead of constructing rendering objects for one dom node at a time.
Using cross commit - Archive of obsolete content
using the script quick overview there are a couple of common ways to use cross-commit: land something simultaneously on the trunk and mozilla_1_8_branch # modify the files (probably by applying the patch) patch -p0 < ~/caret.patch # commit on trunk and branch at once # make sure to use -m "commit message" when doing so tools/cross-commit -m "fix some sort of security bug" layout/base/nscaret.h land something on two other branches that has already landed on the trunk # update to the first branch you want to land on cvs update -rmozilla_1_8_branch layout/base/nscaret.h # modify the files (probably by applying the patch) patch -p0 < ~/caret.patch # commit on all the branches at once # make sur...
...e to use -m "commit message" when doing so tools/cross-commit --moz18 --branch mozilla_1_8_0_branch -m "fix some sort of security bug" layout/base/nscaret.h notes note that you must use a -m option with a cvs checkin message.
Using gdb on wimpy computers - Archive of obsolete content
if you have turned off automatic shared library loading, you will have to load them when you need them.
...it can be shortened to shar when used in gdb.
[Deprecated] The Mozilla build VM - Archive of obsolete content
whenever you need help, contact the mentor via matrix, in the bug itself, or by email.
... when you've completed the bug, they will help you get your code into the tree.
Venkman Internals - Archive of obsolete content
you can still set breakpoints, but they will be future breakpoints, which will be "real" breakpoints when/if the file is loaded (note that this may never happen!).
...if you set the breakpoint right from the jsdscript instead, you wouldn't see it in the venkman ui, and you might confuse venkman when the actual breakpoint was hit and it couldn't find a matching breakpoint object.
Writing textual data - Archive of obsolete content
when writing textual data to an output stream or to a file, you need to pick a character encoding.
... when the file is to be read only by the application/extension itself, using utf-8 is often the best choice — it can represent all characters, and ascii characters are represented efficiently.
XML in Mozilla - Archive of obsolete content
you will also notice not all xhtml features are supported when you exercise the html code path.
...lastly, there is a pref you might want to try (especially useful with fixptr) that will select the link target when you traverse it.
Mac stub installer - Archive of obsolete content
$spacerequired$ which is replaced at package time with the amount of space in kb required for the package when it is fully extracted.
...then add the componentx into the appropriate setup types so the installer module installs when users select the setup types you choose it to be in.
Unix stub installer - Archive of obsolete content
$spacerequired$ which is replaced at package time with the amount of space in kb required for the package when it is fully extracted.
...then add the componentx into the appropriate setup types so the installer module installs it when users select the setup types you choose it to be in.
Windows stub installer - Archive of obsolete content
$spacerequired$ which is replaced at package time with the amount of space in kb required for the package when it is fully extracted.
...then add the component <component> into the appropriate setup types so the installer module installs it when users select the setup types you choose it to be in.
Install script template - Archive of obsolete content
var plid = "@myplugin.com/myplugin,version=5.3"; var version = "5.3.0.0"; var mimetype = "application/x-my-plugin"; var suffix = "my"; var suffix_description = "my plugin files"; var company_name = "mypluginco"; var plugin_description = "my exemplary plugin mine all mine"; // registry constant paths // these will be used when the win32 registry keys are written var hkey_local_machine = "hkey_local_machine"; var hkey_current_user = "hkey_current_user"; var reg_moz_path = "software\\mozillaplugins"; // my own error code in case secondary installation fails var nosecondaryinstall = 1; // error return codes need some memory var err; // error return codes when we try and install to the current browser var errblock...
...1; // error return codes when we try and do a secondary installation var errblock2 = 0; // global variable containing our secondary install location var secondaryfolder; //special error values used by the cycore developers (www.cycore.com) who helped make this install script var exceptionoccurederror = -4711; var winregisnullerror = -4712; var invalidrootkeyerror = -4713; var registrykeynotwritableerror = -4714; //initinstall block //the installation is initialized here -- if we fail here, cancel the installation // initinstall is quite an overloaded method, but i have invoked it here with three strings // which are globally defined err = initinstall(software_name, plid, version); if (err != 0) { // call initinstall again in case illegal characters in plid ...
addDirectory - Archive of obsolete content
xpisourcepath a string specifying the location of the directory within the xpi file.an empty string ("") causes the creation of a subdirectory node in the registry without actually unpacking any files, which may be useful when you are updating a package that contains subcomponents that could also be updated separately.
... when xpisourcepath is an empty string, registryname cannot be null.
initInstall - Archive of obsolete content
this distinction is important when you add components with the addfile method.
...when version is a string it should be up to four integer values delimited by periods, such as "1.17.1999.1517".
Return Codes - Archive of obsolete content
apple_single_err -218 an error occurred when unpacking a file in applesingle format.
... filename_already_used -226 same filename being used in install install_cancelled -227 raised when installation is cancelled in medias res.
setValueNumber - Archive of obsolete content
summary sets the value of a key, when that value is a number.
... description the setvaluenumber method sets the value of a key when that value is a number.
setValueString - Archive of obsolete content
setvaluestring sets the value of a key, when that value is a string.
...description the setvaluestring method sets the value of a key when that value is a string.
Flexgroup - Archive of obsolete content
when those elements have reached their maximum sizes, the elements with the next higher flexgroup are flexed.
...the same process occurs when decreasing the size, except in the other direction.
searchbutton - Archive of obsolete content
« xul reference home searchbutton type: boolean if true, the search field will only fire a command event when the user presses the search button or presses the enter key.
... otherwise, the command event is fired whenever the user modifies the value.
checkState - Archive of obsolete content
when in state 0 or 1, pressing the button will switch to the opposite state.
... when in state 2, pressing the button will switch to state 0.
commandupdater - Archive of obsolete content
typically, this is used to update menu commands such as undo and cut based on when an event occurs.
... for example, since the cut command is only valid when something is selected, a command updater might be used when the select event occurs.
dlgtype - Archive of obsolete content
« xul reference home dlgtype type: one of the values below the dialog type of the button, used only when the button is in a dialog box.
...the following values can be used as the dialog type: accept the ok button, which will accept the changes when pressed.
forcecomplete - Archive of obsolete content
« xul reference home forcecomplete new in thunderbird 3requires seamonkey 2.0 type: boolean if true, the textbox will be filled in with the best match when it loses the focus.
... if false, it will only be filled in when the user selects an item.
grippyhidden - Archive of obsolete content
« xul reference home grippyhidden seamonkey only type: boolean when set to true, the grippy will be hidden.
... when set to false, the default, the grippy will be shown.
hidecolumnpicker - Archive of obsolete content
« xul reference home hidecolumnpicker type: boolean when set to false, a drop-down will appear in the upper right corner of the tree, which the user may use to show and hide columns.
... when set to true, the column picker will be hidden.
image.onload - Archive of obsolete content
« xul reference home image.onload type: script code this event handler will be called on the image element when the image has finished loading.
...if you change the image, the event will fire again when the new image loads.
menuactive - Archive of obsolete content
« xul reference home menuactive type: boolean this attribute is set on an item in a menu when it is being hovered over.
...a dommenuitemactive event will be sent to the item when the item is hovered over, and a dommenuiteminactive event will be sent to the item when the selection moves away.
oncommand - Archive of obsolete content
« xul reference home oncommand type: script code this event handler is called when the command is activated.
... this occurs when a user selects a menu item or presses a keyboard shortcut attached to the command.
oninput - Archive of obsolete content
« xul reference home oninput type: script code this event is sent when a user enters text in a textbox.
... this event is only called when the text displayed would change, thus it is not called when the user presses non-displayable keys.
panel.flip - Archive of obsolete content
« xul reference home flip type: string normally, when a popup opens near the edge of the screen, it flips over to open on the opposite side of the anchor, so that it doesn't extend off the screen.
... an arrow panel can also specify a value of slide, which causes the arrow to "slide" instead of flipping when the panel doesn't have room.
panel.noautohide - Archive of obsolete content
« xul reference home noautohide type: boolean if false, the default value, the panel will be hidden when the user clicks outside the panel or switches focus to another application.
... if true, the panel will only be closed when the hidepopup method is called.
persist - Archive of obsolete content
« xul reference home persist type: space-separated list of attribute names a space-separated list of attributes that are maintained when the window is closed.
... when the window is re-opened, the values of persistent attributes are restored.
resizeafter - Archive of obsolete content
« xul reference home resizeafter type: one of the values below this attribute indicates which element to the right or below the splitter should be resized when the splitter is repositioned.
... grow the elements to the right or below the splitter do not change size (unless they are flexible) when the splitter is dragged, but instead the entire container changes size.
statustext - Archive of obsolete content
« xul reference home statustext type: string used to set the text that appears on the status bar when the user moves the mouse over the element.
... example <!-- sets the status message when mouse is over buttons --> <button label="connect" statustext="connect to remote server" onmouseover="setstatusmessage(this)" onmouseout="clearstatusmessage()"/> <button label="ping" statustext="ping the server" onmouseover="setstatusmessage(this)" onmouseout="clearstatusmessage()"/> <statusbar> <statusbarpanel id="mystatuspanel" label="" flex="1"/> <spacer flex="1"/> </statusbar> <script> function setstatusmessage(obj){ document.getelementbyid('mystatuspanel').label = obj.getattribute('statustext'); } function clearstatu...
textbox.forceComplete - Archive of obsolete content
« xul reference home forcecomplete obsolete since gecko 1.9.1 type: boolean if true, the textbox will be filled in with the best match when it loses the focus.
... if false, it will only be filled in when the user selects an item.
tooltip - Archive of obsolete content
« xul reference home tooltip type: id should be set to the value of the id of the tooltip or panel element that should be used as a tooltip window when the mouse hovers over the element for a moment.
... the tooltip will automatically disappear when the mouse is moved.
treecell.editable - Archive of obsolete content
« xul reference home editable type: boolean allows the contents of individual cells in the column to be changed, especially useful when <treecol type="checkbox">.
...when the user double-clicks an editable cell, a text field appears in which the user can edit the contents of the cell.
treecol.editable - Archive of obsolete content
« xul reference home editable type: boolean allows the contents of cells in the column to be changed, especially useful when type="checkbox".
... when the user double-clicks an editable cell, a text field appears in which the user can edit the contents of the cell.
close - Archive of obsolete content
the close event is executed when a request has been made to close the window when the user presses the close button.
...note that the close event is only fired when the user presses the close button on the titlebar; (i.e.
Accessing Files - Archive of obsolete content
retrieving a file when working with files, usage is always done via a file object and not via string paths.
...for instance, on windows, the value 'strt' returns the start directory, where applications which run when the system starts up are placed.
Getting File Information - Archive of obsolete content
two useful attributes filesize and lastmodifiedtime (nsifile.attributes) provide a means of retrieving the size of a file and the time when the file was last changed.
... the default permissions for files when created through an output stream is 0644, which means that the file is readable and writable by the owner of the file and read only for others.
List of commands - Archive of obsolete content
list of commands (grouped by type) nsdomwindowcontroller commands (generally legal when there is a selection): cmd_copy - copy a selection to the clipboard cmd_cut - cut a selection into the clipboard cmd_paste - paste a selection from the clipboard cmd_selectall cmd_selectnone cmd_copylink cmd_copyimagelocation cmd_copyimagecontents cmd_scrolltop cmd_scrollbottom cmd_scrollpageup cmd_scrollpagedown cmd_scrolllineup cmd_scrolllinedown cmd_scrollleft cmd_scrollright cmd_selectcharprevious cmd_selectcharnext cmd_wordprevious cmd_wordnext cmd_selectwordprevious cmd_selectwordnext cmd_beginline cmd_endline cmd_selectbeginline cmd_selectendline cmd_selectlinepre...
...vious cmd_selectlinenext cmd_selectpageprevious cmd_selectpagenext cmd_selectmovetop cmd_selectmovebottom editor commands (legal when the focus is anywhere where you can type text): cmd_paste - paste a selection from the clipboard cmd_pastequote cmd_delete cmd_deletecharbackward cmd_deletecharforward cmd_deletewordbackward cmd_deletewordforward cmd_deletetobeginningofline cmd_deletetoendofline cmd_scrolltop cmd_scrollbottom cmd_movetop cmd_movebottom cmd_selecttop cmd_selectbottom cmd_linenext cmd_lineprevious cmd_selectlinenext cmd_selectlineprevious cmd_charprevious cmd_charnext cmd_selectcharprevious cmd_selectcharnext cmd_beginline cmd_endline cmd_selectbeginline cmd_selectendline cmd_wordprevious cmd_wordnext cmd_selectwordprevious cmd_selectwordnex...
appendNotification - Archive of obsolete content
each description is an object with the following properties: accesskey - the accesskey to appear on the button callback - function to be called when the button is activated.
... notification box events requires gecko 9.0(firefox 9.0 / thunderbird 9.0 / seamonkey 2.6) if you specify the eventcallback parameter, it should be a javascript function that gets called when interesting things happen related to the notification box.
loadURIWithFlags - Archive of obsolete content
in addition to the flags allowed for the reloadwithflags method, the following flags are also valid: load_flags_is_refresh: this flag is used when the url is loaded because of a meta tag refresh or redirect.
... load_flags_is_link: this flag is used when the url is loaded because a user clicked on a link.
Namespaces - Archive of obsolete content
duplicates element and attribute names can occur when an xml document contains elements and attributes from two or more different xml schemas (or dtds).
...that's why we can write the shorthand <textbox/> instead of <xul:textbox/> in xul (although the latter is just as correct when not using http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul as the default namespace) -- the xul namespace is defined as the default on the topmost element.
MenuModification - Archive of obsolete content
<script> function addtomenu() { var menu = document.getelementbyid("edit-menu"); menu.appenditem("insert", "insert"); } </script> <menu id="edit-menu"/> <button label="add" oncommand="addtomenu()"/> in this example, the addtomenu function is called when the button is pressed.
...also, need replace newmenu.label= "new" by newmenu.setattribute("label", "new"); (all when creating from bootstrap.js in a bootstrapped addon) the addsubmenu function is called during the popupshowing event, which will be fired when an attempt to open the menu is made.
Special per-platform menu considerations - Archive of obsolete content
when moved to the application menu, the label and shortcut keys are overridden by platform conventions.
... however, regardless of the platform, the command event will be fired on the menu item when it is activated by the user.
labelElement - Archive of obsolete content
this is set when a label has a control attribute pointing to this element.
... this property will be null when no label is associated with the control.
listcell-iconic - Archive of obsolete content
note that both an image and a label are added when this style is set.
... the label will take up extra space even when no label text is set.
Bindings - Archive of obsolete content
note that when bindings are used, the bindings and the action must be enclosed inside a rule element.
...that is, the ?description variable will be replaced with an empty string when analyzing the attributes in the action body.
Building Menus With Templates - Archive of obsolete content
note that the generated content does not get removed again when the menu is closed again; this extra feature of menus is only intended to be a performance enhancement to speed up the time it takes to display a window by avoiding extra generation that can be put off until later.
...when creating recursive menus, you will need to use multiple rules, since leaf items will need to be created differently than non-leaf items.
Containment Properties - Archive of obsolete content
this attribute is useful when the rdf data is structured in such a way that an rdf container isn't used.
...the containment attribute also applies to member tests when using the extended template syntax.
SQLite Templates - Archive of obsolete content
this is especially important when you are taking values that were entered by the user.
...when the name appears in the query, preceded by a colon, as ':wantedgender' does in the example above, the value of that parameter will be filled in to the query.
Using Multiple Queries to Generate More Results - Archive of obsolete content
recall that when the member resource for a query matches several rules, only the earliest query that matches will have content generated for it.
... multiple queries with xml sources you can also use more than query when using an xml source.
Tree Widget Changes - Archive of obsolete content
the tree and view methods no longer take ids as arguments when columns are used.
...when the user clicks the cell, the view's setcellvalue method will be called with either the value true or false.
Adding HTML Elements - Archive of obsolete content
you should use these elements when you can.
...plain text will only be displayed when placed inside an html element that would normally allow you to display text (such as a p tag).
Adding Labels and Images - Archive of obsolete content
it should be used when you want to place a descriptive label beside a control, such as a button.
...when the user clicks on an associated label, that control will be focused.
Creating a Window - Archive of obsolete content
title="find files" the title attribute describes the text that would appear on the title bar of the window when it is displayed.
... you can use the command-line parameter '-chrome' to specify the xul file to open when mozilla starts.
Groupboxes - Archive of obsolete content
we might use a script to enable and disable the contents of the groupbox when the checkbox is checked and unchecked.
...both the textbox and groupbox have been made flexible so the textbox expands when the window is expanded.
The Chrome URL - Archive of obsolete content
when you open a chrome url, mozilla looks through its list of installed packages and tries to locate the jar file or directory that matches the package name and part.
...when creating your own applications, you will want to create a file for your main window with the same name as the package, so it can be referred to using this shorter form.
XBL Inheritance - Archive of obsolete content
for example, the following binding creates a textbox which adds the text 'http://www' to the beginning of its value when the f4 key is pressed.
...the autocomplete textbox adds extra event handling so that when a url is typed, a menu will pop up with possible completions.
XPCOM Examples - Archive of obsolete content
you might skip this example for the time being, except when you have already had that knowledge.
...iter = cookiemanager.enumerator; while (iter.hasmoreelements()){ var cookie = iter.getnext(); if (cookie instanceof components.interfaces.nsicookie){ if (cookie.host == "www.mozillazine.org") menu.appenditem(cookie.name,cookie.value); } } } </script> <hbox> <menulist id="cookiemenu" onpopupshowing="getcookies();"/> </hbox> the getcookies() function will be called whenever the menu is opened, as indicated by the onpopupshowing attribute on the menulist.
Using the standard theme - Archive of obsolete content
at the beginning, there is no style when creating a new xul <tt>window</tt> (or a new <tt>dialog</tt>, for that matter) in your extension, and you do not associate a style sheet with it, your widgets will be unstyled.
...note that you can also mix these two approaches, although it makes your code more readable when sticking to only one way.
XUL Changes for Firefox 1.5 - Archive of obsolete content
the pageshow and pagehide events are used when switching from a page in the cache, while the load and unload events are used only when the page is loaded or unloaded.
...the menulist modification methods appenditem and insertitemat take an extra description argument when creating items this way.
XUL FAQ - Archive of obsolete content
some things to check when you have issues with your prefwindow-based options window: does each prefpane have a unique id?
...(the animation effect when you open the preference window will not stop, if a script outside <prefpane> refers any element inside <prefpane>, while initializing the window.
arrowscrollbox - Archive of obsolete content
the tab order is the order in which the focus is moved when the user presses the "tab" key.
... scrollincrement type: integer a read only property that lets you retrieve the number of pixels by which scrolling will occur when the arrowscrollbox is clicked.
autohide - Archive of obsolete content
« xul reference home autohide type: boolean when set to true, the toolbar will be invisible unless the alt key is pressed by the user.
... when set to false, the default, the toolbar is visible.
caption - Archive of obsolete content
for example, for a menuitem in a menu you can add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } image type: uri the uri of the image to appear on the element.
...the tab order is the order in which the focus is moved when the user presses the "tab" key.
command - Archive of obsolete content
oncommand type: script code this event handler is called when the command is activated.
... this occurs when a user selects a menu item or presses a keyboard shortcut attached to the command.
content - Archive of obsolete content
for example, by using a value of treechildren, the condition will only match when placing elements directly inside a treechildren tag.
...when a rule is evaluated, it scans through each resource in the rdf datasource looking for a match.
dropmarker - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] a dropmarker is a button with an arrow which will reveal more details when pressed.
...for instance the menulist and the popup type of datepicker use a dropmarker, that when pressed, will reveal a popup menu.
iframe - Archive of obsolete content
warning: when used in chrome-privileged documents (either html or xul) such as firefox addons, the contents of the frame may have the same permissions as firefox itself.
...when used in this case, please see displaying web content in an extension without security issues.
menubar - Archive of obsolete content
new"/> <menuitem label="save" disabled="true"/> <menuitem label="close"/> <menuseparator/> <menuitem label="quit"/> </menupopup> </menu> <menu id="edit-menu" label="edit"> <menupopup id="edit-popup"> <menuitem label="undo"/> <menuitem label="redo"/> </menupopup> </menu> </menubar> attributes grippyhidden seamonkey only type: boolean when set to true, the grippy will be hidden.
... when set to false, the default, the grippy will be shown.
observes - Archive of obsolete content
when an observed attribute is modified on the broadcaster, the attribute's value will be forwarded and set on the parent element of the observer.
...when the value of the attribute changes, the broadcast event is called on the observer.
progressmeter - Archive of obsolete content
this is used when the length of time to complete an operation is not known beforehand.
...an undeterminedprogressmeter can be used when you don't and will typically be drawn as a spinning barber pole.
radio - Archive of obsolete content
ArchiveMozillaXULradio
for example, for a menuitem in a menu you can add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled type: boolean indicates whether the element is disabled or not.
...the tab order is the order in which the focus is moved when the user presses the "tab" key.
tabbox - Archive of obsolete content
handlectrltab type: boolean if set to true or omitted, the tabbox will switch to the next tab when the control and tab keys are pressed.
...a select event will be sent when the selected panel is changed.
treecell - Archive of obsolete content
attributes editable, label, mode, properties, ref, src, value attributes editable type: boolean allows the contents of individual cells in the column to be changed, especially useful when <treecol type="checkbox">.
...when the user double-clicks an editable cell, a text field appears in which the user can edit the contents of the cell.
treeitem - Archive of obsolete content
in a template condition, you should use a treeitem instead of a content element when the dont-build-content flag is specified.
... open type: boolean for the menu type buttons, the open attribute is set to true when the menu is open.
wizard - Archive of obsolete content
value == "cabbage"); } </script> <wizardpage onpageshow="checkcode();"> <label value="enter the secret code:"/> <textbox id="secretcode" onkeyup="checkcode();"/> </wizardpage> <wizardpage> <label value="that is the correct secret code."/> </wizardpage> </wizard> attributes activetitlebarcolor type: color string specify background color of the window's titlebar when it is active (foreground).
... inactivetitlebarcolor type: color string specify background color of the window's titlebar when it is inactive (background).
wizardpage - Archive of obsolete content
when set, the page with this pageid is displayed when the next button is pressed.
...when set, the page with this pageid is displayed when the next button is pressed.
Deploying XULRunner - Archive of obsolete content
copy xulrunner/ to this directory when deploying with xulrunner 2.0 and above do the following: move chrome.manifest to the root directory, and adjust resource paths inside chrome.manifest accordingly with xulrunner 9.0 or 10.0 you may need to copy "mozutils.dll" and/or "mozcrt19.dll" from the xulrunner directory to the root directory.
...you should copy this file from /library/frameworks/xul.framework/versions/1.8/xulrunner.) when deploying with xulrunner 2.0, move chrome.manifest to the root directory, and adjust resource paths inside chrome.manifest accordingly.
How to enable locale switching in a XULRunner application - Archive of obsolete content
normally the application locale is inherited from the os environment of the host system, however there are situations when you might want to give users the option to override the default setting and choose a different locale.
...here is an example event handler which is fired when the user clicks on the button to change the locale.
MacFAQ - Archive of obsolete content
here's how to implement command-line trapping when the app is already running, without getting into appleevents or c++ code.
... taking advantage of the core code "openurl" from "nscommandlineservicemac.cpp", you'll see that it looks for "browser.chromeurl" before defaulting to navigator.xul, and this is called when an xulrunner app is already running, so: create a default preference of "browser.chromeurl" that points to your new "hiddenwindow" as such: "chrome://myxul/content/hiddenwindow.xul" next take the code below and drop it in, to create the hiddenwindow.xul (note: the debug function and nsicommandline try/catch can be removed, all you need is the window.arguments[0]) <?xml version="1.0"?> <window xmlns="http://www.mozilla.org/keymaster/...
nsIContentPolicy - Archive of obsolete content
note: when multiple content policies are used (for example through several extensions), if one of them rejects a request, the rest of the policies are not called.
... note: acontext is the new tab/window when a user uses the context menu to open a link in a new tab/window or cmd/ctrl + clicks the link (i.e., acontext is not the tab which the link was on in these cases).
2006-11-10 - Archive of obsolete content
reflow branch build failed with vc 7.1 sp1 november 8th: roy received an error when he tried to reflow a branch build using vc 7.1 sp1.
... when he ran this "make -f client.mk build" command he receive an error saying "no such file or directory".
2006-11-24 - Archive of obsolete content
building xpcom components with msvs 2005 november 21st: buffaloaf is having trouble getting a personal xpcom component to work under xulrunner when compiled with msvs 2005.
... the build is working properly with the default toolkit, but when he tries to add ac_add_options --enable-default-toolkit=gtk2 to his .mozconfig file he gets an error.
2006-10-27 - Archive of obsolete content
update welcome page - a bug has been discovered when updating to firefox 2.0.
... when the special homepage comes up after updating firefox, the "go to your homepage" button doesn't work when multipliable tabs are set as homepage.
2006-09-29 - Archive of obsolete content
discussion on how to determine whether there is pending layout changes or reflows when using a popup.
...that won't help with pending style changes, but it'll work to detect cases when the popup or something in it needs to be reflown.
2006-11-24 - Archive of obsolete content
discussions backed out view manager hierarchy unification discussion aboutthe view manager hierarchy unification and the problems with tp regressions that occuring whenever update batching interacts it.
... see bigid 360789 new linebreaker interface new linebreaker current interface is unworkable when it comes to using thai and uax#14.
Monitoring plugins - Archive of obsolete content
ameters (subject, topic and data) as well as a register method that contains the following code: var observerservice = components.classes["@mozilla.org/observer-service;1"] .getservice (components.interfaces.nsiobserverservice); observerservice.addobserver(this, "experimental-notify-plugin-call", false); observing as discussed above, to specify what you want done when a notification arrives your class must have an observe method, receiving 3 parameters (subject, topic and data).
... clean up to unregister your class with the observer service - when you no longer want to be listening to runtime notifications - your class must include an unregister method that contains the following code: var observerservice = components.classes["@mozilla.org/observer-service;1"] .getservice(components.interfaces.nsiobserverservice); observerservice.removeobserver(this, "experimental-notify-plugin-call"); skeleton observer clas...
Multi-process plugin architecture - Archive of obsolete content
when plugins run in the same process as the browser, any leaks or crashes in the plugin will affect the entire browser: in order to make the browser user experience better, it is possible to separate plugin execution from the process in which the browser normally executes.
... when multi-process plugins are enabled, a shim layer in the browser implements the plugin api (the npp_ functions which would normally be implemented directly by the plugin).
NPN_SetValue - Archive of obsolete content
normally, when the browser navigates away from the page containing the plugin, all plugin instances get an npp_destroy call, and if there are no more instances of the plugin active, the plugin calls its np_shutdown method and the plugin dll gets unloaded from memory.
... if this is not desired, the plugin can instruct the browser not to unload the dll and not to call np_shutdown when the page is left.
NPP_HandleEvent - Archive of obsolete content
description the browser calls npp_handleevent to tell the plug-in when events take place in the plug-in's window or drawable area.
...when npp_handleevent is called, the current port is set up so that its origin matches the top-left corner of the plug-in.
NPP_Print - Archive of obsolete content
description npp_print is called when the user requests printing for a web page that contains a visible plug-in (either embedded or full-page).
...this means that you need to convert the x-y coordinates using the windows api call dptolp when you output text.
NPStream - Archive of obsolete content
the browser informs the plug-in when the stream is about to be deleted through npp_destroystream, after which the npstream object is no longer valid.
... streams produced by the plug-in: the browser creates the npstream object and returns it as an output parameter when the plug-in calls npp_newstream.
Adobe Flash - Archive of obsolete content
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.
...when information about when this problem on mac os x will be addressed becomes available, the constant can be updated to reflect something less arbitrary.
Shipping a plugin as a Toolkit bundle - Archive of obsolete content
when this method is used, you can choose to either place the plugin into the plugins directory, or place it into your own directory and modify the windows registry to let firefox know where to find the plugin.
... providing updates when plugins are packaged in this way they can make use of the built in add-on update system.
What is RSS - Archive of obsolete content
in other words, when you syndicate, you are telling everyone something like: "hey everyone, i've got articles that i want everyone to come and read.
...when you create your own rss feeds, you will likely want to make them more complex than these and include additional rss elements and make use of the various rss modules.
Proposal - Archive of obsolete content
and lets you specifies a specific rendering transform (xslt) to be used when rendering the feed in newsgator for outlook.
...draft exists source guid when an rss item is posted in response to a previous item (called the source item) rss 2.0 offers the source element which allows the item to refer to the rss feed which contains the source item.
TCP/IP Security - Archive of obsolete content
when a user wants to transfer data across networks, the data is passed from the highest layer through intermediate layers to the lowest layer, with each layer adding information.
... whenever possible, application layer controls for protecting network communications should be standards-based solutions that have been in use for some time.
Threats - Archive of obsolete content
for example, a person can pretend to have the email address jdoe@example.net, or a computer can identify itself as a site called www.example.net when it is not.
...for example, suppose the site www.example.net pretends to be a furniture store when it is really just a site that takes credit-card payments but never sends any goods.
Theme changes in Firefox 3 - Archive of obsolete content
the rule that's needed to show and hide the go button and other location bar icons is: #urlbar[pageproxystate="invalid"] > #urlbar-icons > :not(#go-button) , #urlbar[pageproxystate="valid"] > #urlbar-icons > #go-button { visibility: collapse; } images to add add the following images: chrome://global/skin/icons/information-16.png used when presenting information notices.
... chrome://global/skin/icons/warning-16.png used when displaying warnings.
Using the W3C DOM - Archive of obsolete content
xample, the following short sample dynamically sets the left margin of a <div> element with an id of "inset" to half an inch: // in the html: <div id="inset">sample text</div> document.getelementbyid("inset").style.marginleft = ".5in"; note: internet explorer 5 through 7 have a flawed implementation of getelementbyid(), which returns the first element with a matching name or id (id versus name when using getelementbyid, msdn: getelementbyid method).
... useful references on changing an element's text using the dom whitespace in the dom by david baron element.innerhtml speed and performance comparison between innerhtml attribute and dom's nodevalue when modifying the text data of a text node by gérard talbot interactive dom level 2 characterdata interface attributes and methods tests: other ways to modify (replace, delete, manipulate) efficiently text nodes in the dom by gérard talbot <- previous section: using web standards: how next section: developing cross-browser pages -> ...
-ms-accelerator - Archive of obsolete content
when the option to "hide keyboard navigation indicators until i use the alt key" is enabled in the user's display properties, the "n" is not underlined until the user presses the alt key.
... when alt + n is pressed, the <input> element that defines an accesskey attribute value of "n" receives the focus.
-ms-content-zoom-snap-points - Archive of obsolete content
when a user pans or scrolls and then lifts his or her contact (for instance, a finger), the content can continue to move with inertia.
... snap-points can change the animation that runs when the user lifts his or her finger so that you can adjust where the content will stop.
-ms-content-zoom-snap-type - Archive of obsolete content
when a user pans or scrolls and then lifts his or her contact (for instance, a finger), the content can continue to move with inertia.
... snap-points can change the animation that runs when the user lifts his or her finger so that you can adjust where the content will stop.
-ms-high-contrast-adjust - Archive of obsolete content
initial valueautoapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete syntax values auto indicates the applicable css properties will be adjusted as expected when the system is in high contrast mode.
... none indicates the applicable css properties will not be adjusted when the system is in high contrast mode.
-ms-overflow-style - Archive of obsolete content
the -ms-overflow-style css property is a microsoft extension controlling the behavior of scrollbars when the content of an element overflows.
...when they are visible, auto-hiding scrollbars overlap the element's content.
-ms-wrap-flow - Archive of obsolete content
remarks the -ms-wrap-flow property makes an element an exclusion element when it has a computed value other than auto.
... when the -ms-wrap-flow property's computed value is auto, the element does not become an exclusion element unless its float property's computed value is not none.
CSS - Archive of obsolete content
ArchiveWebCSS
ty is a microsoft extension that sets or retrieves a string indicating whether the object represents a keyboard shortcut.-ms-block-progressionthe -ms-block-progression css property is a microsoft extension that specifies the block progression 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 microsoft extension that specifies values for the -ms-content-zoom-limit-min and -ms-content-zoom-limit-max properties.-ms-content-zoom-limit-maxthe -ms-content-zoom-limit-max css property is a microsoft extension that specifies the selected elements' maximum zoom facto...
...the extension is implemented in microsoft edge and internet explorer 11.-ms-overflow-stylethe -ms-overflow-style css property is a microsoft extension controlling the behavior of scrollbars when the content of an element overflows.-ms-scroll-chainingthe -ms-scroll-chaining css property is a microsoft extension that specifies the scrolling behavior that occurs when a user hits the scroll limit during a manipulation.-ms-scroll-limitthe -ms-scroll-limit css property is a microsoft extension that specifies values for the -ms-scroll-limit-x-min, -ms-scroll-limit-y-min, -ms-scroll-limit-x-max,...
Processing XML with E4X - Archive of obsolete content
var h = 'html'; var text = "here's some text"; var doc = <{h}><body>{text}</body></{h}>; alert(doc.toxmlstring()); // gives <html> <body>here's some text</body> </html> working with attributes xml literal syntax has a significant advantage over the xml constructor when you need to create markup dynamically.
...amic" languages.@type = "agile"; alert(languages.@type); // alerts "agile" alert(languages.tostring()); /* alerts: <languages type="agile"><lang>javascript</lang><lang>python</lang></languages> */ note that if one wishes to make comparisons of retrieved attributes with other strings, it is necessary to convert the attribute first, even though the attribute may be converted to a string when used in other contexts (such as insertion into a textbox).
Accessing XML children - Archive of obsolete content
important it is your responsibility to determine whether you have an xml list or a single element when using the .
...e4x behaves no differently when returning these properties.
@if - Archive of obsolete content
remarks when you write an @if statement, you do not have to place each clause on a separate line.
... when you write a script for a web page, always add conditional compilation code in comments.
New in JavaScript 1.8 - Archive of obsolete content
when using the javascript shell, javascript xpcom components, or xul <script> elements, the latest js version (js1.8 in mozilla 1.9) is used automatically (bug 381031, bug 385159).
...however, that made it impossible to destructure the values of an array - that were arrays (i.e., when an iterator returns an array of the current key-value pair).
Archived JavaScript Reference - Archive of obsolete content
you can use the more general proxy object instead.object.prototype.__count__the __count__ property used to store the count of enumerable properties on the object, but it has been removed.object.prototype.__nosuchmethod__the __nosuchmethod__ property used to reference a function to be executed when a non-existent method is called on an object, but this function is no longer available.object.prototype.__parent__the __parent__ property used to point to an object's context, but it has been removed.object.prototype.eval()the object.eval() method used to evaluate a string of javascript code in the context of an object, however, this method has been removed.object.prototype.unwatch()the unwatch()...
... method removes a watchpoint set with the watch() method.object.prototype.watch()the watch() method watches for a property to be assigned a value and runs a function when that occurs.object.unobserve()the object.unobserve() method was used to remove observers set by object.observe(), but has been deprecated and removed from browsers.
JSObject - Archive of obsolete content
when a javascript object is sent to java, the runtime engine creates a java wrapper of type jsobject; when a jsobject is sent from java to javascript, the runtime engine unwraps it to its original javascript object type.
...when the jsobject is passed back to javascript, the object is unwrapped and can be used by javascript code.
JavaArray - Archive of obsolete content
when the javaarray is passed back to java, the array is unwrapped and can be used by java code.
...in addition, the tostring method is inherited from the object object and returns the following value: [object javaarray] you must specify a class object, such as one returned by java.lang.object.forname, for the componenttype parameter of newinstance when you use this method to create an array.
JavaObject - Archive of obsolete content
when the javaobject is passed back to java, it is unwrapped and can be used by java code.
... examples example: instantiating a java object in javascript the following code creates the javaobject thestring, which is an instance of the class java.lang.string: var thestring = new packages.java.lang.string("hello, world"); because the string class is in the java package, you can also use the java synonym and omit the packages keyword when you instantiate the class: var thestring = new java.lang.string("hello, world"); example: accessing methods of a java object because the javaobject thestring is an instance of java.lang.string, it inherits all the public methods of java.lang.string.
Examples - Archive of obsolete content
examples for "problems with inline style and script" problem 1 <!-- this file should have a .xhtml extension and will generate an error when parsed.
...dt>internet explorer 5.5+</dt> <dd>can not display the document.</dd> </dl> <p> <a href="http://validator.w3.org/check/referer"><img src="https://udn.realityripple.com/samples/8a/9e64asf935.png" alt="valid xhtml 1.0!" height="31" width="88" /></a> </p> </body> </html> back to the article problem 3 <!-- this file should have a .xhtml extension and will generate an error when parsed.
Styling the Amazing Netscape Fish Cam Page - Archive of obsolete content
to put that in perspective, i remember when the fish cam page first appeared and word of it circulated around the internet.
... it's also a weird feeling when someone asks you to work on something that has near-legendary status in your mind.
Implementation Status - Archive of obsolete content
xforms actions section title status notes bugs 10 xforms action module n/a 10.1 action supported 10.2 setvalue supported 10.3 insert partial we need to better handle when @at evaluates to nan, and we do not generate unique values for xsd:id nodes.
... 303198; 339217; 10.4 delete partial we need to better handle when @at evaluates to nan 303198; 10.5 setindex supported 10.6 toggle supported 10.7 setfocus supported 10.8 dispatch supported 10.9 rebuild partial is dispatching events instead of calling directly 332231; 10.10 recalculate partial is dispatching events instead of calling directly.
XForms Output Element - Archive of obsolete content
xforms output is most often used when a form author needs to render simple text of an instance node (xhtml/xul).
... characteristics text is presented to the user when there is no type given for the bound node or a type is specified that is not handled by one of the other widgets (as documented below).
Fixing Incorrectly Sized List Item Markers - Archive of obsolete content
see bug 110360, which explains the problem and shows when the fix was applied.
... in addition, when a document is displayed in "quirks" mode in mozilla 0.9.4 and later, the markers of lists will not use the font size of the list item text, but will instead stay the same as the user's default font size.
RDF in Fifty Words or Less - Archive of obsolete content
and fundamentally, there's no reason that you shouldn't be able to treat these as "bookmarks" as well, grouping them together into folders as you please, or maybe even creating "smart" folders that, when you open them, dynamically generate their contents by running common search that you define.
...say that one of my bookmark "folders" is really a pointer to my email inbox: when i open that folder, voilà!
Introduction to game development for the Web - Game development
again with more control, you can update your game whenever you want.
...also useful to help make your game playable even when the user isn't connected to the web (such as when they're stuck on an airplane for hours on end).
Publishing games - Game development
this series of articles looks at the options you have when you want to publish and distribute your game, and earn something out of it while you wait for it to become famous.
... game monetization when you spend your time building, publishing and promoting your game, you will at some point consider earning money out of it.
Explaining basic 3D theory - Game development
this article explains all of the basic theory that's useful to know when you are getting started working with 3d.
...texture filtering is applied when the original resolution or the texture image is different from the displayed fragment — it will be minified or magnified accordingly.
Track the score and win - Game development
width && y > b.y && y < b.y+brickheight) { dy = -dy; b.status = 0; score++; } } } } } calling drawscore() from the draw() function keeps the score up to date with every new frame — add the following line inside draw(), just below the drawpaddle() call: drawscore(); displaying a winning message when all bricks have been destroyed collecting the points works well, but you won't be adding them forever — what about when all the bricks have been destroyed?
... score++; if(score == brickrowcount*brickcolumncount) { alert("you win, congratulations!"); document.location.reload(); clearinterval(interval); // needed for chrome to end game } } } } } } thanks to this, your users can actually win the game when they destroy all the bricks, which is quite important when it comes to games.
Collision detection - Game development
the third, optional parameter is the function executed when a collision occurs — ballhitbrick().
... you would expect to have to write a lot more calculations of your own to implement collision detection when using pure javascript.
CSS pixel - MDN Web Docs Glossary: Definitions of Web-related terms
when a user is sitting at a desk in front of a desktop, the display is generally substantially farther away from their eyes than when they're on a cell phone, for instance.
... as such, it generally suffices to say that when the unit px is used, the goal is to try to have the distance 96px equal about 1 inch on the screen, regardless of the actual pixel density of the screen.
DTMF (Dual-Tone Multi-Frequency signaling) - MDN Web Docs Glossary: Definitions of Web-related terms
frequently referred to in the united states as "touch tone" (after the touch-tone trademark used when the transition from pulse dialing to dtmf began), dtmf makes it possible to signal the digits 0-9 as well as the letters "a" through "d" and the symbols "#" and "*".
... computers may make use of dtmf when dialing a modem, or when sending commands to a menu system for teleconferencing or other purposes.
Domain sharding - MDN Web Docs Glossary: Definitions of Web-related terms
when multiple domains are used to serve multiple assets, browsers are able to download more resources simultaneously, resulting in a faster page load time and improved user experience.
... http2 supports unlimited concurrent requests making domain sharding an obsolete requirement when http/2 is enabled.
Falsy - MDN Web Docs Glossary: Definitions of Web-related terms
a falsy (sometimes written falsey) value is a value that is considered false when encountered in a boolean context.
... there are 8 falsy values: false the keyword false 0 the number zero -0 the number negative zero 0n bigint, when used as a boolean, follows the same rule as a number.
First-class Function - MDN Web Docs Glossary: Definitions of Web-related terms
a programming language is said to have first-class functions when functions in that language are treated like any other variable.
...naming it will be helpful when debugging your code.
First CPU idle - MDN Web Docs Glossary: Definitions of Web-related terms
first cpu idle measures when a page is minimally interactive, or when the window is quiet enough to handle user input.
...generally, it occurs when most, but not necessarily all visible ui elements are interactive, and the user interface responds, on average, to most user input within 50ms.
First interactive - MDN Web Docs Glossary: Definitions of Web-related terms
first interactive, also known as first cpu idle, is a non-standard web performance metric that measures when the user's window is quiet enough to handle user input, or what is termed as minimally interactive.
... minimally interactive is defined as when some, but not necessarily all, ui elements on the page have loaded and are interactive, and, on average, respond to user input in a reasonable amount of time.
Fragmentainer - MDN Web Docs Glossary: Definitions of Web-related terms
when breakable content would overflow a fragmentainer in the block dimension, it breaks into the next container in its fragmentation context instead.
...in multiple-column layout the fragmentainer is the column box created when columns are defined on a multicol container.
Function - MDN Web Docs Glossary: Definitions of Web-related terms
when a function is called, arguments are passed to the function as input, and the function can optionally return a value.
...only function expressions can be anonymous, function declarations must have a name: // when used as a function expression (function () {}); // or using the ecmascript 2015 arrow notation () => {}; the following terms are not used in the ecmascript language specification, they're jargon used to refer to different types of functions.
Grid Column - MDN Web Docs Glossary: Definitions of Web-related terms
in addition, columns may be created in the implicit grid when items are placed outside of columns created in the explicit grid.
... when working with alignment in css grid layout, the axis down which columns run is known as the block, or column, axis.
Grid container - MDN Web Docs Glossary: Definitions of Web-related terms
when an element becomes a grid container it establishes a grid formatting context.
... the direct children can now lay themselves out on any explicit grid defined using grid-template-columns and grid-template-rows, or on the implicit grid created when an item is placed outside of the explicit grid.
Grid Row - MDN Web Docs Glossary: Definitions of Web-related terms
in addition, rows may be created in the implicit grid when items are placed outside of rows created in the explicit grid.
... when working with alignment in css grid layout, the axis along which rows run is known as the inline, or row, axis.
Object reference - MDN Web Docs Glossary: Definitions of Web-related terms
the concept of object references becomes clear when assigning the same object to more than one property.
... rather than holding a copy of the object, each assigned property holds object references that link to the same object, so that when the object changes all properties referring to the object reflect the change.
Perceived performance - MDN Web Docs Glossary: Definitions of Web-related terms
perceived performance is not measured by when your site is done loading but when it has loaded enough for users to believe it has loaded and is interactive.
... actual performance is a measurement from when a request is made, through the downloading, parsing and execution of all resources, and the final paint.
Public-key cryptography - MDN Web Docs Glossary: Definitions of Web-related terms
when used for digital signatures, the private key is used to sign and the public key to verify.
... when used for encryption, the public key is used to encrypt and the private key is used to decrypt.
RAIL - MDN Web Docs Glossary: Definitions of Web-related terms
animation when animating, render each frame in under 16ms, aiming for consistency and avoiding jank.
... idle when using the main javascript thread, work in chunks for less than 50ms to free up the thread for user interactions.
REST - MDN Web Docs Glossary: Definitions of Web-related terms
a system is called restful when it adhere to those constraints.
...a document, is transferred with its state and relationships via well-defined, standarized operations and formats or services call themselves restful when they directly modify type of document as opposed to triggering actions somewhere.
Transport Layer Security (TLS) - MDN Web Docs Glossary: Definitions of Web-related terms
when a server and client communicate using tls, it ensures that no third party can eavesdrop or tamper with any message.
...from version 74 onwards, firefox will return a secure connection failed error when connecting to servers using the older tls versions (bug 1606734).
Thread - MDN Web Docs Glossary: Definitions of Web-related terms
a special type of worker, called a service worker, can be created which can be left behind by a site—with the user's permission—to run even when the user isn't currently using that site.
... this is used to create sites capable of notifying the user when things happen while they're not actively engaged with a site.
Time to interactive - MDN Web Docs Glossary: Definitions of Web-related terms
time to interactive (tti) is a non-standardized web performance 'progress' metric defined as the point in time when the last long task finished and was followed by 5 seconds of network and main thread inactivity.
... tti, proposed by the web incubator community group in 2018, is intended to provide a metric that describes when a page or application contains useful content and the main thread is idle and free to respond to user interactions, including having event handlers registered.
Application Context - MDN Web Docs Glossary: Definitions of Web-related terms
otherwise, when the application context is created, the user agent must immediately navigate to the start url with replacement enabled.
... please note that the start url is not necessarily the value of the start_url member: the user or user agent could have changed it when the application was added to home-screen or otherwise bookmarked.
Loop - MDN Web Docs Glossary: Definitions of Web-related terms
example: for(var i = 0; i < 10; i++){ console.log(i) } //this loop will print numbers 0-9, will stop when condition is met (i = 10) for the above example, the syntax is as follows: statement 1 sets the variable for the loop (var i = 0).
... example: var i = 0; while(i < 5){ console.log(i) i++ } //this loop will print number 0-4, will stop when condition becomes false (i >=5) for the above example, the syntax is as follows: the code block will continue to run as long as the variable (i) is less than 5.
Property (JavaScript) - MDN Web Docs Glossary: Definitions of Web-related terms
note that when we say that "a property holds an object", that is shorthand for "a property holds an object reference".
... this distinction matters because the original referenced object remains unchanged when you change the property's value.
What is accessibility? - Learn web development
itive impairments includes: delivering content in more than one way, such as by text-to-speech or by video; easily-understood content, such as text written using plain-language standards; focusing attention on important content; minimizing distractions, such as unnecessary content or advertisements; consistent webpage layout and navigation; familiar elements, such as underlined links blue when not visited and purple when visited; dividing processes into logical, essential steps with progress indicators; 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.
... when planning your project, factor accessibility testing into your testing regime, just like testing for any other important target audience segment (e.g.
Accessibility - Learn web development
overview when someone describes a site as "accessible," they mean that any user can use all its features and content, regardless of how the user accesses the web — even and especially users with physical or mental impairments.
... css and javascript accessibility best practices css and javascript, when used properly, also have the potential to allow for accessible web experiences, but if misused they can significantly harm accessibility.
Combinators - Learn web development
if you insert some other element such as a <h2> in between the <h1> and the <p>, you will find that the paragraph is no longer matched by the selector and so does not get the background and foreground color applied when the element is adjacent.
... ul > li[class="a"] { } take care however when creating big lists of selectors that select very specific parts of your document.
Supporting older browsers - Learn web development
creating fallbacks in css css specifications contain information that explains what the browser does when two layout methods are applied to the same item.
...there are cases, however, when the fallback code will need to include something that the new browsers will also interpret.
Using CSS generated content - Learn web development
this article describes some ways in which you can use css to add content when a document is displayed.
...you can specify text or image content within a stylesheet when that content is closely linked to the document's structure.
Learn to style HTML using CSS - Learn web development
this is because html is far more interesting and much more fun to learn when you apply css, and you can't really learn css without knowing html.
... solving common css problems use css to solve common problems provides links to sections of content explaining how to use css to solve very common problems when creating a web page.
How do you make sure your website works properly? - Learn web development
http statuses servers respond with a status message whenever they receive a request.
...that doesn't matter very much when we're only serving one image, but it would be critical for a high-bandwidth website serving many thousands of images.
How does the Internet work? - Learn web development
deeper dive a simple network when two computers need to communicate, you have to link them, either physically (usually with an ethernet cable) or wirelessly (for example with wifi or bluetooth systems).
... internet and the web as you might notice, when we browse the web with a web browser, we usually use the domain name to reach a website.
How do you set up a local testing server? - Learn web development
when it has downloaded, run it.
... click install, then click close when the installation has finished.
CSS property compatibility table for form controls - Learn web development
be careful when you use them.
...ox-shadow no[1] no[1] meters and progress see the <meter> and <progress> elements: property n t note css box model width yes yes height yes yes border partial yes margin yes yes padding yes partial[1] chrome hides the <progress> and <meter> element when the padding property is applied on a tweaked element.
Test your skills: Form validation - Learn web development
to help, you might want to consider adding some simple css to show when a form field is valid or invalid.
... again, to help you might want to consider adding some simple css to show when a form field is valid or invalid.
Your first form - Learn web development
designing forms is an important step when you are building a site or application.
...all of its attributes are optional, but it's standard practice to always set at least the action and method attributes: the action attribute defines the location (url) where the form's collected data should be sent when it is submitted.
What will your website look like? - Learn web development
when you click on a color, you'll see a strange six-character code like #660066.
... when you find the image you want, click on the image to get an enlarged view of it.
Define terms with HTML - Learn web development
in this article, we'll cover how to properly mark up keywords when you're defining them.
... when you need a term defined, you probably go straight to a dictionary or glossary.
Use JavaScript within a webpage - Learn web development
<script> window.addeventlistener('load', function () { console.log('this function is executed once the page is fully loaded'); }); </script> that's convenient when you just need a small bit of javascript, but if you keep javascript in separate files you'll find it easier to focus on your work write self-sufficient html write structured javascript applications use scripting accessibly accessibility is a major issue in any software development.
... at a minimum, leave a short message with <noscript> like this: <noscript>to use this site, please enable javascript.</noscript> ideally, replicate the javascript functionality with html and server-side scripting when possible.
Document and website structure - Learn web development
take care to use them only when there is no better semantic solution and try to reduce their usage to the minimum otherwise you'll have a hard time updating and maintaining your documents.
...scared, but determined to protect his friends, he raised his wand and prepared to do battle, hoping that his distress call had made it through.</p> <hr> <p>meanwhile, harry was sitting at home, staring at his royalty statement and pondering when the next spin off series would come out, when an enchanted distress letter flew through his window and landed in his lap.
HTML table advanced features and accessibility - Learn web development
you'll learn more about this when you go through our css modules (introduction to css is a good place to start; we also have an article specifically on styling tables).
...this is no problem when you're reading plain text but interpreting a table can be quite a challenge for a blind person.
Structuring the web with HTML - Learn web development
about more advanced topics such as: css, and how to use it to style html (for example alter your text size and fonts used, add borders and drop shadows, layout your page with multiple columns, add animations and other visual effects.) javascript, and how to use it to add dynamic functionality to web pages (for example find your location and plot it on a map, make ui elements appear/disappear when you toggle a button, save users' data locally on their computers, and much much more.) modules this topic contains the following modules, in a suggested order for working through them.
... solving common html problems use html to solve common problems provides links to sections of content explaining how to use html to solve very common problems when creating a webpage: dealing with titles, adding images or videos, emphasizing content, creating a basic form, etc.
Silly story generator - Learn web development
project brief you have been provided with some raw html/css and a few text strings and javascript functions; you need to write the necessary javascript to turn this into a working program, which does the following: generates a silly story when the "generate random story" button is pressed.
...this: adds a click event listener to the randomize variable so that when the button it represents is clicked, the result() function is run.
JavaScript First Steps - Learn web development
troubleshooting javascript when you built up the "guess the number" game in the previous article, you may have found that it didn't work.
...in this article we'll look at all the common things that you really ought to know about strings when learning javascript, such as creating strings, escaping quotes in string, and joining them together.
JavaScript — Dynamic client-side scripting - Learn web development
client-side web apis when writing client-side javascript for web sites or applications, you won't go very far before you start to use apis — interfaces for manipulating different aspects of the browser and operating system the site is running on, or even data from other web sites or services.
... solving common javascript problems use javascript to solve common problems provides links to sections of content explaining how to use javascript to solve very common problems when creating a webpage.
HTML performance features - Learn web development
it is our job, as developers, to ensure that we preserve these two properties when creating or editing html code.
... complications can occur when, for example, the file size of a <video> embed is too large, or when a webpage is not optimized for mobile devices.
Multimedia: Images - Learn web development
it's important to remember that when images are downloaded, they need to be stored in memory.
...for example, when text gets pushed down the page by images loading.
What is web performance? - Learn web development
any other assets can continue to load in the background while the user gets on with primary tasks, and sometimes we only load assets when they are actually needed (this is called lazy loading).
...when you request a url and hit enter / return, the browser finds out where the server is that holds that website's files, establishes a connection to it, and requests the files.
The business case for web performance - Learn web development
when a business site is slow, it can prevent users from completing their intended task.
...when a site performance slowly, users are more likely to abandon the site prematurely which can lead to low time on site metrics.
Web performance - Learn web development
this article introduces the components of performance, from web page loading and rendering, including how your content makes it into your users browser to be viewed, to what groups of people we need to consider when thinking about performance, how do users perceive performance?
... javascript performance best practices javascript, when used properly, can allow for interactive and immersive web experiences — or it can significantly harm download time, render time, in-app performance, battery life, and user experience.
Properly configuring server MIME types - Learn web development
serving content using the correct mime type can also be important for security reasons; it's possible for malicious content to affect the user's computer by pretending to be a safe type of document when it is in fact not.
...for this reason these mime types are usually restricted in terms of what actions a web browser will take when given content of that type.
Server-side website programming first steps - Learn web development
client-server overview now that you know the purpose and potential benefits of server-side programming, we're going to examine in detail what happens when a server receives a "dynamic request" from a browser.
... as most websites' server-side code handles requests and responses in a similar way, this will help you understand what you need to do when writing your own code.
Ember app structure and componentization - Learn web development
--}} {{outlet}} <welcomepage /> is a component provided by an ember addon that renders the default welcome page we saw in the previous article, when we first navigated to our server at localhost:4200.
... when you save application.hbs, the development server you started earlier will automatically rebuild the app and refresh the browser.
React resources - Learn web development
create-react-app makes it possible to import css files into javascript modules, so that css is only sent to your user when the corresponding component is rendered.
...when this merge happens, react router will be the surviving project (with the addition of the focus management features of reach).
Beginning our React todo list - Learn web development
<title>todomatic</title> when your browser refreshes, you should see something like this: it's ugly, and doesn’t function yet, but that's okay — we'll style it in a moment.
...don't worry too much about this for now — we will cover this later on when we get to using events.
omni.ja (formerly omni.jar)
inspecting and repacking omni.ja note: when extracting omni.ja, you may incorrectly get false warnings from some virus protection software.
... omni.ja is also incompatible with zip files in the other direction; editing extracted files won't affect firefox, and repacking edited files may break firefox if you do not use the right options when packing the extracted files.
Mozilla Plugin Accessibility
all browser keys unavailable when plugin has focus focused plugins currently have no choice but to consume all keyboard events.
...the plugin will be responsible for bubbling up shift+tab and tab when the user has reached the end of the tab cycle within the plugin.
Index
in this case, when you upload your extension to amo, you will need to provide your source code and instructions for building that source code, where build processes render your extension’s code hard to read.
...in that case, when you upload your extension to amo, you will need to provide links to the library source code.
Benchmarking
async stacks async stacks no longer impact performance since firefox 78, as bug 1601179 limits async stack capturing to when devtools is opened.
...normally you would want to leave acceleration enabled while profiling, but on linux you may wish to disable accelerated graphics (preferences -> advanced -> general -> use hardware acceleration when available).
Creating JavaScript callbacks in components
the component can then call methods on the observer interface to signal the external code when predefined events occur.
... here is a very simple example of the observer pattern: [scriptable, uuid(...)] interface stringparserobserver { void onword(string word); }; [scriptable, uuid(...)] interface stringparser { void parse(string data); void addobserver(stringparserobserver observer); }; in this example, the stringparser will call the stringparserobserver.onword method whenever it finishes parsing a word found in the raw string data.
Creating MozSearch plugins
firefox will use the above search engine description to construct the following search url: http://search.yahoo.com/search?p=mozilla&ei=utf-8&fr=moz2 if the user clicks the magnifying glass icon in the search bar, or chooses the web search option in the tools menu when the search bar isn't visible, the browser will take them to http://search.yahoo.com/, the value of the <searchform> element.
...this is actually the preferred way to do things when using get as the method.
Debugging Frame Reflow
when the frame's reflow is finished the following information is displayed : reflow metric (desired) width, height max.
... cell 0268a6c0 r=0 a=uc,uc c=uc,15 cnt=871 block 0268a764 r=0 a=uc,uc c=uc,uc cnt=872 block 0268a764 d=0,0 me=0 cell 0268a6c0 d=0,0 me=0 row 0268a594 d=uc,20 value 20 is not a whole pixel rowg 0268a02c d=uc,695 value 695 is not a whole pixel while unaligned values at the entrance of a frame reflow can be ignored, when they appear at the exit of a routine this can cause display errors like stray lines.
Old Thunderbird build
note: parts of the build process also have problems when the source code is in a directory where the path is long (nested many levels deep).
...those have caused several problems historically and tend to be poorly tested when the build system changes.
Simple Instantbird build
note: parts of the build process also have problems when the source code is in a directory where the path is long (nested many levels deep).
... incremental builds when you are working on your own patches, an incremental build is often enough, and is very fast indeed.
Creating Custom Events That Can Pass Data
for example, if you want firefox to perform an action whenever something happens (i.e., something other than the standard mouse/keyboard events) and, depending on the data passed along with this event, you want firefox to react differently.
... what's in a name despite whatever you may have been taught in your english class, there's a lot in a name when it's an event name.
Gecko Logging
set moz_log_file="log.txt" the rotate and append options described above only apply when logging to a file.
... e10s note when a content process is in sandbox, it cannot write to stderr or any file.
Interface Compatibility
web content apis which are visible to web content are not modified, except as a last resort when inherent security vulnerabilities or incompatibility with other browsers make it the only option.
... in micro/maintenance releases, there should be no incompatible changes to interfaces, except as a last resort when a security fix leaves no other option.
Commenting IDL for better documentation
keep in mind that people for whom english is not their native language will be reading your comments (as well as the generated documentation), so try to avoid slang and abbreviations when possible.
...everything in the doxygen comment before a method, attribute, constant, or whatnot will be used as part of its description when the automatic documentation generator tool scans your idl, so if you don't want it in the docs, you probably shouldn't put it there.
Obsolete Build Caveats and Tips
this note below seems redundant as this is true by default https://msdn.microsoft.com/en-us/library/dh8che7s%28v=vs.110%29.aspx note: starting with gecko 7.0, you should no longer include "-zc:wchar_t-" in the command line when building on windows.
...you do not need to install the silverlight runtime or the sql server 2008 express edition when offered.
Contributing to the Mozilla code base
when you commit your code, please use the following format for your commit message: `bug number - what your patch does; r?reviewer` for example, a commit message may look like `bug 1234567 - remove reflow by caching element size.
... step 4b: follow it up once you've asked for a review, a reviewer will often respond within a day or two, reviewing the patch, or saying when they will be able to review it, perhaps due to a backlog.
Listening to events on all tabs
removing a listener to remove a previously installed progress listener, call removetabsprogresslistener(): gbrowser.removetabsprogresslistener(myprogresslistener); 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.
...optional from gecko 10 onprogresschange called when updated progress information for the download of a document is available.
Developer guide
managing multiple profiles when working with prerelease versions of firefox, it's often helpful to have multiple firefox profiles, such as one for each channel, or for different kinds of testing.
... obsolete build caveats and tips a place to put build tips which are no longer relevant to building the latest version of the code from main but are relevant when building old codebases.
Security best practices for Firefox front-end engineers
this article will help firefox developers understand the security controls in place and avoid common pitfalls when developing front-end code for firefox.
... existing security controls sanitizing all strings that enter the dom through apis such as innerhtml when running system-privileged chrome code, we sanitize all html fragments that are created for chrome-privileged documents.
mozbrowseractivitydone
the mozbrowseractivitydone event is fired when something inside the browser <iframe> triggers a web activity, and that web activity's message is consumed by the receiving app.
... if the activity has a returnvalue set to true, then the activity is consumed when postresult or posterror is invoked on the activity by the receiving app.
mozbrowsercontextmenu
the mozbrowsercontextmenu event is fired when the user tried to access a context menu over a browser <iframe>.
... contextmenuitemselected an anonymous function that fires when a menu item is selected.
mozbrowserloadstart
the mozbrowserloadstart event is fired when the browser <iframe> starts to load a new page.
... this can be used when the embedder wants to start spinning a loading indicator, or update the ui in some other way to indicate loading has started.
mozbrowseropensearch
the mozbrowseropensearch event is fired when a link to a search engine is found — i.e.
... when an instance of <link rel="search" type="application/opensearchdescription+xml"> is encountered.
mozbrowserscrollareachanged
the mozbrowserscrollareachanged event is fired when the available scrolling area in the browser <iframe> changes.
... this can occur on resize and when the page size changes (while loading for example.) general info specification non standard interface customevent bubbles yes cancelable yes target <iframe> default action none properties property type description target read only eventtarget the browser iframe type read only domstring the type of event.
mozbrowsershowmodalprompt
the mozbrowsershowmodalprompt event is fired when the content of a browser <iframe> calls the window.alert(), window.confirm(), or window.prompt() methods.
... unblock() a function to be called when the iframe is unblocked.
MozScrolledAreaChanged
the mozscrolledareachanged event is fired when the document view has been scrolled or resized.
...this event, introduced in gecko 1.9.2, is fired whenever either or both of these values change.
Chrome-only Events reference
mozbeforepaintgecko 2.0 adds a new method for performing javascript controlled animations that synchronize not only with one another, but also with css transitions and smil animations being performed within the same window.mozscrolledareachangedthe mozscrolledareachanged event is fired when the document view has been scrolled or resized.
... smartcard-insertthe smartcard-insert event is fired when the insertion of a smart card has been detectedsmartcard-removethe smartcard-remove event is fired when the removal of a smart card has been detected.
Embedding the editor
editor needs to call through one or more interfaces when communicating with the ui.
...(this would be analogous to the nsiwebnavigation interface used for a browser.) when we have one editor per docshell, loading a frameset document, or a page with an <iframe> in composer, will instantiate more than one low-level editor.
How to get a stacktrace for a bug report
note: when filing a crash report, it is important to know whether the crash occurs with firefox safe mode.
... crash reports files on your computer when breakpad initially catches a crash it first writes crash report files (e.g.
IPDL Best Practices
use a flag and the generated actordestroy function to control when ipdl functions can be called; see phttpchannelparent/child for an example.
... when to run code here's a rundown on appropriate places to run certain kinds of code: manager::allocpprotocol - allocation manager::recvpprotocolconstructor - initialization, protocol deletion (the typeaheadfind protocol uses one-shot protocols like this) actor::recv__delete__ - cleanup, ipdl calls still valid but ill-advised actor::actordestroy - non-ipdl cleanup manager::deallocpprotocol - deallocation one construct to avoid: class protocolparent { public: ~protocolparent() { send__delete__(this); } }; class protocolmanagerparent { public: pprotocolparent* allocpprotocol() { return new protocolparent(); } bool deallocpprotocol() { return true; } }; nsautoptr<pprotocolparent> parent = manager->sendpprotocolconstructor(); while ...
Extending a Protocol
and we generally want the parent to let a child know when some work is done - and send some confirmation or result data back to the child.
... async __delete__(); - this is called when an instance is deleted.
Internationalized Domain Names (IDN) Support in Mozilla Browsers
how idn works when a browser sees a host name such as http://developer.mozilla.org, it passes a request to the dns resolver service (usually built into an os), which in turn sends a request to a nearest domain name server to return an ip address that corresponds to the host name.
... how mozilla browsers handle non-ascii domain names unicode and nameprep when mozilla receives idn input from the user via the location bar or a request to process non-ascii host name links, it first turns them into unicode, then normalizes the input string to make it conform to general uri requirement.
TypeListener
method overview void ontypeadded(in addontype type) void ontyperemoved(in addontype type) methods ontypeadded() called when an add-on type has been added.
... void ontypeadded( in addontype type ) parameters type the addontype that is being added needsrestart true if an application restart is necessary for the change to take effect ontyperemoved() called when an add-on type has been removed.
UpdateCheckListener
method overview void onupdatecheckcomplete(in updateinfo results[]) void onupdatecheckerror(in integer status) methods onupdatecheckcomplete() called when the update check completed successfully.
... void onupdatecheckcomplete( in updateinfo results[] ) parameters results an array of updateinfo objects representing the available add-on versions onupdatecheckerror() called when the update check fails.
FileUtils.jsm
to pr_open mode_wronly 0x02 corresponds to the pr_wronly parameter to pr_open mode_create 0x08 corresponds to the pr_create_file parameter to pr_open mode_append 0x10 corresponds to the pr_append parameter to pr_open mode_truncate 0x20 corresponds to the pr_truncate parameter to pr_open perms_file 0644 default permissions when creating files.
... perms_directory 0755 default permissions when creating directories methods getfile() gets a file at the specified hierarchy under a nsidirectoryservice key.
Deferred
note: this function is bound to its associated promise when promise.defer() is called, and can be called with any value of this.
... note: this function is bound to its associated promise when promise.defer() is called, and can be called with any value of this.
Promise.jsm
internally, a promise can be in one of three states: pending, when the final value is not available yet.
... fulfilled, when and if the final value becomes available.
openLocationLastURL.jsm
this object lets you fetch and change the url that is placed in the "open location" dialog box when it opens.
...the value preserved across accesses is not preserved when the user exits private browsing mode.
Mozilla Content Localized in Your Language
the content here should be what you and your localization team have decided, together, to follow when localizing mozilla products and web sites.
... the sequence of the sentence structure in another language may not translate well, when a sentence is half finished as such.
Localization and Plurals
each entry indicates how many plural forms are needed when localizing a word.
... pluralrule=2 seconds=seconde;secondes minutes=minute;minutes hours=heure;heures days=jour;jours like many other times when localizing words, gender agreement might force you to rearrange words in a way that the gender is always the same.
Localizing extension metadata on addons.mozilla.org
the localizable data fields of an extension are: name homepage summary description eula privacy policy version notes developer comments when you submit a new extension to amo, the process is divided into several steps.
...remember, all fields are optional when localizing.
Localizing without a specialized tool
there is also a tooltip that appears when you hover over the magnifying glass icon on the right side of the bar.
... this will familiarize you with our "hg" commands and will get us something that we can import easily when you are done.
QA phase
to create and configure this file, follow these instructions: until the fix for bug 1063880 lands on mozilla-aurora and mozilla-beta when building language packs against those two trees you should: remove ac_add_options --disable-compile-environment from .mozconfig in step 3 use ./mach build config after step 4 update the mozilla source code: $ cd mozilla-aurora $ hg pull -u enter the following command to create the .mozconfig file: $ nano -w .mozconfig enter the following lines in your .mozconfig file: ...
...you might have created it yourself by running hg init or hg clone or you might have had it created by koala when you were setting up a new localization project.
Localization quick start guide
when we get to specific examples, we'll take them from the firefox project, as it is the most widely localized project within mozilla.
...in closing, when you finish this guide, you will have all the tools necessary to start contributing!
Writing localizable code
this page tells you about best practices and guidelines when dealing with ui code with respect to localization.
...when a composite string is needed, try to give the translators "room to move".
Mozilla Framework Based on Templates (MFBT)
mfbt code goes to some length to document all its interfaces in comments, including examples when possible.
... scoped.h implements scope-based resource management, to simplify the task of cleaning up resources when leaving a scope.
Fonts for Mozilla 2.0's MathML engine
furthermore, in accordance with the w3c css2 recommendation on fonts, authors can specify an ordered list of particular fonts which they prefer (using the font-family property of css), with the assurance that mozilla's font engine will hunt for alternate fonts whenever their specified fonts are not found on a particular user's system.
...the following fonts are not necessary when the above fonts are installed, but are worth noting because of their unicode support for many mathematical characters.
MathML Demo: <mtable> - tables and matrices
when align="center" or align="baseline", the middle of the table coincides with the baseline.
...by default -- when the align attribute is not set, or when align="axis", the middle of the table coincides with the math axis.
Mozilla Development Tools
it is our home-grown web-based tool for watching the up-to-the-minute goings-on in our cvs repository (viewing checkins and log messages, reading diffs, etc.) tinderbox tinderbox is for knowing when the tree is in flames.
...it is how we are able to tell when a checkin has broken the build on some platform, and how we know which person needs to be viciously flogged.
mozilla::MonitorAutoEnter
when the mozilla::monitorautoenter goes out of scope, its destructor will exit() the underlying mozilla::monitorautoenter.
... important: when a mozilla::monitorautoenter is live on the stack, your code is guaranteed to own the underlying mozilla::monitor.
mozilla::MutexAutoLock
when the mozilla::mutexautolock goes out of scope, its destructor will unlock() the underlying mozilla::mutex.
...important: when a mozilla::mutexautolock is the mutex raii wrapper most recently pushed on the stack, your code is guaranteed to own the underlying mozilla::mutex.
mozilla::MutexAutoUnlock
when the mozilla::mutexautounlock goes out of scope, its destructor will lock() the underlying mozilla::mutex.
...important: when a mozilla::mutexautounlock is the mutex raii wrapper most recently pushed on the stack, your code is guaranteed not to own the underlying mozilla::mutex.
BloatView
comparing bloat logs you can also compare any two bloat logs (either those produced when the program shuts down, or written to the bloatlogs directory) by running the following program.
...this happens when something that didn't leak before is now leaking.
GC and CC logs
you'll need to disable sandboxing by setting moz_disable_content_sandbox=t when you run firefox.
...you'll need to disable sandboxing by setting moz_disable_content_sandbox=t when you run firefox.
JS::PerfMeasurement
at present, it returns true on linux when the <linux/perf_event.h> api is available (kernel 2.6.31 or later), and false everywhere else.
... the counter variables do not update in real time; they only change when stop is called.
Memory Profiler
start - start profiling stop - stop profiling reset - clear profile data when profiler is stopped profile data is accumulated and resumed after start.
...this gives some intuition of how and when a bulk of objects are allocated.
Profiling with the Gecko Profiler and Local Symbols on Windows
it looks like we consume too much memory when creating the symbol table for this to work in 32 bit firefox builds.
... unfortunately, 32 bit is still the default when building firefox locally.
Scroll-linked effects
instead, it will move with the user's scrolling, and then "snap" back into position when the scroll event handler runs.
... example 2: scroll snapping below is an implementation of scroll snapping, where the scroll position snaps to a particular destination when the user's scrolling stops near that destination.
dtrace
the code between the braces is run when the probe point is hit.
... the above code counts unique stack traces when wakeups occur; ustack is short for "user stack", i.e.
Performance
gpu performance tips for profiling and improving performance when using a gpu.
...the "leaks" tool is not recommended for use with spidermonkey or firefox, because it gets confused by tagged pointers and thinks objects have leaked when they have not (see bug 390944).
Phishing: a short definition
another solution is to strengthen logins with pictures, or colored words, often chosen when signing up for a service.
... users look for these when logging in, and only enter their credentials when they recognize the user defined pictures or words.
Debugging out-of-memory problems
out-of-memory exceptions from js setting memory.dump_reports_on_oom in about:config to true will cause the browser to automatically write about:memory dumps to a temp file printed to the browser console (note: not web console) when an oom crash is encountered.
..."/sdcard/download/") when calling adb pull.
Nonblocking IO In NSPR
(note: <tt>pr_poll()</tt> also works with blocking file descriptors, although it is less useful in the blocking io model.) when <tt>pr_poll()</tt> reports that a file descriptor is ready for some io operation, the central thread invokes that io function on the file descriptor.
... pr_available() when <tt>pr_available()</tt> returns 0, it may mean one of two things: there is no data available for reading on that socket.
Process Forking in NSPR
nspr does not override the fork function and so, when fork is called from the nspr thread the results are different on the various platforms.
...so, to be consistent across all platforms, it is suggested that when using fork in a nspr thread; the exec function should be called in the child process.
Condition Variables
the association between a condition and a monitor is established when a condition variable is created, and the association persists for its life.
...other threads may notify the condition variable when changes occur.
Dynamic Library Linking
prlibrary *lib; void *funcptr; funcptr = pr_findsymbolandlibrary("functionname", &lib); when pr_findsymbolandlibrary returns, funcptr is the value of the function pointer you want to look up, and the variable lib references the main executable program.
...remember to call pr_unloadlibrary(lib) to close the library handle when you are done.
Monitors
when the entry count for a thread reaches zero, the thread releases the monitor's lock, and other threads that were blocked while trying to enter the monitor will be rescheduled.
...when the calling thread resumes, it has the same entry count it had before the wait operation.
Named Shared Memory
be sure to detach it when you're finished.
... pr_closesharedmemory should be called when no further use of the prsharedmemory object is required within a process.
PRLinger
if polarity is set to pr_true and linger is set to 0 (pr_interval_no_wait), the runtime aborts the connection when it is closed and discards any data remaining in the socket send buffer.
... if polarity is set to pr_true and linger is nonzero, the runtime lingers when the socket is closed.
PRThreadState
syntax #include <prthread.h> typedef enum prthreadstate { pr_joinable_thread, pr_unjoinable_thread } prthreadstate; enumerators pr_unjoinable_thread thread termination happens implicitly when the thread returns from the root function.
...what happens when it returns from its root function depends on the thread state passed to pr_createthread when the thread was created.
PR_ASSERT
terminates execution when a given expression is false.
...when the result is zero (false) the application terminates; otherwise the application continues.
PR_ConnectContinue
the caller should poll the file descriptor for the in_flags pr_poll_write|pr_poll_except and retry pr_connectcontinue later when pr_poll() returns.
...when pr_poll() returns, one calls pr_connectcontinue() on the socket to determine whether the nonblocking connect has completed or is still in progress.
PR_DetachThread
a native thread not created by nspr is automatically attached the first time it calls an nspr function, and automatically detached when it exits.
... in nspr release 19980529b and earlier, it is necessary for a native thread not created by nspr to call pr_attachthread before it calls any nspr functions, and call pr_detachthread when it is done calling nspr functions.
PR_EnterMonitor
description when the calling thread returns, it will have acquired the monitor's lock.
...when the entry count reaches zero (or if it is already zero), the entry count is incremented by one and the calling thread is recorded as the lock's holder.
PR_NewThreadPrivateIndex
when you allocate the index, you may also register a destructor function of type prthreadprivatedtor.
... if a destructor function is registered with a new index, it will be called at one of two times, as long as the private data is not null: when replacement private data is set with pr_setthreadprivate when a thread exits the index maintains independent data values for each binding thread.
PR_QueueJob_Accept
causes a job to be queued when a socket has a pending connection.
... fn the function to be executed when the job is executed.
PR_QueueJob_Connect
causes a job to be queued when a socket can be connected.
... fn the function to be executed when the job is executed.
PR_QueueJob_Read
causes a job to be queued when a socket becomes readable.
... fn the function to be executed when the job is executed.
PR_QueueJob_Timer
causes a job to be queued when a timer expires.
... fn the function to be executed when the job is executed.
PR_QueueJob_Write
causes a job to be queued when a socket becomes writable.
... fn the function to be executed when the job is executed.
PR_STATIC_ASSERT
prevents code from compiling when an expression has the value false at compile time.
...when the result is zero (false) program compilation will fail with a compiler error; otherwise compilation completes successfully.
PR_WaitCondVar
when the condition variable is notified, a thread waiting on that condition moves from the "waiting on condition" state to the "ready" state.
... when scheduled, the thread attempts to reacquire the lock that it held when pr_waitcondvar was called.
NSS CERTVerify Log
defined in certt.h: /* * this structure is used to keep a log of errors when verifying * a cert chain.
...when you are through, you will need to walk the list and free all the cert entries, then free the arena.
Getting Started With NSS
when you're satisfied with it, you'll need code review.
...code only works when it has tests, and tests only work when they're part of the automation.
NSS_3.12.1_release_notes.html
ode (for linux x86) fails pairwise consistency test bug 330622: certutil's usage messages incorrectly document certain options bug 330628: coreconf/linux.mk should _not_ default to x86 but result in an error if host is not recognized bug 359302: remove the sslsample code from nss source tree bug 372241: need more versatile form of cert_nametoascii bug 390296: nss ignores subject cn even when san contains no dnsname bug 401928: support generalized pkcs#5 v2 pbes bug 403543: pkix: need a way to enable/disable aia cert fetching bug 408847: pkix_ocspchecker_check does not support specified responder (and given signercert) bug 414003: crash [[@ cert_decodecertpackage] sometimes with this testcase bug 415167: memory leak in certutil bug 417399: arena allocation results are not ...
...warnings in lib/util and lib/freebl bug 433437: vfychain ignores the -a option bug 433594: crash destroying ocsp cert id [[@ cert_destroyocspcertid ] bug 434099: nss relies on unchecked pkcs#11 object attribute values bug 434187: fix the gcc compiler warnings in nss/lib bug 434398: libpkix cannot find issuer cert immediately after checking it with ocsp bug 434808: certutil -b deadlock when importing two or more roots bug 434860: coverity 1150 - dead code in ocsp_createcertid bug 436428: remove unneeded assert from sec_pkcs7encryptlength bug 436430: make nss public headers compilable with no_nspr_10_support defined bug 436577: uninitialized variable in sec_pkcs5createalgorithmid bug 438685: libpkix doesn't try all the issuers in a bridge with multiple certs bug 438876: s...
NSS 3.14.1 release notes
however, when authenticating with such tokens, it was possible for an internal lock to be acquired twice, causing a hang.
... bug 611451 - when built with the current version of apple xcode on mac os x, the nss shared libraries will now only export the public nss functions.
NSS 3.18 release notes
nss 3.18 source distributions are available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_18_rtm/src/ new in nss 3.18 new functionality when importing certificates and keys from a pkcs#12 source, it's now possible to override the nicknames, prior to importing them into the nss database, using new api sec_pkcs12decoderrenamecertnicknames.
... the default key size used by certutil when creating an rsa key pair has been increased from 1024 bits to 2048 bits.
NSS 3.20 release notes
support for the following ciphersuites has been added: tls_dhe_dss_with_aes_128_gcm_sha256 tls_dhe_dss_with_aes_128_cbc_sha256 tls_dhe_dss_with_aes_256_cbc_sha256 by default, the server side tls implementation will use dhe parameters with a size of 2048 bits when using dhe ciphersuites.
... the size of the default pqg parameters used by certutil when creating dsa keys has been increased to use 2048 bit parameters.
NSS 3.28.1 release notes
:4d:59:24:e8:75:65:6d:3d:c9:fb:58:77:1f:6f:61:6f:9d:57:1b:c5:92 cn = symantec class 2 public primary certification authority - g6 sha-256 fingerprint: cb:62:7d:18:b5:8a:d5:6d:de:33:1a:30:45:6b:c6:5c:60:1a:4e:9b:18:de:dc:ea:08:e7:da:aa:07:81:5f:f0 the version number of the updated root ca list has been set to 2.11 a misleading assertion/alert has been removed, when nss tries to flush data to the peer but the connection was already reset.
... bugs fixed in nss 3.28.1 bug 1296697 - december 2016 batch of root ca changes bug 1322496 - internal error assert when the other side closes connection before reading eoed compatibility nss 3.28.1 shared libraries are backward compatible with all older nss 3.x shared libraries.
NSS 3.30 release notes
in ssl.h ssl_alertreceivedcallback - register a callback function, that will be called whenever an ssl/tls alert is received ssl_alertsentcallback - register a callback function, that will be called whenever an ssl/tls alert is sent ssl_setsessionticketkeypair - configures an asymmetric key pair, for use in wrapping session ticket keys, used by the server.
...ponding to the pkcs#5 v2.1 aes based encryption schemes used in the pkcs#12 support in nss in pkcs11n.h cka_nss_mozilla_ca_policy - identifier for a boolean pkcs#11 attribute, that should be set to true, if a ca is present because of it's acceptance according to the mozilla ca policy notable changes in nss 3.30 the tls server code has been enhanced to support session tickets when no rsa certificate (e.g.
NSS 3.31.1 release notes
this notice will be removed when completed.
... bugs fixed in nss 3.31.1 bug 1381784 - potential deadlock when using an external pkcs#11 token.
NSS 3.47 release notes
s bug 1577953 - support longer (up to rfc maximum) hkdf outputs bug 1508776 - remove refcounting from sftk_freesession (cve-2019-11756) bug 1494063 - support tls exporter in tstclnt and selfserv bug 1581024 - heap overflow in nss utility "derdump" bug 1582343 - soft token mac verification not constant time bug 1578238 - handle invald tag sizes for ckm_aes_gcm bug 1576295 - check all bounds when encrypting with seed_cbc bug 1580286 - nss rejects tls 1.2 records with large padding with sha384 hmac bug 1577448 - create additional nested s/mime test messages for thunderbird bug 1399095 - allow nss-try to be used to test nspr changes bug 1267894 - libssl should allow selecting the order of cipher suites in clienthello bug 1581507 - fix unportable grep expression in test scripts bug 123...
... bug 1542207 - limit policy check on signature algorithms to known algorithms bug 1560329 - drbg: add continuous self-test on entropy source bug 1579290 - asan builds should disable lsan while building bug 1385061 - build nspr tests with nss make; add gyp parameters to build/run nspr tests bug 1577359 - build atob and btoa for thunderbird bug 1579036 - confusing error when trying to export non-existent cert with pk12util bug 1578626 - [cid 1453375] ub: decrement nullptr.
NSS 3.50 release notes
3) bug 1574643 - upgrade hacl* verified implementations of chacha20, poly1305, and 64-bit curve25519 bug 1608327 - two problems with neon-specific code in freebl bug 1575843 - detect aarch64 cpu features on freebsd bug 1607099 - remove the buildbot configuration bug 1585429 - add more hkdf test vectors bug 1573911 - add more rsa test vectors bug 1605314 - compare all 8 bytes of an mp_digit when clamping in windows assembly/mp_comba bug 1604596 - update wycheproof vectors and add support for cbc, p256-ecdh, and cmac tests bug 1608493 - use aes-ni for non-gcm aes ciphers on platforms with no assembly-optimized implementation, such as macos.
... bug 1547639 - update zlib in nss to 1.2.11 bug 1609181 - detect arm (32-bit) cpu features on freebsd bug 1602386 - fix build on freebsd/powerpc* bug 1608151 - introduce nss_disable_altivec bug 1612623 - depend on nspr 4.25 bug 1609673 - fix a crash when nss is compiled without libnssdbm support, but the nssdbm shared object is available anyway.
NSS 3.52 release notes
bug 1531906 - fix overzealous assertion when evicting a cached sessionid or using external cache.
... bug 1630925 - guard all instances of nsscmssigneddata.signerinfo to avoid a cms crash bug 1571677 - name constraints validation: cn treated as dns name even when syntactically invalid as dns name this bugzilla query returns all the bugs fixed in nss 3.52: https://bugzilla.mozilla.org/buglist.cgi?resolution=fixed&classification=components&query_format=advanced&product=nss&target_milestone=3.52 compatibility nss 3.52 shared libraries are backward compatible with all older nss 3.x shared libraries.
NSS 3.54 release notes
use arm cryptography extension for sha256, when available.
... bug 1644774 - ssl gtests to use clearservercache when resetting self-encrypt keys.
nss tech note3
when nss is asked to verify the validity of a certificate chain, it verifies the validity of that cert chain for a particular purpose, known as a seccertusage, as of a specific date and time.
...ver: cert_sign; ssl_ca; sslca: cert_sign; ssl_ca; emailsigner: cert_sign; email_ca or ssl_ca emailrecipient: cert_sign; email_ca or ssl_ca objectsigner: cert_sign; object_signing_ca; usageanyca: cert_sign; object_signing_ca or email_ca or ssl_ca; statusresponder: cert_sign; object_signing_ca or email_ca or ssl_ca; note: when the required key usage is key_agreement or key_encipherment, the actual key usage required depends on the key's algorithm.
NSS_Initialize
nss_init_pk11reload - ignore the ckr_cryptoki_already_initialized error when loading pkcs#11 modules.
...the following limitation applies when this is set : secmod_waitforanytokenevent will not use c_waitforslotevent, in order to prevent the need for c_finalize.
NSS Key Functions
when an application makes a copy of a particular certificate or key structure that already exists in memory, ssl makes a shallow copy--that is, it increments the reference count for that object rather than making a whole new copy.
... when you call cert_destroycertificate or seckey_destroyprivatekey, the function decrements the reference count and, if the reference count reaches zero as a result, both frees the memory and sets all the bits to zero.
NSS tools : crlutil
critical/non-critical: is 1 when extension is critical and 0 otherwise.
...this extension allows users to easily determine when a particular crl supersedes another crl crlnumber non-critical number where: crlnumber: identifies the name of an extension critical: should be set to 0 since this is non-critical extension number: value of long which identifies the sequential number of a crl.
NSS tools : ssltab
when used with looping mode, the different connections are separated with horizontal lines.
...usage tips when ssl restarts a previous session, it makes use of cached information to do a partial handshake.
NSS tools : ssltap
when used with looping mode, the different connections are separated with horizontal lines.
...usage tips when ssl restarts a previous session, it makes use of cached information to do a partial handshake.
sslcrt.html
when an application makes a copy of a particular certificate or key structure that already exists in memory, ssl makes a shallow copy--that is, it increments the reference count for that object rather than making a whole new copy.
... when you call cert_destroycertificate or seckey_destroyprivatekey, the function decrements the reference count and, if the reference count reaches zero as a result, both frees the memory and sets all the bits to zero.
sslkey.html
when an application makes a copy of a particular certificate or key structure that already exists in memory, ssl makes a shallow copy--that is, it increments the reference count for that object rather than making a whole new copy.
... when you call cert_destroycertificate or seckey_destroyprivatekey, the function decrements the reference count and, if the reference count reaches zero as a result, both frees the memory and sets all the bits to zero.
NSS Tools crlutil
critical/non-critical: is 1 when extension is critical and 0 otherwise.
...this extension allows users to easily determine when a particular crl supersedes another crl crlnumber non-critical number where: crlnumber: identifies the name of an extension critical: should be set to 0 since this is non-critical extension number: value of long which identifies the sequential number of a crl.
NSS Tools ssltap
when used with looping mode, the different connections are separated with horizontal lines.
... usage tips when ssl restarts a previous session, it makes use of cached information to do a partial handshake.
NSS tools : crlutil
MozillaProjectsNSStoolscrlutil
critical/non-critical: is 1 when extension is critical and 0 otherwise.
...this extension allows users to easily determine when a particular crl supersedes another crl crlnumber non-critical number where: crlnumber: identifies the name of an extension critical: should be set to 0 since this is non-critical extension number: value of long which identifies the sequential number of a crl.
NSS tools : ssltap
MozillaProjectsNSStoolsssltap
when used with looping mode, the different connections are separated with horizontal lines.
... usage tips when ssl restarts a previous session, it makes use of cached information to do a partial handshake.
Necko walkthrough
nspipeinputstream::asyncwait sets the callback to be used later for a response if a target is specified (in this case, the main thread), callback is proxied via an nsinputstreamreadyevent, which is created now and may be called later otherwise, the callback would be called directly, when the socket is readable et voila, the transaction has been posted to the socket thread, and the main thread continues on, unblocked from network io.
... nshttpconnectionmgr::dispatchtransaction nshttpconnectionmgr::dispatchabstracttransaction the transaction is given an indirect reference to the connection (for use later, when the socket has received data from the far end).
Proxies in Necko
note that the proxy method is only used when the protocol handler supports http proxies, as indicated by its protocol flags.
... proxies and local hosts requires gecko 9.0(firefox 9.0 / thunderbird 9.0 / seamonkey 2.6) starting with gecko 9.0 (firefox 9.0 / thunderbird 9.0 / seamonkey 2.6), proxy servers are not used when accessing hosts with no dots in their names, if manual proxy configuration is used and "<local>" is added to the "no proxy for:" text field field.
Performance Hints
var statements use var statements when possible.
... eval and new function avoid calling eval when possible.
SpiderMonkey compartments
in previous versions of spidermonkey, the garbage collector would walk the entire heap of all javascript objects when garbage collection was needed.
...false sharing occurs when we are trying to operate on an object and we have to read an entire cache line of data into the cpu cache.
Creating JavaScript tests
even tests that check for polynomial time complexity will start to fail in a few years when they have sped up enough to run faster than the granularity of the os scheduler or when run on platforms with higher latencies than your development workstation.
...remember that whenever a test fails, someone -- probably you -- is going to have to figure out what went wrong.
Getting SpiderMonkey source code
just like when you're fetching any other mozilla project from cvs, you need to log into the cvs server first.
... to do this, cd into the base directory you'd like to check out the code into, then enter the following command at your command line: cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot login when prompted, enter the password anonymous.
Statistics API
when logging to a file is used in combination with multi-process firefox (e10s) it is necessary to set security.sandbox.content.level = 0, otherwise the content process will crash.
... when: number (milliseconds) - the time this slice started, relative to the first slice's start time.
SpiderMonkey Internals: Thread Safety
a thread needs to lock on allocation only when the relevant per-thread freelist is empty.
... when this happens, the thread also refills that freelist from the jsruntime-wide gc allocator while it's in the lock.
JS::Handle
first, when several such functions call each other then redundant rooting of multiple copies of the gc thing can be avoided.
... second, if the caller does not pass a rooted value a compile error will be generated, which is quicker and easier to fix than when relying on a separate rooting analysis.
JSClass.call
the jsclass.call and jsclass.construct hooks are called when a custom object is used like a function.
... note that when a custom object is called, a this argument is calculated for it just as if it were a function.
JSClass.flags
an object obj that emulates undefined behaves like any other object, except in the following ways: typeof obj === "undefined" obj converts to false when obj is converted to a boolean when used in boolean contexts (if conditions, loop continuation/termination conditions [for/while/do { } while], the condition in a ternary ?: expression, and so on) (obj == undefined) is true, and (obj != undefined) is false (obj == null) is true, and (obj != null) is false == and != comparisons to values other than null or undefined (including t...
...(this is meaningful only if the jsclass_new_resolve flag is also set.) jsclass_construct_prototype obsolete since jsapi 11 instructs js_initclass to invoke the constructor when creating the class prototype.
JSDeletePropertyOp
jsclass hooks jsclass offers the following hook: jsclass.delproperty is called during most property deletions, even when obj has no property named id.
... this hook is not called when the target property is jsprop_permanent and is an own property of the target object.
JSExtendedClass.wrappedObject
(the result may be "object", "function", or "xml".) when assigning to __proto__ or __parent__ from script, the javascript engine checks to see if the assignment would produce a cycle.
...when walking the chain to do this check, wrappers are automatically unwrapped.
JSObjectOps.dropProperty
description the following contract governs jsobjectops callers and implementations: whenever jsobjectops.lookupproperty returns a jsproperty pointer, the property is locked.
...(in a js_threadsafe build, that would risk deadlock.) when finished with a locked property, the caller must release it by calling the dropproperty callback.
JSObjectOps.newObjectMap
the jsobjectops.newobjectmap callback is called whenever a new object is created.
...when nrefs reaches 0 due to a js_dropobjectmap call, jsobjectops.destroyobjectmap will be called to dispose of the map.
JSObjectPrincipalsFinder
for example, when a watchpoint triggers, the engine calls the callback, passing the watchpoint handler, to ensure that watchpoint handlers are invoked only when the watcher is permitted to watch the currently executing script.
... another example: when the function constructor is called, the javascript engine calls the object principals finder callback to obtain principals for the local scope object, to check that the caller has access to that object.
JSPrincipals
when refcount reaches zero, the principals are no longer in use and are destroyed.
...when refcount reaches zero, the principals are no longer in use and are destroyed.
JSPropertyDescriptor
properties a descriptor is an object that can have the following key values field name description getter the get syntax binds an object property to a function that will be called when that property is looked up.
... setter the set syntax binds an object property to a function to be called when there is an attempt to set that property.
JSResolveOp
description jsresolveop callback is a hook which is called when a property is not found on an object.
... jsclass hooks jsclass offers the following hook: jsclass.resolve callback is called when a property is not found on an object.
JS_BeginRequest
description when your multithreaded application wants to use a jscontext, it must use js_beginrequest and js_endrequest to bracket maximal non-blocking hunks of native code that call the jsapi.
...if any thread is in a requests, garbage collection can happen only when that thread calls into the jsapi.
JS_ClearContextThread
when the function is used properly, the return value is always zero, indicating that no thread was previously associated with the context.
...(this is always the current thread id when the function is used properly.) js_newcontext automatically associates the new context with the calling thread.
JS_DefaultValue
hint jstype the hint to pass to the [[defaultvalue]] hook when converting the object.
...behavior when the convert hook is js_convertstub is identical to that for objects defined by ecmascript.
JS_DefinePropertyWithTinyId
however, tiny ids can cause confusion when used with jsclass callbacks.
...traditionally, negative tiny ids are used to minimize the potential confusion, but it is best to specify a non-null getter and setter when defining a property with a tiny id.
JS_GetScopeChain
when you only used this function to retrieve the scope chain's global, then you can use the function js_getglobalforscopechain.
...a scope chain is a sequence of objects whose properties are searched whenever a script or function refers to a variable.
JS_InstanceOf
js_instanceof can also be used in native functions to check the class of an argument when a particular class is required.
...when args is non-null, js_instanceof behaves as follows.
JS_MaybeGC
calling js_maybegc when the application is idle can help prevent garbage collection from happening at less convenient times.
... calling js_maybegc periodically when the application is busy, from a jsbranchcallback or jsoperationcallback added in spidermonkey 1.8, can keep memory usage down and improve performance.
JS_PreventExtensions
the first case occurs when something went wrong internally, not necessarily because the object chose not to become non-extensible.
... var target = {}; var handler = {}; var pair = proxy.revocable(target, handler); var proxy = pair.proxy; var revoke = pair.revoke; revoke(); // bool succeeded; // bool rv = js_preventextensions(cx, proxy, &succeeded); // // rv == false, succeeded is indeterminate the second case occurs when no internal error is encountered, but the object simply refuses to be made non-extensible.
JS_ReportOutOfMemory
when the javascript engine tries to allocate memory and allocation fails, it reports an error as though by calling this function.
...when a script tries to grow an array beyond 230-1 elements, for example, or concatenate strings such that the result is more than 229-1 characters long, the javascript engine reports an error as though by calling this function.
JS_RestoreExceptionState
if any exception was pending when js_saveexceptionstate was called, the same exception will be set to pend for the current context.
... if no exceptions were pending when calling js_saveexceptionstate, any pending exception for the context will likewise be cleared.
JS_SET_TRACING_DETAILS
when printer is null, arg must be const char * or char * c string naming the reference and index must be either (size_t)-1 indicating that the name alone describes the reference or it must be an index into some array vector that stores the reference.
... when printer is not null, the arg and index arguments are available to the callback as the debugprinterarg and debugprintindex fields of trc.
JS_SetBranchCallback
specifies a callback function that is automatically called when a script branches backward during execution, when a function returns, and at the end of the script.
... description js_setbranchcallback specifies a callback function that is automatically called when a script branches backward during execution, when a function returns, and at the end of the script.
JS_SetContextCallback
specifies a callback function that is automatically called whenever a jscontext is created or destroyed.
... description js_setcontextcallback specifies a callback function that is automatically called when jscontexts are created or destroyed.
JS_SetGCCallback
the application may store this return value in order to restore the original callback when the new callback is no longer needed.
...the jsgc_begin callback can occur very early when something triggers garbage collection—before the javascript engine has even determined whether gc should actually be done at the moment.
JS_SetGCZeal
1 collect when roots are added or removed.
... 2 collect when every frequency allocations.
JS_ShutDown
this may not always be the case; it's recommended that all embedders call this method when all other jsapi operations have completed, to be future-proof.
...implementation note: this method has been used to clean up memory allocated by jsdtoa.cpp, memory allocated to implement date.now() on windows, and when the internationalization api is enabled, memory internally allocated by icu.
Parser API
additional options may be provided via the options object, which can include any of the following properties: loc boolean default: true when loc is true, the parser includes source location information in the returned ast nodes.
...when a callback is missing, the default format is used, but the provided builder methods are still used recursively for sub-nodes.
SpiderMonkey 1.8
when javascript 1.8 support is enabled, the parser accepts some incorrect programs by inserting a semicolon where it should instead throw a syntaxerror (bug 384758).
...when gc zeal is enabled, gc happens extremely frequently.
SpiderMonkey 17
the jsresolve_classname and jsresolve_with resolve flags (passed to jsclass.resolve when jsclass.flags contains jsclass_new_resolve) have been removed.
... in the long run we anticipate removing the environment variable-based overriding when we drop support for versions of visual studio prior to 2010.
Split object
again, spidermonkey enforces a slightly stronger rule: outer objects may never appear in a scope chain at all, except when put there by an explicit c-level jsapi call (to js_setparent or equivalent).
...but there is a special case when js_getscopechain is called on a jscontext in which no code is currently running.
Thread Sanitizer
k_add_options moz_objdir=@topsrcdir@/objdir-ff-tsan mk_add_options moz_make_flags=-j12 # enable llvm specific code and build workarounds ac_add_options --enable-thread-sanitizer # if clang is already in your $path, then these can simply be: # export cc=clang # export cxx=clang++ export cc="/path/to/clang" export cxx="/path/to/clang++" # llvm-symbolizer displays much more complete backtraces when data races are detected.
...furthermore, additional debug information is included in traces when llvm-symbolizer is used.
Mozilla Projects
it will pop-up an alert when a window is closed and javascript still links to that window (for example, an observer that is not cleared when the window closes).
...when midas is enabled, the document becomes editable by the user.
Signing Mozilla apps for Mac OS X
--resource-rules /path/to/coderesources specifies a file to use when generating the rules to be applied to the code signing.
... when you're signing mozilla applications with v1 signatures, you'll need to specify a custom coderesources file here.
Animated PNG graphics
MozillaTechAPNG
it is strongly recommended that when any error is encountered decoders should discard all subsequent frames, stop the animation, and revert to displaying the default image.
...when decompressed, the datastream is the complete pixel data of a png image, including the filter byte at the beginning of each scanline, similar to the uncompressed data of all the 'idat' chunks.
Gecko events
is supported: yes targets: table_cell - the cell of <xul:tree/>, any accessible for html element when @title or @alt attribute is changed.
...server applications send this event when a user needs to know that a user interface element has changed.
Gecko Roles
role_nothing used when the accessible item doesn't have a strongly defined role.
... role_popup_menu a temporary window that is usually used to offer the user a list of choices, and then hides when the user selects one of those choices.
Manipulating bookmarks using Places
note: all annotations, tags, and so forth are kept when the bookmark's uri is changed.
...function(abookmarkid, aproperty, aisannotationproperty, avalue) { myextension.dosomething(); }, onitemvisited: function(abookmarkid, avisitid, time) {}, onitemmoved: function(aitemid, aoldparent, aoldindex, anewparent, anewindex) {}, queryinterface: xpcomutils.generateqi([components.interfaces.nsinavbookmarkobserver]) }; // an extension var myextension = { // this function is called when my add-on is loaded onload: function() { bmsvc.addobserver(myext_bookmarklistener, false); }, // this function is called when my add-on is unloaded onunload: function() { bmsvc.removeobserver(myext_bookmarklistener); }, dosomething: function() { alert("did something."); } }; see also nsinavbookmarksservice nsinavbookmarkobserver places using xpcom without chrome ...
Retrieving part of the bookmarks tree
configure the query to get a hierarchical bookmarks result, pass the folder id to setfolders in your query object: query.setfolders([toolbarfolder], 1); run the query the executequery and executequeries functions will return an nsinavhistoryresult object containing the results of your query: var result = historyservice.executequery(query, options); get the results when you are querying for exactly one folder grouped by folder with no fancy query parameters such as keywords or date ranges (as in this example), the root of the result will be an nsinavhistorycontainerresultnode corresponding to your folder.
...when you're done, be sure to close the container to free up the resources.
Making cross-thread calls using runnables
instead, we want to run it on a new thread and be notified when the result is available.
... mcallback(mresult); // if we don't destroy the thread when we're done with it, it will hang around forever...
Components.Exception
these exception objects may be thrown when implementing xpcom interfaces in javascript, and they can provide better diagnostics in the error console if not caught than simply throwing an nsresult's value will.
... syntax var exception = [ new ] components.exception([ message [, result [, stack [, data ] ] ] ]); parameters message a string which can be displayed in the error console when your exception is thrown or in other developer-facing locations, defaulting to 'exception' result the nsresult value of the exception, which defaults to components.results.ns_error_failure stack an xpcom stack to be set on the exception (defaulting to the current stack chain) data any additional data you might want to store, defaulting to null example throw components.exception("i am throwing an exception from a javascript xpcom component."); ...
Components.classes
shortcuts it's a common practice to abbreviate components.classes and components.interfaces by storing a reference to the object as a constant: const cc = components.classes, ci = components.interfaces; var os = cc["@mozilla.org/observer-service;1"] .getservice(ci.nsiobserverservice); a less known trick, useful when creating multiple instances of the same component, is to use the new operator on the class object: var clazz = components.classes["@mozilla.org/supports-array;1"]; var inst = new clazz(components.interfaces.nsisupportsarray); this implicitly calls the createinstance() method for you.
... you still have to provide the interface name each time you create an instance, which is not necessary when using components.constructor.
Components.isSuccessCode
components.issuccesscode() is functionally equivalent to the following javascript: function issuccesscode(returncode) { return (returncode & 0x80000000) === 0; } since failure error codes are turned into exceptions when encountered in javascript, this function usually is not necessary.
...for example, if you ask a component or service to asynchronously perform some task, you must usually pass in an object which will be notified when the task is completed.
Components.utils.createObjectIn
note that this function is now mostly obsolete when you are using sandbox, because you can create an object in a different compartment using new.
... for example, to create a new object in the compartment identified by contentwindow: var newobject = new contentwindow.object(); but it is really needeed from firefox 30 onwards when trying to manipulate the dom window.
XPCshell Test Manifest Expressions
you can add conditions to tests in order to control when tests get run.
... this is useful as the entire line will generally be reported whenever tests are reported as being skipped, meaning the comment as well as the expression itself will appear in any logs where this is reported.
Monitoring HTTP activity
observable socket activities when the activity type reported to your nsihttpactivityobserver.observeactivity() method is activity_type_socket_transport, the activity subtype, which indicates the specific type of activity that occurred, will be a socket transport status code.
... observable http activities when the activity type is activity_type_http_transaction, the activity subtype will be one of the activity subtype constants.
NS_ConvertASCIItoUTF16
call this version when you know the length of 'data'.
...call this version when 'data' is null-terminated.
NS_ConvertUTF16toUTF8
call this version when you know the length of 'data'.
...call this version when 'data' is null-terminated.
NS_ConvertUTF8toUTF16
call this version when you know the length of 'data'.
...call this version when 'data' is null-terminated.
NS_LossyConvertUTF16toASCII
call this version when you know the length of 'data'.
...call this version when 'data' is null-terminated.
nsACString_internal
call this version when you know the length of 'data'.
...call this version when 'data' is null-terminated.
nsAString_internal
call this version when you know the length of 'data'.
...call this version when 'data' is null-terminated.
nsAdoptingCString
call this version when you know the length of 'data'.
...call this version when 'data' is null-terminated.
nsAdoptingString
call this version when you know the length of 'data'.
...call this version when 'data' is null-terminated.
nsAutoString
call this version when you know the length of 'data'.
...call this version when 'data' is null-terminated.
nsCAutoString
call this version when you know the length of 'data'.
...call this version when 'data' is null-terminated.
nsCString
call this version when you know the length of 'data'.
...call this version when 'data' is null-terminated.
nsDependentCSubstring
call this version when you know the length of 'data'.
...call this version when 'data' is null-terminated.
nsDependentString
call this version when you know the length of 'data'.
...call this version when 'data' is null-terminated.
nsDependentSubstring
call this version when you know the length of 'data'.
...call this version when 'data' is null-terminated.
nsFixedCString
call this version when you know the length of 'data'.
...call this version when 'data' is null-terminated.
nsFixedString
call this version when you know the length of 'data'.
...call this version when 'data' is null-terminated.
nsPromiseFlatCString
call this version when you know the length of 'data'.
...call this version when 'data' is null-terminated.
nsPromiseFlatString
call this version when you know the length of 'data'.
...call this version when 'data' is null-terminated.
nsString
call this version when you know the length of 'data'.
...call this version when 'data' is null-terminated.
nsXPIDLCString
call this version when you know the length of 'data'.
...call this version when 'data' is null-terminated.
nsXPIDLString
call this version when you know the length of 'data'.
...call this version when 'data' is null-terminated.
IAccessibleAction
since these key sequences are to be used when the object has focus, they are like mnemonics (access keys), and not like shortcut (accelerator) keys.
...refer to @ref _arrayconsideration "special consideration when using arrays" for more details.
IAccessibleRelation
note that this array is to be allocated by the client and freed when no longer needed.
... refer to @ref _arrayconsideration "special consideration when using arrays" for more details.
amIInstallCallback
toolkit/mozapps/extensions/amiinstalltrigger.idlscriptable a callback function that web pages can implement to be notified when triggered installs complete.
... 1.0 66 introduced gecko 2.0 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview void oninstallended(in astring aurl, in print32 astatus); methods oninstallended() called when an install completes or fails.
mozIColorAnalyzer
void findrepresentativecolor( in nsiuri imageuri, in mozirepresentativecolorcallback callback ); parameters imageuri a uri pointing to the image - ideally a data: uri, but any scheme that will load when setting the src attribute of a dom img element should work.
... callback function to call when the representative color is found or an error occurs.
mozIPlacesAutoComplete
note: pages will not be automatically unregistered when private browsing mode is entered or exited.
...note: pages will not be automatically unregistered when private browsing mode is entered or exited.
mozIRegistry
open issues we have identified two open issues, neither of which appear to be so hard that it we won't be able to solve them in a timely fashion: if and when we remove what is currently a static binding of clsids, there will be the risk that required clsids won't be present.
... there's another component that turns out to also be real important when you go to hook up your code with other mozilla components.
mozIStorageService
the database should not be open, or you should ensure that no database activity is happening when you call this method.
...if cache contention is expected, for instance when operating on a database from multiple threads, using unshared connections may be a performance win.
nsIAccessibleRelation
when there is more than one object in the group each member may have one and the same target, for example a grouping object.
...when this object is activated the target object doesn't lose focus.
nsIAccessibleRole
1.0 66 introduced gecko 1.9 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) constants constant value description role_nothing 0 used when accessible has no strong defined role.
... role_popup_menu 83 a temporary window that is usually used to offer the user a list of choices, and then hides when the user selects one of those choices.
nsIAccessibleText
it should be roughly equivalent to the bounding box of some character when inserted at the end of the text.
...it should be roughly equivalent to the bounding box of some character when inserted at the end of the text.
nsIApplicationCacheNamespace
constants constant value description namespace_bypass 1 items matching this namespace can be fetched from the network when loading from this cache.
... namespace_fallback 2 items matching this namespace can be fetched from the network when loading from this cache; however, if the load fails, the cache entry specified by the data attribute should be loaded intstead.
nsIAuthPrompt2
note: this method may throw any exception when the prompt fails to queue, for example because of out-of-memory error.
... it must not throw when the prompt could already be potentially shown to the user.
nsIAutoCompleteSearch
inherits from: nsisupports last changed in gecko 1.7 users call startsearch() and pass in an nsiautocompleteobserver when the search starts.
...listener an nsiautocompleteobserver listener to notify when the search is complete.
nsIBrowserSearchService
callback a nsisearchinstallcallback that will be notified when the addition is complete, or if the addition fails.
... method the http request method used when submitting a search query.
nsICache
this constant specify that cache session is not a stream based entry when calling nsicacheservice.createsession() method.
...this constant specify that cache session is a stream based entry when calling nsicacheservice.createsession() method.
nsIChannelEventSink
methods asynconchannelredirect() called when a redirect occurs.
... onchannelredirect() obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) called when a redirect occurs.
nsICharsetResolver
inherits from: nsisupports last changed in gecko 1.7 method overview void notifyresolvedcharset(in acstring charset, in nsisupports closure); acstring requestcharset(in nsiwebnavigation awebnavigation, in nsichannel achannel, out boolean awantcharset, out nsisupports aclosure); methods notifyresolvedcharset() some implementations may request that they be notified when the charset is actually detected.
...if the charset cannot be resolved, but the implementation of nsicharsetresolver wants to be notified of the final resolved charset when one is available, it can set awantcharset to true.
nsIComponentRegistrar
this value is passed into the nsimodule.registerself() callback and must be forwarded unmodified when registering factories via their location.
...this value is passed into thensimodule.registerself() callback and must be forwarded unmodified when registering factories via their location.
nsIContentPrefCallback2
n gecko 20.0 (firefox 20.0 / thunderbird 20.0 / seamonkey 2.17) method overview void handlecompletion(in unsigned short reason); void handleerror(in nsresult error); void handleresult(in nsicontentpref pref); constants constant value description complete_ok 0 complete_error 1 methods handlecompletion() called when the method finishes.
... handleerror() called when an error occurs.
nsIContentPrefObserver
1.0 66 introduced gecko 1.9 inherits from: nsisupports last changed in gecko 1.9 (firefox 3) method overview void oncontentprefremoved(in astring agroup, in astring aname); void oncontentprefset(in astring agroup, in astring aname, in nsivariant avalue); methods oncontentprefremoved() called when a content preference is removed.
... oncontentprefset() called when the value of a preference is set (either by changing its current value or by creating the preference).
nsIContentView
when this view is active (that is it is being painted because it's in the visible region of the screen), this value is at first lined up with the content's scroll offset.
... note: when this view becomes inactive, the new content view will have scroll values that are reset to the default.
nsICookiePermission
aissession when cansetcookie is invoked, this is the current issession attribute of the cookie.
...aexpiry when cansetcookie is invoked, this is the current expiry time of the cookie.
nsICookieService
var cookiesvc = components.classes["@mozilla.org/cookieservice;1"] .getservice(components.interfaces.nsicookieservice); notifications this service broadcasts the following notifications when the cookie list is changed, or a cookie is rejected: topic subject data cookie-changed broadcast whenever the cookie list changes in some way.
... cookie-rejected broadcast whenever the user's preferences cause a cookie to be rejected from being set.
nsICryptoHash
the first thing to note is that when you call the init() method you must specify the hash algorithm to use.
... also note that when you call the updatefromstream() method, the second parameter is the number of bytes to read.
nsIDOMEvent
for example, mouse events are retargeted to their parent node when they happen over text nodes (bug 185889), and in that case .target will show the parent and .explicitoriginaltarget will show the text node.
...when not available, a value of 0 will be returned.
nsIDOMGeoPositionCallback
the nsidomgeopositioncallback interface is called when updated position information is available.
... last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) method overview void handleevent(in nsidomgeoposition position); methods handleevent() called when new position information is available.
nsIDownloadManagerUI
constants constant value description reason_user_interacted 0 when opening the download manager user interface, this value indicates that it's being done at the user's request.
... reason_new_download 1 when opening the download manager user interface, this value indicates that the user interface is being displayed because a new download is being started.
nsIDownloader
void init( in nsidownloadobserver observer, in nsifile downloadlocation ); parameters observer the nsidownloadobserver to be notified when the download completes.
...if null, the downloader will select a location and the resulting file will be deleted (or otherwise made invalid) when the downloader object is destroyed.
nsIEditorIMESupport
notify for ime when the editor lost focus.
...notify for ime when the editor got focus.
nsIFeedProgressListener
handlefeedatfirstentry() called when the first entry or item in the feed is encountered.
... reporterror() called by the feed processor when a fatal xml parsing error occurs, or if the document isn't a feed.
nsIFileOutputStream
the deferred open will be performed when one of the following is called: seek() tell() write() flush() defer_open is useful if we use the stream on a background thread, so that the opening and possible stating of the file happens there as well.
...this means that any errors that might happen when this flag is not set would happen during the first write, and if the file is to be created, it will not appear on the disk until the first write.
nsIFrameMessageListener
1.0 66 introduced gecko 2.0 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) this interface is used when implementing out-of-process handling of frames; the process handling a frame should implement this interface in order to receive messages.
... when the listener is called, the this value is the target of the message.
nsIHTMLEditor
aflavor transferable flavor, can be "" asourcedoc document where input was dragged from (may be null) adestinationnode location for insertion (such as when dropped) adestinationoffset used with adestnode to determine insert location.
... void removeinlineproperty( in nsiatom aproperty, in astring aattribute ); parameters aproperty the property to remove from the selection all atoms are for normal html tags (for example nsieditorproperty.font()) except when you want to remove just links and not named anchors.
nsIHttpHeaderVisitor
inherits from: nsisupports last changed in gecko 1.7 method overview void visitheader(in acstring aheader, in acstring avalue); methods visitheader() called by the nsihttpchannel implementation when visiting request and response headers.
...when the observer fires, the visitor interface is used to walk through the response headers and evaluate the mime type.
nsIHttpUpgradeListener
netwerk/protocol/http/nsihttpchannelinternal.idlscriptable the callback interface for nsihttpchannelinternal.httpupgrade; this is called when an http protocol upgrade is finished.
...method overview void ontransportavailable(in nsisockettransport atransport, in nsiasyncinputstream asocketin, in nsiasyncoutputstream asocketout); methods ontransportavailable() called when an http protocol upgrade attempt is completed, passing in the information needed by the protocol handler to take over the channel that is no longer being used by http.
nsIINIParserWriter
when you're done and ready to write the ini file to disk, call the writefile() method.
... method overview void setstring(in autf8string asection, in autf8string akey, in autf8string avalue); void writefile([optional] in nsifile ainifile, [optional] in unsigned long aflags); constants file writing constants these constants are specified when calling writefile(), in order to change its behavior.
nsIInputStream
a stream that is closed will throw an exception when this method is called.
... note: some nsiinputstream implementations automatically close() when end-of-file is reached; others do not.
nsIJetpack
registerreceiver() this registers a callback to be triggered whenever the jetpack process sends a particular message.
...when evaluated, the script's global scope will include all privileged apis.
nsILivemarkService
name the name to show when displaying the livemark.
... name the name to show when displaying the livemark.
nsILocalFile
the persistent descriptor is intended to be used whenever a nsilocalfile needs to be serialized to disk and later recovered.
... delete_on_close file will be deleted when closed.
nsILoginInfo
when an http server sends a 401 result, the www-authenticate header includes a realm to identify the "protection space." see rfc 2617.
... ignorepassword if true, do not examine the password value when matching.
nsIMacDockSupport
dockmenu nsistandalonemenu the menu to display when the user right-clicks on the application's icon in the dock.
...the application should call this to activate itself when one of its dock menu items are selected, since doing so does not automatically activate the application.
nsIMemoryReporter
when a reporter from a child process is copied into the main process, the copy's process field is set appropriately.
... note: the amount field should be given a value 100 times the actual percentage; this number will be divided by 100 when shown.
nsIMessageListener
when the listener is called, 'this' value is the target of the message.
...when there are multiple listeners to synchronous messages, each listener's return value is sent back as an element in an array.
nsIMicrosummary
needsremoval boolean used when a site author has indicated that a microsummary (or an associated generator) will no longer be available.
...if you want know when a microsummary finishes updating, add an observer before calling this method.
nsIMicrosummaryService
if the caller passes a bookmark id, and one of the microsummaries is the current one for the bookmark, this method will retrieve content from the datastore for that microsummary, which is useful when callers want to display a list of microsummaries for a page that isn't loaded, and they want to display the actual content of the selected microsummary immediately (rather than after the content is asynchronously loaded).
...if its value is null, then it's an async refresh, and the caller should register itself as an nsimicrosummaryobserver via nsimicrosummary.addobserver() to find out when the refresh completes.
nsIModule
registerself() when the nsimodule is discovered, this method will be called so that any setup registration can be preformed.
... unregisterself() when the nsimodule is being unregistered, this method will be called so that any unregistration can be preformed.
nsIMsgDBView
used when the message pane is collapsed.
... ondeletecompleted() called when delete is completed on a message.
nsIMsgDBViewCommandUpdater
nsmsgdbviewcommandupdater (for the standalone message window) nsmsgdbviewcommandupdater (for the threadpane message window) nsmsgsearchcommandupdater (for search dialogs) method overview void updatecommandstatus(); void displaymessagechanged(in nsimsgfolder afolder, in astring asubject, in acstring akeywords); void updatenextmessageafterdelete(); methods updatecommandstatus() called when the number of selected items changes.
... displaymessagechanged() called when the displayed message has changed.
nsIMsgDatabase
void markmdnneeded(in nsmsgkey key, in boolean bneeded, in nsidbchangelistener instigator); ismdnneeded() markmdnneeded only used when mail server is a pop3 server, or when the imap server does not support user defined permanentflags.
...the caller should free when done using nsmemory.free().
nsIMsgThread
void addchild(in nsimsgdbhdr child, in nsimsgdbhdr inreplyto, in boolean threadinthread, in nsidbchangeannouncer announcer); parameters child the message to add inreplyto the message this should be in reply to threadinthread announcer an nsidbchangeannouncer to receive notification when the change is made.
... removechildat() void removechildat(in long index); parameters index the index to remove the message from removechildhdr() void removechildhdr(in nsimsgdbhdr child, in nsidbchangeannouncer announcer); parameters child the message to remove announcer an nsidbchangeannouncer to receive notification when the change is made.
nsIMsgWindowCommands
for instance, when deleting attachments, this causes the message to be redisplayed.
... clearmsgpane() this method is called by the backend when it wants to clear the message pane, for instance if you select the group header .
nsINavHistoryResultNode
bookmarkindex long when this item is in a bookmark folder (its parent is of type folder), this is the index into that folder at which this node resides.
...note: when an item is added lastmodified is set to the same value as dateadded.
nsIPermissionManager
constants permission type constants constant value description unknown_action 0 default permission when no entry is found for a host.
... remarks this service broadcasts the following notification when the permission list is changed: topic : "perm-changed" (perm_change_notification) broadcast whenever the permission list changes in some way.
nsIPipe
for example, in the case of an empty non-blocking pipe, the user can call nsiasyncinputstream.asyncwait() on the input end of the pipe to be notified when the pipe has data to read (or when the pipe becomes closed).
...in which case, the pipe is automatically closed when the respective pipe ends are released.
nsIPlacesImportExportService
"bookmarks-restore-failed" is fired right after a failure occurs when importing the bookmarks.
..."bookmarks-restore-failed" is fired right after a failure occurs when importing the bookmarks.
Component; nsIPrefBranch
the observer can request to be held as a weak reference when it is registered.
...however, the observers are not guaranteed to be notified in any particular order, so you can't be sure whether the added/removed observer will be called during the notification when it is added/removed.
nsIPrefBranch2
the observer can request to be held as a weak reference when it is registered.
...however, the observers are not guaranteed to be notified in any particular order, so you can't be sure whether the added/removed observer will be called during the notification when it is added/removed.
nsIPrivateBrowsingService
when firefox is in private browsing mode, firefox shouldn't save any potentially private information.
...in addition, temporary, databases are created to be used for cookies and local storage; these databases are thrown away when private browsing mode is turned off, and the regular databases are re-activated.
nsIProcess2
la.org/process/util;1"] .createinstance(components.interfaces.nsiprocess2); method overview void runasync([array, size_is(count)] in string args, in unsigned long count, [optional] in nsiobserver observer, [optional] in boolean holdweak); methods runasync() asynchronously runs the process with which the object was initialized, optionally calling an observer when the process finishes running.
... observer optional an observer that will be notified when the process exits.
nsIProfile
constants profile shutdown types constant value description shutdown_persist 0x00000001 when shutting down the profile, save all changes.
... shutdown_cleanse 0x00000002 when shutting down the profile, discard changes.
nsISearchEngine
when non-null, this is a unique identifier.
...if value is "{searchterms}", it will be substituted with the user-entered data when retrieving the submission.
nsISelectionPrivate
aissynchronous when true, scrolls the selection into view before returning.
...the textrangestyle will be used by text frame when it is painting the selection.
nsISocketProvider
when set, the hostname parameter passed in this interface will be used instead of the address structure passed for a later request.
... anonymous_connect 1 << 1 when setting this flag, the socket will not apply any credentials when establishing a connection.
nsISpeculativeConnect
netwerk/base/public/nsispeculativeconnect.idlscriptable lets non-networking code provide hints to the networking layer that an http connection attempt to a particular site is likely to happen soon; this lets the networking layer begin setting up tcp and, if appropriate, ssl handshakes to save time when the connection is actually opened later.
...the code implementing this method may use this information to start a tcp and/or ssl level handshake for that resource immediately so that it is ready (or at least in the process of becoming ready) when the transaction is actually submitted.
nsITaskbarProgress
this should be used when the operation is complete or canceled.
...the currentvalue and maxvalue parameters are optional and should be supplied when state is one of state_normal, state_error or state_paused.
nsITaskbarTabPreview
when there are no more tab previews left for a window, the window preview is automatically made visible again.
... this method is only invoked when it's safe to make taskbar api calls.
nsIThreadPoolListener
last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) inherits from: nsisupports method overview void onthreadcreated(); void onthreadshuttingdown(); methods onthreadcreated() called when a new thread is created by the thread pool.
...onthreadshuttingdown() called when a new thread is about to be destroyed by the thread pool.
nsIToolkitProfile
the unlocker object is only available in gecko 34 or later when running on windows vista or later.
...void remove( in boolean removefiles ); parameters removefiles indicates whether or not the profile directory should be removed when the profile is removed from the profile list.
nsITraceableChannel
channels may restrict when you may replace the listener.
...nt set up rejection, but i should listen to on abort or bade status code then reject maybe } ).catch( function(acatch) { console.error('something went wrong, a typo by dev probably:', acatch); } ); } }; services.obs.addobserver(httpresponseobserver, 'http-on-examine-response', false); // services.obs.removeobserver(httpresponseobserver, 'http-on-examine-response'); // call this when you dont want to listen anymore ...
nsITransactionList
the list returned is addref'd so it is up to the caller to release the transaction when it is done.
...the transaction returned is addref'd so it is up to the caller to release the transaction when it is done.
nsITransactionManager
listeners are notified whenever a transaction is done, undone, or redone.
...the transaction's nsitransaction.release() method will be called when the undo or redo stack is pruned or when the transaction manager is destroyed.
nsITreeSelection
selecteventssuppressed boolean this attribute is a boolean indicating whether or not the "select" event should fire when the selection is changed using one of our methods.
... methods adjustselection() called when the row count changes to adjust selection indices.
nsIURIFixup
exceptions thrown ns_error_unknown_protocol when we can not get a protocol handler service for the uri scheme.
... ns_error_malformed_uri when the exposable portion of auri is malformed.
nsIUpdateCheckListener
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 onprogress(in nsixmlhttprequest request, in unsigned long position, in unsigned long totalsize); methods oncheckcomplete() called when the update check is completed.
... onerror() called when an error occurs while loading the remote update service file.
nsIUpdateTimerManager
callback an nsitimercallback object that is notified when the interval expires.
...s: _xpcom_categories: [{ category: "update-timer", value: "contractid," + "method," + "id," + "preference," + "interval" }], this allows you to schedule the timer without actually having to instantiate the component; instead, the component is instantiated when the timer is triggered.
nsIWebBrowserFind
matchcase boolean whether to match case (case sensitive) when searching.
...works correctly when searching backwards.
nsIWebSocketChannel
used to indicate that a connection was closed abnormally (that is, with no close frame being sent) when a status code is expected.
... close() void close( in unsigned short acode, in autf8string areason ); parameters acode the status of the connection when closed; see status codes for possible values.
nsIWifiMonitor
netwerk/wifi/nsiwifimonitor.idlscriptable this interface can be used to be alerted when the list of available wifi access points changes.
...void startwatching( in nsiwifilistener alistener ); parameters alistener the nsiwifilistener object to receive notifications when the wifi access point list changes.
nsIWorkerScope
1.0 66 introduced gecko 1.9.1 inherits from: nsiworkerglobalscope last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) method overview void postmessage(in domstring amessage, [optional] in nsiworkermessageport amessageport); void close(); attributes attribute type description onclose nsidomeventlistener a listener object to be called when the worker stops running.
... onmessage nsidomeventlistener a listener object to be called when a message is posted on the port.
nsIXMLHttpRequest
when using the xpcom interface, as seen below in example 2, we can get access to this.
... though actually, if you use addeventlistener from c++ weird things will happen too, since the result will depend on what js happens to be on the stack when you do it....
nsIXULWindow
when the window is destroyed, it will fire a "xul-window-destroyed" notification through the global observer service.
...in particular, calling this when this xul window does not yet have a document in its docshell could cause problems.
NS_IF_RELEASE
ns_if_release has no effect when the pointer is null.
... this macro should only be used when the pointer might be null; otherwise, use ns_release.
XPCOM reference
it is now a strongly typed enum when xpcom is built using a c++11 compiler.
... this causes compile-time errors to occur when improper values are returned as nsresult values, thereby making it easier to catch many bugs.
The Thread Manager
when you dispatch an event to the pool, the pool selects an available worker thread to process the event.
... nsithreadobserver provides the ability to monitor a thread, to receive notifications when events are dispatched to it and when they're finished being processed.
Troubleshooting XPCOM components registration
when adding a component to a xulrunner application, change the buildid in application.ini.
... pass the -wl,-z,defs flag to gcc when linking your component.
Working with Multiple Versions of Interfaces
the problem arises when one tries to run an extension built with the latest sdk in an older version of firefox, say firefox 2.
...mine date back to august of 2006, which is when i first built the lizard.
Working with out parameters
when working with xpcom components, you might come across method declarations like the following one: [scriptable, uuid(8b5314bc-db01-11d2-96ce-0060b0fb9956)] interface nsitransferable : nsisupports { ...
...implementation when implementing a method which has out parameters in javascript, you have to set a new property called value to the out parameter which will hold the required value.
XPCOM ABI
while xpcom components written in a scripting language (such as javascript) can be moved across platforms (such as windows and os x) without adaptation, those written in a compiled language (such as c++) require recompilation when moving to a different platform.
...(this is an internals detail and should be of no concern to an extension developer.) extension installation when the application (e.g.
XSLT 2.0
for users saxon-ce no extensions are required, saxon-ce runs whenever a html page is loaded that links to the saxon-ce javascript library.
... saxon-b the xsl results extension uses the new incarnation of liveconnect (handled by java 1.6v12+ instead of mozilla-specific code) to connect with the java-based saxon-b library, and adds support for having xslt performed automatically when visiting a page with the appropriate xslt processing instruction (and which isn't processed by firefox's own xslt 1.0 processor).
Events
composition event name event type fired when...
... folders event name event type fired when...
MailNews fakeserver
onstartup none server's response called when a connection is made.
... onmultiline sent line server's response or nothing called when in multi-line mode.
MailNews Filters
filter execution is done by evaluating the search terms using the core mailnews/base/search code, and then applying the filter hits when the search terms match.
...we also coalesce moves to the same destination folder, so that we can do them in one url/command to the server, and we playback those moves when the header download is done.
Demo Addon
let query = gloda.newquery(gloda.noun_message); query.subjectmatches(searchterm); let mylistener = { /* called when new items are returned by the database query or freshly indexed */ onitemsadded: function mylistener_onitemsadded(aitems, acollection) { }, /* called when items that are already in our collection get re-indexed */ onitemsmodified: function mylistener_onitemsmodified(aitems, acollection) { }, /* called when items that are in our collection are purged from the system */ ...
...onitemsremoved: function mylistener_onitemsremoved(aitems, acollection) { }, /* called when our database query completes */ onquerycompleted: function mylistener_onquerycompleted(acollection) { let items = acollection.items; let data = { messages: [], }; for (let i in items) { data.messages.push({ subject: items[i].subject, date: items[i].date, author: items[i].from.value, }); // ...
Folders and message lists
when using this, be sure that there's only one selected message (or that you only care about the first one).
...like selectedmessages, this also includes messages in selected collapsed threads when so enabled.
customDBHeaders Preference
because comparisons are case-insensitive, all of the custom headers get set to lowercase when the data gets migrated to the message database.
...when using the latest releases, the line should look like: // space-delimited list in the latest code!
Toolkit version format
compatibility and readability: if the version part is a single asterisk, it is interpreted as an infinitely-large number: 1.5.0.* is the same as 1.5.0.(infinity) if string-b is a plus sign, number-a is incremented to be compatible with the firefox 1.0.x version format: 1.0+ is the same as 1.1pre the rationale behind splitting a version part into a sequence of strings and numbers is that when comparing version parts, the numeric parts are compared as numbers, e.g.
... comparing versions when two version strings are compared, their version parts are compared left to right.
Using tab-modal prompts
that is, when an alert occurred, it blocked the user interface on all tabs in the window until the user dismissed the prompt.
...an alert!"]; prompt.alert.apply(null, promptargs); nsiprompt will automatically fall back to window-modal prompts when necessary (such as in situations in which tab-modal prompts aren't supported, or for prompts displayed outside the context of a tab).le to use other forms of the prompts of nsipromptservice interface see the example code.
Using the Mozilla source server
now, when you click on a frame in the "calls" window, windbg will prompt you about running cvs to download the associated source code.
...symbols will load and then, if you're using a cvs build, when you try to step into or step over a confirmation window will appear asking if you trust the cvs command that source server is trying to run.
Virtualenv
the populate_virtualenv.py script, when invoked, installs a list of packages, http://mxr.mozilla.org/mozilla-central/source/build/virtualenv/packages.txt , into the virtualenv via one of various methods.
...when using this method, be aware that the parts of package installation invoked via setup.py, such as console-script creation and dependency resolution, will not be invoked.
Memory Management
when binary code hands back a pointer/handle to allocated memory, the js code must make sure to free that memory with the correct allocator.
... when in doubt, malloc() when you need to keep data around, you can use malloc() to allocate it directly.
Type conversion
implicit convert in js-ctypes, data could be converted implicitly when passing to or returning from a functiontype call, or setting pointer content, an array element or a struct field.
... mystruct.v = { x: 10, z: 10 }; // throws error target type source converted value any struct types js object (only if the object has properties for all fields and no other properties) implicitly convert each enumerable property to corresponding field explicit convert in js-ctypes, data could be converted explicitly, when passing to cdata constructor: ctypes.int32_t("123"); // string "123" is parsed as 10-base string explicit convert tries implicit convert first, and if it fails, the following rules are applied: boolean type target type source converted value ctype.bool js value toboolean(src) console.log(ctypes.bool("123").tostring()); // 'ctypes.bool(true)' console.log(c...
CData
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 readstringreplacemalformed, 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 tried this: //"stringptr.contents.tost...
...info('char16_val:', char16_val); return char16_val; } if (!jschar) { try { var char8_val = stringptr.readstring(); console.info('stringptr.readstring():', char8_val); return char8_val; } catch (ex if ex.message.indexof('malformed utf-8 character sequence at offset ') == 0) { console.warn('ex of offset utf8 read error when trying to do readstring so using alternative method, ex:', ex); return readjscharstring(); } } else { return readjscharstring(); } } ...
Scripting plugins - Plugins
a plugin that wishes to be scriptable using this new mechanism needs to return the appropriate npobject (which is created by calling npn_createobject) when the browser requests it by calling: npp_getvalue(npp, nppvpluginscriptablenpobject, ...); accessing browser objects from a plugin a plugin that wishes to access objects in the browser window that loaded the plugin can do this by getting the npobject for the browser's window object, or the dom element that loaded the plugin.
... and as always when working with reference counted npobjects, the caller is responsible for calling npn_releaseobject on the npobject to drop the reference.
3D view - Firefox Developer Tools
when you click on the 3d view button, the page goes into 3d view mode; in this mode, you can see your page presented in a 3d view in which nested blocks of html are increasingly "tall," projecting outward from the bottom of the page.
...this can become much more obvious when looking at the 3d view and seeing where your elements are nested wrong.
DOM Inspector internals - Firefox Developer Tools
this is the two-pane inspector that appears when ctrl+shift+i (or cmd+shift+i) is pressed from one of the applications for which dom inspector has explicit support (i.e., menuitems placed via overlay).
... viewers are dynamically loaded; when the panel is made to switch from one viewer to another, the old viewer is destroyed, and the new viewer is loaded in its place.
Inspecting web app manifests - Firefox Developer Tools
when you open the application panel’s manifest view on a page that doesn't have an app manifest successfully deployed, you'll get the following output shown: deploying a manifest to get a manifest deployed successfully, you need to include a <link> element in the <head> of your document that points to your .webmanifest file: <link rel="manifest" href="/manifest.webmanifest"> the .webmanifest extension is recommended in the spec, and should be served with an application/manifest+json mime type, although browsers generally tend to support manifests with other appropriate extensions like .json (mime type: application/json).
...it provides a link to the manifest file at the top which when clicked on brings up the json in a new tab.
Browser Console - Firefox Developer Tools
this example here makes it so that when you mouse over the "clear" button it will clear the browser console: components.utils.import("resource://devtools/shared/loader.jsm"); var hudservice = devtools.require("devtools/client/webconsole/hudservice"); var hud = hudservice.getbrowserconsole(); var clearbtn = hud.chromewindow.document.queryselector('.webconsole-clear-console-button'); clearbtn.addeventlistener('mouseover', function() {...
...here's an example add-on that just logs an error when the user clicks a widget: widget = require("sdk/widget").widget({ id: "an-error-happened", label: "error!", width: 40, content: "error!", onclick: logerror }); function logerror() { console.error("something went wrong!"); } if you build this as an xpi file, then open the browser console, then open the xpi file in firefox and install it, you'll see a widget labeled "error!" in the add-on bar: click the icon.
Debug worker threads - Firefox Developer Tools
inspecting worker code for example, see the selected item worker.js below — it is listed in a separate thread in the sources list, but appears in the source pane in the same way as main thread code when selected.
... you can set a breakpoint (or logpoint) on any active worker thread: when execution is paused in a worker thread, the context of the debugger is updated to show the correct breakpoints, call stack, etc., just as you'd expect.
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.
...in the screenshot below the variable upvar has been optimized away: modify variables when the code has stopped at a breakpoint, you can modify variables in the variables pane of the debugger.
Highlight and inspect DOM nodes - Firefox Developer Tools
when you are working with dom notes in the debugger, you can easily highlight the node on the page or view it in the page inspector.
... also, when you view the details of a dom node in the code panel, objects that you can highlight in the list will also have a target next to them.
Search - Firefox Developer Tools
for example, if i enter "load" when viewing the above list, i get the following: only the functions with load in their name are shown.
... this feature may not seem terribly useful when searching a file with a handful of functions in it but when you are searching through a file with dozens of functions, it comes in handy.
Set watch expressions - Firefox Developer Tools
when debugging code, sometimes it's useful to watch expressions as executions are paused.
...when the debugger reaches a breakpoint, it will display your watch expressions variables: you can step through your code, watching the value of the expression as it changes.
Set a conditional breakpoint - Firefox Developer Tools
a normal breakpoint is just associated with a line: when the program reaches that line, the debugger pauses.
...when the program reaches the line, the debugger pauses only if the breakpoint's specified expression evaluates to true.
Step through code - Firefox Developer Tools
when the debugger is stopped at a breakpoint, you can step through it using four buttons in the toolbar: in order, the buttons are: play: run to the next breakpoint step over: advance to the next line in the same function.
... step in: advance to the next line in the function, unless on a function call, in which case enter the function being called step out: run to the end of the current function, in which case, the debugger will skip the return value from a function, returning execution to the caller split console when paused, you can press the esc key to open and close the split console to gain more insight into errors and variables: pause on breakpoints overlay since firefox 70, when your code is paused on a breakpoint an overlay appears on the viewport of the tab you are debugging.
Set an XHR breakpoint - Firefox Developer Tools
an xhr (xmlhttprequest) breakpoint breaks code execution when an xhr request is dispatched so that you can examine the current state of the program.
... when your code breaks on an xhr request, the righthand pane will have two additional sections: call stack the list of functions that were executed in order ot get to the currently executing code.
Debugger.Environment - Firefox Developer Tools
this means that the debugger can use the == operator to recognize when two debugger.environment instances refer to the same environment in the debuggee, and place its own properties on a debugger.environment instance to store metadata about particular environments.
...when true, getvariable returns an ordinary javascript object whose optimizedout property is true on all bindings, and setvariable throws a referenceerror.
Debugger-API - Firefox Developer Tools
you can set functions to be called when new stack frames are pushed; when new code is loaded; and so on.
... examples here are some things you can try out yourself that show off some of debugger’s features: setting a breakpoint in a page, running a handler function when it is hit that evaluates an expression in the page’s context.
The Firefox JavaScript Debugger - Firefox Developer Tools
there are multiple ways to tell the debugger how and when to pause: set a breakpoint set a conditional breakpoint set an xhr breakpoint set event listener breakpoints break on exceptions use watchpoints for property reads and writes break on dom mutation disable breakpoints control execution what can you do after execution pauses?
... step through code black box a source debug worker threads debug eval sources look at values you probably want to see the value of variables or expressions, either during execution or when it is paused.
Aggregate view - Firefox Developer Tools
let's see what the example looks like when we select "inverted call stack": now at the top we can immediately see the createtoolbarbutton() call accounting for 89% of the heap usage in our page.
... for example: any scripts the page loads occupy heap space sometimes an object is allocated when there is no javascript on the stack.
Dominators - Firefox Developer Tools
they can just create and use objects, and when the objects are no longer needed, the runtime takes care of cleaning up, and frees the memory the objects occupied.
... so when an object becomes unreachable (for example, because it is only referenced by a single local variable which goes out of scope) then any objects it references also become unreachable, as long as no other objects reference them: conversely, this means that objects are kept alive as long as some other reachable object is holding a reference to them.
Edit Shape Paths in CSS - Firefox Developer Tools
an ellipse is a squashed circle and therefore has the option to resize horizontally and vertically when you click on the shapes icon.
...this is the most complex of the basic shape values, therefore the tool gives you more options when editing these: clicking on the shapes icon will activate the shapes path editor and give you the option to move any of the points of your polygon shape.
Use the Inspector API - Firefox Developer Tools
.markdirty() - marks that the page has been changed by the inspector - a warning will be shown when leaving the page, since changes made through the inspector are rewritten on reload.
... bindable events using on: markuploaded called when the left panel has been refreshed, after page change.
Work with animations - Firefox Developer Tools
finally, if you click inside the bar at the top of the timeline, you get a scrubber that you can drag left and right to move backwards and forwards through the animation, and pinpoint exactly what's happening when.
...in this case, the message is "animations of 'transform' cannot be run on the compositor when geometric properties are animated on the same element at the same time." edit @keyframes any @keyframes rules associated with the currently selected element are displayed in the rules view and are editable: edit timing functions when you create a css animation you can specify a timing function: this determines the rate at which the animation progresses.
Allocations - Firefox Developer Tools
spidermonkey uses a complex set of heuristics to decide when to do what sort of garbage collection.
...for example: can you allocate memory lazily, when it is actually needed, instead of up front?
Extension Storage - Firefox Developer Tools
this storage type is only shown when debugging extensions.
... when selecting an extension id in the storage tree of the storage inspector, a table lists the details of all the extension storage present for the extension.
Toolbox - Firefox Developer Tools
this is what it looks like when it's docked: the window itself is split into two parts: a toolbar along the top, and a main pane underneath: note: since firefox 62, you can drag and drop tabs in the main toolbar of the toolbox to reorder your tools as you wish (bug 1226272).
... keyboard shortcuts these shortcuts work whenever the toolbox is open, no matter which tool is active.
Rich output - Firefox Developer Tools
when the web console prints objects, it includes a richer set of information than just the object's name.
...om elements, and enables you to select them in the inspector type-specific rich output the web console provides rich output for many object types, including the following: object array date promise regexp window document element event examining object properties when an object is logged to the console it has a right-pointing triangle next to it, indicating that it can be expanded.
Firefox Developer Tools
this button only appears when there are multiple iframes on a page.
... network monitor see the network requests made when a page is loaded.
ANGLE_instanced_arrays.drawElementsInstancedANGLE() - Web APIs
note: when using webgl2, this method is available as gl.drawelementsinstanced() by default.
...possible values are: gl.unsigned_byte gl.unsigned_short when using the oes_element_index_uint extension: gl.unsigned_int offset a glintptr specifying an offset in the element array buffer.
ANGLE_instanced_arrays.vertexAttribDivisorANGLE() - Web APIs
the angle_instanced_arrays.vertexattribdivisorangle() method of the webgl api modifies the rate at which generic vertex attributes advance when rendering multiple instances of primitives with ext.drawarraysinstancedangle() and ext.drawelementsinstancedangle().
... note: when using webgl2, this method is available as gl.vertexattribdivisor() by default.
AbortController.AbortController() - Web APIs
when the fetch request is initiated, we pass in the abortsignal as an option inside the request's options object (see {signal}, below).
... }).catch(function(e) { reports.textcontent = 'download error: ' + e.message; }) } note: when abort() is called, the fetch() promise rejects with an aborterror.
AbortController.abort() - Web APIs
when the fetch request is initiated, we pass in the abortsignal as an option inside the request's options object (see {signal}, below).
... }).catch(function(e) { reports.textcontent = 'download error: ' + e.message; }) } note: when abort() is called, the fetch() promise rejects with an aborterror.
AbortController.signal - Web APIs
when the fetch request is initiated, we pass in the abortsignal as an option inside the request's options object (see {signal}, below).
... }).catch(function(e) { reports.textcontent = 'download error: ' + e.message; }) } note: when abort() is called, the fetch() promise rejects with an aborterror.
AbortSignal.onabort - Web APIs
the onabort read-only property of the fetchsignal interface is an event handler invoked when an abort event fires, i.e.
... when the fetch request(s) the signal is communicating with is/are aborted.
AbstractWorker - Web APIs
event handlers abstractworker.onerror an eventlistener which is invoked whenever an errorevent of type error bubbles through the worker.
...this code assumes that there's an <input> element represented by first; an event handler for the change event is established so that when the user changes the value of first, a message is posted to the worker to let it know.
AddressErrors.addressLine - Web APIs
an object based on addresserrors includes an addressline property when validation of the address finds one or more errors in the array of strings in the address's addressline.
... the text should also include, when possible, advice about how to go about correcting the error.
Ambient Light Events - Web APIs
light events when the light sensor of a device detects a change in the light level, it notifies the browser of that change.
... when the browser gets such a notification, it fires a devicelightevent event that provides information about the exact light intensity (in lux units).
AnalyserNode.maxDecibels - Web APIs
the maxdecibels property of the analysernode interface is a double value representing the maximum power value in the scaling range for the fft analysis data, for conversion to unsigned byte/float values — basically, this specifies the maximum value for the range of results when using getfloatfrequencydata() or getbytefrequencydata().
... when getting data from getfloatfrequencydata() or getbytefrequencydata(), any frequencies with an amplitude of maxdecibels or higher will be returned as +1.0 or 255, respectively.
AnalyserNode.minDecibels - Web APIs
the mindecibels property of the analysernode interface is a double value representing the minimum power value in the scaling range for the fft analysis data, for conversion to unsigned byte/float values — basically, this specifies the minimum value for the range of results when using getfloatfrequencydata() or getbytefrequencydata().
... when getting data from getfloatfrequencydata() or getbytefrequencydata(), any frequencies with an amplitude of mindecibels or lower will be returned as 0.0 or 0, respectively.
AnalyserNode - Web APIs
analysernode.mindecibels is a double value representing the minimum power value in the scaling range for the fft analysis data, for conversion to unsigned byte values — basically, this specifies the minimum value for the range of results when using getbytefrequencydata().
... analysernode.maxdecibels is a double value representing the maximum power value in the scaling range for the fft analysis data, for conversion to unsigned byte values — basically, this specifies the maximum value for the range of results when using getbytefrequencydata().
Animation.cancel() - Web APIs
WebAPIAnimationcancel
when an animation is cancelled, its starttime and currenttime are set to null.
... exceptions this method doesn't directly throw exceptions; however, if the animation's playstate is anything but "idle" when cancelled, the current finished promise is rejected with a domexception named aborterror.
Animation.oncancel - Web APIs
the cancel event can be triggered manually with animation.cancel() when the animation enters the "idle" play state from another state, such as when the animation is removed from an element before it finishes playing creating a new animation that is initially idle does not trigger a cancel event on the new animation.
... syntax var cancelhandler = animation.oncancel; animation.oncancel = cancelhandler; value a function to be executed when the animation is cancelled, or null if there is no cancel event handler.
Animation.persist() - Web APIs
WebAPIAnimationpersist
the persist() method of the web animations api's animation interface explicitly persists an animation, when it would otherwise be removed due to the browser's automatically removing filling animations behavior.
...', evt => { let anim = divelem.animate( { transform: `translate(${ evt.clientx}px, ${evt.clienty}px)` }, { duration: 500, fill: 'forwards' } ); anim.commitstyles(); //anim.persist() anim.onremove = function() { console.log('animation removed'); } console.log(anim.replacestate); }); here we have a <div> element, and an event listener that fires the event handler code whenever the mouse moves.
Animation.play() - Web APIs
WebAPIAnimationplay
nommingcake.pause(); // this function will play when ever a user clicks or taps var growalice = function() { // play alice's animation.
... nommingcake.play(); } // when a user holds their mouse down or taps, call growalice to make all the animations play.
Animation.playState - Web APIs
in the game, for performance reasons, the tears should only be animating when they're visible.
...ted like so: // setting up the tear animations tears.foreach(function(el) { el.animate( tearsfalling, { delay: getrandommsrange(-1000, 1000), // randomized for each tear duration: getrandommsrange(2000, 6000), // randomized for each tear iterations: infinity, easing: 'cubic-bezier(0.6, 0.04, 0.98, 0.335)' }); el.pause(); }); // play the tears falling when the ending needs to be shown.
Animation.replaceState - Web APIs
the value can be one of: active: the initial value of the animation's replace state; when the animation has been removed by the browser's automatically removing filling animations behavior.
...', evt => { let anim = divelem.animate( { transform: `translate(${ evt.clientx}px, ${evt.clienty}px)` }, { duration: 500, fill: 'forwards' } ); anim.commitstyles(); //anim.persist() anim.onremove = function() { console.log('animation removed'); } console.log(anim.replacestate); }); here we have a <div> element, and an event listener that fires the event handler code whenever the mouse moves.
Attr.prefix - Web APIs
WebAPIAttrprefix
<div x:id="example" onclick="console.log(this.attributes[0].prefix)"/> notes this will only work when a namespace-aware parser is used, i.e.
... when a document is served with an xml mime type.
AudioBufferSourceNode.loopStart - Web APIs
this value is only used when the loop parameter is true.
... when the audio is played to the end, it loops, but you can control how long the loops last by altering loopstart and loopend.
AudioContext.createMediaElementSource() - Web APIs
when the mouse pointer is moved, the updatepage() function is invoked, which calculates the current gain as a ratio of mouse y position divided by overall window height.
...t'); pre.innerhtml = myscript.innerhtml; // create a mediaelementaudiosourcenode // feed the htmlmediaelement into it var source = audioctx.createmediaelementsource(myaudio); // create a gain node var gainnode = audioctx.creategain(); // create variables to store mouse pointer y coordinate // and height of screen var cury; var height = window.innerheight; // get new mouse pointer coordinates when mouse is moved // then set new gain value document.onmousemove = updatepage; function updatepage(e) { cury = (window.event) ?
AudioContext.resume() - Web APIs
return value a promise that resolves when the context has resumed.
... example the following snippet is taken from our audiocontext states demo (see it running live.) when the suspend/resume button is clicked, the audiocontext.state is queried — if it is running, suspend() is called; if it is suspended, resume() is called.
AudioContext.suspend() - Web APIs
the suspend() method of the audiocontext interface suspends the progression 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.
... example the following snippet is taken from our audiocontext states demo (see it running live.) when the suspend/resume button is clicked, the audiocontext.state is queried — if it is running, suspend() is called; if it is suspended, resume() is called.
AudioContextOptions.sampleRate - Web APIs
the audiocontextoptions dictionary (used when instantiating an audiocontext) may contain a property named samplerate, which indicates the sample rate to use for the new context.
... if the samplerate property is not included in the options, or the options are not specified when creating the audio context, the new context's output device's preferred sample rate is used by default.
AudioListener - Web APIs
deprecated features audiolistener.dopplerfactor a double value representing the amount of pitch shift to use when rendering a doppler effect.
... the behavior to adopt when an audiobuffersourcenode was connected to multiple pannernodes was unclear.
AudioNodeOptions - Web APIs
the audionodeoptions dictionary of the web audio api specifies options that can be used when creating new audionode objects.
... syntax var audionodeoptions = { "channelcount" : 2, "channelcountmode" : "max", "channelinterpretation" : "discrete" } properties channelcount optional represents an integer used to determine how many channels are used when up-mixing and down-mixing connections to any inputs to the node.
AudioParam.exponentialRampToValueAtTime() - Web APIs
note: exponential ramps are considered more useful when changing frequencies or playback rates than linear ramps because of the way the human ear works.
... examples in this example, we have a media source with two control buttons (see the audio-param repo for the source code, or view the example live.) when these buttons are pressed, exponentialramptovalueattime() is used to fade the gain value up to 1.0, and down to 0, respectively.
AudioParam.setValueCurveAtTime() - Web APIs
usage notes when the parameter's value finishes following the curve, its value is guaranteed to match the last value in the set of values specified in the values parameter.
... examples in this example, we have a media source with a single button (see the webaudio-examples repo for the source code, or view the example live.) when this button is pressed, setvaluecurveattime() is used to change the gain value between the values contained in the wavearray array: // create audio context var audiocontext = window.audiocontext || window.webkitaudiocontext; var audioctx = new audiocontext(); // set basic variables for example var myaudio = document.queryselector('audio'); var pre = document.queryselector('pre'); var myscript = document.queryselector('script'); pre.innerhtml = myscript.innerhtml; var valuecurve = document.queryselector('.value-curve...
AudioParam - Web APIs
each audioparam has a list of events, initially empty, that define when and how values change.
... when this list is not empty, changes using the audioparam.value attributes are ignored.
AudioScheduledSourceNode.stop() - Web APIs
syntax audioscheduledsourcenode.stop([when]); parameters when optional the time, in seconds, at which the sound should stop playing.
... rangeerror the value specified for when is negative.
AudioScheduledSourceNode - Web APIs
unless stated otherwise, nodes based upon audioscheduledsourcenode output silence when not playing (that is, before start() is called and after stop() is called).
... events listen to these events using addeventlistener() or by assigning an event listener to the oneventname property of this interface: ended fired when the source node has stopped playing, either because it's reached a predetermined stop time, the full duration of the audio has been performed, or because the entire buffer has been played.
AudioTrackList.onchange - Web APIs
the audiotracklist property onchange is an event handler which is called when the change event occurs, indicating that one or more of the audiotracks in the audiotracklist have been enabled or disabled.
... syntax audiotracklist.onchange = eventhandler; value set onchange to a function that should be called whenever tracks are enabled or disabled on the media element.
AudioTrackList.onremovetrack - Web APIs
the audiotracklist onremovetrack event handler is called when the removetrack event occurs, indicating that an audio track has been removed from the media element, and therefore also from the audiotracklist.
... example this simple example just fetches the current number of audio tracks in the media element whenever a track is removed from the media element.
AudioWorkletGlobalScope.registerProcessor - Web APIs
the name is to be referred to when creating an audioworkletnode based on the registered processor.
... // test-processor.js class testprocessor extends audioworkletprocessor { process (inputs, outputs, parameters) { return true } } registerprocessor('test-processor', testprocessor) next, in our main script file we'll load the processor, create an instance of audioworkletnode — passing it the processor name that we used when calling registerprocessor — and connect it to an audio graph.
AudioWorkletNode.onprocessorerror - Web APIs
the onprocessorerror property of the audioworkletnode interface defines an event handler function to be called when the processorerror event fires.
... this occurs when the underlying audioworkletprocessor behind the node throws an exception in its constructor, the process method, or any user-defined class method.
AuthenticatorResponse.clientDataJSON - Web APIs
properties after the clientdatajson object is converted from an arraybuffer to a javascript object, it will have the following properties: type a string which is either "webauthn.get" when an existing credential is retrieved or "webauthn.create" when a new credential is created.
...it has two properties: status: a string which is either "supported" which indicates the client support token binding but did not negotiate with the relying party or "present" when token binding was used already id: a domstring which is the base64url encoding of the token binding id which was used for the communication.
BaseAudioContext.createBufferSource() - Web APIs
audiobuffers are created using baseaudiocontext.createbuffer or returned by baseaudiocontext.decodeaudiodata when it successfully decodes an audio track.
... // this is the audionode to use when we want to play an audiobuffer var source = audioctx.createbuffersource(); // set the buffer in the audiobuffersourcenode source.buffer = myarraybuffer; // connect the audiobuffersourcenode to the // destination so we can hear the sound source.connect(audioctx.destination); // start the source playing source.start(); } specifications specification status comment ...
BaseAudioContext.createScriptProcessor() - Web APIs
important: webkit currently (version 31) requires that a valid buffersize be passed when calling this method.
...) { // make output equal to the same as the input outputdata[sample] = inputdata[sample]; // add noise to each output sample outputdata[sample] += ((math.random() * 2) - 1) * 0.2; } } } getdata(); // wire up play button playbutton.onclick = function() { source.connect(scriptnode); scriptnode.connect(audioctx.destination); source.start(); } // when the buffer source stops playing, disconnect everything source.onended = function() { source.disconnect(scriptnode); scriptnode.disconnect(audioctx.destination); } specifications specification status comment web audio apithe definition of 'createscriptprocessor' in that specification.
BaseAudioContext.createStereoPanner() - Web APIs
we then use an oninput event handler to change the value of the stereopannernode.pan parameter and update the pan value display when the slider is moved.
...ector('.panning-control'); var panvalue = document.queryselector('.panning-value'); pre.innerhtml = myscript.innerhtml; // create a mediaelementaudiosourcenode // feed the htmlmediaelement into it var source = audioctx.createmediaelementsource(myaudio); // create a stereo panner var pannode = audioctx.createstereopanner(); // event handler function to increase panning to the right and left // when the slider is moved pancontrol.oninput = function() { pannode.pan.setvalueattime(pancontrol.value, audioctx.currenttime); panvalue.innerhtml = pancontrol.value; } // connect the mediaelementaudiosourcenode to the pannode // and the pannode to the destination, so we can play the // music and adjust the panning using the controls source.connect(pannode); pannode.connect(audioctx.destination);...
BatteryManager.onchargingchange - Web APIs
these events occur when the battery charging state is updated.
... syntax battery.onchargingchange = funcref where battery is a batterymanager object, and funcref is a function to be called when the chargingchange event occurs.
BatteryManager.onchargingtimechange - Web APIs
these events occur when the battery chargingtime is updated.
... syntax battery.onchargingtimechange = funcref where battery is a batterymanager object, and funcref is a function to be called when the chargingtimechange event occurs.
BatteryManager.ondischargingtimechange - Web APIs
these events occur when the battery dischargingtime is updated.
... syntax battery.ondischargingtimechange = funcref where battery is a batterymanager object, and funcref is a function to be called when the dischargingtimechange event occurs.
BatteryManager.onlevelchange - Web APIs
these events occur when the battery level is updated.
... syntax navigator.battery.onlevelchange = funcref where battery is a batterymanager object, and funcref is a function to be called when the levelchange event occurs.
Battery Status API - Web APIs
the battery status api, more often referred to as the battery api, provides information about the system's battery charge level and lets you be notified by events that are sent when the battery level or charging status change.
... this can be used to adjust your app's resource usage to reduce battery drain when the battery is low, or to save changes before the battery runs out in order to prevent data loss.
Bluetooth.onavailabilitychanged - Web APIs
the onavailabilitychanged property of the bluetooth interface is an eventhandler that processes availabilitychanged events that fire when the bluetooth system as a whole becomes available or unavailable to the user agent.
... syntax bluetooth.onavailabilitychanged = functionref; value functionref is the handler function to be called when the bluetooth availabilitychanged event fires.
BroadcastChannel: message event - Web APIs
the message event is fired on a broadcastchannel object when a message arrives on that channel.
... bubbles no cancelable no interface messageevent event handler property onmessage examples live example in this example there's a "sender" <iframe> that broadcasts the contents of a <textarea> when the user clicks a button.
Broadcast Channel API - Web APIs
receiving a message when a message is posted, a message event is dispatched to each broadcastchannel object connected to this channel.
...it can be used to detect user actions in other tabs within a same origin, like when the user logs in or out.
CSSOMString - Web APIs
when a specification says cssomstring, it depends on the browser vendors to choose whether to use domstring or usvstring.
... while browser implementations that use utf-8 internally to represent strings in memory can use usvstring when the specification says cssomstring, implementations that already represent strings as 16-bit sequences might choose to use domstring instead.
Using dynamic styling information - Web APIs
note also that, as with individual element's dom styles, when speaking of manipulating the stylesheets, this is not actually manipulating the physical document(s), but merely the internal representation of the document.
... also, when you set this property on an element, you override any styles that have been set elsewhere for that element's particular property you are setting.
CanvasCaptureMediaStreamTrack.requestFrame() - Web APIs
applications that need to carefully control the timing of rendering and frame capture can use requestframe() to directly specify when it's time to capture a frame.
... to prevent automatic capture of frames, so that frames are only captured when requestframe() is called, specify a value of 0 for the capturestream() method when creating the stream.
CanvasRenderingContext2D.addHitRegion() - Web APIs
when provided, it is an object which can contain the following properties: path a path2d object describing the area of the hit region.
... cursor the cursor to use when the mouse is over this region (defaults to inherit).
CanvasRenderingContext2D.shadowColor - Web APIs
be aware that the shadow's rendered opacity will be affected by the opacity of the fillstyle color when filling, and of the strokestyle color when stroking.
...elementbyid('canvas'); const ctx = canvas.getcontext('2d'); // shadow ctx.shadowcolor = 'red'; ctx.shadowoffsetx = 10; ctx.shadowoffsety = 10; // filled rectangle ctx.fillrect(20, 20, 100, 100); // stroked rectangle ctx.linewidth = 6; ctx.strokerect(170, 20, 100, 100); result shadows on translucent shapes a shadow's opacity is affected by the transparency level of its parent object (even when shadowcolor specifies a completely opaque value).
CanvasRenderingContext2D - Web APIs
call this method when you want to create a new path.
...the transformation matrix is applied when creating the current default path, painting text, shapes and path2d objects.
Basic usage of canvas - Web APIs
when no width and height attributes are specified, the canvas will initially be 300 pixels wide and 150 pixels high.
...when no styling rules are applied to the canvas it will initially be fully transparent.
Drawing text - Web APIs
there are some more properties which let you adjust the way the text gets displayed on the canvas: font = value the current text style being used when drawing text.
... measuretext() returns a textmetrics object containing the width, in pixels, that the specified text will be when drawn in the current text style.
Clipboard.write() - Web APIs
WebAPIClipboardwrite
the "clipboard-write" permission of the permissions api, is granted automatically to pages when they are in the active tab.
... return value a promise which is resolved when the data has been written to the clipboard.
ClipboardItem - Web APIs
the clipboarditem interface of the clipboard api represents a single item format, used when reading or writing data via the clipboard api.
... access to the contents of the clipboard is gated behind the permissions api: the clipboard-write permission is granted automatically to pages when they are in the active tab.
Clipboard API - Web APIs
access to the contents of the clipboard is gated behind the permissions api: the clipboard-write permission is granted automatically to pages when they are in the active tab.
... clipboarditem secure context represents a single item format, used when reading or writing data.
console.log() - Web APIs
WebAPIConsolelog
another useful difference in chrome exists when sending dom elements to the console.
...this is often useful when trying to see the full representation of the dom js object.
Console.time() - Web APIs
WebAPIConsoletime
when you call console.timeend() with the same name, the browser will output the time, in milliseconds, that elapsed since the timer was started.
...this will identify the timer; use the same name when calling console.timeend() to stop the timer and get the time output to the console.
ConstantSourceNode - Web APIs
onended fired whenever the constantsourcenode data has stopped playing.
... now, whenever the value of constantnode.offset changes, the gain on both gainnode2 and gainnode3 will change to have that same value.
Constraint validation API - Web APIs
setcustomvalidity(message) sets a custom error message string to be shown to the user upon submitting the form, explaining why the value is not valid — when a message is set, the validity state is set to invalid.
... as a result, if the input value is invalid when the submit button is pressed, one of the custom error messages will be shown.
ContentIndexEvent - Web APIs
the contentdelete event is only fired when the deletion happens due to interaction with the browser's built-in user interface.
... it is not fired when the contentindex.delete method is called.
ConvolverNode.normalize - Web APIs
the normalize property of the convolvernode interface is a boolean that controls whether the impulse response from the buffer will be scaled by an equal-power normalization when the buffer attribute is set, or not.
... its default value is true in order to achieve a more uniform output level from the convolver, when loaded with diverse impulse responses.
CustomElementRegistry - Web APIs
customelementregistry.whendefined() returns an empty promise that resolves when a custom element becomes defined with the given name.
...ntent return text.split(/\s+/g).length; } var count = 'words: ' + countwords(wcparent); // create a shadow root var shadow = this.attachshadow({mode: 'open'}); // create text node and add word count to it var text = document.createelement('span'); text.textcontent = count; // append it to the shadow root shadow.appendchild(text); // update count when element content changes setinterval(function() { var count = 'words: ' + countwords(wcparent); text.textcontent = count; }, 200) } } // define the new element customelements.define('word-count', wordcount, { extends: 'p' }); note: the customelementregistry is available through the window.customelements property.
DOMPointInit.y - Web APIs
WebAPIDOMPointInity
the dompointinit dictionary's y property is used to specify the y-coordinate of a point in 2d or 3d space when either creating or serializing to json a dompoint or dompointreadonly object.
... if this property is missing when the dompointinit object is passed into frompoint(), the value is assumed to be 0 by default.
DOMPointInit.z - Web APIs
WebAPIDOMPointInitz
the dompointinit dictionary's z property is used to specify the z-coordinate of a point in 2d or 3d space when either creating or serializing to json a dompoint or dompointreadonly object.
... if this property is missing when the dompointinit object is passed into frompoint(), the value is assumed to be 0 by default.
DOMPointInit - Web APIs
the dompointinit dictionary is used to provide the values of the coordinates and perspective when creating and jsonifying a dompoint or dompointreadonly object.
...it's used as the return value when calling tojson().
DOMTokenList.forEach() - Web APIs
thisarg optional value to use as this when executing callback.
...we when retrieve an iterator containing the values using foreach(), writing each one to the <span>'s node.textcontent inside the foreach() inner function.
DataTransfer.dropEffect - Web APIs
for example, when the user hovers over a target drop element, the browser's cursor may indicate which type of operation will occur.
... when the datatransfer object is created, dropeffect is set to a string value.
DedicatedWorkerGlobalScope: message event - Web APIs
the message event is fired on a dedicatedworkerglobalscope object when the worker receives a message from its parent (i.e.
... when the parent sends a message using worker.postmessage()).
Document: animationcancel event - Web APIs
the animationcancel event is fired when a css animation unexpectedly aborts.
...this might happen when the animation-name is changed such that the animation is removed, or when the animating node is hidden using css.
Document: animationstart event - Web APIs
the animationstart event is fired when a css animation has started.
... examples this listens for the animationstart event and logs a message when it is fired: document.addeventlistener('animationstart', () => { console.log('animation started'); }); the same, but using onanimationstart: document.onanimationstart = () => { console.log('animation started'); }; see a live example of this event.
Document.cookie - Web APIs
WebAPIDocumentcookie
when user privacy is a concern, it's important that any web app implementation invalidate cookie data after a certain timeout instead of relying on the browser to do it.
... the strict value will prevent the cookie from being sent by the browser to the target site in all cross-site browsing contexts, even when following a regular link.
Document.getElementsByTagName() - Web APIs
<p>some div2 text</p> </div> </div> <p>some outer text</p> <p>some outer text</p> <button onclick="getallparaelems();"> show all p elements in document</button><br /> <button onclick="div1paraelems();"> show all p elements in div1 element</button><br /> <button onclick="div2paraelems();"> show all p elements in div2 element</button> </body> </html> notes when called on an html document, getelementsbytagname() lower-cases its argument before proceeding.
... this is undesirable when trying to match camelcase svg elements in a subtree in an html document.
Document: keydown event - Web APIs
the keydown event is fired when a key is pressed.
...ydown events that are part of composition, do something like this (229 is a special value set for a keycode relating to an event that has been processed by an ime): eventtarget.addeventlistener("keydown", event => { if (event.iscomposing || event.keycode === 229) { return; } // do something }); examples addeventlistener keydown example this example logs the keyboardevent.code value whenever you press down a key.
Document: keypress event - Web APIs
the keypress event is fired when a key that produces a character value is pressed down.
... interface keyboardevent bubbles yes cancelable yes default action varies: keypress event; launch text composition system; blur and focus events; domactivate event; other event examples addeventlistener keypress example this example logs the keyboardevent.code value whenever you press a key.
Document: keyup event - Web APIs
the keyup event is fired when a key is released.
...to ignore all keyup events that are part of composition, do something like this (229 is a special value set for a keycode relating to an event that has been processed by an ime): eventtarget.addeventlistener("keyup", event => { if (event.iscomposing || event.keycode === 229) { return; } // do something }); examples this example logs the keyboardevent.code value whenever you release a key.
Document.lastStyleSheetSet - Web APIs
this property's value changes whenever the document.selectedstylesheetset property is changed.
... note: this value doesn't change when document.enablestylesheetsforset() is called.
Document: lostpointercapture event - Web APIs
the lostpointercapture event is fired when a captured pointer is released.
...when the user subsequently releases the pointer, the lostpointercapture event will be fired.
Document.onafterscriptexecute - Web APIs
the document.onafterscriptexecute property references a function that fires when a static <script> element finishes executing its script.
... syntax document.onafterscriptexecute = funcref; funcref is a function reference, called when the event is fired.
Document.onbeforescriptexecute - Web APIs
fired when the code in a <script> element declared in an html document is about to start executing.
... syntax document.onbeforescriptexecute = funcref; funcref is a function reference, called when the event is fired.
Document.ononline - Web APIs
WebAPIDocumentononline
the document.online event is fired on the <body> of each page when the browser switches between online and offline mode.
...the online and offline events are fired when the value of this attribute changes.
Document: pointerleave event - Web APIs
the pointerleave event is fired when a pointing device is moved out of the hit test boundaries of an element.
... for pen devices, this event is fired when the stylus leaves the hover range detectable by the digitizer.
Document.popupNode - Web APIs
when a popup attached via the popup or context attributes is opened, the xul document's popupnode property is set to the node that was clicked on.
...in these other cases, for example when calling the popup's showpopup method, you may wish to set the popupnode property directly beforehand.
Document.querySelectorAll() - Web APIs
since javascript also uses backslash escaping, special care must be taken when writing string literals using these characters.
... in this example, when selecting .outer .inner in the context the <div> with the class select, the element with the class .inner is still found, even though .outer is not a descendant of the base element on which the search is performed (.select).
Document: transitionend event - Web APIs
the transitionend event is fired when a css transition has completed.
... bubbles yes cancelable yes interface transitionevent event handler property ontransitionend the transitionend event is fired in both directions - as it finishes transitioning to the transitioned state, and when it fully reverts to the default or non-transitioned state.
Document.visibilityState - Web APIs
when the value of this property changes, the visibilitychange event is sent to the document.
... typical use of this can be to prevent the download of some assets when the document is solely prerendered, or stop some activities when the document is in the background or minimized.
Document: visibilitychange event - Web APIs
the visibilitychange event is fired at the document when the content of its tab have become visible or have been hidden.
... examples this example begins playing a music track when the document becomes visible, and pauses the music when the document is no longer visible.
Document: wheel event - Web APIs
the wheel event fires when the user rotates a wheel button on a pointing device (typically a mouse).
...even when it does, the delta* values in the wheel event don't necessarily reflect the content's scrolling direction.
Document.write() - Web APIs
WebAPIDocumentwrite
this happens when opening a local file with the .xhtml file extension or for any document served with an application/xhtml+xml mime type.
... note: starting with version 55, chrome will not execute <script> elements injected via document.write() when specific conditions are met.
Examples of web and XML development using the DOM - Web APIs
when the body of this html document loads, an event listener is registered with the top row of the table.
...note that the table itself has an onclick event handler that ought to display a message when the table is clicked.
Traversing an HTML table with JavaScript and DOM Interfaces - Web APIs
when called, it returns an array with all of the element's descendants matching the tag name.
...so visually, when you see the html page it seems like the two text nodes hello and world are a single node, but remember that in the document model, there are two nodes.
EXT_disjoint_timer_query - Web APIs
ext.beginqueryext() the timer starts when all commands prior to beginqueryext have been fully executed.
... ext.endqueryext() the timer stops when all commands prior to endqueryext have been fully executed.
EffectTiming.direction - Web APIs
the direction property of the web animations api dictionary effecttiming indicates an animation's playback direction along its timeline, as well as its behavior when it reaches the end of an iteration element.animate(), keyframeeffectreadonly(), and keyframeeffect() all accept an object of timing properties including direction.
... syntax var timingproperties = { direction: "normal" | "reverse" | "alternate" | "alternate-reverse" }; timingproperties.direction = "normal" | "reverse" | "alternate" | "alternate-reverse"; value a domstring which specifies the direction in which the animation should play as well as what to do when the playback reaches the end of the animation sequence in the current direction.
EffectTiming.easing - Web APIs
the browser flips to a different static frame when each interval is reached, rather than animating smoothly.
...the browser flips to a different static frame when each interval is reached, rather than animating smoothly.
EffectTiming - Web APIs
simply put, these properties describe how the user agent should go about making the transition from keyframe to keyframe, and how to behave when the animation begins and ends.
...this is primarily of use when sequencing animations based on the end time of another animation.
Element: DOMMouseScroll event - Web APIs
the dom dommousescroll event is fired asynchronously when mouse wheel or similar device is operated and the accumulated scroll amount is over 1 line or 1 page since last event.
... bubbles yes cancelable yes interface mousescrollevent if you want to prevent the default action of mouse wheel events, it's not enough to handle only this event on gecko because if scroll amount by a native mouse wheel event is less than 1 line (or less than 1 page when the system setting is by page scroll), other mouse wheel events may be fired without this event.
Element: MSGestureStart event - Web APIs
the msgesturestart event is fired when there's a new point of contact on the touch surface, thus starting a new gesture.
... when the gesture has ended, a msgestureend event will be fired.
Element: MSManipulationStateChanged event - Web APIs
msmanipulationstatechanged fires when the state of an element being manipulated has changed (ie.
... whenever you start or finish panning or zooming an element).
Element.clientLeft - Web APIs
when layout.scrollbar.side preference is set to 1 or to 3 and when the text-direction is set to rtl, then the vertical scrollbar is positioned on the left and this impacts the way clientleft is computed.
... note: when an element has display: inline, clientleft returns 0 regardless of the element's border.
Element: dblclick event - Web APIs
the dblclick event fires when a pointing device button (such as a mouse's primary button) is double-clicked; that is, when it's rapidly clicked twice on a single element within a very short span of time.
... bubbles yes cancelable yes interface mouseevent event handler property ondblclick examples this example toggles the size of a card when you double click on it.
Element: gesturestart event - Web APIs
the gesturestart event is fired when multiple fingers contact the touch surface, thus starting a new gesture.
...when the gesture has ended, a gestureend event will be fired.
Element.getAttribute() - Web APIs
examples const div1 = document.getelementbyid('div1'); const align = div1.getattribute('align'); alert(align); // shows the value of align for the element with id="div1" description lower casing when called on an html element in a dom flagged as an html document, getattribute() lower-cases its argument before proceeding.
... non-existing attributes essentially all web browsers (firefox, internet explorer, recent versions of opera, safari, konqueror, and icab, as a non-exhaustive list) return null when the specified attribute does not exist on the specified element; this is what the current dom specification draft specifies.
Element.getClientRects() - Web APIs
when called on svg elements other than an outer-<svg>, the "viewport" that the resulting rectangles are relative to is the viewport that the element's outer-<svg> establishes (and to be clear, the rectangles are also transformed by the outer-<svg>'s viewbox transform, if any).
... the amount of scrolling that has been done of the viewport area (or any other scrollable element) is taken into account when computing the rectangles.
Element.getElementsByTagName() - Web APIs
when called on an html element in an html document, getelementsbytagname lower-cases the argument before searching for it.
... this is undesirable when trying to match camel-cased svg elements (such as <lineargradient>) in an html document.
Element.insertAdjacentHTML() - Web APIs
example // <div id="one">one</div> var d1 = document.getelementbyid('one'); d1.insertadjacenthtml('afterend', '<div id="two">two</div>'); // at this point, the new structure is: // <div id="one">one</div><div id="two">two</div> notes security considerations when inserting html into a page by using insertadjacenthtml(), be careful not to use user input that hasn't been escaped.
... it is not recommended you use insertadjacenthtml() when inserting plain text; instead, use the node.textcontent property or the element.insertadjacenttext() method.
Element: keydown event - Web APIs
the keydown event is fired when a key is pressed.
...ydown events that are part of composition, do something like this (229 is a special value set for a keycode relating to an event that has been processed by an ime): eventtarget.addeventlistener("keydown", event => { if (event.iscomposing || event.keycode === 229) { return; } // do something }); examples addeventlistener keydown example this example logs the keyboardevent.code value whenever you press down a key inside the <input> element.
Element: keypress event - Web APIs
the keypress event is fired when a key that produces a character value is pressed down.
... interface keyboardevent bubbles yes cancelable yes default action varies: keypress event; launch text composition system; blur and focus events; domactivate event; other event examples addeventlistener keypress example this example logs the keyboardevent.code value whenever you press a key after focussing the <input> element.
Element: keyup event - Web APIs
the keyup event is fired when a key is released.
...all keyup events that are part of composition, do something like this (229 is a special value set for a keycode relating to an event that has been processed by an ime): eventtarget.addeventlistener("keyup", event => { if (event.iscomposing || event.keycode === 229) { return; } // do something }); examples addeventlistener keyup example this example logs the keyboardevent.code value whenever you release a key inside the <input> element.
Element: mouseover event - Web APIs
the mouseover event is fired at an element when a pointing device (such as a mouse or trackpad) is used to move the cursor onto the element or one of its child elements.
... html <ul id="test"> <li>item 1</li> <li>item 2</li> <li>item 3</li> </ul> javascript let test = document.getelementbyid("test"); // this handler will be executed only once when the cursor // moves over the unordered list test.addeventlistener("mouseenter", function( event ) { // highlight the mouseenter target event.target.style.color = "purple"; // reset the color after a short delay settimeout(function() { event.target.style.color = ""; }, 500); }, false); // this handler will be executed every time the cursor // is moved over a different list item tes...
Element.onfullscreenchange - Web APIs
the element interface's onfullscreenchange property is an event handler for the fullscreenchange event that is fired when the element has transitioned into or out of full-screen mode.
... this gives us a value, isfullscreen, which we pass into a function called adjustmycontrols(), which we imagine to be a function that makes adjustments to the app's user interface to present itself optimally when it's in full-screen mode versus being displayed in a window.
Element.prefix - Web APIs
WebAPIElementprefix
<x:div onclick="console.log(this.prefix)"/> notes this will only work when a namespace-aware parser is used, i.e.
... when a document is served with an xml mime type.
Element.querySelector() - Web APIs
the entire hierarchy of elements is considered when matching, including those outside the set of elements including baseelement and its descendants; in other words, selectors is first applied to the whole document, not the baseelement, to generate an initial list of potential elements.
... find a specific element with specific values of an attribute in this first example, the first <style> element which either has no type or has type "text/css" in the html document body is returned: var el = document.body.queryselector("style[type='text/css'], style:not([type])"); the entire hierarchy counts this example demonstrates that the hierarchy of the entire document is considered when applying selectors, so that levels outside the specified baseelement are still considered when locating matches.
Element.querySelectorAll() - Web APIs
since javascript also uses backspace escaping, special care must be taken when writing string literals using these characters.
... in this example, when selecting ".outer .inner" in the context the <div> with the class "select", the element with the class ".inner" is still found, even though .outer is not a descendant of the base element on which the search is performed (".select").
Element.releasePointerCapture() - Web APIs
example this example sets pointer capture on a <div> when you press down on it.
... this lets you slide the element horizontally, even when you pointer moves outside of its boundaries.
Element.scrollTop - Web APIs
WebAPIElementscrollTop
when an element's content does not generate a vertical scrollbar, then its scrolltop value is 0.
... when scrolltop is used on the root element (the <html> element), the scrolly of the window is returned.
Element: underflow event - Web APIs
the non-standard underflow event, which is specific to firefox, is fired when an element is no longer overflowed by its content.
... the counterpart overflow event is fired when overflow occurs.
Element: wheel event - Web APIs
the wheel event fires when the user rotates a wheel button on a pointing device (typically a mouse).
...even when it does, the delta* values in the wheel event don't necessarily reflect the content's scrolling direction.
ElementCSSInlineStyle.style - Web APIs
when getting, it returns a cssstyledeclaration object that contains a list of all styles properties for that element with values assigned for the attributes that are defined in the element's inline style attribute.
...internet explorer requires setting it to an empty string, and does not do anything when setting it to null.
Comparison of Event Targets - Web APIs
event targets it's easy to get confused about which target to examine when writing an event handler.
...for example, mouse events are retargeted to their parent node when they happen over text nodes (bug 185889), and in that case .target will show the parent and .explicitoriginaltarget will show the text node.
Event.cancelable - Web APIs
WebAPIEventcancelable
custom events created by other javascript code control if they can be canceled when they are created.
... console.warn(`the following event couldn't be canceled:`); console.dir(event); } } document.addeventlistener('wheel', preventscrollwheel); notes whether an event can be canceled or not is something that's determined when that event is initialized.
Event.currentTarget - Web APIs
syntax var currenteventtarget = event.currenttarget; value eventtarget examples event.currenttarget is interesting to use when attaching the same event handler to several elements.
... function hide(e){ e.currenttarget.style.visibility = 'hidden'; console.log(e.currenttarget); // when this function is used as an event handler: this === e.currenttarget } var ps = document.getelementsbytagname('p'); for(var i = 0; i < ps.length; i++){ // console: print the clicked <p> element ps[i].addeventlistener('click', hide, false); } // console: print <body> document.body.addeventlistener('click', hide, false); // click around and make paragraphs disappear note: the value of event.currenttarget is only available while the event is being handled.
Event.target - Web APIs
WebAPIEventtarget
it is different from event.currenttarget when the event handler is called during the bubbling or capturing phase of the event.
...ld(ul); const li1 = document.createelement('li'); const li2 = document.createelement('li'); ul.appendchild(li1); ul.appendchild(li2); function hide(evt) { // e.target refers to the clicked <li> element // this is different than e.currenttarget, which would refer to the parent <ul> in this context evt.target.style.visibility = 'hidden'; } // attach the listener to the list // it will fire when each <li> is clicked ul.addeventlistener('click', hide, false); specifications specification status comment domthe definition of 'event.target' in that specification.
Event.type - Web APIs
WebAPIEventtype
it is set when the event is constructed and is the name commonly used to refer to the specific event, such as click, load, or error.
... example this example logs the event type whenever you press a keyboard key or click a mouse button.
Event - Web APIs
WebAPIEvent
further, when properly added, such handlers can also be disconnected if needed using removeeventlistener().
...(for example, a webpage with an advertising-module and statistics-module both monitoring video-watching.) when there are many nested elements, each with its own handler(s), event processing can become very complicated—especially where a parent element receives the very same event as its child elements because "spatially" they overlap so the event technically occurs in both, and the processing order of such events depends on the event bubbling and capture settings of each handler triggered.
EventListener - Web APIs
eventlistener.handleevent() a function that is called whenever an event of the specified type occurs.
...// whenever the element is clicked, a pop-up with "element clicked!" will // appear.
FetchEvent.replacesClientId - Web APIs
for example, when navigating from page a to page b replacesclientid is the id of the client associated with page a.
... it can be an empty string when navigating from about:blank to another page, as about:blank's client will be reused, rather than be replaced.
FetchEvent.respondWith() - Web APIs
specifying the final url of a resource from firefox 59 onwards, when a service worker provides a response to fetchevent.respondwith(), the response.url value will be propagated to the intercepted network request as the final resolved url.
... this means sites can still provide an "alternate" view of a web page when offline without changing the user-visible url.
Fetch basic concepts - Web APIs
when a new headers object is created using the headers() constructor, its guard is set to none (the default).
... when a request or response object is created, it has an associated headers object whose guard is set as summarized below: new object's type creating constructor guard setting of associated headers object request request() request request() with mode of no-cors request-no-cors response response() response error() or redirect() methods immutable a header's guard affects the set(), delete(), and append() methods which change the header's contents.
FileError - Web APIs
WebAPIFileError
when you're just testing your app, and you don't want to set up a web server, you can bypass the security restriction on chrome.
...for example, the app is asking for a directory, when the entry is really a file.
FileException - Web APIs
when errors occur, forward them to the main app using postmessage() as in the following: function onerror(e) { postmessage('error:' + e.tostring()); } try { //error is thrown if "log.txt" already exists.
...for example, the app is accessing a directoryentry when the user is requesting a fileentry.
FileReader.onabort - Web APIs
the filereader.onabort property contains an event handler executed when the abort event is fired, i.e.
... when the process of reading the file is aborted.
FileSystemDirectoryEntry.getDirectory() - Web APIs
[1] when create is false, the value of exclusive is irrelevant and ignored.
...when that is loaded successfully (as indicated by the loadend event being fired), the loaded text is passed into json.parse() to be reconstituted into a javascript object.
FileSystemDirectoryEntry.getFile() - Web APIs
[1] when create is false, the value of exclusive is irrelevant and ignored.
...when that is loaded successfully (as indicated by the loadend event being fired), the loaded text is passed into json.parse() to be reconstituted into a javascript object.
FileSystemEntry.copyTo() - Web APIs
when copying a directory, the copy is always recursive; you can't leave out subfolders.
... successcallback optional a function which is called when the copy operation is succesfully completed.
FileSystemFileEntry.createWriter() - Web APIs
syntax filesystemfileentry.createwriter(successcallback[, errorcallback]); parameters successcallback a callback function which is called when the filewriter has been created successfully; the filewriter is passed into the callback as the only parameter.
... errorcallback optional if provided, this must be a method which is caled when an error occurs while trying to create the filewriter.
FileSystemFlags.create - Web APIs
filesystemflags is only used when calling filesystemdirectoryentry.getfile() or filesystemdirectoryentry.getdirectory().
... [1] when create is false, the value of exclusive is irrelevant and ignored.
FileSystemFlags.exclusive - Web APIs
the exclusive property on the filesystemflags dictionary is used in tandem with the create property to determine whether or not it's acceptable to require that the file not already exist when the reference to it is created by calling filesystemdirectoryentry.getfile() or filesystemdirectoryentry.getdirectory().
... [1] when create is false, the value of exclusive is irrelevant and ignored.
FormData() - Web APIs
WebAPIFormDataFormData
syntax var formdata = new formdata(form) parameters form optional an html <form> element — when specified, the formdata object will be populated with the form's current keys/values using the name property of each element for the keys and their submitted value for the values.
... example the following line creates an empty formdata object: var formdata = new formdata(); // currently empty you could add a key/value pair to this using formdata.append: formdata.append('username', 'chris'); or you can specify the optional form argument when creating the formdata object, to prepopulate it with values from the specified form: <form id="myform" name="myform"> <div> <label for="username">enter name:</label> <input type="text" id="username" name="username"> </div> <div> <label for="useracc">enter account number:</label> <input type="text" id="useracc" name="useracc"> </div> <div> <label for="userfile">upload file:</label> <input type="file" id="userfile" name="userfile"> </div> <input type="...
Gamepad API - Web APIs
window events window.ongamepadconnected represents an event handler that will run when a gamepad is connected (when the gamepadconnected event fires).
... window.ongamepaddisconnected represents an event handler that will run when a gamepad is disconnected (when the gamepaddisconnected event fires).
Geolocation - Web APIs
note: for security reasons, when a web page tries to access location information, the user is notified and asked to grant permission.
... geolocation.watchposition() secure context returns a long value representing the newly established callback function to be invoked whenever the device location changes.
GeolocationCoordinates.longitude - Web APIs
javascript the javascript code below creates an event listener so that when the user clicks on a button, the location information is retrieved and displayed.
...when the user clicks the button, we'll fetch and display the location information.
GlobalEventHandlers.onanimationend - Web APIs
the animationend event fires when a css animation reaches the end of its active period (which is calculated as animation-duration * animation-iteration-count) + animation-delay).
... syntax var animendhandler = target.onanimationend; target.onanimationend = function value a function to be called when an animationend event occurs indicating that a css animation has begun on the target, where the target object is an html element (htmlelement), document (document), or window (window).
GlobalEventHandlers.onanimationstart - Web APIs
this event is sent when a css animation starts to play.
... syntax var animstarthandler = target.onanimationstart; target.onanimationstart = function value a function to be called when an animationstart event occurs indicating that a css animation has begun on the target, where the target object is an html element (htmlelement), document (document), or window (window).
GlobalEventHandlers.onauxclick - Web APIs
the auxclick event is raised when a non-primary button has been pressed on an input device (e.g., a middle mouse button).
...ton.onclick = function() { var rndcol = 'rgb(' + random(255) + ',' + random(255) + ',' + random(255) + ')'; button.style.backgroundcolor = rndcol; }; button.onauxclick = function() { var rndcol = 'rgb(' + random(255) + ',' + random(255) + ',' + random(255) + ')'; button.style.color = rndcol; } note: if you are using a three-button mouse, you'll notice that the onauxclick handler is run when either of the non-left mouse buttons are clicked.
GlobalEventHandlers.oncontextmenu - Web APIs
the contextmenu event typically fires when the right mouse button is clicked on the window.
...is it disabled?<p> javascript window.oncontextmenu = (e) => { e.preventdefault(); } result pausing an animation this example pauses a spinning shape whenever you open the context menu.
GlobalEventHandlers.onkeydown - Web APIs
the keydown event fires when the user presses a keyboard key.
... example this example logs the keyboardevent.code value whenever you press down a key inside the <input> element.
GlobalEventHandlers.onkeypress - Web APIs
the keypress event should fire when the user presses a key on the keyboard.
... examples basic example this example logs the keyboardevent.code value whenever you press a key inside the <input> element.
GlobalEventHandlers.onkeyup - Web APIs
the keyup event fires when the user releases a key that was previously pressed.
... example this example logs the keyboardevent.code value whenever you release a key inside the <input> element.
GlobalEventHandlers.onmousedown - Web APIs
the mousedown event fires when the user depresses the mouse button.
... example this example reveals part of an image when you press and hold a mouse button.
GlobalEventHandlers.onmouseout - Web APIs
the mouseout event fires when the mouse leaves an element.
... for example, when the mouse moves off of an image in the web page, the mouseout event is raised for that image element.
GlobalEventHandlers.onmouseup - Web APIs
the mouseup event fires when the user releases the mouse button.
... example in this example, a piece of "toast" hides when you click down with the mouse, and reappears when you release.
GlobalEventHandlers.onreset - Web APIs
the reset event fires when the user clicks a reset button in a form (<input type="reset">).
... example this example logs the current event.timestamp whenever you reset the form.
HTMLAnchorElement.referrerPolicy - Web APIs
the htmlanchorelement.referrerpolicy property reflect the html referrerpolicy attribute of the <a> element defining which referrer is sent when fetching the resource.
... examples var elt = document.createelement("a"); var linktext = document.createtextnode("my link"); elt.appendchild(linktext); elt.href = "https://developer.mozilla.org/"; elt.referrerpolicy = "no-referrer"; var div = document.getelementbyid("divaround"); div.appendchild(elt); // when clicked, the link will not send a referrer header.
HTMLAreaElement.referrerPolicy - Web APIs
the htmlareaelement.referrerpolicy property reflect the html referrerpolicy attribute of the <area> element defining which referrer is sent when fetching the resource.
... examples <img usemap="#maparound" width="100" height="100" src="/img/logo@2x.png" /> <map id="mymap" name="maparound" />> var elt = document.createelement("area"); elt.href = "/img2.png"; elt.shape = "rect"; elt.referrerpolicy = "no-referrer"; elt.coords = "0,0,100,100"; var map = document.getelementbyid("mymap"); map.appendchild(elt); // when clicked, the area's link will not send a referrer header.
HTMLCanvasElement.getContext() - Web APIs
contextattributes you can use several context attributes when creating your rendering context, for example: const gl = canvas.getcontext('webgl', { antialias: false, depth: false }); 2d context attributes: alpha: boolean that indicates if the canvas contains an alpha channel.
...this will force the use of a software (instead of hardware accelerated) 2d canvas and can save memory when calling getimagedata() frequently.
HTMLCanvasElement.mozOpaque - Web APIs
this has been standardized as setting the alpha option to false when creating a drawing context with htmlcanvaselement.getcontext().
...for example, you could conditionally set it to true if mimetype == 'image/jpeg', or similar, to gain performance in your application when translucency is not needed.
HTMLDetailsElement: toggle event - Web APIs
the toggle event fires when the open/closed state of a <details> element is toggled.
...chapters are removed from the log when they are closed.
HTMLDialogElement: cancel event - Web APIs
the cancel event fires on a <dialog> when the user instructs the browser that they wish to dismiss the current open dialog.
... for example, the browser might fire this event when the user presses the esc key or clicks a "close dialog" button which is part of the browser's ui.
HTMLDialogElement - Web APIs
events close fired when the dialog is closed.
... examples the following example shows a simple button that, when clicked, opens a <dialog> containing a form via the htmldialogelement.showmodal() function.
HTMLElement: animationcancel event - Web APIs
the animationcancel event is fired when a css animation unexpectedly aborts.
...this might happen when the animation-name is changed such that the animation is removed, or when the animating node is hidden using css.
HTMLElement: animationstart event - Web APIs
the animationstart event is fired when a css animation has started.
... bubbles yes cancelable no interface animationevent event handler property onanimationstart examples this listens for the animationstart event and logs a message when it is fired: const animated = document.queryselector('.animated'); animated.addeventlistener('animationstart', () => { console.log('animation started'); }); the same, but using onanimationstart: const animated = document.queryselector('.animated'); animated.onanimationstart = () => { console.log('animation started'); }; live example html <div class="animation-example"> <div clas...
HTMLElement: beforeinput event - Web APIs
the dom beforeinput event fires when the value of an <input>, <select>, or <textarea> element is about to be modified.
... the event also applies to elements with contenteditable enabled, and to any element when designmode is turned on.
HTMLElement: change event - Web APIs
the change event is fired for <input>, <select>, and <textarea> elements when an alteration to the element's value is committed by the user.
... bubbles yes cancelable no interface event event handler property onchange depending on the kind of element being changed and the way the user interacts with the element, the change event fires at a different moment: when the element is :checked (by clicking or using the keyboard) for <input type="radio"> and <input type="checkbox">; when the user commits the change explicitly (e.g., by selecting a value from a <select>'s dropdown with a mouse click, by selecting a date from a date picker for <input type="date">, by selecting a file in the file picker for <input type="file">, etc.); when the element loses focus after its value...
HTMLElement.click() - Web APIs
WebAPIHTMLElementclick
when click() is used with supported elements (such as an <input>), it fires the element's click event.
... syntax element.click() example simulate a mouse-click when moving the mouse pointer over a checkbox: html <form> <input type="checkbox" id="mycheck" onmouseover="myfunction()" onclick="alert('click event occured')"> </form> javascript // on mouse-over, execute myfunction function myfunction() { document.getelementbyid("mycheck").click(); } specification specification status comment html living standard living standard document object model (dom) level 2 html specification obsolete initial definition.
HTMLElement.dir - Web APIs
WebAPIHTMLElementdir
when a table has its dir set to "rtl", the column order is arranged from right to left.
... when an element has its dir set to "auto", the direction of the element is determined based on its first strong directionality character, or default to the directionality of its parent element.
HTMLElement: lostpointercapture event - Web APIs
the lostpointercapture event is fired when a captured pointer is released.
...when the user subsequently releases the pointer, the lostpointercapture event will be fired.
HTMLElement: pointerleave event - Web APIs
the pointerleave event is fired when a pointing device is moved out of the hit test boundaries of an element.
... for pen devices, this event is fired when the stylus leaves the hover range detectable by the digitizer.
HTMLFormElement: reset event - Web APIs
the reset event fires when a <form> is reset.
... bubbles yes (although specified as a simple event that doesn't bubble) cancelable yes interface event event handler property globaleventhandlers.onreset examples this example uses eventtarget.addeventlistener() to listen for form resets, and logs the current event.timestamp whenever that occurs.
HTMLFormElement.submit() - Web APIs
when invoking this method directly, however: no submit event is raised.
... <input> with attribute type="submit" will not be submitted with the form when using htmlformelement.submit(), but it would be submitted when you do it with original html form submit.
HTMLImageElement.crossOrigin - Web APIs
the htmlimageelement interface's crossorigin attribute is a string which specifies the cross-origin resource sharing (cors) setting to use when retrieving the image.
... syntax htmlimageelement.crossorigin = crossoriginmode; let crossoriginmode = htmlimageelement.crossorigin; value a domstring of a keyword specifying the cors mode to use when fetching the image resource.
HTMLImageElement - Web APIs
when called without parameters, new image() is equivalent to calling document.createelement("img").
... htmlimageelement.decode() returns a promise that resolves when the image is decoded and it's safe to append the image to the dom.
HTMLInputElement.webkitdirectory - Web APIs
when a directory is selected, the directory and its entire hierarchy of contents are included in the set of selected items.
...when the change event occurs, a list of all files contained within the selected directory hierarchies is generated and displayed.
HTMLMediaElement: canplay event - Web APIs
the canplay event is fired when the user agent can play the media, but estimates that not enough data has been loaded to play the media up to its end without having to stop for further buffering of content.
... bubbles no cancelable no interface event target element default action none event handler property globaleventhandlers.oncanplay specification html5 media examples these examples add an event listener for the htmlmediaelement's canplay event, then post a message when that event handler has reacted to the event firing.
HTMLMediaElement: canplaythrough event - Web APIs
the canplaythrough event is fired when the user agent can play the media, and estimates that enough data has been loaded to play the media up to its end without having to stop for further buffering of content.
... bubbles no cancelable no interface event target element default action none event handler property globaleventhandlers.oncanplaythrough specification html5 media examples these examples add an event listener for the htmlmediaelement's canplaythrough event, then post a message when that event handler has reacted to the event firing.
HTMLMediaElement: durationchange event - Web APIs
the durationchange event is fired when the duration attribute has been updated.
... bubbles no cancelable no interface event target element default action none event handler property globaleventhandlers.ondurationchange specification html5 media examples these examples add an event listener for the htmlmediaelement's durationchange event, then post a message when that event handler has reacted to the event firing.
HTMLMediaElement: emptied event - Web APIs
the emptied event is fired when the media has become empty; for example, this event is sent if the media has already been loaded (or partially loaded), and the load() method is called to reload it.
... bubbles no cancelable no interface event target element default action none event handler property globaleventhandlers.onemptied specification html5 media examples these examples add an event listener for the htmlmediaelement's emptied event, then post a message when that event handler has reacted to the event firing.
HTMLMediaElement: loadeddata event - Web APIs
the loadeddata event is fired when the frame at the current playback position of the media has finished loading; often the first frame.
... examples these examples add an event listener for the htmlmediaelement's loadeddata event, then post a message when that event handler has reacted to the event firing.
HTMLMediaElement: loadedmetadata event - Web APIs
the loadedmetadata event is fired when the metadata has been loaded.
... examples these examples add an event listener for the htmlmediaelement's loadedmetadata event, then post a message when that event handler has reacted to the event firing.
HTMLMediaElement.onerror - Web APIs
the error event fires when some form of error occurs while attempting to load or perform the media.
...when an error occurs, the specified function will be called.
HTMLMediaElement: pause event - Web APIs
the pause event is sent when a request to pause an activity is handled and the activity has entered its paused state, most commonly after the media has been paused through a call to the element's pause() method.
... general info bubbles no cancelable no interface event target element default action none event handler property globaleventhandlers.onpause specification html5 media examples these examples add an event listener for the htmlmediaelement's pause event, then post a message when that event handler has reacted to the event firing.
HTMLMediaElement: play event - Web APIs
the play event is fired when the paused property is changed from true to false, as a result of the play method, or the autoplay attribute.
... bubbles no cancelable no interface event target element default action none event handler property globaleventhandlers.onplay specification html5 media examples these examples add an event listener for the htmlmediaelement's play event, then post a message when that event handler has reacted to the event firing.
HTMLMediaElement: playing event - Web APIs
the playing event is fired when playback is ready to start after having been paused or delayed due to lack of data.
... bubbles no cancelable no interface event target element default action none event handler property globaleventhandlers.onplaying specification html5 media examples these examples add an event listener for the htmlmediaelement's playing event, then post a message when that event handler has reacted to the event firing.
HTMLMediaElement: ratechange event - Web APIs
the ratechange event is fired when the playback rate has changed.
... bubbles no cancelable no interface event target element default action none event handler property globaleventhandlers.onratechange specification html5 media examples these examples add an event listener for the htmlmediaelement's ratechange event, then post a message when that event handler has reacted to the event firing.
HTMLMediaElement: seeked event - Web APIs
the seeked event is fired when a seek operation completed, the current playback position has changed, and the boolean seeking attribute is changed to false.
... bubbles no cancelable no interface event target element default action none event handler property globaleventhandlers.onseeked specification html5 media examples these examples add an event listener for the htmlmediaelement's seeked event, then post a message when that event handler has reacted to the event firing.
HTMLMediaElement: seeking event - Web APIs
the seeking event is fired when a seek operation starts, meaning the boolean seeking attribute has changed to true and the media is seeking a new position.
... bubbles no cancelable no interface event target element default action none event handler property globaleventhandlers.onseeking specification html5 media examples these examples add an event listener for the htmlmediaelement's seeking event, then post a message when that event handler has reacted to the event firing.
HTMLMediaElement: stalled event - Web APIs
the stalled event is fired when the user agent is trying to fetch media data, but data is unexpectedly not forthcoming.
... bubbles no cancelable no interface event target element default action none event handler property globaleventhandlers.onstalled specification html5 media examples these examples add an event listener for the htmlmediaelement's stalled event, then post a message when that event handler has reacted to the event firing.
HTMLMediaElement: suspend event - Web APIs
the suspend event is fired when media data loading has been suspended.
... bubbles no cancelable no interface event target element default action none event handler property globaleventhandlers.onsuspend specification html5 media examples these examples add an event listener for the htmlmediaelement's suspend event, then post a message when that event handler has reacted to the event firing.
HTMLMedia​Element​.textTracks - Web APIs
you can detect when tracks are added to and removed from an <audio> or <video> element using the addtrack and removetrack events.
...once you have a reference to the list, you can monitor it for changes to detect when new text tracks are added or existing ones removed.
HTMLMediaElement: timeupdate event - Web APIs
the timeupdate event is fired when the time indicated by the currenttime attribute has been updated.
... bubbles no cancelable no interface event target element default action none event handler property globaleventhandlers.ontimeupdate specification html5 media examples these examples add an event listener for the htmlmediaelement's timeupdate event, then post a message when that event handler has reacted to the event firing.
HTMLMediaElement: volumechange event - Web APIs
the volumechange event is fired when the volume has changed.
... bubbles no cancelable no interface event target element default action none event handler property globaleventhandlers.onvolumechange specification html5 media examples these examples add an event listener for the htmlmediaelement's volumechange event, then post a message when that event handler has reacted to the event firing.
HTMLMediaElement: waiting event - Web APIs
the waiting event is fired when playback has stopped because of a temporary lack of data.
... bubbles no cancelable no interface event target element default action none event handler property globaleventhandlers.onwaiting specification html5 media examples these examples add an event listener for the htmlmediaelement's waiting event, then post a message when that event handler has reacted to the event firing.
Option() - Web APIs
for the associated <select> element's value when the form is submitted to the server.
...so that this <option> will be the default value selected in the <select> element when the page is first loaded.
HTMLSelectElement.autofocus - Web APIs
the htmlselectelement.autofocus property is a boolean that reflects the autofocus html attribute, which indicates whether the associated <select> element will get input focus when the page loads, unless the user overrides it.
... setting this property doesn't set the focus to the associated <select> element: it merely tells the browser to focus to it when the element is inserted in the document.
HTMLTrackElement - Web APIs
error 3 indicates that the text track was enabled, but when the user agent attempted to obtain it, this failed in some way.
... cuechange sent when the underlying texttrack has changed the currently-presented cues.
HTMLVideoElement.videoHeight - Web APIs
this can happen when the element switches from displaying the poster frame to displaying video content, or when the displayed video track changes.
...this avoids applying invalid changes when there's no true information available yet for dimensions.
HTMLVideoElement.videoWidth - Web APIs
this can happen when the element switches from displaying the poster frame to displaying video content, or when the displayed video track changes.
...this avoids applying invalid changes when there's no true information available yet for dimensions.
File drag and drop - Web APIs
in this example, the drop target element uses the following styling: #drop_zone { border: 5px solid blue; width: 200px; height: 100px; } note that dragstart and dragend events are not fired when dragging a file into the browser from the os.
... process the drop the drop event is fired when the user drops the file(s).
IDBDatabase.onversionchange - Web APIs
the onversionchange event handler of the idbdatabase interface handles the versionchange event, fired when a database structure change (idbopendbrequest.onupgradeneeded event or idbfactory.deletedatabase) was requested elsewhere (most probably in another window/tab on the same computer).
...} example this example shows an idbopendbrequest.onupgradeneeded block that creates a new object store; it also includes onerror and onabort functions to handle non-success cases, and an onversionchange function to notify when a database structure change has occurred.
IDBIndex.multiEntry - Web APIs
the multientry read-only property of the idbindex interface returns a boolean value that affects how the index behaves when the result of evaluating the index's key path yields an array.
... this is decided when the index is created, using the idbobjectstore.createindex method.
IDBIndex.name - Web APIs
WebAPIIDBIndexname
exceptions there are a several exceptions which can occur when you attempt to change an index's name.
...you can only rename indexes during upgrade transactions; that is, when the mode is "versionchange".
FileHandle.onabort - Web APIs
these events occur when the associated locked file has been aborted with the lockedfile.abort() method.
... syntax instanceoffilehandle.onabort = funcref; where funcref is a function to be called when the abort event occurs.
FileHandle.onerror - Web APIs
these events occur when something goes wrong.
... syntax instanceoffilehandle.onerror = funcref; where funcref is a function to be called when the error event occurs.
IDBObjectStore.add() - Web APIs
in other words, the success event is only triggered when the transaction has been successfully queued.
...ta(); }; function adddata() { // create a new object ready to insert into the idb var newitem = [ { tasktitle: "walk dog", hours: 19, minutes: 30, day: 24, month: "december", year: 2013, notified: "no" } ]; // open a read/write db transaction, ready for adding the data var transaction = db.transaction(["todolist"], "readwrite"); // report on the success of the transaction completing, when everything is done transaction.oncomplete = function(event) { note.innerhtml += '<li>transaction completed.</li>'; }; transaction.onerror = function(event) { note.innerhtml += '<li>transaction not opened due to error.
IDBObjectStore.createIndex() - Web APIs
multientry if true, the index will add an entry in the index for each array element when the keypath resolves to an array.
... db = request.result; // run the displaydata() function to populate the task list with // all the to-do list data already in the idb displaydata(); }; // this handler fires when a new database is created and indicates // either that one has not been created before, or a new version // was submitted with window.indexeddb.open().
IDBObjectStore - Web APIs
this is for updating existing records in an object store when the transaction's mode is readwrite.
...= '<li>object store created.</li>'; }; // create a new item to add in to the object store var newitem = [ { tasktitle: "walk dog", hours: 19, minutes: 30, day: 24, month: 'december', year: 2013, notified: "no" } ]; // open a read/write db transaction, ready for adding the data var transaction = db.transaction(["todolist"], "readwrite"); // report on the success of the transaction completing, when everything is done transaction.oncomplete = function(event) { note.innerhtml += '<li>transaction completed.</li>'; }; transaction.onerror = function(event) { note.innerhtml += '<li>transaction not opened due to error.
IDBOpenDBRequest - Web APIs
blocked fired when an open connection to a database is blocking a versionchange transaction on the same database.
... upgradeneeded fired when an attempt was made to open a database with a version number higher than its current version.
IDBRequest.error - Web APIs
WebAPIIDBRequesterror
the list describes problems that could occur when the request is being executed, but you might also encounter other problems when the request is being made.
...retitlerequest = objectstore.get(title); objectstoretitlerequest.onsuccess = function() { // grab the data object returned as the result var data = objectstoretitlerequest.result; // update the notified value in the object to "yes" data.notified = "yes"; // create another request that inserts the item // back into the database var updatetitlerequest = objectstore.put(data); // when this new request succeeds, run the displaydata() // function again to update the display updatetitlerequest.onsuccess = function() { displaydata(); }; }; objectstoretitlerequest.onerror = function() { // if an error occurs with the request, log what it is console.log("there has been an error with retrieving your data: " + objectstoretitlerequest.error); }; specifications ...
IDBRequest.onerror - Web APIs
the onerror event handler of the idbrequest interface handles the error event, fired when a request returns an error.
...retitlerequest = objectstore.get(title); objectstoretitlerequest.onsuccess = function() { // grab the data object returned as the result var data = objectstoretitlerequest.result; // update the notified value in the object to "yes" data.notified = "yes"; // create another request that inserts the item back // into the database var updatetitlerequest = objectstore.put(data); // when this new request succeeds, run the displaydata() // function again to update the display updatetitlerequest.onsuccess = function() { displaydata(); }; }; objectstoretitlerequest.onerror = function() { // if an error occurs with the request, log what it is console.log("there has been an error with retrieving your data: " + objectstoretitlerequest.error); // todo what about event p...
IDBRequest.onsuccess - Web APIs
the onsuccess event handler of the idbrequest interface handles the success event, fired when the result of a request is successfully returned.
...retitlerequest = objectstore.get(title); objectstoretitlerequest.onsuccess = function() { // grab the data object returned as the result var data = objectstoretitlerequest.result; // update the notified value in the object to "yes" data.notified = "yes"; // create another request that inserts the item back // into the database var updatetitlerequest = objectstore.put(data); // when this new request succeeds, run the displaydata() // function again to update the display updatetitlerequest.onsuccess = function() { displaydata(); }; }; specifications specification status comment indexed database api 2.0the definition of 'onsuccess' in that specification.
IDBRequest.readyState - Web APIs
the state changes to done when the request completes successfully or when an error occurs.
...ned as the result var data = objectstoretitlerequest.result; // update the notified value in the object to "yes" data.notified = "yes"; // create another request that inserts the item // back into the database var updatetitlerequest = objectstore.put(data); // log the source of this request console.log("the readystate of this request is " + updatetitlerequest.readystate); // when this new request succeeds, run the displaydata() // function again to update the display updatetitlerequest.onsuccess = function() { displaydata(); }; }; specifications specification status comment indexed database api 2.0the definition of 'readystate' in that specification.
IDBRequest.source - Web APIs
WebAPIIDBRequestsource
if no source exists (such as when calling indexeddb.open), it returns null.
...ect returned as the result var data = objectstoretitlerequest.result; // update the notified value in the object to "yes" data.notified = "yes"; // create another request that inserts the item // back into the database var updatetitlerequest = objectstore.put(data); // log the source of this request console.log("the source of this request is " + updatetitlerequest.source); // when this new request succeeds, run the displaydata() // function again to update the display updatetitlerequest.onsuccess = function() { displaydata(); }; }; specifications specification status comment indexed database api 2.0the definition of 'source' in that specification.
IDBRequest.transaction - Web APIs
if a version upgrade is needed when opening a database then during the upgradeneeded event handler the transaction property will be an idbtransaction with mode equal to "versionchange", and can be used to access existing object stores and indexes, or abort the the upgrade.
...jectstoretitlerequest.result; // update the notified value in the object to "yes" data.notified = "yes"; // create another request that inserts the item back // into the database var updatetitlerequest = objectstore.put(data); // log the transaction that originated this request console.log("the transaction that originated this request is " + updatetitlerequest.transaction); // when this new request succeeds, run the displaydata() // function again to update the display updatetitlerequest.onsuccess = function() { displaydata(); }; }; this example shows how a the transaction property can be used during a version upgrade to access existing object stores:​ var openrequest = indexeddb.open('db', 2); console.log(openrequest.transaction); // will log "null".
IDBTransaction: abort event - Web APIs
the abort event is fired when an indexeddb transaction is aborted.
... bubbles yes cancelable no interface event event handler property onabort this can happen for any of the following reasons: bad requests, (for example, trying to add the same key twice, or put the same index key when the key has a uniqueness constraint), an explicit abort() call an uncaught exception in the request's success/error handler, an i/o error (an actual failure to write to disk, for example disk detached, or other os/hardware failure) quota exceeded.
IDBTransaction.error - Web APIs
the idbtransaction.error property of the idbtransaction interface returns one of several types of error when there is an unsuccessful transaction.
...note the transaction.onerror = function(event) { }; block, making use of transaction.error to help in reporting what went wrong when the transaction was unsuccessful.
IDBTransaction.onerror - Web APIs
the onerror event handler of the idbtransaction interface handles the error event, fired when a request returns an error and bubbles up to the transaction object.
...note the transaction.onerror = function(event) { }; block, making use of transaction.error to help in reporting what went wrong when the transaction was unsuccessful.
InputEvent.data - Web APIs
WebAPIInputEventdata
this may be an empty string if the change doesn't insert text (such as when deleting characters, for example).
... examples in the following simple example we've set up an event listener on the input event so that when any change is made to the contents of the <input> element (either by typing or pasting), the text that was added is retrieved via the inputevent.data property and reported in the paragraph below the input.
IntersectionObserver.IntersectionObserver() - Web APIs
syntax var observer = new intersectionobserver(callback[, options]); parameters callback a function which is called when the percentage of the target element is visible crosses a threshold.
... rootmargin a string which specifies a set of offsets to add to the root's bounding_box when calculating intersections, effectively shrinking or growing the root for calculation purposes.
IntersectionObserver.rootMargin - Web APIs
the string returned by this property may not match the one specified when the intersectionobserver was instantiated.
... the browser is permitted to alter the values if rootmargin isn't specified when the object was instantiated, it defaults to the string "0px 0px 0px 0px", meaning that the intersection will be computed between the root element's unmodified bounds rectangle and the target's bounds.
InterventionReportBody - Web APIs
an intervention report is generated when usage of a feature in a web document has been blocked by the browser for reasons such as security, performance, or user annoyance.
...this typically matches the message a browser will display in its devtools console when an intervention is imposed, if one is available.
KeyboardEvent.keyCode - Web APIs
web developers shouldn't use the keycode attribute for printable characters when handling keydown and keyup events.
...when implementing a shortcut key handler, the keypress event is usually better (at least when gecko is the runtime in use).
KeyboardEvent.metaKey - Web APIs
the keyboardevent.metakey read-only property returning a boolean that indicates if the meta key was pressed (true) or not (false) when the event occurred.
...keyboardevent.metakey is false when the ⊞ windows is pressed.
KeyframeEffectOptions - Web APIs
simply put, these properties describe how the user agent should go about making the transition from keyframe to keyframe, and how to behave when the animation begins and ends.
...this is primarily of use when sequencing animations based on the end time of another animation.
LayoutShift - Web APIs
note that in this example data is only sent to the server when the user leaves the tab.
... // catch errors since some browsers throw when using the new `type` option.
Locks.name - Web APIs
WebAPILockname
the name read-only property of the lock interface returns the name passed to lockmanager.request selected when the lock was requested.
... the name of a lock is passed by script when the lock is requested.
Lock - Web APIs
WebAPILock
properties lock.mode read only returns the access mode passed to lockmanager.request() when the lock was requested.
... lock.name read only returns the name passed to lockmanager.request() when the lock was requested.
LockedFile.onabort - Web APIs
these events occur when the locked file has been aborted with the lockedfile.abort() method.
... syntax instanceoflockedfile.onabort = funcref; where funcref is a function to be called when the abort event occurs.
LockedFile.onerror - Web APIs
these events occur when something goes wrong.
... syntax instanceoflockedfile.onerror = funcref; where funcref is a function to be called when the error event occurs.
MIDIConnectionEvent - Web APIs
this occurs any time a new port becomes available, or when a previously available port becomes unavailable.
... for example, this event is fired whenever a midi device is either plugged in to or unplugged from a computer.
MSGraphicsTrust - Web APIs
syntax var trustobject = media.msgraphicstruststatus; parameters constrictionactive a read-only property which returns true when protected media is forced to play in a lower resolution.
... status a read-only property which returns an enum with the driver status when playing protected content.
MSManipulationEvent - Web APIs
msmanipulationevent provides contextual information when contact is made to the screen and an element is manipulated.
... events msmanipulationstatechanged: event fires when the state of an element being manipulated has changed.
MediaCapabilities - Web APIs
methods mediacapabilities.encodinginfo() when passed a valid media configuration, it returns a promise with information as to whether the media type is supported, and whether encoding such media would be smooth and power efficient.
... mediacapabilities.decodinginfo() when passed a valid media configuration, it returns a promise with information as to whether the media type is supported, and whether decoding such media would be smooth and power efficient.
MediaPositionState.position - Web APIs
the mediapositionstate dictionary's position property is used when calling the mediasession method setpositionstate() to provide the user agent with the current playback position, in seconds, of the currently-playing media.
...if the media is still playing when the interval is fired, setpositionstate() is called with an object that specifies the duration, playback rate, and position as reported by a mymedia object that describes the track being played.
MediaQueryListListener - Web APIs
a mediaquerylist object maintains a list of media queries on a document, and handles sending notifications to listeners when the media queries on the document change.
... this makes it possible to observe a document to detect when its media queries change, instead of polling the values periodically, if you need to detect changes to the values of media queries on a document.
MediaRecorder.mimeType - Web APIs
the mimetype read-only property returns the mime media type that was specified when creating the mediarecorder object, or, if none was specified, which was chosen by the browser.
... keep in mind that not all codecs are supported by a given container; if you write media using a codec that is not supported by a given media container, the resulting file may not work reliably if at all when you try to play it back.
MediaRecorder.requestData() - Web APIs
the mediarecorder.requestdata() method (part of the mediarecorder api) is used to raise a dataavailable event containing a blob object of the captured media as it was when the method was called.
... when the requestdata() method is invoked, the browser queues a task that runs the following steps: if mediarecorder.state is not "recording", raise a dom invalidstate error and terminate these steps.
MediaRecorder.resume() - Web APIs
the mediarecorder.resume() method (part of the mediarecorder api) is used to resume media recording when it has been previously paused.
... when the resume() method is invoked, the browser queues a task that runs the following steps: if mediarecorder.state is "inactive", raise a dom invalidstate error and terminate these steps.
MediaRecorder.stream - Web APIs
the mediarecorder.stream read-only property returns the stream that was passed into the mediarecorder() constructor when the mediarecorder was created.
... syntax var stream = mediarecorder.stream values the mediastream passed into the mediarecorder() constructor when the mediarecorder was originally created.
MediaSession.setActionHandler() - Web APIs
these actions let a web app receive notifications when the user engages a device's built-in physical or onscreen media controls, such as play, stop, or seek buttons.
... callback a function to call when the specified action type is invoked.
MediaSessionActionDetails.fastSeek - Web APIs
the boolean property fastseek in the mediasessionactiondetails dictionary is an optional value which, when specified and true, indicates that the requested seekto operation is part of an ongoing series of seekto operations.
... your handler should take steps to return as quickly as possible by skipping any steps of its operation which are only necessary when the seek operation is complete.
MediaSessionActionDetails.seekTime - Web APIs
the mediasessionactiondetails dictionary's seektime property is always included when a seekto action is sent to the action handler callback.
... usage notes to perform a "fast" seek (such as when issuing multiple seekto actions in sequence while handling a scrubbing operation, the details object's fastseek property's value is set to true, indicating that you should minimize or eliminate anything you do while handling the action that is only necessary at the final step.
MediaSessionActionDetails - Web APIs
the media session api's mediasessionactiondetails dictionary is the type used by the sole input parameter into the callback which is executed when a media session action occurs.
...a "fast" seek is a seek being performed in a rapid sequence, such as when fast-forwarding or reversing through the media, rapidly skipping through it.
MediaSource.endOfStream() - Web APIs
syntax mediasource.endofstream(endofstreamerror); parameters endofstreamerror optional a domstring representing an error to throw when the end of the stream is reached.
...when you make an xmlhttprequest call for a media chunk, and onabort or onerror triggers, you might want to call endofstream('network'), display a descriptive message in the ui, and maybe retry the network request immediately or wait until the network is back up (via some kind of polling.) decode: terminates playback and signals that a decoding error has occured.
MediaStreamAudioSourceOptions - Web APIs
the mediastreamaudiosourceoptions dictionary provides configuration options used when creating a mediastreamaudiosourcenode using its constructor.
... it is not needed when using the audiocontext.createmediastreamsource() method.
MediaStreamConstraints - Web APIs
the mediastreamconstraints dictionary is used when calling getusermedia() to specify what kinds of tracks should be included in the returned mediastream, and, optionally, to establish constraints for those tracks' settings.
...when a peer identity is set, mediastreamtracks from that peer have their isolated flag set to true.
MediaStreamTrack.applyConstraints() - Web APIs
return value a promise which resolves when the constraints have been successfully applied.
...this can happen if the specified constraints are too strict to find a match when attempting to configure the track.
MediaStreamTrack: ended event - Web APIs
the ended event of the mediastreamtrack interface is fired when playback or streaming has stopped because the end of the media was reached or because no further data is available.
... bubbles no cancelable no interface event event handler property mediastreamtrack.onended usage notes ended events fire when the media stream track's source permanently stops sending data on the stream.
MediaStreamTrack.muted - Web APIs
when a track is disabled by setting enabled to false, it generates only empty frames (audio frames in which every sample is 0, or video frames in which every pixel is black).
... when possible, avoid polling muted to monitor the track's muting status.
MediaStreamTrack.onended - Web APIs
the mediastreamtrack.onended event handler is used to specify a function which serves as an eventhandler to be called when the ended event occurs on the track.
... this event occurs when the track will no longer provide data to the stream for any reason, including the end of the media input being reached, the user revoking needed permissions, the source device being removed, or the remote peer ending a connection.
MediaStreamTrack.onmute - Web APIs
mediastreamtrack's onmute event handler is called when the mute event is received.
... such an event is sent when the track is temporarily not able to send data.
MediaStreamTrack.onoverconstrained - Web APIs
the mediastreamtrack.onoverconstrained event handler is a property called when the overconstrained event is received.
... such an event is sent when the track is again able to send data.
MediaStreamTrackAudioSourceOptions - Web APIs
the mediastreamtrackaudiosourceoptions dictionary is used when specifying options to the mediastreamtrackaudiosourcenode() constructor.
... it isn't needed when using the audiocontext.createmediastreamtracksource() method.
MediaTrackConstraints.deviceId - Web APIs
that means that a given track will only return one value for the deviceid when you call getcapabilities().
... because of this, there's no use for the device id when calling mediastreamtrack.applyconstraints(), since there is only one possible value; however, you can record a deviceid and use it to ensure that you get the same source for multiple calls to getusermedia().
MediaTrackConstraints.latency - Web APIs
in audio processing, latency is the time between the start of processing (when sound occurs in the real world, or is generated by a hardware device) and the data being made available to the next step in the audio input or output process.
... in most cases, low latency is desirable for performance and user experience purposes, but when power consumption is a concern, or delays are otherwise acceptable, higher latency might be acceptable.
MediaTrackSettings.deviceId - Web APIs
this lets you determine what value was selected to comply with your specified constraints for this property's value as described in the mediatrackconstraints.deviceid property you provided when calling either getusermedia().
...that makes the device id not useful for any changes to constraints when calling mediastreamtrack.applyconstraints().
Media Session API - Web APIs
the user agent provides default behaviors, when no page-defined behavior is available.
... mediapositionstate used to contain information about the current playback position, playback speed, and overall media duration when calling the mediasession method setpositionstate() to establish the media's length, playback position, and playback speed.
Transcoding assets for Media Source Extensions - Web APIs
when working with media source extensions, it is likely that you need to condition your assets before you can stream them.
... [0] (c) copyright 2008, blender foundation / www.bigbuckbunny.org / https://peach.blender.org/about/ tools required when working with mse, the following tools are a must have: ffmpeg — a command-line utility for transcoding your media into the required formats.
Media Source API - Web APIs
mse gives us finer grained control over how much and how often content is fetched, and some control over memory usage details, such as when buffers are evicted.
... htmlmediaelement.seekable when a mediasource object is played by an html media element, this property will return a timeranges object that contains the time ranges that the user is able to seek to.
MessageChannel() - Web APIs
when the iframe has loaded, we pass port2 to the iframe using messageport.postmessage along with a message.
...messagechannel.port1 is listened to, to check when the message arrives.
MessageChannel.port1 - Web APIs
when the <iframe> has loaded, we pass messagechannel.port2 to the <iframe> using messageport.postmessage along with a message.
...the handlemessage method is associated to the port1 to listen when the message arrives.
MessageChannel.port2 - Web APIs
when the iframe has loaded, we pass port2 to the iframe using messageport.postmessage along with a message.
...messagechannel.port1 is listened to, to check when the message arrives.
MessageChannel - Web APIs
when the iframe has loaded, we register an onmessage handler for messagechannel.port1 and transfer messagechannel.port2 to the iframe using the window.postmessage method along with a message.
... when a message is received back from the iframe, the onmessage function simply outputs the message to a paragraph.
MessageEvent.ports - Web APIs
in channel messaging or when sending a message to a shared worker).
... example onconnect = function(e) { var port = e.ports[0]; port.addeventlistener('message', function(e) { var workerresult = 'result: ' + (e.data[0] * e.data[1]); port.postmessage(workerresult); }); port.start(); // required when using addeventlistener.
MessagePort: message event - Web APIs
the message event is fired on a messageport object when a message arrives on that channel.
...this is only needed when using the addeventlistener() method: if the receiver uses onmessage instead, start() is called implicitly: window.addeventlistener('message', (event) => { const myport = event.ports[0]; myport.onmessage = (event) => { received.textcontent = event.data; }; }); specifications specification status html living standard living standard ...
MessagePort: messageerror event - Web APIs
the messageerror event is fired on a messageport object when it receives a message that can't be deserialized.
...this is only needed when using the addeventlistener() method: if the receiver uses onmessage instead, start() is called implicitly: window.addeventlistener('message', (event) => { const myport = event.ports[0]; myport.onmessage = (event) => { received.textcontent = event.data; }; myport.onmessageerror = (event) => { console.error(event.data); }; }); specifications specif...
MessagePort.postMessage() - Web APIs
when the iframe has loaded, we pass messagechannel.port2 to the iframe using window.postmessage along with a message.
... the handlemessage handler then responds to a message being sent back from the iframe using onmessage, putting it into a paragraph — messagechannel.port1 is listened to, to check when the message arrives.
MessagePort.start() - Web APIs
WebAPIMessagePortstart
this method is only needed when using eventtarget.addeventlistener; it is implied when using messagechannel.onmessage.
... example in the following code block, you can see a handlemessage handler function, run when a message is sent back to this document using onmessage: channel.port1.onmessage = handlemessage; function handlemessage(e) { para.innerhtml = e.data; } another option would be to do this using eventtarget.addeventlistener, however, when this method is used, you need to explicitly call start() to begin the flow of messages to this document: channel.port1.addeventlistener('message', handlemessage, false); function handlemessage(e) { para.innerhtml = e.data; textinput.value = ''; } channel.port1.start(); specifications specification status comment html living ...
MouseEvent.altKey - Web APIs
WebAPIMouseEventaltKey
the mouseevent.altkey read-only property is a boolean that indicates whether the alt key was pressed or not when a given mouse event occurs.
... example this example logs the altkey property when you trigger a click event.
MouseEvent.buttons - Web APIs
the mouseevent.buttons read-only property indicates which buttons are pressed on the mouse (or other input device) when a mouse event is triggered.
... 0 : no button or un-initialized 1 : primary button (usually the left button) 2 : secondary button (usually the right button) 4 : auxiliary button (usually the mouse wheel button or middle button) 8 : 4th button (typically the "browser back" button) 16 : 5th button (typically the "browser forward" button) example this example logs the buttons property when you trigger a mousedown event.
MouseEvent.ctrlKey - Web APIs
the mouseevent.ctrlkey read-only property is a boolean that indicates whether the ctrl key was pressed or not when a given mouse event occurs.
... example this example logs the ctrlkey property when you trigger a click event.
MouseEvent.screenX - Web APIs
example this example displays your mouse's coordinates whenever you trigger the mousemove event.
... html <p>move your mouse to see its position.</p> <p id="screen-log"></p> javascript let screenlog = document.queryselector('#screen-log'); document.addeventlistener('mousemove', logkey); function logkey(e) { screenlog.innertext = ` screen x/y: ${e.screenx}, ${e.screeny} client x/y: ${e.clientx}, ${e.clienty}`; } result routing an event when you trap events on the window, document, or other roomy elements, you can get the coordinates of that event (e.g., a click) and route it properly, as the following example demonstrates: function checkclickmap(e) { if (e.screenx < 50) doredbutton(); if (50 <= e.screenx && e.screenx < 100) doyellowbutton(); if (e.screenx >= 100) doredbutton(); } specifications specification status comment css object model...
MouseEvent.shiftKey - Web APIs
the mouseevent.shiftkey read-only property is a boolean that indicates whether the shift key was pressed or not when a given mouse event occurs.
... example this example logs the shiftkey property when you trigger a click event.
MutationObserver.observe() - Web APIs
observation follows nodes when disconnected mutation observers are intended to let you be able to watch the desired set of nodes over time, even if the direct connections between those nodes are severed.
... // identify an element to observe const elementtoobserve = document.queryselector("#targetelementid"); // create a new instance of `mutationobserver` named `observer`, // passing it a callback function const observer = new mutationobserver(function() { console.log('callback that runs when observer is triggered'); }); // call `observe()` on that mutationobserver instance, // passing it the element to observe, and the options object observer.observe(elementtoobserve, {subtree: true, childlist: true}); specifications specification status comment domthe definition of 'mutationobserver.observe()' in that specification.
MutationObserver.takeRecords() - Web APIs
the most common use case for this is to immediately fetch all pending mutation records immediately prior to disconnecting the observer, so that any pending mutations can be processed when stopping down the observer.
... const targetnode = document.queryselector("#someelement"); const observeroptions = { childlist: true, attributes: true } const observer = new mutationobserver(callback); observer.observe(targetnode, observeroptions); /* ...later, when it's time to stop observing...
MutationObserverInit.characterData - Web APIs
syntax var options = { characterdata: true | false } value a boolean value indicating whether or not to call the observer's callback function when textual nodes' values change.
... if true, the callback specified when observe() was used to start observing the node or subtree is called any time the contents of a text node are changed.
NDEFReader.onerror - Web APIs
the onerror property of ndefreader interface of the web nfc api is called whenever an error occurs during reading of nfc tags, e.g.
... when tags leave the reader's magnetic induction field.
NDEFReader.onreading - Web APIs
the onreading property of ndefreader interface of the web nfc api is called whenever a new reading is available from compatible nfc devices, e.g.
... nfc tags supporting ndef, when these devices are within the reader's magnetic induction field.
Navigator.getBattery() - Web APIs
syntax var batterypromise = navigator.getbattery(); return value a promise which, when resolved, calls its fulfillment handler with a single parameter: a batterymanager object which you can use to get information about the battery's state.
... example this example fetches the current charging state of the battery and establishes a handler for the chargingchange event, so that the charging state is recorded whenever it changes.
Navigator.getUserMedia() - Web APIs
successcallback a function which is invoked when the request for media access is approved.
... }; } errorcallback when the call fails, the function specified in the errorcallback is invokedwith a mediastreamerror object as its sole argument; this object is is modeled on domexception.
msSaveBlob - Web APIs
defaultname the file name to be used when saving file.
... notes when a site calls this method, the behavior is the same as when windows internet explorer downloads a file with the following in the header, where x-download-options removes the file open button from the browser file download dialog: content-length: <blob.size> content-type: <blob.type> content-disposition: attachment;filename=<defaultname> x-download-options: noopen specifications not part of any specifications.
msSaveOrOpenBlob - Web APIs
defaultname the file name to be used when saving file.
... notes when a site calls this method, the behavior is the same as when windows internet explorer downloads a file with the following in the header: content-length: <blob.size> content-type: <blob.type> content-disposition: attachment;filename=<defaultname> specifications not part of any specifications.
Navigator.sendBeacon() - Web APIs
with the sendbeacon() method, the data is transmitted asynchronously when the user agent has an opportunity to do so, without delaying unload or the next navigation.
... window.addeventlistener("unload", function logdata() { navigator.sendbeacon("/log", analyticsdata); }); the beacon sends an http request via the post method, with all relevant cookies available when called.
Node.namespaceURI - Web APIs
WebAPINodenamespaceURI
when the node is a document, it returns the xml namespace for the current document.
... obsolete specifies the behavior when it's set to null.
Node - Web APIs
WebAPINode
when multiple prefixes are possible, the result is implementation-dependent.
... if callback is provided, and it returns boolean false when called, the current recursion level is aborted, and the function resumes execution at the last parent's level.
NodeFilter.acceptNode() - Web APIs
possible return values are: constant description nodefilter.filter_accept value returned by the nodefilter.acceptnode() method when a node should be accepted.
... nodefilter.filter_reject value to be returned by the nodefilter.acceptnode() method when a node should be rejected.
NodeFilter - Web APIs
possible return values are: constant description filter_accept value returned by the nodefilter.acceptnode() method when a node should be accepted.
... filter_reject value to be returned by the nodefilter.acceptnode() method when a node should be rejected.
NodeIterator.filter - Web APIs
when creating the nodeiterator, the filter object is passed in as the third parameter, and the object method acceptnode(node) is called on every single node to determine whether or not to accept it.
... this function should return the constant nodefilter.filter_accept for cases when the node should be accepted and nodefilter.filter_reject for cases when the node should be rejected.
NodeList - Web APIs
WebAPINodeList
it's good to keep this distinction in mind when you choose how to iterate over the items in the nodelist, and whether you should cache the list's length.
... an alternative to accessing nodelist[i] (which instead returns undefined when i is out-of-bounds).
Notification.close() - Web APIs
examples in the following snippet, we have a simple function that when called creates an options object and then a new notification.
... at the end of the function, it also calls close() inside a addeventlistener() function to remove the notification when the relevant content has been read on the webpage.
OVR_multiview2.framebufferTextureMultiviewOVR() - Web APIs
gl.color_attachment1 gl.color_attachment2 gl.color_attachment3 gl.color_attachment4 gl.color_attachment5 gl.color_attachment6 gl.color_attachment7 gl.color_attachment8 gl.color_attachment9 gl.color_attachment10 gl.color_attachment11 gl.color_attachment12 gl.color_attachment13 gl.color_attachment14 gl.color_attachment15 when using the webgl_draw_buffers extension: ext.color_attachment0_webgl (same as gl.color_attachment0) ext.color_attachment1_webgl ext.color_attachment2_webgl ext.color_attachment3_webgl ext.color_attachment4_webgl ext.color_attachment5_webgl ext.color_attachment6_webgl ext.color_attachment7_webgl ext.color_attachment8_webgl ext.color_attachment9_w...
...ebgl ext.color_attachment10_webgl ext.color_attachment11_webgl ext.color_attachment12_webgl ext.color_attachment13_webgl ext.color_attachment14_webgl ext.color_attachment15_webgl when using the webgl_depth_texture extension: ext.depth_stencil_attachment: depth and stencil buffer data storage.
OfflineAudioCompletionEvent - Web APIs
the web audio api offlineaudiocompletionevent interface represents events that occur when the processing of an offlineaudiocontext is terminated.
... note: this interface is marked as deprecated; it is still supported for legacy reasons, but it will soon be superseded when the promise version of offlineaudiocontext.startrendering is supported in browsers, which will no longer need it.
OfflineAudioContext: complete event - Web APIs
the complete event of the offlineaudiocontext interface is fired when the rendering of an offline audio context is complete.
... bubbles no cancelable no default action none interface offlineaudiocompletionevent event handler property offlineaudiocontext.oncomplete examples when processing is complete, you might want to use the oncomplete handler the prompt the user that the audio can now be played, and enable the play button: let offlineaudioctx = new offlineaudiocontext(); offlineaudioctx.addeventlistener('complete', () => { console.log('offline audio processing now complete'); showmodaldialog('song processed and ready to play'); playbtn.disabled = false; }) you can also set up the event handler using the offlineaudiocontext.oncomplete property: let offlineaudioctx = new offlineaudiocontext(); offlineaudioctx.oncomplete = function() { c...
OfflineAudioContext.oncomplete - Web APIs
the oncomplete event handler of the offlineaudiocontext interface is called when the audio processing is terminated, that is when the complete event (of type offlineaudiocompletionevent) is raised.
...} example when processing is complete, you might want to use the oncomplete handler the prompt the user that the audio can now be played, and enable the play button.
OffscreenCanvas.getContext() - Web APIs
contextattributes you can use several context attributes when creating your rendering context, for example: offscreen.getcontext("webgl", { antialias: false, depth: false }); 2d context attributes: alpha: boolean that indicates if the canvas contains an alpha channel.
...this will force the use of a software (instead of hardware accelerated) 2d canvas and can save memory when calling getimagedata() frequently.
PaintWorklet.registerPaint - Web APIs
return value undefined exceptions typeerror thrown when one of the arguments is invalid or missing.
... invalidmodificationerror thrown when the a worklet already exists with the specified name.
PannerNode.coneInnerAngle - Web APIs
const context = new audiocontext(); const osc = new 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) degrees 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) degrees either direction, // the volume will decrea...
...se gradually panner.coneouterangle = 45; // this value determines the volume of the sound outside of both inner and outer cone // setting it to 0 means there is no sound, so we can clearly hear when we leave the cone // 0 is also the default panner.coneoutergain = 0; // increase the z position to ensure the cone has an effect // (otherwise the sound is located at the same position as the listener) panner.positionz.setvalueattime(1, context.currenttime); having set up the pannernode, we can now schedule some updates to its y-axis rotation: // 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.orientatio...
PannerNode.coneOuterAngle - Web APIs
const context = new audiocontext(); const osc = new 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) degrees 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) degrees either direction, // the volume will decrea...
...se gradually panner.coneouterangle = 45; // this value determines the volume of the sound outside of both inner and outer cone // setting it to 0 means there is no sound, so we can clearly hear when we leave the cone // 0 is also the default panner.coneoutergain = 0; // increase the z position to ensure the cone has an effect // (otherwise the sound is located at the same position as the listener) panner.positionz.setvalueattime(1, context.currenttime); having set up the pannernode, we can now schedule some updates to its y-axis rotation: // 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.orientatio...
PannerNode.coneOuterGain - Web APIs
const context = new audiocontext(); const osc = new 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) degrees 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) degrees either direction, // the volume will decrea...
...se gradually panner.coneouterangle = 45; // this value determines the volume of the sound outside of both inner and outer cone // setting it to 0 means there is no sound, so we can clearly hear when we leave the cone // 0 is also the default panner.coneoutergain = 0; // increase the z position to ensure the cone has an effect // (otherwise the sound is located at the same position as the listener) panner.positionz.setvalueattime(1, context.currenttime); having set up the pannernode, we can now schedule some updates to its y-axis rotation: // 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.orientatio...
PannerNode.orientationX - Web APIs
const context = new audiocontext(); const osc = new 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) degrees 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) degrees either direction, // the volume will decrea...
...se gradually panner.coneouterangle = 45; // this value determines the volume of the sound outside of both inner and outer cone // setting it to 0 means there is no sound, so we can clearly hear when we leave the cone // 0 is also the default panner.coneoutergain = 0; // increase the z position to ensure the cone has an effect // (otherwise the sound is located at the same position as the listener) panner.positionz.setvalueattime(1, context.currenttime); having set up the pannernode, we can now schedule some updates to its y-axis rotation: // 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.orientatio...
PannerNode.orientationY - Web APIs
const context = new audiocontext(); const osc = new 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) degrees 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) degrees either direction, // the volume will decrea...
...se gradually panner.coneouterangle = 45; // this value determines the volume of the sound outside of both inner and outer cone // setting it to 0 means there is no sound, so we can clearly hear when we leave the cone // 0 is also the default panner.coneoutergain = 0; // increase the z position to ensure the cone has an effect // (otherwise the sound is located at the same position as the listener) panner.positionz.setvalueattime(1, context.currenttime); having set up the pannernode, we can now schedule some updates to its y-axis rotation: // 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.orientatio...
PannerNode.orientationZ - Web APIs
const context = new audiocontext(); const osc = new 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) degrees 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) degrees either direction, // the volume will decrea...
...se gradually panner.coneouterangle = 45; // this value determines the volume of the sound outside of both inner and outer cone // setting it to 0 means there is no sound, so we can clearly hear when we leave the cone // 0 is also the default panner.coneoutergain = 0; // increase the z position to ensure the cone has an effect // (otherwise the sound is located at the same position as the listener) panner.positionz.setvalueattime(1, context.currenttime); having set up the pannernode, we can now schedule some updates to its y-axis rotation: // 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.orientatio...
ParentNode.querySelectorAll() - Web APIs
since javascript also uses backslash escaping, special care must be taken when writing string literals using these characters.
... in this example, when selecting .outer .inner in the context the <div> with the class select, the element with the class .inner is still found, even though .outer is not a descendant of the base element on which the search is performed (.select).
PasswordCredential.idName - Web APIs
the idname property of the passwordcredential interface returns a usvstring, representing the name that will be used for the id field, when submitting the current object to a remote endpoint via fetch.
... syntax var idname = passwordcredential.idname passwordcredential.idname = "userid" value a usvstring represents the name used for the id field, when submitting the current object to a remote endpoint via fetch.
PasswordCredential.passwordName - Web APIs
the passwordname property of the passwordcredential interface returns a usvstring, depicting the name used by the password field, when submitting the current object to a remote endpoint via fetch.
... syntax var passwordname = passwordcredential.passwordname passwordcredential.passwordname = "passcode" value a usvstring representing the password field name, used when submitting the current object to a remote endpoint via fetch.
PasswordCredential - Web APIs
passwordcredential.idname secure context a usvstring containing the name that will be used for the id field when submitting the current object to a remote endpoint via fetch.
... passwordcredential.passwordname secure context a usvstring representing the name that will be used for the password field when submitting the current object to a remote endpoint via fetch.
Path2D() - Web APIs
WebAPIPath2DPath2D
syntax new path2d(); new path2d(path); new path2d(d); parameters path optional when invoked with another path2d object, a copy of the path argument is created.
... d optional when invoked with a string consisting of svg path data, a new path is created from that description.
PaymentMethodChangeEvent - Web APIs
the paymentmethodchangeevent interface of the payment request api describes the paymentmethodchange event which is fired by some payment handlers when the user switches payment instruments (e.g., a user selects a "store" card to make a purchase while using apple pay).
... methoddetails read only secure context an object containing payment method-specific data useful when handling a payment method change.
PaymentRequest.PaymentRequest() - Web APIs
this is typically used when details.modifiers.additionalitems adds a discount or a surchase to the request.
... shippingtype lets you specify how the user interface refers to shipping when the word 'shipping' isn't appropriate for your use case.
PaymentRequest.canMakePayment() - Web APIs
you can call this before calling show() to provide a streamlined user experience when the user's browser can't handle any of the payment methods you accept.
...}) canpay = await paymentrequest.canmakepayment(); returns a promise to a boolean that resolves to true if the user agent supports any of the payment methods supplied when instantiating the request using the paymentrequest constructor.
PaymentRequest.onmerchantvalidation - Web APIs
the paymentrequest event handler onmerchantvalidation is invoked when the merchantvalidation is fired, indicating that the payment handler (e.g., apple pay) requires the merchant to validate themselves.
... syntax paymentrequest.onmerchantvalidation = eventhandlerfunction; value an event handler function which is to be called whenever the merchantvalidation event is fired at the paymentrequest, indicating that the payment handler requires the merchant to validate themselves as allowed to use this payment handler.
PaymentRequest.onshippingaddresschange - Web APIs
the onshippingaddresschange event of the paymentrequest interface is fired whenever the user changes their shipping address, including when an address is added by the user for the first time.
...to make sure an updated address is included when sending payment information to the server, you should add event listeners for a paymentrequest object after instantiation, but before the call to show().
PaymentRequest.shippingAddress - Web APIs
you can trigger this by setting paymentoptions.requestshipping to true when calling the paymentrequest constructor.
...when the paymentrequest.onshippingaddresschange is called, updatedetails() is called to update the details of the paymentrequest, using shippingaddress to set the correct shipping cost.
PaymentResponse.onpayerdetailchange - Web APIs
the paymentresponse object's onpayerdetailchange property is an event handler which is called to handle the payerdetailchange event, which is sent to the paymentresponse when the user makes changes to their personal information while filling out a payment request form.
... syntax paymentresponse.onpayerdetailchange = eventhandlerfunction; value an event handler function which is called to handle the payerdetailchange event when the user makes changes to their personal information while editing a payment request form.
PaymentResponse.shippingAddress - Web APIs
you can trigger this by setting paymentoptions.requestshipping to true when calling the paymentrequest constructor.
...when the paymentrequest.onshippingaddresschange is called, updatedetails() is called to update the details of the paymentrequest, using shippingaddress to set the correct shipping cost.
Using the Payment Request API - Web APIs
recommending a payment app when user has no apps if you select to pay with the bobpay demo payment provider on this merchant page, it tries to call paymentrequest.show(), while intercepting the notsupportederr exception.
...for demo purposes: intropanel.style.display = 'none'; legacypanel.style.display = 'block'; } }); }); note: see our recommending a payment app when user has no apps demo for the full code.
performance.measure() - Web APIs
when measuring between two marks, there is a start mark and end mark, respectively.
... name - set to the "name" given when the measure was created.
PerformanceEntry.entryType - Web APIs
mark performancemark domstring the name used when the mark was created by calling performance.mark().
... measure performancemeasure domstring name used when the measure was created by calling performance.measure().
PerformanceEntry.name - Web APIs
domstring performancemark mark the name used when the mark was created by calling performance.mark().
... domstring performancemeasure measure name used when the measure was created by calling performance.measure().
PerformanceMark - Web APIs
performanceentry.name returns the name given to the mark when it was created via a call to performance.mark().
... performanceentry.starttime returns the domhighrestimestamp when performance.mark() was called.
PerformanceMeasure - Web APIs
performanceentry.name returns the name given to the measure when it was created via a call to performance.measure().
... performanceentry.starttime returns a timestamp given to the measure when performance.measure() was called.
PerformanceNavigationTiming.loadEventEnd - Web APIs
the loadeventend read-only property returns a timestamp which is equal to the time when the load event of the current document is completed.
... syntax perfentry.loadeventend; return value a timestamp representing the time when the load event of the current document is completed.
PointerEvent.pressure - Web APIs
for hardware that does not support pressure, such as a mouse, the value is 0.5 when the pointer is active buttons state and 0 otherwise.
... example in this snippet, when a pointerdown event is fired, different functions are called depending on the value of the event's pressure property.
PopStateEvent - Web APIs
and the event is only triggered when the user navigates between two history entries for the same document.
...n: http://example.com/example.html?page=1, state: {"page":1}" history.back(); // alerts "location: http://example.com/example.html, state: null history.go(2); // alerts "location: http://example.com/example.html?page=3, state: {"page":3} note that even though the original history entry (for http://example.com/example.html) has no state object associated with it, a popstate event is still fired when we activate that entry after the second call to history.back().
ProgressEvent() - Web APIs
when downloading a resource using http, this only represent the part of the content itself, not headers and other overhead.
...when downloading a resource using http, this only represent the content itself, not headers and other overhead.
ProgressEvent.initProgressEvent() - Web APIs
when downloading a resource using http, this only represent the part of the content itself, not headers and other overhead.
...when downloading a resource using http, this only represent the content itself, not headers and other overhead.
ProgressEvent - Web APIs
when downloading a resource using http, this only represent the part of the content itself, not headers and other overhead.
...when downloading a resource using http, this only represent the content itself, not headers and other overhead.
PromiseRejectionEvent() - Web APIs
the promiserejectionevent() constructor returns a newly created promiserejectionevent, which represents events fired when a javascript promise is rejected.
... there are two types of promiserejectionevent: unhandledrejection is sent by the javascript runtime when a promise is rejected but the rejection goes unhandled.
PublicKeyCredential.response - Web APIs
an authenticatorresponse is either: an authenticatorattestationresponse (when the publickeycredential is created via credentialscontainer.create()) an authenticatorassertionresponse (when the publickeycredential is obtained via credentialscontainer.get()).
... note: when validating the fetching of existing credentials, the whole publickeycredential object and the client extensions are necessary for the relying party's server.
PushSubscription.unsubscribe() - Web APIs
the unsubscribe() method of the pushsubscription interface returns a promise that resolves to a boolean when the current subscription is successfully unsubscribed.
... returns a promise that resolves to a boolean when the current subscription is successfully unsubscribed.
RTCDataChannel.bufferedAmount - Web APIs
whenever this value decreases to fall to or below the value specified in the bufferedamountlowthreshold property, the user agent fires the bufferedamountlow event.
... this event may be used, for example, to implement code which queues more messages to be sent whenever there's room to buffer them.
RTCDataChannel.bufferedAmountLowThreshold - Web APIs
when the number of buffered outgoing bytes, as indicated by the bufferedamount property, falls to or below this value, a bufferedamountlow event is fired.
... this event may be used, for example, to implement code which queues more messages to be sent whenever there's room to buffer them.
RTCDataChannel.maxPacketLifeTime - Web APIs
the read-only rtcdatachannel property maxpacketlifetime returns the amount of time, in milliseconds, the browser is allowed to take to attempt to transmit a message, as set when the data channel was created, or null.
...if not set when rtcpeerconnection.createdatachannel() was called to create the data channel, this value is null.
RTCDataChannel.onbufferedamountlow - Web APIs
the rtcdatachannel.onbufferedamountlow property is an eventhandler which specifies a function the browser calls when the bufferedamountlow event is sent to the rtcdatachannel.
... this event, which is represented by a simple event object, is sent when the amount of data buffered to be sent falls to or below the threshold specified by the channel's bufferedamountlowthreshold.
RTCDataChannel.onclose - Web APIs
the rtcdatachannel.onclose property is an eventhandler which specifies a function to be called by the browser when the close event is received by the rtcdatachannel.
... this way, the message entry field and the send button are only enabled for use when the connection is actually open.
RTCDataChannel.onmessage - Web APIs
the rtcdatachannel.onmessage property stores an eventhandler which specifies a function to be called when the message event is fired on the channel.
...this event is sent to the channel when a message is received from the other peer.
RTCDataChannelEvent - Web APIs
these events sent to an rtcpeerconnection when its remote peer is asking to open an rtcdatachannel between the two peers.
...just listen for the datachannel event to be received by the rtcpeerconnection and when you receive it, use the rtcdatachannelevent.channel property to gain access to the data channel which has been opened.
RTCIceCandidate.protocol - Web APIs
protocol is null by default if not specified properly in the sdp, but this is an error condition and will result in a thrown exception when you call rtcpeerconnection.addicecandidate().
... the protocol property's value is set when the rtcicecandidate() constructor is used.
RTCIceServer.credential - Web APIs
the rtciceserver dictionary's credential property is a string providing the credential to use when connecting to the described server.
... this value is used when the rtciceserver describes a turn server.
RTCIceServer.username - Web APIs
the rtciceserver dictionary's username property is a string which specifies the username to use when authenticating with the ice server being described.
... this value is used when the rtciceserver describes a turn server.
RTCIceServer - Web APIs
properties credential optional the credential to use when logging into the server.
... credentialtype optional if the rtciceserver represents a turn server, this attribute specifies what kind of credential is to be used when connecting.
RTCIceTransport.onselectedcandidatepairchange - Web APIs
the rtcicetransport interface's onselectedcandidatepairchange event handler specifies a function to be called to handle the selectedcandidatepairchange event, which is fired when the ice agent selects a new candidate pair to be used for the connection.
... syntax rtcicetransport.onselectedcandidatepairchange = candidatepairhandler; value this propoerty should be set to reference an event handler function to be called by the ice agent when it discovers a new candidate pair that the rtcicetransport will be using for communication with the remote peer.
RTCIceTransport.onstatechange - Web APIs
the onstatechange event handler for the rtcicetransport interface is a property which specifies a function to serve as the eventhandler for the statechange event that is fired whenever the transport's state changes.
... syntax rtcicetransport.onstatechange = statechangehandler; value set this property to reference a function you provide that is called by the webrtc layer when the rtcicetransport object's state changes.
RTCIceTransport - Web APIs
selectedcandidatepairchange sent to the rtcicetransport when a new, better pair of candidates has been selected to describe the connectivity between the two peers.
... statechange sent to the rtcicetransport instance when the value of the state property has changed, indicating that the ice gathering process has changed state.
RTCIceTransportState - Web APIs
if the restart occured during a transient "disconnected" state, the state transitions to "checking" the disconnected state "disconnected" is a transient state that occurs when the connection between the two peers fails in a manner that the webrtc infrastructure can automatically correct once the connection is available again.
... the "disconnected" state can also occur when the transport has finished checking all existing candidate pairs and has not found a pair that will work—or a valid pair was found but rejected due to consent to use the pair being denied.
RTCOfferAnswerOptions.voiceActivityDetection - Web APIs
the default value, true, indicates that voice detection should be used and that if possible, the user agent should automatically disable or mute outgoing audio when the audio source is not sensing a human voice.
...the default value, true, indicates that the user agent should monitor the audio coming from the microphone or other audio source and automatically cease transmitting data or mute when the user isn't speaking into the microphone, a value of false indicates that the audio should continue to be transmitted regardless of whether or not speech is detected.
RTCOfferAnswerOptions - Web APIs
it's used as the base type for the options parameter when calling createoffer() or createanswer() on an rtcpeerconnection.
... properties voiceactivitydetection optional for configurations of systems and codecs that are able to detect when the user is speaking and toggle muting on and off automatically, this option enables and disables that behavior.
RTCOfferOptions.iceRestart - Web APIs
the icerestart property of the rtcofferoptions dictionary is a boolean value which, when true, tells the rtcpeerconnection to start ice renegotiation.
... usage notes when the rtcpeerconnection object's ice connection state changes to failed, you should try to trigger an ice restart.
RTCOfferOptions - Web APIs
the rtcofferoptions dictionary is used to provide optional settings when creating an rtcpeerconnection offer with the createoffer() method.
... icerestart optional a boolean which, when set to true, tells createoffer() to generate and use new values for the identifying properties of the sdp it creates, resulting in a request that triggers renegotiation of the ice connection.
RTCPeerConnection: datachannel event - Web APIs
a datachannel event is sent to an rtcpeerconnection instance when an rtcdatachannel has been added to the connection, as a result of the remote peer calling rtcpeerconnection.createdatachannel().
... note: this event is not dispatched when the local end of the connection creates the channel.
RTCPeerConnection.iceConnectionState - Web APIs
you can detect when this value has changed by watching for the iceconnectionstatechange event.
...when the problem resolves, the connection may return to the "connected" state.
RTCPeerConnection: idpassertionerror event - Web APIs
an idpassertionerror event informs the target, a rtcpeerconnection object, that the identity provider (idp) encountered an error when trying to generate an identity assertion.
... bubbles no cancelable no interface rtcidentityerrorevent event handler property onidpassertionerror warning: this event is no longer used; instead, you can detect an assertion error by detecting when the promise returned by rtcpeerconnection.peeridentity is rejected.
RTCPeerConnection: negotiationneeded event - Web APIs
a negotiationneeded event is sent to the rtcpeerconnection when negotiation of the connection through the signaling channel is required.
... bubbles no cancelable no interface event event handler property rtcpeerconnection.onnegotiationneeded the negotiationneeded event is first dispatched to the rtcpeerconnection when media is first added to the connection.
RTCPeerConnection.ondatachannel - Web APIs
the rtcpeerconnection.ondatachannel property is an eventhandler which specifies a function which is called when the datachannel event occurs on an rtcpeerconnection.
... this event, of type rtcdatachannelevent, is sent when an rtcdatachannel is added to the connection by the remote peer calling createdatachannel().
RTCPeerConnection.onicecandidateerror - Web APIs
the rtcpeerconnection.onicecandidateerror property is an eventhandler which specifies a function which is called to handle the icecandidateerror event when it occurs on an rtcpeerconnection instance.
... this event is fired when an error occurs during the ice candidate gathering process.
RTCPeerConnection.oniceconnectionstatechange - Web APIs
the rtcpeerconnection.oniceconnectionstatechange property is an event handler which specifies a function to be called when the iceconnectionstatechange event is fired on an rtcpeerconnection instance.
... this happens when the state of the connection's ice agent, as represented by the iceconnectionstate property, changes.
RTCPeerConnection.onicegatheringstatechange - Web APIs
the rtcpeerconnection.onicegatheringstatechange property is an eventhandler which specifies a function to be called when the icegatheringstatechange event is sent to an rtcpeerconnection instance.
... this happens when the ice gathering state—that is, whether or not the ice agent is actively gathering candidates—changes.
RTCPeerConnection.onidentityresult - Web APIs
the rtcpeerconnection.onidentityresult event handler is a property containing the code to execute when the identityresult event, of type rtcidentityevent, is received by this rtcpeerconnection.
... such an event is sent when an identity assertion is generated, via getidentityassertion() or during the creation of an offer or an answer.
RTCPeerConnection.onidpassertionerror - Web APIs
the rtcpeerconnection.onidpassertionerror event handler is a property containing the code to execute whent the idpassertionerror event, of type rtcidentityerrorevent, is received by this rtcpeerconnection.
... such an event is sent when the associated identity provider (idp) encounters an error while generating an identity assertion.
RTCPeerConnection.onidpvalidationerror - Web APIs
the rtcpeerconnection.onidpvalidationerror event handler is a property containing the code to execute whent the idpvalidationerror event, of type rtcidentityerrorevent, is received by this rtcpeerconnection.
... such an event is sent when the associated identity provider (idp) encounters an error while validating an identity assertion.
RTCPeerConnection.onpeeridentity - Web APIs
the rtcpeerconnection.onpeeridentity event handler is a property containing the code to execute whent the peeridentity event, of type event, is received by this rtcpeerconnection.
... such an event is sent when an identity assertion, received from a peer, has been successfully validated.
RTCPeerConnection.onremovestream - Web APIs
the rtcpeerconnection.onremovestream event handler is a property containing the code to execute when the removestream event, of type mediastreamevent, is received by this rtcpeerconnection.
... such an event is sent when a mediastream is removed from this connection.
RTCPeerConnection.onsignalingstatechange - Web APIs
the onsignalingstatechange event handler property of the rtcpeerconnection interface specifies a function to be called when the signalingstatechange event occurs on an rtcpeerconnection interface.
... the function receives as input the event object of type event; this event is sent when the peer connection's signalingstate changes, which may happen either because of a call to setlocaldescription() or to setremotedescription().
RTCPeerConnection.ontrack - Web APIs
the rtcpeerconnection property ontrack is an eventhandler which specifies a function to be called when the track event occurs, indicating that a track has been added to the rtcpeerconnection.
... the function receives as input the event object, of type rtctrackevent; this event is sent when a new incoming mediastreamtrack has been created and associated with an rtcrtpreceiver object which has been added to the set of receivers on connection.
RTCPeerConnection: peeridentity event - Web APIs
the peeridentity event is sent to the connection concerned when peer identity has been set and verified on it.
...instead of using this event to detect when an identity is available, simply wait for the promise returned by rtcpeerconnection.peeridentity to be resolved.
RTCPeerConnection.setLocalDescription() - Web APIs
deprecated exceptions when using the deprecated callback-based version of setlocaldescription(), the following exceptions may occur: invalidstateerror the connection's signalingstate is "closed", indicating that the connection is not currently open, so negotiation cannot take place.
... async function handlenegotiationneededevent() { try { await offer = pc.createoffer(); pc.setlocaldescription(offer); signalremotepeer({ description: pc.localdescription }); } catch(err) { reporterror(err); } } this begins by creating an offer by calling createoffer(); when that succeeds, we call setlocaldescription().
RTCPeerConnection.signalingState - Web APIs
because the signaling process is a state machine, being able to verify that your code is in the expected state when messages arrive can help avoid unexpected and avoidable failures.
... in addition, when the value of this property changes, a signalingstatechange event is sent to the rtcpeerconnection instance.
RTCRtpReceiver.transport - Web APIs
description when the rtcrtpreceiver is first created, the value of transport is null.
... note that when bundling is in effect—that is, when the rtcpeerconnection was created with an rtcconfiguration object whose bundlepolicy is max-compat or max-bundle—multiple receivers may be sharing the same transport; in this case, all of them are using the same connection to transmit and/or receive rtp and rtcp packets.
RTCRtpSender.transport - Web APIs
description when the rtcrtpsender is first created, the value of transport is null.
... note that when bundling is in effect—that is, when the rtcpeerconnection was created with an rtcconfiguration object whose bundlepolicy is max-compat or max-bundle—multiple senders may be sharing the same transport; in this case, all of them are using the same connection to transmit and/or receive rtp and rtcp packets.
RTCRtpTransceiver.direction - Web APIs
exceptions when setting the value of direction, the following exceptions can occur: invalidstateerror either the receiver's rtcpeerconnection is closed or the rtcrtpreceiver is stopped.
... usage notes setting the direction when you change the value of direction, an invalidstateerror exception will occur if the connection is closed or the receiver is stopped.
RTCRtpTransceiver.setCodecPreferences() - Web APIs
when preparing to open an rtcpeerconnection, you can change the codec parameters from the user agent's default configuration by calling setcodecparameters() before calling either rtcpeerconnection.createoffer() or createanswer().
...if any unsupported codecs are listed, the browser will throw an invalidaccesserror exception when you call this method.
ReadableStream.cancel() - Web APIs
cancel is used when you've completely finished with the stream and don't need any more data from it, even if there are chunks enqueued waiting to be read.
...when the search terms is found, cancel() is used to cancel the stream — the job is finished so it is no longer needed.
ReadableStream.getReader() - Web APIs
function fetchstream() { const reader = stream.getreader(); let charsreceived = 0; // read() returns a promise that resolves // when a value has been received reader.read().then(function processtext({ done, value }) { // result objects contain two properties: // done - true if the stream has already given you all its data.
...always undefined when done is true.
ReadableStream.tee() - Web APIs
function teestream() { const teedoff = stream.tee(); fetchstream(teedoff[0], list2); fetchstream(teedoff[1], list3); } function fetchstream(stream, list) { const reader = stream.getreader(); let charsreceived = 0; // read() returns a promise that resolves // when a value has been received reader.read().then(function processtext({ done, value }) { // result objects contain two properties: // done - true if the stream has already given you all its data.
...always undefined when done is true.
ReadableStreamDefaultController.error() - Web APIs
note: the error() method can be called more than once, and can be called when the stream is not readable.
... examples the a readable stream with an underlying push source and backpressure support example in the spec provides a good example of using readablestreamdefaultcontroller.desiredsize to manually detect when the stream is full and apply backpressure, and also of using error() to manually trigger a stream error if another part of the system it relies on fails.
ReadableStreamDefaultReader.ReadableStreamDefaultReader() - Web APIs
function fetchstream() { const reader = stream.getreader(); let charsreceived = 0; // read() returns a promise that resolves // when a value has been received reader.read().then(function processtext({ done, value }) { // result objects contain two properties: // done - true if the stream has already given you all its data.
...always undefined when done is true.
ReadableStreamDefaultReader.read() - Web APIs
function fetchstream() { const reader = stream.getreader(); let charsreceived = 0; // read() returns a promise that resolves // when a value has been received reader.read().then(function processtext({ done, value }) { // result objects contain two properties: // done - true if the stream has already given you all its data.
...always undefined when done is true.
Request.mode - Web APIs
WebAPIRequestmode
for example, when a request object is created using the request.request constructor, the value of the mode property for that request is set to cors.
... however, for requests created other than by the request.request constructor, no-cors is typically used as the mode; for example, for embedded resources where the request is initiated from markup, unless the crossorigin attribute is present, the request is in most cases made using the no-cors mode — that is, for the <link> or <script> elements (except when used with modules), or <img>, <audio>, <video>, <object>, <embed>, or <iframe> elements.
ResizeObserver() - Web APIs
syntax var resizeobserver = new resizeobserver(callback) parameters callback the function called whenever an observed resize occurs.
...this could be used for example to automatically unobserve the observer when a certain condition is reached, but you can omit it if you don't need it.
ResizeObserverEntry.contentBoxSize - Web APIs
the contentboxsize read-only property of the resizeobserverentry interface returns an array containing the new content box size of the observed element when the callback is run.
...when the viewport size is changed, the box's rounded corners change in proportion to the size of the box.
Response.clone() - Web APIs
WebAPIResponseclone
in fact, the main reason clone() exists is to allow multiple uses of body objects (when they are one-use only.) syntax var response2 = response1.clone(); parameters none.
...when the fetch resolves successfully, we clone it, extract a blob from both responses using two body.blob calls, create object urls out of the blobs using url.createobjecturl, and display them in two separate <img> elements.
RsaPssParams - Web APIs
the rsapssparams dictionary of the web crypto api represents the object that should be passed as the algorithm parameter into subtlecrypto.sign() or subtlecrypto.verify(), when using the rsa-pss algorithm.
... rfc 3447 says that "typical salt lengths" are either 0 or the length of the output of the digest algorithm that was selected when this key was generated.
SVGAElement - Web APIs
svgaelement.ping is a domstring that reflects the ping attribute, containing a space-separated list of urls to which, when the hyperlink is followed, post requests with the body ping will be sent by the browser (in the background).
... example in the example below, the target attribute of the <a> element is set to _blank and when the link is clicked, it logs to notify whether the condition is met or not.
SVGAnimationElement: beginEvent event - Web APIs
the beginevent event of the svganimationelement interface is fired when the element local timeline begins to play.
... it will be raised each time the element begins the active duration (i.e., when it restarts, but not when it repeats).
SVGMarkerElement - Web APIs
exceptions: a domexception with code no_modification_allowed_err is raised when the object itself is read only.
... exceptions: a domexception with code no_modification_allowed_err is raised when the object itself is read only.
SVGMatrix - Web APIs
WebAPISVGMatrix
many of svg's graphics operations utilize 2x3 matrices of the form: [a c e] [b d f] which, when expanded into a 3x3 matrix for the purposes of matrix arithmetic, become: [a c e] [b d f] [0 0 1] an svgmatrix object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown.
... exceptions a domexception with the code no_modification_allowed_err is raised when attempting updating a read-only attribute or when the object itself is read-only.
SVGSVGElement - Web APIs
when the browser is actually rendering the content, then the position and size values represent the actual values when rendering.
...when the browser actually knows the physical size of a "screen unit", this float attribute will express that information; otherwise, user agents will provide a suitable default value (such as .28mm).
Screen.mozBrightness - Web APIs
you can read and write this attribute even when the screen is disabled, but the backlight is off while the screen is disabled.
... if you write a value of x into this attribute, the attribute may not have the same value x when you later read it.
Screen.width - Web APIs
WebAPIScreenwidth
when other widgets occupy space that cannot be used by the window object, there is a difference in window.screen.width and window.screen.availwidth.
... internet explorer will take into account the zoom setting when reporting the screen width.
Sensor APIs - Web APIs
checking for thrown errors when instantiating a sensor object.
...the only time anything is shown to the user is when permissions need to be requested and when the sensor type isn't supported by the device.
ServiceWorker.onstatechange - Web APIs
an eventlistener property called whenever an event of type statechange is fired; it is basically fired anytime the serviceworker.state changes.
...) { serviceworker = registration.waiting; document.queryselector('#kind').textcontent = 'waiting'; } else if (registration.active) { serviceworker = registration.active; document.queryselector('#kind').textcontent = 'active'; } if (serviceworker) { logstate(serviceworker.state); serviceworker.addeventlistener('statechange', function(e) { logstate(e.target.state); }); } note that when statechange fires, the service worker's references may have changed.
ServiceWorkerGlobalScope.onactivate - Web APIs
the onactivate property of the serviceworkerglobalscope interface is an event handler fired whenever an activate event occurs (when the service worker activates).
... this happens after installation, when the page to be controlled by the service worker refreshes.
ServiceWorkerGlobalScope.onfetch - Web APIs
the onfetch property of the serviceworkerglobalscope interface is an event handler fired whenever a fetch event occurs (usually when the windoworworkerglobalscope.fetch() method is called.) syntax serviceworkerglobalscope.onfetch = function(fetchevent) { ...
...when fired, the code returns a promise that resolves to the first matching request in the cache object.
ServiceWorkerGlobalScope.onpushsubscriptionchange - Web APIs
when browser refresh the push subscription.
... previously, it was defined as the event interface that is fired whenever a push subscription has been invalidated (or is about to become so).
ServiceWorkerGlobalScope.onsync - Web APIs
the serviceworkerglobalscope.onsync event of the serviceworkerglobalscope interface is fired whenever a syncevent event occurs.
... this is triggered when a call to syncmanager.register is made from a service worker client page.
ServiceWorkerMessageEvent - Web APIs
the event object is accessed via the handler function of a message event, when fired by a message received from a service worker.
... examples when the following code is used inside the main thread to set up a message channel between it and a service worker for sending messages between the two, the event object of onmessage will be a serviceworkermessageevent.
ServiceWorkerRegistration - Web APIs
an active worker will control a serviceworkerclient if the client's url falls within the scope of the registration (the scope option set when serviceworkercontainer.register is first called.) serviceworkerregistration.navigationpreload read only returns the instance of navigationpreloadmanager associated with the current service worker registration.
... event handlers serviceworkerregistration.onupdatefound read only an eventlistener property called whenever an event of type updatefound is fired; it is fired any time the serviceworkerregistration.installing property acquires a new service worker.
SharedWorkerGlobalScope: connect event - Web APIs
the connect event is fired in shared workers at their sharedworkerglobalscope when a new client connects.
... bubbles no cancelable no interface messageevent event handler property sharedworkerglobalscope.onconnect examples this example shows a shared worker file — when a connection to the worker occurs from a main thread via a messageport, the onconnect event handler fires.
SharedWorkerGlobalScope.onconnect - Web APIs
the onconnect property of the sharedworkerglobalscope interface is an event handler representing the code to be called when the connect event is raised — that is, when a messageport connection is opened between the associated sharedworker and the main thread.
...}; examples this example shows a shared worker file — when a connection to the worker occurs from a main thread via a messageport, the onconnect event handler fires.
SourceBuffer.abort() - Web APIs
saying that, current implementations can be useful in certain situations, when you want to stop the current append (or whatever) operation occuring on a sourcebuffer, and then immediately start performing operations on it again.
... you can see something similar in action in nick desaulnier's bufferwhenneeded demo — in line 48, an event listener is added to the playing video so a function called seek() is run when the seeking event fires.
SourceBuffer.removeAsync() - Web APIs
a promise is returned, which is fulfilled when the buffers in the specified time range have been removed.
... this method can only be called when updating is false.
SpeechSynthesis.onvoiceschanged - Web APIs
the onvoiceschanged property of the speechsynthesis interface represents an event handler that will run when the list of speechsynthesisvoice objects that would be returned by the speechsynthesis.getvoices() method has changed (when the voiceschanged event fires.) this may occur when speech synthesis is being done on the server-side and the voices list is being determined asynchronously, or when client-side voices are installed/uninstalled while a speech synthesis application is running.
...}; examples this could be used to populate a list of voices that the user can choose between when the event fires (see our speak easy synthesis demo.) note that firefox doesn't support it at present, and will just return a list of voices when speechsynthesis.getvoices() is fired.
SpeechSynthesis.speak() - Web APIs
the speak() method of the speechsynthesis interface adds an utterance to the utterance queue; it will be spoken when any other utterances queued before it have been spoken.
...when a form containing the text we want to speak is submitted, we (amongst other things) create a new utterance containing this text, then speak it by passing it into speak() as a parameter.
SpeechSynthesis - Web APIs
speechsynthesis.speak() adds an utterance to the utterance queue; it will be spoken when any other utterances queued before it have been spoken.
... voiceschanged fired when the list of speechsynthesisvoice objects that would be returned by the speechsynthesis.getvoices() method has changed.
StereoPannerNode.pan - Web APIs
we then use an oninput event handler to change the value of the stereopannernode.pan parameter and update the pan value display when the slider is moved.
...ector('.panning-control'); var panvalue = document.queryselector('.panning-value'); pre.innerhtml = myscript.innerhtml; // create a mediaelementaudiosourcenode // feed the htmlmediaelement into it var source = audioctx.createmediaelementsource(myaudio); // create a stereo panner var pannode = audioctx.createstereopanner(); // event handler function to increase panning to the right and left // when the slider is moved pancontrol.oninput = function() { pannode.pan.setvalueattime(pancontrol.value, audioctx.currenttime); panvalue.innerhtml = pancontrol.value; } // connect the mediaelementaudiosourcenode to the pannode // and the pannode to the destination, so we can play the // music and adjust the panning using the controls source.connect(pannode); pannode.connect(audioctx.destination);...
StereoPannerNode - Web APIs
we then use an oninput event handler to change the value of the stereopannernode.pan parameter and update the pan value display when the slider is moved.
...ector('.panning-control'); var panvalue = document.queryselector('.panning-value'); pre.innerhtml = myscript.innerhtml; // create a mediaelementaudiosourcenode // feed the htmlmediaelement into it var source = audioctx.createmediaelementsource(myaudio); // create a stereo panner var pannode = audioctx.createstereopanner(); // event handler function to increase panning to the right and left // when the slider is moved pancontrol.oninput = function() { pannode.pan.setvalueattime(pancontrol.value, audioctx.currenttime); panvalue.innerhtml = pancontrol.value; } // connect the mediaelementaudiosourcenode to the pannode // and the pannode to the destination, so we can play the // music and adjust the panning using the controls source.connect(pannode); pannode.connect(audioctx.destination);...
Storage.setItem() - Web APIs
WebAPIStoragesetItem
the setitem() method of the storage interface, when passed a key name and value, will add that key to the given storage object, or update that key's value if it already exists.
...particularly, in mobile safari (since ios 5) it always throws when the user enters private mode.
Storage API - Web APIs
when clearing site storage units, an origin's box is treated as a single entity; if the user agent needs to clear it and the user approves, the entire data store is cleared rather than providing some means of clearing only data from individual apis.
... to determine the estimated quota and usage values for a given origin, use the navigator.storage.estimate() method, which returns a promise that, when resolved, receives a storageestimate that contains these figures.
Using the Storage Access API - Web APIs
usage notes the storage access api is designed to allow embedded content to request access to storage that would otherwise be blocked when a user’s browser is set to block all third-party cookies.
...this is particularly true for document.cookie access, as browsers will often return an empty cookie jar when third-party cookies are blocked.
SubtleCrypto.decrypt() - Web APIs
exceptions the promise is rejected when the following exceptions are encountered: invalidaccesserror raised when the requested operation is not valid for the provided key (e.g.
... operationerror raised when the operation failed for an operation-specific reason (e.g.
SubtleCrypto.deriveBits() - Web APIs
exceptions the promise is rejected when one of the following exceptions are encountered: invalidaccesserror raised when the base key is not a key for the requested derivation algorithm or if the cryptokey.usages value of that key doesn't contain derivekey.
... notsupported raised when trying to use an algorithm that is either unknown or isn't suitable for derivation, or if the algorithm requested for the derived key doesn't define a key length.
SubtleCrypto.generateKey() - Web APIs
exceptions the promise is rejected when the following exception is encountered: syntaxerror raised when the result is a cryptokey of type secret or private but keyusages is empty.
... syntaxerror raised when the result is a cryptokeypair and its privatekey.usages attribute is empty.
SubtleCrypto.importKey() - Web APIs
exceptions the promise is rejected when one of the following exceptions is encountered: syntaxerror raised when keyusages is empty but the unwrapped key is of type secret or private.
... typeerror raised when trying to use an invalid format or if the keydata is not suited for that format.
SyncManager.register() - Web APIs
the available options are: allowonbattery: a boolean that determines whether synchronization is allowed when the user agent is on a battery-powered device.
... idlerequired: a boolean that determines whether synchronization is allowed when the user agent's device is idle.
TextDecoder() - Web APIs
", "gb_2312-80", "gbk", "iso-ir-58", "x-gbk" 'gbk' "gb18030" 'gb18030' "hz-gb-2312" 'hz-gb-2312' "big5", "big5-hkscs", "cn-big5", "csbig5", "x-x-big5" 'big5' "cseucpkdfmtjapanese", "euc-jp", "x-euc-jp" 'euc-jp' "csiso2022jp", "iso-2022-jp" note: firefox used to accept iso-2022-jp-2 sequences silently when an iso-2022-jp decoder was instantiated, however this was removed in version 56 to simplify the api, as no other browsers support it and no pages seem to use it.
..."utf-16be" 'utf-16be' "utf-16", "utf-16le" 'utf-16le' "x-user-defined" 'x-user-defined' "iso-2022-cn", "iso-2022-cn-ext" 'replacement' optionsoptional is a textdecoderoptions dictionary with the property: fatal a boolean flag indicating if the textdecoder.decode() method must throw a domexception with the "encodingerror" value when an coding error is found.
TextTrack - Web APIs
WebAPITextTrack
events cuechange fired when cues are entered and exited.
... a given text cue appears when the cue is entered and disappears when the cue is exited.
TextTrackList.onremovetrack - Web APIs
the texttracklist onremovetrack event handler is called when the removetrack event occurs, indicating that a text track has been removed from the media element, and therefore also from the texttracklist.
... example this simple example just fetches the current number of text tracks in the first media element whenever a track is removed from the media element.
Touch - Web APIs
WebAPITouch
this can be helpful when dealing with imprecise pointing devices such as fingers.
... touch.target read only returns the element on which the touch point started when it was first placed on the surface, even if the touch point has since moved outside the interactive area of that element or even been removed from the document.
UIEvent.isChar - Web APIs
WebAPIUIEventisChar
when this is the case, ischar returns false.
... it is used when event handlers need to do something like echo the input on the screen.
URL.createObjectURL() - Web APIs
each of these must be released by calling url.revokeobjecturl() when you no longer need them.
... browsers will release object urls automatically when the document is unloaded; however, for optimal performance and memory usage, if there are safe times when you can explicitly unload them, you should do so.
URLUtilsReadOnly - Web APIs
utilsreadonlychrome no support noedge no support nofirefox full support 57 full support 57 no support 3.5 — 57notes notes firefox has a bug whereby single quotes contained in urls are escaped when accessed via url apis (see bug 1386683).ie no support noopera no support nosafari no support nowebview android no support nochrome android no support nofirefox android ...
... full support 57 full support 57 no support 4 — 57notes notes firefox has a bug whereby single quotes contained in urls are escaped when accessed via url apis (see bug 1386683).opera android no support nosafari ios no support nosamsung internet android no support nohash experimentalchrome no support noedge no support nofirefox full support 38 full support 38 no ...
USB - Web APIs
WebAPIUSB
event handlers usb.onconnect an event handler called whenever a previously paired device is connected.
... usb.ondisconnect an event handler called whenever a paired device is disconnected.
USBDevice.clearHalt() - Web APIs
the clearhalt() method of the usbdevice interface returns a promise that resolves when a halt condition is cleared.
... a halt condition is when a data tranfer to or from the device has a status of 'stall', which requires the web page (the host system, in usb terminology) to clear that condition.
ValidityState.patternMismatch - Web APIs
when true, the element matches the :invalid css pseudo-classes.
...when invalid, the validitystate.typemismatch will be true, if there is no pattern attribute (or if the pattern attribute is not valid for that input type).
ValidityState.typeMismatch - Web APIs
s given the following: <p> <label> enter an email address: <input type="email" value="example.com"/> </label> </p> <p> <label> enter a url: <input type="url" value="example.com"/> </label> </p> input:invalid { border: red solid 3px; } the above each produce a typemismatch because the email address is just a domain and the url has no protocol the typemismatch occurs when there is a disconnect between the value expected via the type attribute and the data that is actually present.
...when the value provided doesn't match the expected value based on the type for other input types, you get different errors.
VideoTrackList.onchange - Web APIs
the videotracklist property onchange is an event handler which is called when the change event occurs, indicating that a videotrack in the videotracklist has been made active.
... syntax videotracklist.onchange = eventhandler; value set onchange to a function that should be called whenever a track is made active.
VideoTrackList.onremovetrack - Web APIs
the videotracklist onremovetrack event handler is called when the removetrack event occurs, indicating that a video track has been removed from the media element, and therefore also from the videotracklist.
... example this simple example just fetches the current number of video tracks in the media element whenever a track is removed from the media element.
VisualViewport.onresize - Web APIs
the onresize event handler of the visualviewport interface is called when a viewport is resized, i.e.
... when the resize event is fired.
VisualViewport.onscroll - Web APIs
the onscroll event handler of the visualviewport interface is called when a viewport is scrolled, i.e.
... when the scroll event is fired.
WEBGL_compressed_texture_atc - Web APIs
ext.compressed_rgba_atc_explicit_alpha_webgl compresses rgba textures using explicit alpha encoding (useful when alpha transitions are sharp).
... ext.compressed_rgba_atc_interpolated_alpha_webgl compresses rgba textures using interpolated alpha encoding (useful when alpha transitions are gradient).
WebGL2RenderingContext.drawElementsInstanced() - Web APIs
note: when using webgl 1, the angle_instanced_arrays extension can provide this method, too.
...possible values are: gl.unsigned_byte gl.unsigned_short when using the oes_element_index_uint extension: gl.unsigned_int offset a glintptr specifying an offset in the element array buffer.
WebGL2RenderingContext.vertexAttribDivisor() - Web APIs
the webgl2renderingcontext.vertexattribdivisor() method of the webgl 2 api modifies the rate at which generic vertex attributes advance when rendering multiple instances of primitives with gl.drawarraysinstanced() and gl.drawelementsinstanced().
... note: when using webgl 1, the angle_instanced_arrays extension can provide this method, too.
WebGL2RenderingContext - Web APIs
some methods of the webgl 1 context can accept additional values when used in a webgl 2 context.
... drawing buffers webgl2renderingcontext.vertexattribdivisor() modifies the rate at which generic vertex attributes advance when rendering multiple instances of primitives with gl.drawarraysinstanced() and gl.drawelementsinstanced().
WebGLRenderingContext.blendEquation() - Web APIs
must be either: gl.func_add: source + destination, gl.func_subtract: source - destination, gl.func_reverse_subtract: destination - source when using the ext_blend_minmax extension: ext.min_ext: minimum of source and destination, ext.max_ext: maximum of source and destination.
... when using a webgl 2 context, the following values are available additionally: gl.min: minimum of source and destination, gl.max: maximum of source and destination.
WebGLRenderingContext.bufferData() - Web APIs
when using a webgl 2 context, the following values are available additionally: gl.copy_read_buffer: buffer for copying from one buffer object to another.
... when using a webgl 2 context, the following values are available additionally: gl.static_read: the contents are intended to be specified once by reading data from webgl, and queried many times by the application.
WebGLRenderingContext.clearDepth() - Web APIs
this specifies what depth value to use when calling the clear() method.
... syntax void gl.cleardepth(depth); parameters depth a glclampf specifying the depth value used when the depth buffer is cleared.
WebGLRenderingContext.clearStencil() - Web APIs
this specifies what stencil value to use when calling the clear() method.
... syntax void gl.clearstencil(s); parameters s a glint specifying the index used when the stencil buffer is cleared.
WebGLRenderingContext.deleteShader() - Web APIs
it will then be deleted whenever the shader is no longer in use.
... this method has no effect if the shader has already been deleted, and the webglshader is automatically marked for deletion when it is destroyed by the garbage collector.
WebGLRenderingContext.getBufferParameter() - Web APIs
when using a webgl 2 context, the following values are available additionally: gl.copy_read_buffer: buffer for copying from one buffer object to another.
... when using a webgl 2 context, the following values are available additionally: gl.static_read, gl.dynamic_read, gl.stream_read, gl.static_copy, gl.dynamic_copy, gl.stream_copy.
WebGLRenderingContext.getVertexAttrib() - Web APIs
when using a webgl 2 context, the following values are available additionally: gl.vertex_attrib_array_integer: returns a glboolean indicating whether or not an integer data type is in the vertex attribute array at the given index.
... when using the angle_instanced_arrays extension: ext.vertex_attrib_array_divisor_angle: returns a glint describing the frequency divisor used for instanced rendering.
WebGLRenderingContext.isContextLost() - Web APIs
the user's computer has multiple graphics processors (such as a laptop with both mobile and desktop class gpus, the former used primarily when on battery power), and the user or system decides to switch gpus.
... examples for example, when checking for program linking success, you could also check if the context is not lost: gl.linkprogram(program); if (!gl.getprogramparameter(program, gl.link_status) && !gl.iscontextlost()) { var info = gl.getprograminfolog(program); console.log('error linking program:\n' + info); } specifications specification status comment webgl 1.0the definition of 'webglrenderi...
WebGLRenderingContext.texImage2D() - Web APIs
when using the webgl_depth_texture extension: gl.depth_component gl.depth_stencil when using the ext_srgb extension: ext.srgb_ext ext.srgb_alpha_ext when using a webgl 2 context, the following values are available additionally: gl.r8 gl.r16f gl.r32f gl.r8ui gl.rg8 gl.rg16f gl.rg32f gl.rg8ui gl.rg16ui gl.rg32ui gl...
... when using the webgl_depth_texture extension: gl.unsigned_short gl.unsigned_int ext.unsigned_int_24_8_webgl (constant provided by the extension) when using the oes_texture_float extension: gl.float when using the oes_texture_half_float extension: ext.half_float_oes (constant provided by the extension) when using a webgl 2 context, the followin...
WebGLRenderingContext.texSubImage2D() - Web APIs
when using the ext_srgb extension: ext.srgb_ext ext.srgb_alpha_ext when using a webgl 2 context, the following values are available additionally: gl.red gl.rg gl.red_integer gl.rg_integer gl.rgb_integer gl.rgba_integer type a glenum specifying the data type of the texel data.
... when using the oes_texture_float extension: gl.float when using the oes_texture_half_float extension: gl.half_float_oes when using a webgl 2 context, the following values are available additionally: gl.byte gl.unsigned_short gl.short gl.unsigned_int gl.int gl.half_float gl.float gl.unsigned_int_2_10_10_10_rev gl.unsigned_int_10f_11f_11f_rev gl.unsigned_int_5_9_9_9_rev gl.unsigned_int_24_8 gl.float_32_unsigned_int...
WebGLRenderingContext.uniform[1234][fi][v]() - Web APIs
all active uniform variables defined in a program object are initialized to 0 when the program object is linked successfully.
... they retain the values assigned to them by a call to this method until the next successful link operation occurs on the program object, when they are once again initialized to 0.
A basic 2D WebGL animation example - Web APIs
in this case, we set the viewport based on the size of the <canvas>, call clearcolor() to set the color to use when clearing content, then we clear the buffer with clear().
... uglobalcolor is set using uniform4fv() to the color we wish to use when drawing the square.
WebGL by example - Web APIs
sometimes we revisit a topic several times, such as when needing to discuss it initially at a basic level, and later at intermediate and advanced levels.
...clearing the rendering context with a random color when the user clicks.
Animating textures in WebGL - Web APIs
getting access to the video the first step is to create the <video> element that we'll use to retrieve the video frames: // will set to true when video can be copied to texture var copyvideo = false; function setupvideo(url) { const video = document.createelement('video'); var playing = false; var timeupdate = false; video.autoplay = true; video.muted = true; video.loop = true; // waiting for these 2 events ensures // there is data in the video video.addeventlistener('playing', function() { playing = true; ...
...it's nearly identical to the image onload function in the previous example — except when we call teximage2d(), instead of passing an image object, we pass in the <video> element.
Lighting in WebGL - Web APIs
we'll see how to do that when we look at the code for the shader.
...pointer( programinfo.attriblocations.vertexnormal, numcomponents, type, normalize, stride, offset); gl.enablevertexattribarray( programinfo.attriblocations.vertexnormal); } finally, we need to update the code that builds the uniform matrices to generate and deliver to the shader a normal matrix, which is used to transform the normals when dealing with the current orientation of the cube in relation to the light source: const normalmatrix = mat4.create(); mat4.invert(normalmatrix, modelviewmatrix); mat4.transpose(normalmatrix, normalmatrix); ...
WebSocket: close event - Web APIs
the close event is fired when a connection with a websocket is closed.
... bubbles no cancelable no interface closeevent event handler property onclose examples you might want to know when the connection has been closed so that you can update the ui or, perhaps, save data about the closed connection.
WebSocket.onerror - Web APIs
WebAPIWebSocketonerror
the websocket interface's onerror event handler property is a function which gets called when an error occurs on the websocket.
... syntax websocket.onerror = eventhandler; value a function or eventhandler which is executed whenever an error event occurs on the websocket connection.
Writing a WebSocket server in Java - Web APIs
serversocket constructor: serversocket(int port) when you instantiate the serversocket class, it is bound to the port number you specified by the port argument.
... inputstream in = client.getinputstream(); outputstream out = client.getoutputstream(); scanner s = new scanner(in, "utf-8"); handshaking when a client connects to a server, it sends a get request to upgrade the connection to a websocket from a simple http request.
Web Video Text Tracks Format (WebVTT) - Web APIs
3 00:00:34.159 --> 00:00:35.743 third cue timings a cue timing indicates when the cue is shown.
... example 12 - karaoke style text 1 00:16.500 --> 00:18.500 when the moon <00:17.500>hits your eye 1 00:00:18.500 --> 00:00:20.500 like a <00:19.000>big-a <00:19.500>pizza <00:20.000>pie 1 00:00:20.500 --> 00:00:21.500 that's <00:00:21.000>amore the following tags are the html tags allowed in a cue and require opening and closing tags (e.g., <b>text</b>).
WebXR performance guide - Web APIs
this section will combine information from https://github.com/immersive-web/webxr/blob/master/explainer.md#controlling-depth-precision and https://github.com/immersive-web/webxr/blob/master/explainer.md#preventing-the-compositor-from-using-the-depth-buffer optimizing memory use when using libraries that perform things such as matrix mathematics, you typically have a number of working variables through which various vectors, matrices, and quaternions pass over time.
...that means that for every frame, the javascript runtime has to allocate memory for those and set them up—possibly triggering garbage collection—and then when each interaction of the loop is completed, the memory is released.
Web Animations API Concepts - Web APIs
each animation is anchored to a point in the timeline by its starttime, representing the moment along the document’s timeline when the animation starts playing.
... timeline timeline objects provide the useful property currenttime, which lets us see how long the page has been opened for: it's the "current time" of the document's timeline, which started when the page was opened.
Window: animationcancel event - Web APIs
the animationcancel event is fired when a css animation unexpectedly aborts.
...this might happen when the animation-name is changed such that the animation is removed, or when the animating node is hidden using css.
Window: animationstart event - Web APIs
the animationstart event is fired when a css animation has started.
... examples this listens for the animationstart event and logs a message when it is fired: window.addeventlistener('animationstart', () => { console.log('animation started'); }); the same, but using onanimationstart: window.onanimationstart = () => { console.log('animation started'); }; see a live example of this event.
Window: blur event - Web APIs
WebAPIWindowblur event
the blur event fires when an element has lost focus.
... bubbles no cancelable no interface focusevent event handler property onblur sync / async sync composed yes examples live example this example changes the appearance of a document when it loses focus.
Window.close() - Web APIs
WebAPIWindowclose
note also that close() has no effect when called on window objects returned by htmliframe​element​.content​window.
... //global var to store a reference to the opened window var openedwindow; function openwindow() { openedwindow = window.open('moreinfo.htm'); } function closeopenedwindow() { openedwindow.close(); } closing the current window in the past, when you called the window object's close() method directly, rather than calling close() on a window instance, the browser closed the frontmost window, whether your script created that window or not.
Window: focus event - Web APIs
the focus event fires when an element has received focus.
... bubbles no cancelable no interface focusevent event handler property onfocus sync / async sync composed yes examples live example this example changes the appearance of a document when it loses focus.
Window: load event - Web APIs
WebAPIWindowload event
the load event is fired when the whole page has loaded, including all dependent resources such as stylesheets and images.
... bubbles no cancelable no interface event event handler property onload examples log a message when the page is fully loaded: window.addeventlistener('load', (event) => { console.log('page is fully loaded'); }); the same, but using the onload event handler property: window.onload = (event) => { console.log('page is fully loaded'); }; live example html <div class="controls"> <button id="reload" type="button">reload</button> </div> <div class="event-log"> <label>event log:</label> <textarea readonly class="event-log-contents" rows="8" cols="30"></textarea> </div> css body { ...
Window.localStorage - Web APIs
localstorage is similar to sessionstorage, except that while data stored in localstorage has no expiration time, data stored in sessionstorage gets cleared when the page session ends — that is, when the page is closed.
... (data in a localstorage object created in a "private browsing" or "incognito" session is cleared when the last "private" tab is closed.) data stored in either localstorage is specific to the protocol of the page.
Window.ondevicelight - Web APIs
these events occur when the device's light level sensor detects a change in the intensity of the ambient light level.
... syntax window.ondevicelight = funcref where funcref is a function to be called when the devicelight event occurs.
Window.ondeviceproximity - Web APIs
these events occur when the device sensor detects that an object becomes closer to or farther from the device.
... syntax window.onuserproximity = funcref where funcref is a function to be called when the deviceproximity event occurs.
Window.onpaint - Web APIs
WebAPIWindowonpaint
the paint event is raised when the window is rendered.
... this event occurs after the load event for a window, and reoccurs each time the window needs to be re-rendered, such as when another window obscures it and is then cleared away.
Window.onuserproximity - Web APIs
the window.onuserproxymity property represents an eventhandler, that is a function to be called when the userproximity event occurs.
... these events are of type userproximityevent and occur when the the device sensor detects that an object becomes nearby.
Window: pagehide event - Web APIs
the pagehide event is sent to a window when the browser hides the current page in the process of presenting a different page from the session's history.
... for example, when the user clicks the browser's back button, the current page receives a pagehide event before the previous page is shown.
Window: rejectionhandled event - Web APIs
the rejectionhandled event is sent to the script's global scope (usually window but also worker) whenever a javascript promise is rejected but after the promise rejection has been handled.
... this can be used in debugging and for general application resiliency, in tandem with the unhandledrejection event, which is sent when a promise is rejected but there is no hander for the rejection.
Window: transitionend event - Web APIs
the transitionend event is fired when a css transition has completed.
... bubbles yes cancelable yes interface transitionevent event handler property ontransitionend the transitionend event is fired in both directions - as it finishes transitioning to the transitioned state, and when it fully reverts to the default or non-transitioned state.
Window: unload event - Web APIs
the unload event is fired when the document or a child resource is being unloaded.
...nt of child-frame.html: <!doctype html> <html> <head> <title>child frame</title> <script> window.addeventlistener('beforeunload', function(event) { console.log('i am the 2nd one.'); }); window.addeventlistener('unload', function(event) { console.log('i am the 4th and last one…'); }); </script> </head> <body> ☻ </body> </html> when the parent frame is unloaded, events will be fired in the order described by the console.log() messages.
WindowEventHandlers.onbeforeunload - Web APIs
these events fire when a window is about to unload its resources.
... behavior in mozilla firefox prompt will always be shown // chrome requires returnvalue to be set e.returnvalue = ''; }); guarantee the browser unload by removing the returnvalue property of the event window.addeventlistener('beforeunload', function (e) { // the absence of a returnvalue property on the event will guarantee the browser unload happens delete e['returnvalue']; }); notes when your page uses javascript to render content, the javascript may stop when leaving and then navigating back to the page.
WindowEventHandlers.onpopstate - Web APIs
the popstate event is only triggered by performing a browser action, such as clicking on the back button (or calling history.back() in javascript), when navigating between two history entries for the same document.
...: http://example.com/example.html?page=1, state: {"page":1}" history.back(); // alerts "location: http://example.com/example.html, state: null history.go(2); // alerts "location: http://example.com/example.html?page=3, state: {"page":3} note that even though the original history entry (for http://example.com/example.html) has no state object associated with it, a popstate event is still fired, when we activate that entry after the second call to history.back().
WindowEventHandlers.onstorage - Web APIs
the storage event fires when a storage area has been changed in the context of another document.
... example this example logs the value for a storage key whenever it changes in another document.
WindowOrWorkerGlobalScope.setInterval() - Web APIs
for clarity, however, you should try to always match them to avoid confusion when maintaining your code.
... the "this" problem when you pass a method to setinterval() or any other function, it is invoked with the wrong this value.
Worker: message event - Web APIs
the message event is fired on a worker object when the worker's parent receives a message from its worker (i.e.
... when the worker sends a message using dedicatedworkerglobalscope.postmessage()).
WritableStreamDefaultWriter.releaseLock() - Web APIs
if the associated stream is errored when the lock is released, the writer will appear errored in the same way from now on; otherwise, the writer will appear closed.
... // release writer's lock on the stream when desired writer.releaselock(); specifications specification status comment streamsthe definition of 'releaselock()' in that specification.
WritableStreamDefaultWriter - Web APIs
writablestreamdefaultwriter.readyread only returns a promise that resolves when the desired size of the stream's internal queue transitions from non-positive to positive, signaling that it is no longer applying backpressure.
...if the associated stream is errored when the lock is released, the writer will appear errored in the same way from now on; otherwise, the writer will appear closed.
XDomainRequest.onerror - Web APIs
an event handler which is called when an xdomainrequest encounters an error.
... syntax xdr.onerror = funcref; parameters funcref a function to call when an error occurs.
XDomainRequest.ontimeout - Web APIs
an event handler which is called when a pending xdomainrequest times out.
... syntax xdr.ontimeout = funcref; parameters funcref a function to be called when the event times out.
init() - Web APIs
baseuri the base uri to use when resolving relative uris when handling the request.
... loadgroup optional an optional load group used when performing the request.
XMLHttpRequest.response - Web APIs
the value is null if the request is not yet complete or was unsuccessful, with the exception that when reading text data using a responsetype of "text" or the empty string (""), the response can contain the response so far while the request is still in the loading readystate (3).
...it works by creating an xmlhttprequest object and creating a listener for readystatechange events such that that when readystate changes to done (4), the response is obtained and passed into the callback function provided to load().
XMLHttpRequestEventTarget.onabort - Web APIs
the xmlhttprequesteventtarget.onabort is the function called when an xmlhttprequest transaction is aborted, such as when the xmlhttprequest.abort() function is called.
... syntax xmlhttprequest.onabort = callback; values callback is the function to be executed when the transaction is aborted.
XMLHttpRequestEventTarget.onerror - Web APIs
the xmlhttprequesteventtarget.onerror is the function called when an xmlhttprequest transaction fails due to an error.
... syntax xmlhttprequest.onerror = callback; values callback is the function to be executed when the request fails.
XMLHttpRequestEventTarget.onload - Web APIs
the xmlhttprequesteventtarget.onload is the function called when an xmlhttprequest transaction completes successfully.
... syntax xmlhttprequest.onload = callback; values callback is the function to be executed when the request completes successfully.
XMLHttpRequestEventTarget.onloadstart - Web APIs
the xmlhttprequesteventtarget.onloadstart is the function called when an xmlhttprequest transaction starts transferring data.
... syntax xmlhttprequest.onloadstart = callback; values callback is the function to be called when the transaction begins to transfer data.
XRInputSourcesChangeEvent - Web APIs
the webxr device api interface xrinputsourceschangeevent is used to represent the inputsourceschange event sent to an xrsession when the set of available webxr input controllers changes.
... event types inputsourceschange delivered to the xrsession when the set of input devices available to it changes.
XRReferenceSpace.onreset - Web APIs
the xrreferencespace interface's onreset event handler property can be set to a function which is called when the xrreferencespace receives a reset event, signaling that the xr device has experienced a discontinuity large enough to require that the position and/or orientation of the origin be significantly altered to compensate.
... syntax xrreferencespace.onreset = eventhandler; eventhandler = xrreferencespace.onreset; value an event handler function which will be called whenever the reset event is received by the xrreferencespace.
XRReferenceSpaceType - Web APIs
this type is used when calling the requestreferencespace() method to obtain a reference space for an xrsession.
...it's particularly useful when determining the distance between the viewer and an input, or when working with offset spaces.
XRRenderState - Web APIs
when you apply changes using the xrsession method updaterenderstate(), the specified changes take effect after the current animation frame has completed, but before the next one begins.
... inlineverticalfieldofview read only the default vertical field of view, defined in radians, to use when the session is in inline mode.
XRRenderStateInit - Web APIs
the xrrenderstateinit dictionary is a writeable version of the xrrenderstate interface, and is used when calling an xrsession's updaterenderstate() method to apply changes to the render state prior to rendering the next frame.
... inlineverticalfieldofview optional a floating-point value indicating the default field of view, in radians, to be used when computing the projection matrix for an inline xrsession.
XRRigidTransform() - Web APIs
among other things, xrrigidtransform is used when providing a transform to translate between coordinate systems across spaces.
...the drawframe() callback will be executed when the system is ready to draw the next frame.
XRSession: end event - Web APIs
an end event is fired at an xrsession object when the webxr session has ended, either because the web application has chosen to stop the session, or because the user agent terminated the session.
... bubbles no cancelable no interface xrsessionevent event handler xrsession.onend example to be informed when a webxr session comes to an end, you can add a handler to your xrsession instance using addeventlistener(), like this: xrsession.addeventlistener("end", function(event) { /* the session has shut down */ }); alternatively, you can use the xrsession.onend event handler property to establish a handler for the end event: xrsession.onend = function(event) { /* the session has shut down */ } specifications specification status comment webxr device apithe definition of 'end event' in that specification.
XRSession.onselect - Web APIs
the onselect property of the xrsession object is the event handler for the select event, which is dispatched when a primary action is completed successfully by the user.
... syntax xrsession.onselect = selecthandlerfunction; value an event handler function to be invoked when the xrsession receives a select event.
XRSession.onsqueeze - Web APIs
the xrsession interface's onsqueeze event handler property can be set to a function which is then invoked to handle the squeeze event that's sent when the user successfully completes a primary squeeze action on a webxr input device.
... syntax xrsession.onsqueeze = squeezehandlerfunction; value a function to be invoked whenever the xrsession receives a squeeze event.
XRSession.onsqueezeend - Web APIs
the xrsession interface's onsqueezeend event handler property is a function to be invokedn when the squeezeend event sent to an xrsession when a primary squeeze action ends.
... syntax xrsession.onsqueezeend = squeezeendhandlerfunction; value a function to be invoked whenever the xrsession receives a squeezestart event, indicating the ending of a primary squeeze action.
XRSession.onsqueezestart - Web APIs
the xrsession interface's onsqueezestart event handler property can be set to a function which is then invoked to handle the squeezestart event that's sent when the user successfully begins a primary squeeze action on a webxr input device.
... syntax xrsession.onsqueezestart = squeezestarthandlerfunction; value a function to be invoked whenever the xrsession receives a squeezestart event.
XRSession: select event - Web APIs
the webxr event select is sent to an xrsession when one of the session's input sources has completed a primary action.
... examples of comon kinds of primary action are users pressing triggers or buttons, tapping a touchpad, speaking a command, or performing a recognizable gesture when using a video tracking system or handheld controller with an accelerometer.
XRSession: selectend event - Web APIs
the webxr event selectend is sent to an xrsession when one of its input sources ends its primary action or when an input source that's in the process of handling an ongoing primary action is disconnected without successfully completing the action.
... primary actions include things like users pressing triggers or buttons, tapping a touchpad, speaking a command, or performing a recognizable gesture when using a video tracking system or handheld controller with an accelerometer.
XRSession: selectstart event - Web APIs
the webxr event selectstart is sent to an xrsession when the user begins a primary action on one of its input sources.
... primary actions include things like users pressing triggers or buttons, tapping a touchpad, speaking a command, or performing a recognizable gesture when using a video tracking system or handheld controller with an accelerometer.
XRSession: squeezeend event - Web APIs
the webxr event squeezeend is sent to an xrsession when one of its input sources ends its primary action or when an input source that's in the process of handling an ongoing primary action is disconnected without successfully completing the action.
... primary squeeze actions include things like users pressing triggers or buttons, tapping a touchpad, speaking a command, or performing a recognizable gesture when using a video tracking system or handheld controller with an accelerometer.
XRSessionEvent() - Web APIs
end fired at the session when it has ended, after being terminated by the application or the user agent.
... visibilitychange fired at the session whenever its visibility state changes.
XRSystem: devicechange event - Web APIs
a devicechange event is fired on an xrsystem object whenever the whenever the availability of immersive xr devices has changed; for example, a vr headset or ar goggles have been connected or disconnected.
... if (navigator.xr) { navigator.xr.addeventlistener("devicechange", event => { navigator.xr.issessionsupported("immersive-vr") .then(immersiveok) => { if (immersiveok) { enablexrbutton.disabled = false; } else { enablexrbutton.disabled = true; } }); }); } when devicechange is received, the handler set up in this code calls the xr method issessionsupported() to find out if there's a device available that can handle immersive vr presentations.
XRSystem - Web APIs
WebAPIXRSystem
events devicechange sent when the set of available xr devices has changed.
...when the returned promise resolves, we set xrsession to null to record the fact that we no longer have an ongoing session.
XRWebGLLayer.antialias - Web APIs
when the webxr compositor is enabled, this value corresponds to the value of the antialias property on the object returned by the webgl context's getcontentattributes() method.
... usage notes since this is a read-only property, you can set the antialiasing mode only when initially creating the xrwebgllayer, by specifying the antialias object in the xrwebgllayer() constructor's layerinit parameter.
XRWebGLLayerInit - Web APIs
the webxr device api's xrwebgllayerinit dictionary is used to provide configuration options when creating a new xrwebgllayer object with the xrwebgllayer() constructor.
... antialias optional a boolean value which is true if anti-aliasing is to be used when rendering in the context; otherwise false.
msWriteProfilerMark - Web APIs
notes mswriteprofilermark enables you to inject dom based performance markers in addition to existing javascript api to learn exactly when parts of the page are being rendered, building a waterfall view for every one of our impressions showing latency per object, which can be useful for more accurately debugging real users perf issues.
... the bstrprofilermarkname property has a 32-character limit when called from script.
msthumbnailclick - Web APIs
the msthumbnailclick event occurs when a user clicks a button or thumbnail icon in the taskbar.
...(); // pinned icons on your taskbar can be instructed to trigger specific events on your site from the taskbar // add an event handlerdocument.addeventlistener('msthumbnailclick', onbuttonclicked, false); // add the buttons var btnplay = window.external.mssitemodeaddthumbbarbutton(iconuri, tooltip); // refresh the taskbar window.external.mssitemodeshowthumbbar(); // call a javascript function when the button is pressed function onbuttonclicked(e) { switch (e.buttonid) { case btnplay: play(); break;} } see also microsoft api extensions ...
Using the aria-invalid attribute - Accessibility
possible effects on user agents and assistive technology user agents should inform the user when a field is invalid.
...ent("div"); newalert.setattribute("role", "alert"); newalert.setattribute("id", "alert"); var content = document.createtextnode(msg); newalert.appendchild(content); document.body.appendchild(newalert); } } note that the alert has the aria role attribute set to "alert." working examples: alert role example (uses the aria-invalid attribute) notes when aria-invalid is used in conjunction with the aria-required attribute, aria-invalid should not be set to true before the form is submitted - only in response to validation.
ARIA: figure role - Accessibility
<p id="figure-1">text that describes the figure.</p> </div> use aria-labelledby when the text is a concise label.
... use aria-describedby when the text is a longer description.
ARIA: Suggestion role - Accessibility
examples when you’ve got a content change that involves an insertion and a deletion, there is no way for a screenreader user to work out if the two are related or not.
...</p> we could even provide an information box saying who made the suggestion and when, and associate it with the suggestion via aria-details: <p>freida’s pet is a <span role="suggestion" aria-details="comment-source"> <span role="deletion">black cat called luna</span> <span role="insertion">purple tyrannosaurus rex called tiny</span> </span>.
Web applications and ARIA FAQ - Accessibility
degrading gracefully from html5 to aria when delivering content to browsers that aren't html5-aware, you may want to consider gracefully degrading to the use of aria where necessary.
...they include: orca for linux nvda for windows voiceover is built into os x when you're testing with a screen reader, keep two key points in mind: casual testing with a screen reader user can never replace feedback, testing, and help from real users.
Basic form hints - Accessibility
when implementing forms using traditional html form-related elements, it is important to provide labels for controls, and explicitly associate a label with its control.
... when a screen reader user navigates a page, the screen reader will describe form controls.
ARIA - Accessibility
it supplements html so that interactions and widgets commonly used in applications can be passed to assistive technologies when there is not otherwise a mechanism.
...because of this, it is important to use semantic html elements whenever possible, as semantic html has far better support for assistive technology.
Accessibility: What users can do to browse more safely - Accessibility
of particular interest is a user who has photosensitive epilepsy, and uses it when feeling "seizure-y".
...grayscale is enabled when the color filters button is toggled "on" see also accessibilty accessibility learning path web accessibility for seizures and physical reactions color blindness discussion: "what is the “grayscale” setting for in accessibility options?" contributors many, many thanks to eric eggert from knowbility; for his discussions and huge help on this topic.
HTML To MSAA - Accessibility
attribute is used state_system_ protected n/a "activate" n/a input type="checkbox" role_system_ checkbutton n/a n/a state_system_ marqueed used as state checkable state_system_ mixed for html 5 if intermediate property of dom element returns true state_system_ checked if checked property of dom element returns true n/a "check"/"uncheck"/"cycle" depending on state event_object_ statechange when state is changed input type="radio" role_system_ radiobutton n/a n/a state_system_ marqueed used as state checkable state_system_ checked if checked property of dom element returns true n/a "select" event_object_ statechange when state is changed label role_system_ statictext from child nodes n/a n/a n/a n/a n/a legend role_system_ statictext n/a n/a n/a label_for (0x1002), points t...
...ove if unselected select @size > 1 role_system_ list n/a n/a state_system_ multiselectable if multiselectable n/a n/a n/a select @size = 1 role_system_ combobox n/a name of focused option state_system_ expanded if combobox open state_system_ collapsed if combobox is collapsed state_system_ haspopup state_system_ focusable n/a "open"/"close" depending on state event_object_ valuechange when selected option is changed table role_system_ table from @summary attribute n/a described_by (0x100e) points to caption element n/a n/a td, th role_system_ cell n/a n/a n/a n/a n/a n/a thead role_system_ columnheader n/a n/a n/a n/a n/a n/a abbr, acronym, blockquote, form, frame, h1-h6, iframe bstr role n/a n/a n/a n/a n/a n/a ...
Web accessibility for seizures and physical reactions - Accessibility
natural light, such as sunlight, especially when shimmering off water, flickering through trees or through the slats of venetian blinds.
...because of this condition, their brain will produce seizure-like discharges when exposed to this type of visual stimulation gamma oscillations and photosensitive epilepsy current biology volume 27, issue 9, 8 may 2017, pages r336-r338 certain visual images, even in the absence of motion or flicker, can trigger seizures in patients with photosensitive epilepsy.
Color contrast - Accessibility
when designing readable interfaces for different vision capabilities, the wcag guidelines recommend the following contrast ratios: type of content minimum ratio (aa rating) enhanced ratio (aaa rating) body text 4.5 : 1 7 : 1 large-scale text (120-150% larger than body text) 3 : 1 4.5 : 1 active user interface components and graphical objects such as icons and graphs 3 : 1 not defined these ratios do not apply to "incidental" text, such as inactive controls, logotypes, or purely decorative text.
... the other hand has a very dark purple background, which makes the text much harder to read: example2 <div class="bad"> bad contrast </div> div { font-family: sans-serif; text-align: center; font-size: 2rem; font-weight: bold; width: 250px; padding: 30px; border-radius: 20px; box-shadow: 1px 1px 1px black; } .bad { background-color: #400064; } solution when choosing a color scheme for your website, choose foreground and background colors that have good contrast.
Robust - Accessibility
when using semantic elements correctly for their intended purpose, this criterion should be passed automatically.
... when scripting custom components, you will need to use wai-aria roles and other features to make sure your controls will be interpreted and are able to be used as intended, e.g.
-moz-force-broken-image-icon - CSS: Cascading Style Sheets
the -moz-force-broken-image-icon extended css property can be used to force the broken image icon to be shown even when a broken image has an alt attribute.
...when the value 0 is used the image will act as usual and only display the alt attribute.
-webkit-mask-repeat-x - CSS: Cascading Style Sheets
the only case where clipping happens using space is when there isn't enough room to display one image.
...when the next image is added, all of the current ones compress to allow room.
-webkit-mask-repeat-y - CSS: Cascading Style Sheets
the only case where clipping happens using space is when there isn't enough room to display one image.
...when the next image is added, all of the current ones compress to allow room.
-webkit-touch-callout - CSS: Cascading Style Sheets
the -webkit-touch-callout css property controls the display of the default callout shown when you touch and hold a touch target.
... when a target is touched and held on ios, safari displays a callout information about the link.
::-webkit-meter-even-less-good-value - CSS: Cascading Style Sheets
the ::-webkit-meter-even-less-good-value gives a red color to a <meter> element when the value and the optimum attributes fall outside the low-high range, but in opposite zones.
... to illustrate, it applies when value < low < high < optimum or value > high > low > optimum.
::first-letter (:first-letter) - CSS: Cascading Style Sheets
the ::first-letter css pseudo-element applies styles to the first letter of the first line of a block-level element, but only when not preceded by other content (such as images or inline tables).
...margin, margin-top, margin-right, margin-bottom, margin-left all padding properties: padding, padding-top, padding-right, padding-bottom, padding-left all border properties: the shorthands border, border-style, border-color, border-width, border-radius, border-image, and the longhands properties the color property the text-decoration, text-shadow, text-transform, letter-spacing, word-spacing (when appropriate), line-height, text-decoration-color, text-decoration-line, text-decoration-style, box-shadow, float, vertical-align (only if float is none) css properties syntax /* css3 syntax */ ::first-letter /* css2 syntax */ :first-letter examples simple drop cap in this example we will use the ::first-letter pseudo-element to create a simple drop cap effect on the first letter of the par...
:checked - CSS: Cascading Style Sheets
WebCSS:checked
> <input type="checkbox" name="my-checkbox" id="opt-in"> <label for="opt-in">check me!</label> </div> <select name="my-select" id="fruit"> <option value="opt1">apples</option> <option value="opt2">grapes</option> <option value="opt3">pears</option> </select> css div, select { margin: 8px; } /* labels for checked inputs */ input:checked + label { color: red; } /* radio element, when checked */ input[type="radio"]:checked { box-shadow: 0 0 0 3px orange; } /* checkbox element, when checked */ input[type="checkbox"]:checked { box-shadow: 0 0 0 3px hotpink; } /* option elements, when selected */ option:checked { box-shadow: 0 0 0 3px lime; color: red; } result toggling elements with a hidden checkbox this example utilizes the :checked pseudo-class to let the user...
...ggle hidden rows</label> css /* hide the toggle checkbox */ #expand-toggle { display: none; } /* hide expandable content by default */ .expandable { visibility: collapse; background: #ddd; } /* style the button */ #expand-btn { display: inline-block; margin-top: 12px; padding: 5px 11px; background-color: #ff7; border: 1px solid; border-radius: 3px; } /* show hidden content when the checkbox is checked */ #expand-toggle:checked ~ * .expandable { visibility: visible; } /* style the button when the checkbox is checked */ #expand-toggle:checked ~ #expand-btn { background-color: #ccc; } result image gallery you can use the :checked pseudo-class to build an image gallery with full-size images that show only when the user clicks on a thumbnail.
:first - CSS: Cascading Style Sheets
WebCSS:first
(see :first-child for general first element of a node.) /* selects the first page when printing */ @page :first { margin-left: 50%; margin-top: 50%; } note: you can't change all css properties with this pseudo-class.
...furthermore, you may only use absolute-length units when defining the margins.
:focus-visible - CSS: Cascading Style Sheets
syntax :focus-visible examples basic example in this example, the :focus-visible selector uses the ua's behavior to determine when to match.
... compare what happens when you click on the different controls with a mouse, versus when you tab through them using a keyboard.
:focus-within - CSS: Cascading Style Sheets
(this includes descendants in shadow trees.) /* selects a <div> when one of its descendants is focused */ div:focus-within { background: cyan; } this selector is useful, to take a common example, for highlighting an entire <form> container when the user focuses on one of its <input> fields.
... syntax :focus-within examples in this example, the form will receive special coloring styles when either text input receives focus.
:in-range - CSS: Cascading Style Sheets
WebCSS:in-range
/* selects any <input>, but only when it has a range specified, and its value is inside that range */ input:in-range { background-color: rgba(0, 255, 0, 0.25); } this pseudo-class is useful for giving the user a visual indication that a field's current value is within the permitted limits.
... living standard defines when :in-range matches elements in html.
:is() (:matches(), :any()) - CSS: Cascading Style Sheets
WebCSS:is
can be replaced with: /* 3-deep (or more) unordered lists use a square */ :is(ol, ul, menu, dir) :is(ol, ul, menu, dir) ul, :is(ol, ul, menu, dir) :is(ol, ul, menu, dir) menu, :is(ol, ul, menu, dir) :is(ol, ul, menu, dir) dir { list-style-type: square; } simplifying section selectors the :is() pseudo-class is particularly useful when dealing with html5 sections and headings.
...le, aside, nav) h1 { font-size: 25px; } /* level 2 */ :is(section, article, aside, nav) :is(section, article, aside, nav) h1 { font-size: 20px; } /* level 3 */ :is(section, article, aside, nav) :is(section, article, aside, nav) :is(section, article, aside, nav) h1 { font-size: 15px; } avoiding selector list invalidation unlike selector lists, the :is() pseudo-class doesn't get invalidated when one of the selectors passed to it isn't supported by the browser.
:out-of-range - CSS: Cascading Style Sheets
/* selects any <input>, but only when it has a range specified, and its value is outside that range */ input:out-of-range { background-color: rgba(255, 0, 0, 0.25); } this pseudo-class is useful for giving the user a visual indication that a field's current value is outside the permitted limits.
... living standard defines when :out-of-range matches elements in html.
:placeholder-shown - CSS: Cascading Style Sheets
/* selects any element with an active placeholder */ :placeholder-shown { border: 2px solid silver; } syntax :placeholder-shown examples basic example this example applies special font and border styles when the placeholder is shown.
... html <input placeholder="type something here!"> css input { border: 1px solid black; padding: 3px; } input:placeholder-shown { border-color: teal; color: purple; font-style: italic; } result overflowing text when form fields are too small, placeholder text can get cropped in an undesirable way.
additive-symbols - CSS: Cascading Style Sheets
the additive-symbols descriptor lets you specify symbols when the value of a counter system descriptor is additive.
... syntax additive-symbols: 3 "0"; additive-symbols: 3 "0", 2 "\2e\20"; additive-symbols: 3 "0", 2 url(symbol.png); when the system descriptor is cyclic, numeric, alphabetic, symbolic, or fixed, use the symbols descriptor instead of additive-symbols.
fallback - CSS: Cascading Style Sheets
a couple of scenarios where a fallback style will be used are: when the range descriptor is specified for a counter style, the fallback style will be used to represent values that fall outside the range.
... when the fixed system is used and there are not enough symbols to cover all the list items, the fallback style will be used for the rest of the list items.
pad - CSS: Cascading Style Sheets
the pad descriptor can be used with custom counter style definitions when you need the marker representations to have a minimum length.
...a common usage of the pad descriptor is when you need your list to start numbering from 01 and go through 02, 03 and so on, instead of just 1, 2, 3...
range - CSS: Cascading Style Sheets
when defining custom counter styles, the range descriptor lets the author specify a range of counter values over which the style is applied.
... when range is specified as integers, the value infinite can be used to denote infinity.
symbols - CSS: Cascading Style Sheets
symbols: a b c d e; symbols: "\24b6" "\24b7" "\24b8" d e; symbols: "0" "1" "2" "4" "5" "6" "7" "8" "9"; symbols: url('first.svg') url('second.svg') url('third.svg'); symbols: indic-numbers; the symbols descriptor must be specified when the value of the system descriptor is cyclic, numeric, alphabetic, symbolic, or fixed.
... when the additive system is used, use the additive-symbols descriptor instead to specify the symbols.
@counter-style - CSS: Cascading Style Sheets
the @counter-style at-rule addresses this shortcoming in an open-ended manner, by allowing authors to define their own counter styles when the pre-defined styles aren't fitting their needs.
... pad is used when you need the marker representations to be of a minimum length.
Box alignment in grid layout - CSS: Cascading Style Sheets
grid axes as a two-dimensional layout method, when working with grid layout we always have two axes on which to align our items.
... content alignment justify-content align-content place-content these properties deal with aligning the tracks of the grid when there is extra space to distribute.
Box alignment in Flexbox - CSS: Cascading Style Sheets
therefore it is easiest to think about the main and cross axis when working in flexbox like so: the main axis = direction set by flex-direction = alignment via justify-content the cross axis = runs across the main axis = alignment via align-content, align-self/align-items main axis alignment justify-content cross axis alignment align-self align-items align-content there is no justify-self in flexbox on the main axis, flexbox deals with our cont...
... alignment and auto margins there is a specific use case in flexbox where we might think that a justify-self property is what we need, and this is when we want to split a set of flex items, perhaps to create a split navigation pattern.
Basic Concepts of Multicol - CSS: Cascading Style Sheets
this happens in the same way that content is fragmented into pages when we work with css paged media, for example by creating a print stylesheet.
... when using both properties together you may get fewer columns than specified in the value for column-count.
Handling Overflow in Multicol - CSS: Cascading Style Sheets
overflow inside column boxes an overflow situation happens when an item's size is larger than the column box.
... for example, the situation could happen when an image in a column is wider than the column-width value or the width of the column based on the number of columns declared with column-count.
Handling content breaks in multicol - CSS: Cascading Style Sheets
they take the following values when in a multicol context: auto avoid avoid-column column in this next example, we are forcing a column break before an h2 element.
... when things don’t work as expected if you have small amounts of content and are trying to control breaks in a number of ways or on several elements, your content needs to break somewhere, so you may not always get the result you intended.
CSS Containment - CSS: Cascading Style Sheets
if we give each <article> the contain property with a value of content, when new elements are inserted the browser understands it does not need to relayout or repaint any area outside of the containing element's subtree, although if the <article> is styled such that its size depends on its contents (e.g.
... size containment article { contain: size; } size containment does not offer much in the way of performance optimizations when used on its own.
Typical use cases of Flexbox - CSS: Cascading Style Sheets
when we have a set of items that we want to display horizontally, we may well end up with additional space.
... form controls flexbox is particularly useful when it comes to styling form controls.
In Flow and Out of Flow - CSS: Cascading Style Sheets
when taking an item out of flow with positioning, you will need to manage the possibility of content overlapping.
... when you do anything to remove, or shift an item from where it would be placed in normal flow, you can expect to need to do some managing of the content and the content around it to prevent overlaps.
OpenType font features guide - CSS: Cascading Style Sheets
numerals within paragraphs of text set as 'oldstyle' sit more comfortably between lower-case letters, and likewise setting them as 'tabular numbers' will make them line up better when setting a list of costs in a table say.
...while these last ones are not technically ligatures, they are generally similar in that they replace specific combinations of letters when they appear together.
Using CSS gradients - CSS: Cascading Style Sheets
in addition, because gradients are generated by the browser, they look better than raster images when zoomed in, and can be resized on the fly.
... <div class="angled-gradient"></div> div { width: 120px; height: 120px; } .angled-gradient { background: linear-gradient(70deg, blue, pink); } when using an angle, 0deg creates a vertical gradient running bottom to top, 90deg creates a horizontal gradient running left to right, and so on in a clockwise direction.
Basic concepts of Logical Properties and Values - CSS: Cascading Style Sheets
when working with a site in a writing mode other than a horizontal, top to bottom one, or when using writing modes for creative reasons, being able to relate to the flow of the content makes a lot of sense.
...as we saw above, newer css layout methods such as flexbox and grid layout use the concepts of block and inline rather than right and left/top and bottom when aligning items.
Logical properties for floating and positioning - CSS: Cascading Style Sheets
new properties have been created in the logical properties specification for when you want the positioning to relate to the flow of text in your writing mode.
... this works in a more consistent way when using box alignment that uses start and end rather than physical directions for alignment.
Logical properties for sizing - CSS: Cascading Style Sheets
when specifying the size of an item, the logical properties and values specification gives you the ability to indicate sizing as it relates to the flow of text (inline and block) rather than physical sizing which relates to the physical dimensions of horizontal and vertical (e.g.
...when working in english, replacing width with inline-size and height with block-size will give the same layout.
CSS Overflow - CSS: Cascading Style Sheets
in css overflow happens when the content of a box extends past one or more of the box's edges.
...the overflow properties are how we can control what happens when content overflows a box.
Stacking context example 3 - CSS: Cascading Style Sheets
« css « understanding css z-index stacking context example 3 this last example shows problems that arise when mixing several positioned elements in a multi-level html hierarchy and when z-indexes are assigned using class selectors.
...second-level and third-level divs appear when hovering or clicking on their parents.
Browser compatibility and Scroll Snap - CSS: Cascading Style Sheets
in this article, we consider questions that might arise related to compatibility across browsers and versions of browsers when adding support for scroll-snap to your web site or app.
...at some point browsers need to implement a spec to show that it works, and to discover any problems that only become apparent when the spec is in use alongside other properties in the real world.
Layout and the containing block - CSS: Cascading Style Sheets
when a user agent (such as your browser) lays out a document, it generates a box for every element.
... calculating percentage values from the containing block as noted above, when certain properties are given a percentage value, the computed value depends on the element's containing block.
Inline formatting context - CSS: Cascading Style Sheets
this box will be large enough to contain all of the inline boxes in that line; when there is no more room in the inline direction another line will be created.
... when an inline box is split, margins, borders, and padding have no visual effect where the split occurs.
Card - CSS: Cascading Style Sheets
when added to a collection of cards, the cards should line up in two dimensions.
...when setting up the single column grid i use the following: .card { display: grid; grid-template-rows: max-content 200px 1fr; } the heading track is set to max-content, which prevents it from stretching.
Cookbook template - CSS: Cascading Style Sheets
please use this as a raw template when you create a new cookbook page.
... download the example choices made explain your decisions when creating the pattern.
Sticky footers - CSS: Cascading Style Sheets
requirements the sticky footer pattern needs to meet the following requirements: footer sticks to the bottom of the viewport when content is short.
...then we set our main content to flex-grow: 1 and the other two elements to flex-shrink: 0 — this prevents them from shrinking smaller when content fills the main area.
CSS Layout cookbook - CSS: Cascading Style Sheets
css grid, float fallback, fit-content() sizing columns when to choose multi-column layout, flexbox or grid for your columns.
... flexbox, box alignment sticky footers creating a footer which sits at the bottom of the container or viewport when the content is shorter.
Testing media queries programmatically - CSS: Cascading Style Sheets
once you've created a mediaquerylist object, you can check the result of the query or receive notifications when the result changes.
...to do this, call the addlistener() method on the mediaquerylist object, with a callback function to invoke when the media query status changes (e.g., the media query test goes from true to false): // create the query list.
Pseudo-classes - CSS: Cascading Style Sheets
for example, :hover can be used to change a button's color when the user's pointer hovers over it.
... html living standard living standard defines when particular selectors match html elements.
animation-fill-mode - CSS: Cascading Style Sheets
syntax /* single animation */ animation-fill-mode: none; animation-fill-mode: forwards; animation-fill-mode: backwards; animation-fill-mode: both; /* multiple animations */ animation-fill-mode: none, backwards; animation-fill-mode: both, forwards, none; values none the animation will not apply any styles to the target when it's not executing.
... note: when you specify multiple comma-separated values on an animation-* property, they will be assigned to the animations specified in the animation-name property in different ways depending on how many there are.
animation-timing-function - CSS: Cascading Style Sheets
whether the animation holds temporarily at 0%, 20%, 40%, 60% and 80%, on the 20%, 40%, 60%, 80% and 100%, or makes 5 stops between the 0% and 100% along the animation, or makes 5 stops including the 0% and 100% marks (on the 0%, 25%, 50%, 75%, and 100%) depends on which of the following jump terms is used: jump-start denotes a left-continuous function, so that the first jump happens when the animation begins; jump-end denotes a right-continuous function, so that the last jump happens when the animation ends; jump-none there is no jump on either end.
... step-start equal to steps(1, jump-start) step-end equal to steps(1, jump-end) note: when you specify multiple comma-separated values on an animation-* property, they will be assigned to the animations specified in the animation-name property in different ways depending on how many there are.
animation - CSS: Cascading Style Sheets
WebCSSanimation
when parsed, keywords that are valid for properties other than animation-name, and whose values were not found earlier in the shorthand, must be accepted for those properties rather than for animation-name.
... furthermore, when serialized, default values of other properties must be output in at least the cases necessary to distinguish an animation-name that could be a value of another property, and may be output in additional cases.
background-attachment - CSS: Cascading Style Sheets
it also applies to ::first-letter and ::first-line.inheritednocomputed valueas specifiedanimation typediscrete formal syntax <attachment>#where <attachment> = scroll | fixed | local examples simple example html <p> there were doors all round the hall, but they were all locked; and when alice had been all the way down one side and up the other, trying every door, she walked sadly down the middle, wondering how she was ever to get out again.
... html <p> there were doors all round the hall, but they were all locked; and when alice had been all the way down one side and up the other, trying every door, she walked sadly down the middle, wondering how she was ever to get out again.
background-clip - CSS: Cascading Style Sheets
if the element has no background-image or background-color, this property will only have a visual effect when the border has transparent regions or partially opaque regions (due to border-style or border-image); otherwise, the border masks the difference.
... note: because the root element has a different background painting area, the background-clip property has no effect when specified on it.
background-image - CSS: Cascading Style Sheets
if a specified image cannot be drawn (for example, when the file denoted by the specified uri cannot be loaded), browsers handle it as they would a none value.
...if the images cannot be loaded—for instance, when the network is down—the background color will be used as a fallback.
background-repeat - CSS: Cascading Style Sheets
the only case where clipping happens using space is when there isn't enough room to display one image.
...when the next image is added, all of the current ones compress to allow room.
border-collapse - CSS: Cascading Style Sheets
when cells are collapsed, the border-style value of inset behaves like groove, and outset behaves like ridge.
... when cells are separated, the distance between cells is defined by the border-spacing property.
border-end-end-radius - CSS: Cascading Style Sheets
this is useful when building styles to work regardless of the text orientation and writing mode.
... formal definition initial value0applies toall elements; but user agents are not required to apply to table and inline-table elements when border-collapse is collapse.
border-end-start-radius - CSS: Cascading Style Sheets
this is useful when building styles to work regardless of the text orientation and writing mode.
... formal definition initial value0applies toall elements; but user agents are not required to apply to table and inline-table elements when border-collapse is collapse.
border-image - CSS: Cascading Style Sheets
mdn understanding wcag, guideline 1.1 explanations understanding success criterion 1.1.1 | understanding wcag 2.0 formal definition initial valueas each of the properties of the shorthand:border-image-source: noneborder-image-slice: 100%border-image-width: 1border-image-outset: 0border-image-repeat: stretchapplies toall elements, except internal table elements when border-collapse is collapse.
... candidate recommendation initial definition initial valueas each of the properties of the shorthand:border-image-source: noneborder-image-slice: 100%border-image-width: 1border-image-outset: 0border-image-repeat: stretchapplies toall elements, except internal table elements when border-collapse is collapse.
border-radius - CSS: Cascading Style Sheets
the border-radius property does not apply to table elements when border-collapse is collapse.
...x; border-top-right-radius: 3px 4px; border-bottom-right-radius: 6px 2px; border-bottom-left-radius: 3px 4px; formal definition initial valueas each of the properties of the shorthand:border-top-left-radius: 0border-top-right-radius: 0border-bottom-right-radius: 0border-bottom-left-radius: 0applies toall elements; but user agents are not required to apply to table and inline-table elements when border-collapse is collapse.
border-start-end-radius - CSS: Cascading Style Sheets
this is useful when building styles to work regardless of the text orientation and writing mode.
... formal definition initial value0applies toall elements; but user agents are not required to apply to table and inline-table elements when border-collapse is collapse.
border-start-start-radius - CSS: Cascading Style Sheets
this is useful when building styles to work regardless of the text orientation and writing mode.
... formal definition initial value0applies toall elements; but user agents are not required to apply to table and inline-table elements when border-collapse is collapse.
box-flex-group - CSS: Cascading Style Sheets
when dividing up the box's extra space, the browser first considers all elements within the first flex group.
... if the box would overflow after the preferred space of the children has been computed, then space is removed from flexible elements in a manner similar to that used when adding extra space.
box-sizing - CSS: Cascading Style Sheets
this means that when you set width and height, you have to adjust the value you give to allow for any border or padding that may be added.
... on the other hand, when using position: relative or position: absolute, use of box-sizing: content-box allows the positioning values to be relative to the content, and independent of changes to border and padding sizes, which is sometimes desirable.
clamp() - CSS: Cascading Style Sheets
WebCSSclamp
you may also use parentheses to establish computation order when needed.
...you may also use parentheses to establish computation order when needed.
clear - CSS: Cascading Style Sheets
WebCSSclear
when applied to non-floating blocks, it moves the border edge of the element down until it is below the margin edge of all relevant floats.
...when applied to floating elements, the margin edge of the bottom element is moved below the margin edge of all relevant floats.
<display-outside> - CSS: Cascading Style Sheets
syntax valid <display-outside> values: block the element generates a block element box, generating line breaks both before and after the element when in the normal flow.
... note: browsers that support the two value syntax, on finding the outer value only, such as when display: block or display: inline is specified, will set the inner value to flow.
<easing-function> - CSS: Cascading Style Sheets
when you specify an invalid cubic-bezier curve, css ignores the whole property.
... direction is a keyword indicating if it the function is left- or right-continuous: jump-start denotes a left-continuous function, so that the first step or jump happens when the animation begins; jump-end denotes a right-continuous function, so that the last step or jump happens when the animation ends; jump-both denotes a right and left continuous function, includes pauses at both the 0% and 100% marks, effectively adding a step during the animation iteration; jump-none there is no jump on either end.
font-feature-settings - CSS: Cascading Style Sheets
syntax /* use the default settings */ font-feature-settings: normal; /* set values for opentype feature tags */ font-feature-settings: "smcp"; font-feature-settings: "smcp" on; font-feature-settings: "swsh" 2; font-feature-settings: "smcp", "swsh" 2; /* global values */ font-feature-settings: inherit; font-feature-settings: initial; font-feature-settings: unset; whenever possible, web authors should instead use the font-variant shorthand property or an associated longhand property such as font-variant-ligatures, font-variant-caps, font-variant-east-asian, font-variant-alternates, font-variant-numeric or font-variant-position.
... <feature-tag-value> when rendering text, the list of opentype feature tag value is passed to the text layout engine to enable or disable font features.
font-size-adjust - CSS: Cascading Style Sheets
legibility can become an issue when the first-choice font-family is unavailable and its replacement has a significantly different aspect ratio (the ratio of the size of lowercase letters to the size of the font).
...this means that the first-choice font, when available, will appear the same size in browsers, whether or not they support font-size-adjust.
font-size - CSS: Cascading Style Sheets
WebCSSfont-size
pixels setting the font size in pixel values (px) is a good choice when you need pixel accuracy.
...when defining the font-size property, an em is equal to the font size of the element on which the em is used.
font-smooth - CSS: Cascading Style Sheets
the font-smooth css property controls the application of anti-aliasing when fonts are rendered.
... auto - let the browser decide (uses subpixel anti-aliasing when available; this is the default) none - turn font smoothing off; display text with jagged sharp edges.
font-weight - CSS: Cascading Style Sheets
meaning of relative weights when lighter or bolder is specified, the below chart shows how the absolute font weight of the element is determined.
... note that when using relative weights, only four font weights are considered — thin (100), normal (400), bold (700), and heavy (900).
<gradient> - CSS: Cascading Style Sheets
WebCSSgradient
this prevents unexpected shades of gray from appearing when both the color and the opacity are changing.
... (be aware that older browsers may not use this behavior when using the transparent keyword.) examples linear gradient example a simple linear gradient.
grid-auto-flow - CSS: Cascading Style Sheets
this may cause items to appear out-of-order, when doing so would fill in holes left by larger items.
... if it is omitted, a "sparse" algorithm is used, where the placement algorithm only ever moves "forward" in the grid when placing items, never backtracking to fill holes.
<integer> - CSS: Cascading Style Sheets
WebCSSinteger
interpolation when animated, values of the <integer> data type are interpolated using discrete, whole steps.
...\4e94 non-arabic numerals are not allowed, even when escaped (here: the japanese 5, 五).
mask-repeat - CSS: Cascading Style Sheets
the only case where clipping happens using space is when there isn't enough room to display one image.
...when the next image is added, all of the current ones compress to allow room.
mask-type - CSS: Cascading Style Sheets
WebCSSmask-type
values luminance is a keyword indicating that the associated mask image is a luminance mask, i.e., that its relative luminance values must be used when applying it.
... alpha is a keyword indicating that the associated mask image is an alpha mask, i.e., that its alpha channel values must be used when applying it.
max() - CSS: Cascading Style Sheets
WebCSSmax
you may also use parentheses to establish computation order when needed.
... accessibility concerns when max() is used for controlling text size, make sure the text is always large enough to read.
min() - CSS: Cascading Style Sheets
WebCSSmin
you may also use parentheses to establish computation order when needed.
... formal syntax min( <calc-sum># )where <calc-sum> = <calc-product> [ [ '+' | '-' ] <calc-product> ]*where <calc-product> = <calc-value> [ '*' <calc-value> | '/' <number> ]*where <calc-value> = <number> | <dimension> | <percentage> | ( <calc-sum> ) accessibility concerns when using min() to set a maximum font size, ensure that the font can still be scaled at least 200% for readability (without assistive technology like a zoom function).
overflow-block - CSS: Cascading Style Sheets
the overflow-block css property sets what shows when content overflows the block start and block end edges of a box.
...(this prevents scrollbars from appearing or disappearing when the content changes.) printers may still print overflowing content.
overflow-inline - CSS: Cascading Style Sheets
the overflow-inline css property sets what shows when content overflows the inline start and end edges of a box.
...(this prevents scrollbars from appearing or disappearing when the content changes.) printers may still print overflowing content.
overflow-x - CSS: Cascading Style Sheets
the overflow-x css property sets what shows when content overflows a block-level element's left and right edges.
...(this prevents scrollbars from appearing or disappearing when the content changes.) printers may still print overflowing content.
overflow-y - CSS: Cascading Style Sheets
the overflow-y css property sets what shows when content overflows a block-level element's top and bottom edges.
...(this prevents scrollbars from appearing or disappearing when the content changes.) printers may still print overflowing content.
overflow - CSS: Cascading Style Sheets
WebCSSoverflow
when an element's content is too big to fit in its block formatting context — in both directions.
... the javascript element.scrolltop property may be used to scroll an html element even when overflow is set to hidden.
overscroll-behavior-x - CSS: Cascading Style Sheets
the overscroll-behavior-x css property sets the browser's behavior when the horizontal boundary of a scrolling area is reached.
... by default, when the inner box is scrolled and a scroll boundary is reached, the whole page will begin to scroll, which is probably not what we want.
scroll-behavior - CSS: Cascading Style Sheets
the scroll-behavior css property sets the behavior for a scrolling box when scrolling is triggered by the navigation or cssom scrolling apis.
...when this property is specified on the root element, it applies to the viewport instead.
scroll-snap-type-x - CSS: Cascading Style Sheets
/* keyword values */ scroll-snap-type-x: none; scroll-snap-type-x: mandatory; scroll-snap-type-x: proximity; /* global values */ scroll-snap-type-x: inherit; scroll-snap-type-x: initial; scroll-snap-type-x: unset; syntax values none when the visual viewport of this scroll container is scrolled horizontally, it must ignore snap points.
...that means it snaps on that point when the scroll action finished, if possible.
scroll-snap-type-y - CSS: Cascading Style Sheets
/* keyword values */ scroll-snap-type-y: none; scroll-snap-type-y: mandatory; scroll-snap-type-y: proximity; /* global values */ scroll-snap-type-y: inherit; scroll-snap-type-y: initial; scroll-snap-type-y: unset; syntax values none when the visual viewport of this scroll container is scrolled vertically, it must ignore snap points.
...that means it snaps on that point when the scroll action finished, if possible.
scroll-snap-type - CSS: Cascading Style Sheets
-type: none; scroll-snap-type: x; scroll-snap-type: y; scroll-snap-type: block; scroll-snap-type: inline; scroll-snap-type: both; /* optional mandatory | proximity*/ scroll-snap-type: x mandatory; scroll-snap-type: y proximity; scroll-snap-type: both mandatory; /* etc */ /* global values */ scroll-snap-type: inherit; scroll-snap-type: initial; scroll-snap-type: unset; syntax values none when the visual viewport of this scroll container is scrolled, it must ignore snap points.
...that means it snaps on that point when the scroll action finished, if possible.
shape-outside - CSS: Cascading Style Sheets
when fetching, user agents must use "anonymous" mode, set the referrer source to the stylesheet's url, and set the origin to the url of the containing document.
... interpolation when animating between one <basic-shape> and a second, the rules below are applied.
<shape> - CSS: Cascading Style Sheets
WebCSSshape
when possible, use clip-path and the <basic-shape> data type instead.
... interpolation when animated, values of the <shape> data type are interpolated over their top, right, bottom, and left components, each treated as a real, floating-point number.
text-emphasis-position - CSS: Cascading Style Sheets
formal definition initial valueover rightapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax [ over | under ] && [ right | left ] examples preferring ruby over emphasis marks some editors prefer to hide emphasis marks when they conflict with ruby.
... in html, this can be done with the following style rule: ruby { text-emphasis: none; } preferring emphasis marks over ruby some other editors prefer to hide ruby when they conflict with emphasis marks.
text-shadow - CSS: Cascading Style Sheets
when more than one shadow is given, shadows are applied front-to-back, with the first-specified shadow on top.
...if unspecified, the color's value is left up to the user agent, so when consistency across browsers is desired you should define it explicitly.
text-underline-position - CSS: Cascading Style Sheets
when used with east-asian text, using the auto keyword will lead to a similar effect.
...when used with alphabetic text, using the auto keyword will lead to a similar effect.
transition-delay - CSS: Cascading Style Sheets
the transition-delay css property specifies the duration to wait before starting a property's transition effect when its value changes.
... you may specify multiple delays, which is useful when transitioning multiple properties.
WAI ARIA Live Regions/API Support - Developer guides
the entire atomic region should be presented once when it is finally no longer busy.
...it is difficult for a screen reader to decide when to interrupt a user with changes on a page.
The Unicode Bidirectional Text Algorithm - Developer guides
understanding this algorithm in at least basic terms is helpful when you're striving to produce localization-ready web content or apps.
... in this guide, we'll take a look at the bidi algorithm and learn in general what it does and how it applies to your content, so that you'll be better prepared when using the features of html and css to which the algorithm applies while determining the order and directionality of text during rendering.
Developer guides
optimization and performance when building modern web apps and sites, it's important to make your content work quickly and efficiently.
...this guide covers the algorithm in general and how it applies to content you create—especially when you build properly localized and internationalized content.
HTML attribute: crossorigin - HTML: Hypertext Markup Language
by default (that is, when the attribute is not specified), cors is not used at all.
... <script src="https://example.com/example-framework.js" crossorigin="anonymous"></script> example: webmanifest with credentials the use-credentials value must be used when fetching a manifest that requires credentials, even if the file is from the same origin.
HTML attribute: readonly - HTML: Hypertext Markup Language
the boolean readonly attribute, when present, makes the element not mutable, meaning the user can not edit the control.
... when an input has the readonly attribute, the :read-only pseudo-class also applies to it.
HTML attribute: required - HTML: Hypertext Markup Language
when an input has the required attribute, the :required pseudo-class also applies to it.
... usability when including the required attribute, provide a visible indication near the control informing the user that the input, select or textarea is required.
<bdi>: The Bidirectional Isolate element - HTML: Hypertext Markup Language
WebHTMLElementbdi
it's particularly useful when a website dynamically inserts some text and doesn't know the directionality of the text being inserted.
...when the names only contain ltr text the results look fine: <ul> <li><span class="name">henrietta boffin</span> - 1st place</li> <li><span class="name">jerry cruncher</span> - 2nd place</li> </ul> body { border: 1px solid #3f87a6; max-width: calc(100% - 40px - 6px); padding: 20px; width: calc(100% - 40px - 6px); border-width: 1px 1px 1px 5px; } no <bdi> with rtl text this examp...
<caption>: The Table Caption element - HTML: Hypertext Markup Language
WebHTMLElementcaption
they are documented below for reference when updating existing code and for historical interest only.
... when the <table> element that contains the <caption> is the only descendant of a <figure> element, you should use the <figcaption> element instead of <caption>.
<col> - HTML: Hypertext Markup Language
WebHTMLElementcol
they are documented below for reference when updating existing code and for historical interest only.
...typical values for this include a period (.) when attempting to align numbers or monetary values.
<colgroup> - HTML: Hypertext Markup Language
WebHTMLElementcolgroup
they are documented below for reference when updating existing code and for historical interest only.
...typical values for this include a period (.) when attempting to align numbers or monetary values.
<frame> - HTML: Hypertext Markup Language
WebHTMLElementframe
if this attribute is not used, the browser adds a scrollbar when necessary.
... there are two choices: "yes" for forcing a scrollbar even when it is not necessary and "no" for forcing no scrollbar even when it is necessary.
<image>: The obsolete Image element - HTML: Hypertext Markup Language
WebHTMLElementimage
seriously, the specification even literally uses the words "don't ask" when describing this element.
... while some browsers will attempt to automatically convert this into an <img> element, they won't always do so, and won't always succeed when they try, due to various ways in which the options can be interpreted.
<input type="range"> - HTML: Hypertext Markup Language
WebHTMLElementinputrange
note: when the data entered by the user doesn't adhere to the stepping configuration, the user agent may round to the nearest valid value, preferring numbers in the positive direction when there are two equally close options.
...when supported, we will be able to make the range vertical, to slide up and down with css by declaring a height value greater than the width value.
<keygen> - HTML: Hypertext Markup Language
WebHTMLElementkeygen
autofocus this boolean attribute lets you specify that the control should have input focus when the page loads, unless the user overrides it, for example by typing in a different control.
... when the submit button is pressed, a key pair of the selected size is generated.
<label> - HTML: Hypertext Markup Language
WebHTMLElementlabel
this means that, for example, a screenreader will read out the label when the user is focused on the form input, making it easier for an assistive technology user to understand what data should be entered.
... when a <label> is clicked or tapped and it is associated with a form control, the resulting click event is also raised for the associated control.
<menu> - HTML: Hypertext Markup Language
WebHTMLElementmenu
must only be specified when the parent element is a <menu> in the context menu state.
... html <!-- a button, which displays a menu when clicked.
<nextid>: The NeXT ID element (Obsolete) - HTML: Hypertext Markup Language
WebHTMLElementnextid
when opening the document, the next editor finds and reads this <nextid n="z8"> tag, and now knows to give the first of these new sections the name of z8 in the table of contents, and z14 to the content body.
...so then the nextid value is z30 when it's returned modified: <html> <head> <title> ...
<noframes>: The Frame Fallback element - HTML: Hypertext Markup Language
WebHTMLElementnoframes
a <noframes> element can contain any html elements that are allowed within the body of an html document, with the exception of the <frameset> and <frame> elements, since using frames when they aren't supported doesn't make sense.
...when frames are needed at all, they should be presented using the <iframe> element.
<noscript> - HTML: Hypertext Markup Language
WebHTMLElementnoscript
permitted content when scripting is disabled and when it is a descendant of the <head> element: in any order, zero or more <link> elements, zero or more <style> elements, and zero or more <meta> elements.
... when scripting is disabled and when it isn't a descendant of the <head> element: any transparent content, but no <noscript> element must be among its descendants.
<u>: The Unarticulated Annotation (Underline) element - HTML: Hypertext Markup Language
WebHTMLElementu
see the usage notes section for further details on when it's appropriate to use <u> and when it isn't.
... css u.spelling { text-decoration: red wavy underline; } this css indicates that when the <u> element is styled with the class spelling, it should have a red wavy underline underneath its text.
translate - HTML: Hypertext Markup Language
the translate global attribute is an enumerated attribute that is used to specify whether an element's translateable attribute values and its text node children should be translated when the page is localized, or whether to leave them unchanged.
... it can have the following values: empty string or "yes", which indicates that the element should be translated when the page is localized.
Link types: noopener - HTML: Hypertext Markup Language
this is especially useful when opening untrusted links, in order to ensure they cannot tamper with the originating document via the window.opener property (see about rel=noopener for more details), while still providing the referer http header (unless noreferrer is used as well).
... note that when noopener is used, nonempty target names other than _top, _self, and _parent are all treated like _blank in terms of deciding whether to open a new window/tab.
Quirks Mode and Standards Mode - HTML: Hypertext Markup Language
when the web standards were made at w3c, browsers could not just start using them, as doing so would break most existing sites on the web.
... see also a detailed description of when different browsers choose various modes.
Microformats - HTML: Hypertext Markup Language
for example if they wanted to identify themselves they could use an h-card such as: html example <a class="h-card" href="http://alice.example.com">alice blogger</a> when a parser encounters this data, it will know that this page contains a "card" which describes a person or organization named alice blogger with a url of http://alice.example.com/.
... datetime="2013-06-13 12:00:00">13<sup>th</sup> june 2013</time></p> <p class="p-summary">in which i extoll the virtues of using microformats.</p> <div class="e-content"> <p>blah blah blah</p> </div> </article> properties property 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.jgregorymcverry.com/profile/jgmac1106" ><img class="u-photo" src="https://quickthoughts.jgregorymcverry.com/file/2d6c9cfed7ac8e849f492b5bc7e6a630/thumb.jpg...
HTML: Hypertext Markup Language
WebHTML
use html to solve common problems provides links to sections of content explaining how to use html to solve very common problems when creating a web page: dealing with titles, adding images or videos, emphasizing content, creating a basic form, etc.
... related topics applying color to html elements using css this article covers most of the ways you use css to add color to html content, listing what parts of html documents can be colored and what css properties to use when doing so.
Choosing between www and non-www URLs - HTTP
example: a server receives a request for http://www.example.org/whaddup (when the canonical domain is example.org) the server answers with a code 301 with the header location: http://example.org/whaddup.
... when adding such a tag, you serve the same content for both domains, telling search engines which url is canonical.
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.
... for example, a script on browserleaks highlights what firefox reveals when queried by a simple script running on the site (you can find the code in https://browserleaks.com/firefox#more).
Reason: CORS disabled - HTTP
WebHTTPCORSErrorsCORSDisabled
when this happens, the user needs to turn cors back on in their browser.
...setting this to true disables cors, so whenever that's the case, cors requests will always fail with this error.
Reason: Did not find method in CORS header ‘Access-Control-Allow-Methods’ - HTTP
this header specifies a comma-delineated list of the http methods which may be used when using cors to access the url specified in the request; if the request is using any other method, this error occurs.
... make sure your code only uses the permitted http methods when accessing the service.
Reason: CORS request not HTTP - HTTP
to fix this problem, simply make sure you use https urls when issuing requests involving cors, such as xmlhttprequest, fetch apis, web fonts (@font-face), and webgl textures, and xsl stylesheets.
... local file security in firefox 68 when a user opened a page using a file:/// uri in firefox 67 and earlier, the origin of the page was defined as the directory from which the page was opened.
Using Feature Policy - HTTP
be wary of this when implementing feature policy on your website.
...when applying a policy to existing content, testing is likely required to verify it continues to work as expected.
Feature Policy - HTTP
the general principle is that there should be an intuitive or non-breaking way for web developers to detect or handle the case when the feature is disabled.
... in most cases, the policy-controlled features represent functionality that when used will negatively impact the user experience.
Accept-Language - HTTP
this header is a hint to be used when the server has no way of determining the language via another way, like a specific url, that is controlled by an explicit user decision.
...the content of the accept-language is often out of the control of the user (like when traveling and using an internet cafe in a different country); the user may also want to visit a page in another language than the locale of their user interface.
CSP: style-src - HTTP
when generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace.
... content-security-policy: style-src 'sha256-a330698cbe9dc4ef1fb12e2ee9fc06d5d14300262fa4dc5878103ab7347e158f' when generating the hash, don't include the <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace.
CSP: worker-src - HTTP
csp version 3 directive type fetch directive fallback if this directive is absent, the user agent will first look for the child-src directive, then the script-src directive, then finally for the default-src directive, when governing worker execution.
...when generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace.
Content-Security-Policy-Report-Only - HTTP
a browser capable of enforcing csp will send the following violation report as a post request to http://example.com/_/csp-reports, when the document is visited: { "csp-report": { "document-uri": "http://example.com/signup.html", "referrer": "", "blocked-uri": "http://example.com/css/style.css", "violated-directive": "style-src cdn.example.com", "original-policy": "default-src 'none'; style-src cdn.example.com; report-uri /_/csp-reports", "disposition": "report" } } as you can see, the report includes...
...for example, when the signup.html would attempt to load css from http://anothercdn.example.com/stylesheet.css, the browser would not include the full path but only the origin (http://anothercdn.example.com).
Content-Security-Policy - HTTP
so for compatibility with current browsers while also adding forward compatibility when browsers get report-to support, you can specify both report-uri and report-to: content-security-policy: ...; report-uri https://endpoint.example.com; report-to groupname in browsers that support report-to, the report-uri directive will be ignored.
... other directives block-all-mixed-content prevents loading any assets using http when the page is loaded using https.
ETag - HTTP
WebHTTPHeadersETag
this means weak etags prevent caching when byte range requests are used, but strong etags mean range requests can still be cached.
... for example, when editing mdn, the current wiki content is hashed and put into an etag in the response: etag: "33a64df551425fcc55e4d42a148795d9f25f89d4" when saving changes to a wiki page (posting data), the post request will contain the if-match header containing the etag values to check freshness against.
Location - HTTP
WebHTTPHeadersLocation
it only provides a meaning when served with a 3xx (redirection) or 201 (created) status response.
... location and content-location are different: location indicates the target of a redirection (or the url of a newly created resource), while content-location indicates the direct url to use to access the resource when content negotiation happened, without the need of further content negotiation.
Save-Data - HTTP
a value of on indicates explicit user opt-in into a reduced data usage mode on the client, and when communicated to origins allows them to deliver alternative content to reduce the data downloaded such as smaller image and video resources, different markup and styling, disabled polling and automatic updates, and so on.
... examples the vary header ensures that the content is cached properly (for instance ensuring that the user is not served a lower-quality image from the cache when save-data header is no longer present [e.g.
X-Forwarded-For - HTTP
when traffic is intercepted between clients and servers, server access logs contain the ip address of the proxy or load balancer only.
...therefore the user's privacy must be kept in mind when deploying this header.
OPTIONS - HTTP
WebHTTPMethodsOPTIONS
in this example, we will request permission for these parameters: the access-control-request-method header sent in the preflight request tells the server that when the actual request is sent, it will have a post request method.
... the access-control-request-headers header tells the server that when the actual request is sent, it will have the x-pingother and content-type headers.
An overview of HTTP - HTTP
WebHTTPOverview
this is less efficient than sharing a single tcp connection when multiple requests are sent in close succession.
... http flow when a client wants to communicate with a server, either the final server or an intermediate proxy, it performs the following steps: open a tcp connection: the tcp connection is used to send a request, or several, and receive an answer.
Proxy servers and tunneling - HTTP
when navigating through different networks of the internet, proxy servers and http tunnels are facilitating access to content on the world wide web.
...a common way to disclose this information is by using the following http headers: the standardized header: forwarded contains information from the client-facing side of proxy servers that is altered or lost when a proxy is involved in the path of the request.
302 Found - HTTP
WebHTTPStatus302
even if the specification requires the method (and the body) not to be altered when the redirection is performed, not all user-agents conform here - you can still find this type of bugged software out there.
...this is useful when you want to give a response to a put method that is not the uploaded resource but a confirmation message such as: 'you successfully uploaded xyz'.
307 Temporary Redirect - HTTP
WebHTTPStatus307
this is useful when you want to give an answer to a put method that is not the uploaded resources, but a confirmation message (like "you successfully uploaded xyz").
... the only difference between 307 and 302 is that 307 guarantees that the method and the body will not be changed when the redirected request is made.
412 Precondition Failed - HTTP
WebHTTPStatus412
this happens with conditional requests on methods other than get or head when the condition defined by the if-unmodified-since or if-none-match headers is not fulfilled.
... for example, when editing mdn, the current wiki content is hashed and put into an etag in the response: etag: "33a64df551425fcc55e4d42a148795d9f25f89d4" when saving changes to a wiki page (posting data), the post request will contain the if-match header containing the etag values to check freshness against.
501 Not Implemented - HTTP
WebHTTPStatus501
this status can also send a retry-after header, telling the requester when to check back to see if the functionality is supported by then.
... 501 is the appropriate response when the server does not recognize the request method and is incapable of supporting it for any resource.
Introduction - JavaScript
to get a better idea about the different technologies that are used when programming with javascript, consult the article javascript technologies overview.
...use the javascript documentation for information when writing scripts.
Iterators and generators - JavaScript
when called, generator functions do not initially execute their code.
...when a value is consumed by calling the generator's next method, the generator function executes until it encounters the yield keyword.
Assertions - JavaScript
this character has a different meaning when it appears at the start of a group.
... let fruitsstartswitha = fruits.filter(fruit => /^a/.test(fruit)); console.log(fruitsstartswitha); // [ 'apple', 'avocado' ] in the second example ^ is used both for matching at the beginning of input and for creating negated or complemented character sets when used within groups.
TypeError: can't assign to property "x" on "y": not an object - JavaScript
the javascript strict mode exception "can't assign to property" occurs when attempting to create a property on primitive value such as a symbol, a string, a number or a boolean.
... in strict_mode, a typeerror is raised when attempting to create a property on primitive value such as a symbol, a string, a number or a boolean.
TypeError: can't define property "x": "obj" is not extensible - JavaScript
the javascript exception "can't define property "x": "obj" is not extensible" occurs when object.preventextensions() marked an object as no longer extensible, so that it will never have properties beyond the ones it had at the time it was marked as non-extensible.
... 'use strict'; var obj = {}; object.preventextensions(obj); obj.x = 'foo'; // typeerror: can't define property "x": "obj" is not extensible in both, strict mode and sloppy mode, a call to object.defineproperty() throws when adding a new property to a non-extensible object.
TypeError: can't redefine non-configurable property "x" - JavaScript
the javascript exception "can't redefine non-configurable property" occurs when it was attempted to redefine a property, but that property is non-configurable.
...however, for example, when using object.defineproperty(), the property isn't configurable by default.
TypeError: can't access dead object - JavaScript
the javascript exception "can't access dead object" occurs when firefox disallows add-ons to keep strong references to dom objects after their parent document has been destroyed to improve in memory usage and to prevent memory leaks.
...to avoid these issues, references to dom nodes in foreign document should instead be stored in an object which is specific to that document, and cleaned up when the document is unloaded, or stored as weak references.
SyntaxError: Using //@ to indicate sourceURL pragmas is deprecated. Use //# instead - JavaScript
use //# instead" occurs when there is a deprecated source map syntax in a javascript source.
... the source map specification changed the syntax due to a conflict with ie whenever it was found in the page after //@cc_on was interpreted to turn on conditional compilation in the ie jscript engine.
RangeError: invalid array length - JavaScript
the javascript exception "invalid array length" occurs when creating an array or an arraybuffer which has a length which is either negative or larger or equal to 232, or when setting the array.length property to a value which is either negative or larger or equal to 232.
... an invalid array length might appear in these situations: when creating an array or an arraybuffer which has a length which is either negative or larger or equal to 232, or when setting the array.length property to a value which is either negative or larger or equal to 232.
SyntaxError: JSON.parse: bad parsing - JavaScript
the javascript exceptions thrown by json.parse() occur when string failed to be parsed as json.
...n.parse: missing digits after exponent sign syntaxerror: json.parse: exponent part is missing a number syntaxerror: json.parse: unexpected end of data syntaxerror: json.parse: unexpected keyword syntaxerror: json.parse: unexpected character syntaxerror: json.parse: end of data while reading object contents syntaxerror: json.parse: expected property name or '}' syntaxerror: json.parse: end of data when ',' or ']' was expected syntaxerror: json.parse: expected ',' or ']' after array element syntaxerror: json.parse: end of data when property name was expected syntaxerror: json.parse: expected double-quoted property name syntaxerror: json.parse: end of data after property name when ':' was expected syntaxerror: json.parse: expected ':' after property name in object syntaxerror: json.parse: end of ...
SyntaxError: missing : after property id - JavaScript
the javascript exception "missing : after property id" occurs when objects are created using the object initializer syntax.
... when creating objects with the object initializer syntax, a colon (:) separates keys and values for the object's properties.
TypeError: "x" is not a non-null object - JavaScript
the javascript exception "is not a non-null object" occurs when an object is expected somewhere and wasn't provided.
... examples property descriptor expected when methods like object.create() or object.defineproperty() and object.defineproperties() are used, the optional descriptor parameter expects a property descriptor object.
RangeError: argument is not a valid code point - JavaScript
the javascript exception "invalid code point" occurs when nan values, negative integers (-1), non-integers (5.4), or values larger than 0x10ffff (1114111) are used with string.fromcodepoint().
... string.fromcodepoint() throws this error when passed nan values, negative integers (-1), non-integers (5.4), or values larger than 0x10ffff (1114111).
TypeError: "x" is not a constructor - JavaScript
the javascript exception "is not a constructor" occurs when there was an attempt to use an object or a variable as a constructor, but that object or variable is not a constructor.
...to do this, you would write the following function: function car(make, model, year) { this.make = make; this.model = model; this.year = year; } now you can create an object called mycar as follows: var mycar = new car('eagle', 'talon tsi', 1993); in promises when returning an immediately-resolved or immediately-rejected promise, you do not need to create a new promise(...) and act on it.
ReferenceError: "x" is not defined - JavaScript
the javascript exception "variable is not defined" occurs when there is a non-existent variable referenced somewhere.
... note: when loading a library (such as jquery), make sure it is loaded before you access library variables, such as "$".
SyntaxError: "x" is a reserved identifier - JavaScript
the javascript exception "variable is a reserved identifier" occurs when reserved keywords are used as identifiers.
...these are reserved in strict mode and sloppy mode: enum the following are only reserved when they are found in strict mode code: implements interface let package private protected public static examples strict and non-strict reserved keywords the enum identifier is generally reserved.
SyntaxError: Unexpected token - JavaScript
the javascript exceptions "unexpected token" occur when a specific language construct was expected, but something else was provided.
... examples expression expected for example, when chaining expressions, trailing commas are not allowed.
SyntaxError: function statement requires a name - JavaScript
the javascript exception "function statement requires a name" occurs when there is a function statement in the code that requires a name.
... var greeter = { german: function () { return "moin"; } }; callback syntax also, check your syntax when using callbacks.
TypeError: cannot use 'in' operator to search for 'x' in 'y' - JavaScript
the javascript exception "right-hand side of 'in' should be an object" occurs when the in operator was used to search in strings, or in numbers, or other primitive types.
... var foo = { baz: "bar" }; "bar" in foo; // false "pi" in math; // true "pi" in math; // false searching in arrays be careful when using the in operator to search in array objects.
TypeError: 'x' is not iterable - JavaScript
the javascript exception "is not iterable" occurs when the value which is given as the right hand-side of for…of or as argument of a function such as promise.all or typedarray.from, is not an iterable object.
... function* generate(a, b) { yield a; yield b; } for (let x of generate) // typeerror: generate is not iterable console.log(x); when they are not called, the function object corresponding to the generator is callable, but not iterable.
Default parameters - JavaScript
in the following example, if no value is provided for b when multiply is called, b's value would be undefined when evaluating a * b and multiply would return nan.
... the following function will throw a referenceerror when invoked, because the default parameter value does not have access to the child scope of the function body: function f(a = go()) { // throws a `referenceerror` when `f` is invoked.
The arguments object - JavaScript
using typeof with arguments the typeof operator returns 'object' when used with arguments console.log(typeof arguments); // 'object' the type of individual arguments can be determined by indexing arguments: console.log(typeof arguments[0]); // returns the type of the first argument properties arguments.callee reference to the currently executing function that the arguments belong to.
...instead, the arguments object in non-strict functions with complex parameters will always reflect the values passed to the function when the function was called (this is the same behavior as exhibited by all strict-mode functions, regardless of the type of variables they are passed): function func(a = 55) { arguments[0] = 99; // updating arguments[0] does not also update a console.log(a); } func(10); // 10 and also: function func(a = 55) { a = 99; // updating a does not also update arguments[0] console.log(arguments[0])...
AggregateError - JavaScript
the aggregateerror object represents an error when several errors need to be wrapped in a single error.
... it is thrown when multiple errors need to be reported by an operation, for example by promise.any(), when all promises passed to it reject.
Array.prototype.every() - JavaScript
thisarg optional a value to use as this when executing callback.
... [12, 5, 8, 130, 44].every(x => x >= 10); // false [12, 54, 18, 130, 44].every(x => x >= 10); // true​ affecting initial array (modifying, appending, and deleting) the following examples tests the behaviour of the every method when the array is modified.
Array.prototype.filter() - JavaScript
thisargoptional value to use as this when executing callback.
...ria (query) */ const filteritems = (arr, query) => { return arr.filter(el => el.tolowercase().indexof(query.tolowercase()) !== -1) } console.log(filteritems(fruits, 'ap')) // ['apple', 'grapes'] console.log(filteritems(fruits, 'an')) // ['banana', 'mango', 'orange'] affecting initial array (modifying, appending and deleting) the following examples tests the behavior of the filter method when the array is modified.
Array.prototype.forEach() - JavaScript
thisarg optional value to use as this when executing callback.
... when the entry containing the value two is reached, the first entry of the whole array is shifted off—resulting in all remaining entries moving up one position.
Array.from() - JavaScript
thisarg optional value to use as this when executing mapfn.
... if (!iscallable(mapfn)) { throw new typeerror( 'array.from: when provided, the second argument must be a function' ); } // 5.
Array.prototype.indexOf() - JavaScript
this will allow you to use indexof() when there is still no native support.
... // this version tries to optimize by only checking for "in" when looking for undefined and // skipping the definitely fruitless nan search.
Array.prototype.some() - JavaScript
thisargoptional a value to use as this when executing callback.
... description the some() method executes the callback function once for each element present in the array until it finds the one where callback returns a truthy value (a value that becomes true when converted to a boolean).
Array.prototype.sort() - JavaScript
comparefunction(a, b) must always return the same value when given a specific pair of elements a and b as its two arguments.
...as the output shows, when a compare function is used, numbers sort correctly whether they are numbers or numeric strings.
Array - JavaScript
several of the built-in array methods (e.g., join(), slice(), indexof(), etc.) take into account the value of an array's length property when they're called.
... const fruits = [] fruits.push('banana', 'apple', 'peach') console.log(fruits.length) // 3 when setting a property on a javascript array when the property is a valid array index and that index is outside the current bounds of the array, the engine will update the array's length property accordingly: fruits[5] = 'mango' console.log(fruits[5]) // 'mango' console.log(object.keys(fruits)) // ['0', '1', '2', '5'] console.log(fruits.length) // 6 increasing the length.
AsyncFunction - JavaScript
description async function objects created with the asyncfunction constructor are parsed when the function is created.
... when running them, they will only be able to access their own local variables and global ones, not the ones from the scope in which the asyncfunction constructor was called.
BigInt.prototype.toLocaleString() - JavaScript
performance when formatting large numbers of numbers, it is better to create a numberformat object and use the function provided by its numberformat.format property.
...chinese decimal console.log(bigint.tolocalestring('zh-hans-cn-u-nu-hanidec')); // → 一二三,四五六,七八九,一二三,四五六,七八九 // when requesting a language that may not be supported, such as // balinese, include a fallback language, in this case indonesian console.log(bigint.tolocalestring(['ban', 'id'])); // → 123.456.789.123.456.789 using options the results provided by tolocalestring can be customized using the options argument: var bigint = 123456789123456789n; // request a currency format console.log(bigint.tolocale...
Boolean - JavaScript
any object of which the value is not undefined or null, including a boolean object whose value is false, evaluates to true when passed to a conditional statement.
... note: when the non-standard property document.all is used as an argument for this constructor, the result is a boolean object with the value false.
DataView.prototype.byteLength - JavaScript
the value is established when an dataview is constructed and cannot be changed.
... examples using the bytelength property var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.bytelength; // 8 (matches the bytelength of the buffer) var dataview2 = new dataview(buffer, 1, 5); dataview2.bytelength; // 5 (as specified when constructing the dataview) var dataview3 = new dataview(buffer, 2); dataview3.bytelength; // 6 (due to the offset of the constructed dataview) specifications specification ecmascript (ecma-262)the definition of 'dataview.prototype.bytelength' in that specification.
DataView.prototype.byteOffset - JavaScript
the value is established when an dataview is constructed and cannot be changed.
... examples using the byteoffset property var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.byteoffset; // 0 (no offset specified) var dataview2 = new dataview(buffer, 3); dataview2.byteoffset; // 3 (as specified when constructing the dataview) specifications specification ecmascript (ecma-262)the definition of 'dataview.prototype.byteoffset' in that specification.
Date.prototype.toLocaleDateString() - JavaScript
performance when formatting large numbers of dates, it is better to create an intl.datetimeformat object and use the function provided by its format property.
...edatestring('fa-ir')); // → "۱۳۹۱/۹/۳۰" // arabic in most arabic speaking countries uses real arabic digits console.log(date.tolocaledatestring('ar-eg')); // → "٢٠‏/١٢‏/٢٠١٢" // for japanese, applications may want to use the japanese calendar, // where 2012 was the year 24 of the heisei era console.log(date.tolocaledatestring('ja-jp-u-ca-japanese')); // → "24/12/20" // when requesting a language that may not be supported, such as // balinese, include a fallback language, in this case indonesian console.log(date.tolocaledatestring(['ban', 'id'])); // → "20/12/2012" using options the results provided by tolocaledatestring() can be customized using the options argument: var date = new date(date.utc(2012, 11, 20, 3, 0, 0)); // request a weekday along with a long ...
Date.prototype.toLocaleTimeString() - JavaScript
performance when formatting large numbers of dates, it is better to create an intl.datetimeformat object and use the function provided by its format property.
...s')); // → "7:00:00 pm" // british english uses 24-hour time without am/pm console.log(date.tolocaletimestring('en-gb')); // → "03:00:00" // korean uses 12-hour time with am/pm console.log(date.tolocaletimestring('ko-kr')); // → "오후 12:00:00" // arabic in most arabic speaking countries uses real arabic digits console.log(date.tolocaletimestring('ar-eg')); // → "٧:٠٠:٠٠ م" // when requesting a language that may not be supported, such as // balinese, include a fallback language, in this case indonesian console.log(date.tolocaletimestring(['ban', 'id'])); // → "11.00.00" using options the results provided by tolocaletimestring() can be customized using the options argument: var date = new date(date.utc(2012, 11, 20, 3, 0, 0)); // an application may want to use utc and...
Date.prototype.toString() - JavaScript
the tostring() method is automatically called when a date is to be represented as a text value, e.g.
... console.log(new date()), or when a date is used in a string concatenation, such as var today = 'today is ' + new date().
Error.prototype.stack - JavaScript
description each step will be separated by a newline, with the first part of the line being the function name (if not a call from the global scope), then by an at (@) sign, the file location (except when the function is the error constructor as the error is being thrown), a colon, and, if there is a file location, the line number.
...for example, firefox sets it when creating an error object, while phantomjs sets it only when throwing the error, and archived msdn docs also seem to match the phantomjs implementation.
Function.prototype.call() - JavaScript
syntax func.call([thisarg[, arg1, arg2, ...argn]]) parameters thisarg optional the value to use as this when calling func.
... { species: '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.prototype.toString() - JavaScript
javascript calls the tostring method automatically when a function is to be represented as a text value, e.g.
... when a function is concatenated with a string.
Function - JavaScript
function.prototype.bind(thisarg[, arg1[, arg2[, ...argn]]]) creates a new function which, when called, has its this set to the provided thisarg.
...when running them, they will only be able to access their own local variables and global ones, not the ones from the scope in which the function constructor was created.
GeneratorFunction - JavaScript
description generator function objects created with the generatorfunction constructor are parsed when the function is created.
... when running them, they will only be able to access their own local variables and global ones, not the ones from the scope in which the generatorfunction constructor was called.
Intl.DateTimeFormat.prototype.formatRange() - JavaScript
the intl.datetimeformat.prototype.formatrange() formats a date range in the most concise way based on the locale and options provided when instantiating intl.datetimeformat object.
... syntax intl.datetimeformat.prototype.formatrange(startdate, enddate) examples basic formatrange usage this method receives two dates and formats the date range in the most concise way based on the locale and options provided when instantiating intl.datetimeformat.
Intl.DateTimeFormat.prototype.formatToParts() - JavaScript
var datestring = formatter.formattoparts(date).map(({type, value}) => { switch (type) { case 'dayperiod': return `<b>${value}</b>`; default : return value; } }).reduce((string, part) => string + part); this will make the day period bold, when using the formattoparts() method.
... 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.
Intl.DateTimeFormat - JavaScript
intl.datetimeformat.prototype.formatrange() this method receives two dates and formats the date range in the most concise way based on the locale and options provided when instantiating datetimeformat.
...19." // arabic in most arabic speaking countries uses real arabic digits console.log(new intl.datetimeformat('ar-eg').format(date)); // → "١٩‏/١٢‏/٢٠١٢" // for japanese, applications may want to use the japanese calendar, // where 2012 was the year 24 of the heisei era console.log(new intl.datetimeformat('ja-jp-u-ca-japanese').format(date)); // → "24/12/19" // when requesting a language that may not be supported, such as // balinese, include a fallback language, in this case indonesian console.log(new intl.datetimeformat(['ban', 'id']).format(date)); // → "19/12/2012" using options the date and time formats can be customized using the options argument: var date = new date(date.utc(2012, 11, 20, 3, 0, 0, 200)); // request a weekday along with a long d...
Number.prototype.toLocaleString() - JavaScript
performance when formatting large numbers of numbers, it is better to create a numberformat object and use the function provided by its numberformat.format property.
...chinese decimal console.log(number.tolocalestring('zh-hans-cn-u-nu-hanidec')); // → 一二三,四五六.七八九 // when requesting a language that may not be supported, such as // balinese, include a fallback language, in this case indonesian console.log(number.tolocalestring(['ban', 'id'])); // → 123.456,789 using options the results provided by tolocalestring can be customized using the options argument: var number = 123456.789; // request a currency format console.log(number.tolocalestring('de-de', { sty...
Number - JavaScript
description when used as a function, number(value) converts a string or other value to the number type.
...(more details on this are described in the ecmascript standard, chapter 6.1.6 the number type.) const biggestint = number.max_safe_integer // (253 - 1) => 9007199254740991 const smallestint = number.min_safe_integer // -(253 - 1) => -9007199254740991 when parsing data that has been serialized to json, integer values falling outside of this range can be expected to become corrupted when json parser coerces them to number type.
Object.prototype.__defineSetter__() - JavaScript
the __definesetter__ method binds an object's property to a function to be called when an attempt is made to set that property.
... fun a function to be called when there is an attempt to set the specified property.
Object.assign() - JavaScript
(target === null || target === undefined) { throw new typeerror('cannot convert undefined or null to object'); } var to = object(target); for (var index = 1; index < arguments.length; index++) { var nextsource = arguments[index]; if (nextsource !== null && nextsource !== undefined) { for (var nextkey in nextsource) { // avoid bugs when hasownproperty is shadowed if (object.prototype.hasownproperty.call(nextsource, nextkey)) { to[nextkey] = nextsource[nextkey]; } } } } return to; }, writable: true, configurable: true }); } examples cloning an object const obj = { a: 1 }; const copy = object.assign({}, obj); console.log(copy); // { a: 1 } warn...
...console.log(obj); // { "0": "a", "1": "b", "2": "c" } exceptions will interrupt the ongoing copying task const target = object.defineproperty({}, 'foo', { value: 1, writable: false }); // target.foo is a read-only property object.assign(target, { bar: 2 }, { foo2: 3, foo: 3, foo3: 3 }, { baz: 4 }); // typeerror: "foo" is read-only // the exception is thrown when assigning target.foo console.log(target.bar); // 2, the first source was copied successfully.
Object.prototype.constructor - JavaScript
*/ } parent.prototype.parentmethod = function parentmethod() {} function child() { parent.call(this) // make sure everything is initialized properly } child.prototype = object.create(parent.prototype) // re-define child prototype to parent prototype child.prototype.constructor = child // return original constructor to child but when do we need to perform the last line here?
... let's try to define the cases in which re-assignment of the original constructor will play a major role, and when it will be one superfluous line of code.
Object.create() - JavaScript
this is especially true when debugging, since common object-property converting/detecting utility functions may generate errors, or simply lose information (especially if using silent error-traps that ignore errors).
...however, when attempting to actually use these objects, their differences quickly become apparent: > "oco is: " + oco // shows "oco is: [object object]" > "ocn is: " + ocn // throws error: cannot convert object to primitive value testing just a few of the many most basic built-in functions shows the magnitude of the problem more clearly: > alert(oco) // shows [object object] > alert(ocn) // throws error: ...
Object.preventExtensions() - JavaScript
attempting to add new properties to a non-extensible object will fail, either silently or by throwing a typeerror (most commonly, but not exclusively, when in strict mode).
...object.preventextensions(empty); object.isextensible(empty); // === false // object.defineproperty throws when adding // a new property to a non-extensible object.
Object.prototype.valueOf() - JavaScript
you rarely need to invoke the valueof method yourself; javascript automatically invokes it when encountering an object where a primitive value is expected.
...when you create a custom object, you can override object.prototype.valueof() to call a custom method instead of the default object method.
Promise.prototype.catch() - JavaScript
syntax p.catch(onrejected); p.catch(function(reason) { // rejection }); parameters onrejected a function called when the promise is rejected.
... { console.log('not fired due to the catch'); }); // the following behaves the same as above p1.then(function(value) { console.log(value); // "success!" return promise.reject('oh, no!'); }).catch(function(e) { console.error(e); // "oh, no!" }).then(function(){ console.log('after a catch the chain is restored'); }, function () { console.log('not fired due to the catch'); }); gotchas when throwing errors // throwing an error will call the catch method most of the time var p1 = new promise(function(resolve, reject) { throw new error('uh-oh!'); }); p1.catch(function(e) { console.error(e); // "uh-oh!" }); // errors thrown inside asynchronous functions will act like uncaught errors var p2 = new promise(function(resolve, reject) { settimeout(function() { throw new error('u...
Reflect.construct() - JavaScript
when using object.create() and function.prototype.apply(), the new.target operator will point to undefined within the function used as the constructor, since the new keyword is not being used to create the object.
... when invoking reflect.construct(), on the other hand, the new.target operator will point to the newtarget parameter if supplied, or target if not.
RegExp.prototype.sticky - JavaScript
egex.test(str); // true regex.lastindex = 5; regex.test(str); // false (lastindex is taken into account with sticky flag) regex.lastindex; // 0 (reset after match failure) anchored sticky flag for several versions, firefox's spidermonkey engine had a bug with regard to the ^ assertion and the sticky flag which allowed expressions starting with the ^ assertion and using the sticky flag to match when they shouldn't.
...perhaps because of the bug, the es2015 specification specifically calls out the fact that: when the y flag is used with a pattern, ^ always matches only at the beginning of the input, or (if multiline is true) at the beginning of a line.
String.prototype.fontsize() - JavaScript
description when you specify size as an integer, you set the font size of str to one of the 7 defined sizes.
... when you specify size as a string such as "-2", you adjust the font size of str relative to the size set in the <basefont> tag.
String.prototype.localeCompare() - JavaScript
negative when the referencestr occurs before comparestring positive when the referencestr occurs after comparestring returns 0 if they are equivalent do not rely on exact return values of -1 or 1!
... performance when comparing large numbers of strings, such as in sorting large arrays, it is better to create an intl.collator object and use the function provided by its compare property.
String.prototype.replaceAll() - JavaScript
syntax const newstr = str.replaceall(regexp|substr, newsubstr|function) when using a `regexp` you must have to set the global ("g") flag; otherwise, it will throw a typeerror: "replaceall must be called with a global regexp".
... (the exact number of arguments depends on whether the first argument is a regexp object—and, if so, how many parenthesized submatches it specifies.) examples using replaceall 'aabbcc'.replaceall('b', '.'); // 'aa..cc' non-global regex throws when using a regular expression search value, it must be global.
String.prototype.toUpperCase() - JavaScript
exceptions typeerror when called on null or undefined, for example, string.prototype.touppercase.call(undefined).
... examples basic usage console.log('alphabet'.touppercase()); // 'alphabet' conversion of non-string this values to strings this method will convert any non-string value to a string, when you set its this to a value that is not a string: const a = string.prototype.touppercase.call({ tostring: function tostring() { return 'abcdef'; } }); const b = string.prototype.touppercase.call(true); // prints out 'abcdef true'.
Symbol.isConcatSpreadable - JavaScript
the symbol.isconcatspreadable well-known symbol is used to configure if an object should be flattened to its array elements when using the array.prototype.concat() method.
...oncatspreadable writable no enumerable no configurable no examples arrays by default, array.prototype.concat() spreads (flattens) arrays into its result: let alpha = ['a', 'b', 'c'], let numeric = [1, 2, 3] let alphanumeric = alpha.concat(numeric) console.log(alphanumeric) // result: ['a', 'b', 'c', 1, 2, 3] when setting symbol.isconcatspreadable to false, you can disable the default behavior: let alpha = ['a', 'b', 'c'], let numeric = [1, 2, 3] numeric[symbol.isconcatspreadable] = false let alphanumeric = alpha.concat(numeric) console.log(alphanumeric) // result: ['a', 'b', 'c', [1, 2, 3] ] array-like objects for array-like objects, the default is to not spread.
SyntaxError - JavaScript
the syntaxerror object represents an error when trying to interpret syntactically invalid code.
... it is thrown when the javascript engine encounters tokens or token order that does not conform to the syntax of the language when parsing code.
TypeError - JavaScript
the typeerror object represents an error when an operation could not be performed, typically (but not exclusively) when a value is not of the expected type.
... a typeerror may be thrown when: an operand or argument passed to a function is incompatible with the type expected by that operator or function; or when attempting to modify a value that cannot be changed; or when attempting to use a value in an inappropriate way.
TypedArray.prototype.byteLength - JavaScript
the value is established when a typedarray is constructed and cannot be changed.
... examples using the bytelength property var buffer = new arraybuffer(8); var uint8 = new uint8array(buffer); uint8.bytelength; // 8 (matches the bytelength of the buffer) var uint8 = new uint8array(buffer, 1, 5); uint8.bytelength; // 5 (as specified when constructing the uint8array) var uint8 = new uint8array(buffer, 2); uint8.bytelength; // 6 (due to the offset of the constructed uint8array) specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.bytelength' in that specification.
TypedArray.prototype.byteOffset - JavaScript
the value is established when a typedarray is constructed and cannot be changed.
... examples using the byteoffset property var buffer = new arraybuffer(8); var uint8 = new uint8array(buffer); uint8.byteoffset; // 0 (no offset specified) var uint8 = new uint8array(buffer, 3); uint8.byteoffset; // 3 (as specified when constructing uint8array) specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.byteoffset' in that specification.
TypedArray.prototype.filter() - JavaScript
thisarg optional value to use as this when executing callback.
... callback is invoked with three arguments: the value of the element the index of the element the typed array object being traversed if a thisarg parameter is provided to filter, it will be passed to callback when invoked, for use as its this value.
TypedArray.prototype.forEach() - JavaScript
value to use as this when executing callback.
... callback is invoked with three arguments: the element value the element index the typed array being traversed if a thisarg parameter is provided to foreach(), it will be passed to callback when invoked, for use as its this value.
TypedArray.prototype.length - JavaScript
the value is established when a typedarray is constructed and cannot be changed.
... examples using the length property var buffer = new arraybuffer(8); var uint8 = new uint8array(buffer); uint8.length; // 8 (matches the length of the buffer) var uint8 = new uint8array(buffer, 1, 5); uint8.length; // 5 (as specified when constructing the uint8array) var uint8 = new uint8array(buffer, 2); uint8.length; // 6 (due to the offset of the constructed uint8array) specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.length' in that specification.
TypedArray.prototype.some() - JavaScript
value to use as this when executing callback.
... if a thisarg parameter is provided to some, it will be passed to callback when invoked, for use as its this value.
WebAssembly - JavaScript
webassembly.runtimeerror() error type that is thrown whenever webassembly specifies a trap.
...because the instantiatestreaming() function accepts a promise for a response object, you can directly pass it a windoworworkerglobalscope.fetch() call, and it will pass the response into the function when it fulfills.
eval() - JavaScript
it is far too easy for a bad actor to run arbitrary code when you use eval().
...when the second statement is executed, eval() will cause these statements to be performed, and it will also evaluate the set of statements and return the value that is assigned to z.
Property accessors - JavaScript
it's typical when speaking of an object's properties to make a distinction between properties and methods.
... x = eval('document.forms.form_name.elements.' + strformcontrol + '.value') eval() is slow and should be avoided whenever possible.
new operator - JavaScript
when the code new foo(...) is executed, the following things happen: a new object is created, inheriting from foo.prototype.
... property that takes a person object, as follows: function car(make, model, year, owner) { this.make = make; this.model = model; this.year = year; this.owner = owner; } to instantiate the new objects, you then use the following: var car1 = new car('eagle', 'talon tsi', 1993, rand); var car2 = new car('nissan', '300zx', 1992, ken); instead of passing a literal string or integer value when creating the new objects, the above statements pass the objects rand and ken as the parameters for the owners.
super - JavaScript
super.functiononparent([arguments]); description when used in a constructor, the super keyword appears alone and must be used before the this keyword is used.
... super.prop cannot overwrite non-writable properties when defining non-writable properties with e.g.
continue - JavaScript
examples using continue with while the following example shows a while loop that has a continue statement that executes when the value of i is 3.
...when false is returned, the remainder of the checkiandj statement is completed.
debugger - JavaScript
syntax debugger; examples using the debugger statement the following example shows code where a debugger statement has been inserted, to invoke a debugger (if one exists) when the function is called.
...} when the debugger is invoked, execution is paused at the debugger statement.
export - JavaScript
the export statement is used when creating javascript modules to export live bindings to functions, objects, or primitive values from the module so they can be used by other programs with the import statement.
... bindings that are exported can still be modified locally; when imported, although they can only be read by the importing module the value updates whenever it is updated by the exporting module.
if...else - JavaScript
any value that is not false, undefined, null, 0, -0, nan, or the empty string (""), and any object, including a boolean object whose value is false, is considered truthy when used as the condition.
...however, you can write it with a space between else and if: if (x > 50) { /* do something */ } else if (x > 5) { /* do something */ } else { /* do something */ } assignment within the conditional expression it is advisable to not use simple assignments in a conditional expression, because the assignment can be confused with equality when glancing over the code.
throw - JavaScript
when you throw an exception, expression specifies the value of the exception.
... examples throw an object you can specify an object when you throw an exception.
var - JavaScript
when attempting to resolve a name to a value, the scope chain is searched.
...the value will be indeed assigned when the assignment statement is reached: function do_something() { console.log(bar); // undefined var bar = 111; console.log(bar); // 111 } // ...is implicitly understood as: function do_something() { var bar; console.log(bar); // undefined bar = 111; console.log(bar); // 111 } examples declaring and initializing two variables var a = 0, b = 0; assigning two variables with sing...
background_color - Web app manifests
this value is used by the user agent to draw the background color of a shortcut when the manifest is available before the stylesheet has loaded.
... note: the background_color member is only meant to improve the user experience while the main stylesheet is loading from the network or the storage media; it is not used by the user agent as the background-color css property when the progressive web app stylesheet is available.
shortcuts - Web app manifests
a user agent can use these values to assemble a context menu to be displayed by the operating system when a user engages with the web app's icon.
... when user invokes a shortcut, the user agent will navigate to the address given by shortcut's url member.
Authoring MathML - MathML
html becomes verbose when your document contains advanced structures like lists or tables but fortunately there are many generators from simple notations, wysiwyg editors and other content management systems to help writing web pages.
...the editor uses its own syntax "starmath" for the source but mathml is also generated when the document is saved.
<maction> - MathML
toggle: when there is a click on the subexpression, the rendering alternates the display of selected subexpressions.
... tooltip: when the pointer moves over the expression, a tooltip box with a message is displayed near the expression.
<mo> - MathML
WebMathMLElementmo
largeop specifies whether the operator should be drawn larger than normal when displaystyle="true" is set.
...allowed values are: infinity an arbitrary length movablelimits specifies whether attached under- and overscripts move to sub- and superscript positions when displaystyle is false.
MathML documentation index - MathML
WebMathMLIndex
html becomes verbose when your document contains advanced structures like lists or tables but fortunately there are many generators from simple notations, wysiwyg editors and other content management systems to help writing web pages.
...note that this error is not thrown when your mathml markup is wrong or not well-formed xml.
Media type and format guide: image, audio, and video content - Web media technologies
WebMediaFormats
the "codecs" parameter in common media types when specifying the mime type describing a media format, you can provide details using the codecs parameter as part of the type string.
...this lets you make real-time decisions about what formats to use and when.
Performance budgets - Web Performance
when defining metrics, you should focus on user experience, which will dictate not only the bounce or conversion rate but how likely is that user to return.
...webpack), has performance features that will notify you when assets exceed specified limits.
color-interpolation - SVG: Scalable Vector Graphics
when a child element is blended into a background, the value of the color-interpolation property on the child determines the type of blending, not the value of the color-interpolation on the parent.
...when animating colors, color interpolation is performed according to the value of the color-interpolation property on the element being animated.
display - SVG: Scalable Vector Graphics
WebSVGAttributedisplay
when applied to a container element, setting display to none causes the container and all of its children to be invisible; thus, it acts on groups of elements as a group.
... when the display attribute is set to none, then the given element does not become part of the rendering tree.
method - SVG: Scalable Vector Graphics
WebSVGAttributemethod
the characters are rotated, scaled and stretched when they are rendered.
...cursive fonts), the connections may not align properly when text is rendered along the path.
restart - SVG: Scalable Vector Graphics
WebSVGAttributerestart
<svg viewbox="0 0 220 200" xmlns="http://www.w3.org/2000/svg"> <rect y="30" width="100" height="100"> <animate attributetype="xml" attributename="y" from="30" to="100" dur="5s" repeatcount="1" restart="always" /> </rect> <rect x="120" y="30" width="100" height="100"> <animate attributetype="xml" attributename="y" from="30" to="100" dur="5s" repeatcount="1" restart="whennotactive"/> </rect> <a id="restart"><text y="20">restart animation</text></a> </svg> document.getelementbyid("restart").addeventlistener("click", evt => { document.queryselectorall("animate").foreach(element => { element.beginelement(); }); }); usage notes value always | whennotactive | never default value always animatable no always ...
... whennotactive this value indicates that the animation can only be restarted when it is not active (i.e.
target - SVG: Scalable Vector Graphics
WebSVGAttributetarget
the target attribute should be used when there are multiple possible targets for the ending resource, such as when the parent document is embedded within an html or xhtml document, or is viewed with a tabbed browser.
... this attribute specifies the name of the browsing context (e.g., a browser tab or an (x)html iframe or object element) into which a document is to be opened when the link is activated: only one element is using this attribute: <a> html, body, svg { height: 100%; } text { font: 20px arial, helvetica, sans-serif; fill: blue; text-decoration: underline; } <svg viewbox="0 0 300 120" xmlns="http://www.w3.org/2000/svg"> <a href="https://developer.mozilla.org" target="_self"> <text x="0" y="20">open link within iframe</text> </a> <a href="https://developer.mozilla.org" target="_blank"> <text x="0" y="60">open link in new tab or window</text> </a> <a href="https://developer.mozilla.org" target="_top"> <text x="0" y="100">open link in this tab or window</text> </...
vector-effect - SVG: Scalable Vector Graphics
the vector-effect property specifies the vector effect to use when drawing an object.
...when this vector effect and the transform property are defined at the same time, that property is consumed for this effect.
<use> - SVG: Scalable Vector Graphics
WebSVGElementuse
since the cloned nodes are not exposed, care must be taken when using css to style a use element and its cloned descendants.
...they only have an effect when use refers to a svg or symbol element.
SVG as an Image - SVG: Scalable Vector Graphics
in: html <img> or <svg> elements css background-image gecko-specific contexts additionally, gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) introduced support for using svg in these contexts: css list-style-image css content svg <image> element svg <feimage> element canvas drawimage function restrictions for security purposes, gecko places some restrictions on svg content when it's being used as an image: javascript is disabled.
... note that the above restrictions are specific to image contexts; they don't apply when svg content is viewed directly, or when it's embedded as a document via the <iframe>, <object>, or <embed> elements.
Basic Transformations - SVG: Scalable Vector Graphics
effects on coordinate systems when using transformations you establish a new coordinate system inside the element the transformations apply to.
...the more intriguing effects arise, when you rely on attributes like userspaceonuse and the such.
Paths - SVG: Scalable Vector Graphics
WebSVGTutorialPaths
a good understanding of paths is important when drawing svgs.
...when the parser runs into this letter, it knows it needs to move to a point.
Patterns - SVG: Scalable Vector Graphics
WebSVGTutorialPatterns
what this means is that unless you specify one or both of these attributes (patterncontentunits and patternunits), the shapes you draw inside your pattern are being drawn in a different coordinate system than the pattern element is using, which can make things a bit confusing when you're writing this by hand.
... neither of these uses is what one would normally think of when you think of a pattern.
Texts - SVG: Scalable Vector Graphics
WebSVGTutorialTexts
« previousnext » when talking about text in svg we have to differentiate two almost completely separate topics.
...it is meant to allow the rendering engine to fine-tune the positions of the glyphs when its own measured text length doesn't meet the one provided here.
Certificate Transparency - Web security
implementation when certificates are submitted to a ct log, a signed certificate timestamp (sct) is generated and returned.
... the specification states that compliant servers must provide a number of these scts to tls clients when they connect.
Subdomain takeovers - Web security
a subdomain takeover occurs when an attacker gains control over a subdomain of a target domain.
... typically, this happens when the subdomain has a canonical name (cname) in the domain name system (dns), but no host is providing content for it.
Web security
this article provides an overview of tls and the kinds of decisions you need to make when securing your content.
...this article provides some information about signature algorithms known to be weak, so you can avoid them when appropriate.
<xsl:choose> - XSLT: Extensible Stylesheet Language Transformations
WebXSLTElementchoose
syntax <xsl:choose> <xsl:when test="[whatever to test1]"></xsl:when> <xsl:when test="[whatever to test2]"></xsl:when> <xsl:otherwise></xsl:otherwise> [optional] </xsl:choose> required attributes none.
...it contains one or more <xsl:when> elements, and, optionally, a final <xsl:otherwise> element.
<xsl:number> - XSLT: Extensible Stylesheet Language Transformations
WebXSLTElementnumber
the processor goes to the first node in the ancestor-or-self axis that matches the count attribute and then counts that node plus all its preceding siblings (stopping when it reaches a match to the from attribute, if there is one) that also match the count attribute.if no match is found, the sequence will be an empty list.
...the processor looks at all ancestors of the current node and the current node itself, stopping when it reaches a match for the from attribute, if there is one.
<xsl:param> - XSLT: Extensible Stylesheet Language Transformations
WebXSLTElementparam
when used as a top-level element, the parameter is global .
... when used inside an <xsl:template> element, the parameter is local to that template.
XSLT elements reference - XSLT: Extensible Stylesheet Language Transformations
WebXSLTElement
e><xsl:choose><xsl:comment><xsl:copy-of><xsl:copy><xsl:decimal-format><xsl:element><xsl:fallback><xsl:for-each><xsl:if><xsl:import><xsl:include><xsl:key><xsl:message><xsl:namespace-alias><xsl:number><xsl:otherwise><xsl:output><xsl:param><xsl:preserve-space><xsl:processing-instruction><xsl:sort><xsl:strip-space><xsl:stylesheet><xsl:template><xsl:text><xsl:transform><xsl:value-of><xsl:variable><xsl:when><xsl:with-param> <xsl:apply-imports> <xsl:apply-templates> <xsl:attribute> <xsl:attribute-set> <xsl:call-template> <xsl:choose> <xsl:comment> <xsl:copy> <xsl:copy-of> <xsl:decimal-format> <xsl:element> <xsl:fallback> (not supported) <xsl:for-each> <xsl:if> <xsl:import> (mostly supported) <xsl:include> <xsl:key> <xsl:message> <xsl:namespace-alias> (not supported) <xsl:number>...
... (partially supported) <xsl:otherwise> <xsl:output> (partially supported) <xsl:param> <xsl:preserve-space> <xsl:processing-instruction> <xsl:sort> <xsl:strip-space> <xsl:stylesheet> (partially supported) <xsl:template> <xsl:text> (partially supported) <xsl:transform> <xsl:value-of> (partially supported) <xsl:variable> <xsl:when> <xsl:with-param> ...
Using the WebAssembly JavaScript API - WebAssembly
we need to reflect this two-level namespace in javascript when writing the object to be imported into the wasm module.
... when the time comes to call a function pointer, the webassembly caller supplies the index, which can then be safety bounds checked against the table before indexing and calling the indexed function reference.
WebAssembly
compiling a new c/c++ module to webassembly when you’ve written code in c/c++, you can then compile it into .wasm using a tool like emscripten.
...this is the low-level textual representation of a .wasm module shown in browser developer tools when debugging.
Navigator.mozNotification - Archive of obsolete content
permissions when using notifications in an open web app, be sure to add the desktop-notification permission in your manifest file: "permissions": { "desktop-notification": {} } usage notes in firefox 22+, the instantiation of a new notification should be done with the notification object by calling new notification(title, options).
Window: deviceproximity event - Archive of obsolete content
the deviceproximity event is fired when fresh data is available from a proximity sensor.
Window: userproximity event - Archive of obsolete content
the userproximity event is fired when fresh data is available from a proximity sensor (indicates whether the nearby object is near the device or not).
Reddit Example - Archive of obsolete content
when the user clicks on the title of a story in the panel, the add-on opens the linked story in a new tab in the main browser window.
Contributor's Guide - Archive of obsolete content
each class defines one or more members, which are initialized to a given value when the class is instantiated.
Testing the Add-on SDK - Archive of obsolete content
this suite builds add-ons which are tests (ie: their main.js script's merely run tests and close firefox when their tests are done), and runs them as cfx run would.
XUL Migration Guide - Archive of obsolete content
next, we'll look at some of the main tasks involved in migrating: working with content scripts using the sdk's supported apis how to go beyond the supported apis when necessary, by: using third party modules using the sdk's low-level apis getting direct access to xpcom finally, we'll walk through a simple example.
ui - Archive of obsolete content
so they have a checked property which is toggled when the user clicks the button, and the icon gets a "pressed" look when the button is checked.
content/worker - Archive of obsolete content
detach this event is emitted when the document associated with this worker is unloaded or the worker's destroy() method is called.
event/core - Archive of obsolete content
for example, the tabs module emits an open event when a new tab is opened.
event/target - Archive of obsolete content
for example, a panel instance emits an show event when the panel is shown.
io/file - Archive of obsolete content
if your add-on uses literal windows-style path specifications with this api, your add-on likely won't work when users run it on unix-like systems.
io/text-streams - Archive of obsolete content
it's called as callback(error) when the write completes.
net/url - Archive of obsolete content
charset string the character set to use when read the content of the uri given.
preferences/service - Archive of obsolete content
value : string preference value, a url to a properties file example: require("sdk/preferences/service").set("general.useragent.locale", "chrome://global/locale/intl.properties"); example: setting global preferences var { get, set } = require("sdk/preferences/service"); var { when: unload } = require("sdk/system/unload"); var oldvalue = get("browser.urlbar.autofill"); set("browser.urlbar.autofill", true); // by amo policy global preferences must be changed back to their original value unload(function() { set("browser.urlbar.autofill", oldvalue); }); ...
system/child_process - Archive of obsolete content
the sdk versions don't: so when you specify a command you must pass in a complete path to the command or use the env option to set up the child process environment.
test/assert - Archive of obsolete content
each test will be passed an assert object when you run the tests using jpm test.
test/httpd - Archive of obsolete content
usage the most basic usage is: var { startserverasync } = require("sdk/test/httpd"); var srv = startserverasync(port, basepath); require("sdk/system/unload").when(function cleanup() { srv.stop(function() { // you should continue execution from this point.
Low-Level APIs - Archive of obsolete content
system/unload register callbacks that are called when a module is unloaded.
Release notes - Archive of obsolete content
content scripts in page-mod get detach events when the add-on is disabled or removed.
jpmignore - Archive of obsolete content
by using this file you can let jpm know which files and directories you would like it to ignore when building a .xpi file with jpm xpi.
Adding a Button to the Toolbar - Archive of obsolete content
this is just like the action button api except it adds a boolean checked property which is toggled whenever the button is checked.
Annotator - Archive of obsolete content
whenever the user loads a page containing annotated elements these elements are highlighted, and if the user moves the mouse over an annotated element its annotation is displayed.
Creating Event Targets - Archive of obsolete content
it will emit events when the user adds and visits bookmarks, enabling users of the module to listen for these events using the sdk's standard event api.
Creating Reusable Modules - Archive of obsolete content
var s = array.from(hash, (c, i) => tohexstring(hash.charcodeat(i))).join(""); return s; } putting it together the complete add-on adds a button to firefox: when the user clicks the button, we ask them to select a file, compute the hash, and log the hash to the console: var {cc, ci} = require("chrome"); // return the two-digit hexadecimal code for a byte function tohexstring(charcode) { return ("0" + charcode.tostring(16)).slice(-2); } function md5file(path) { var f = cc["@mozilla.org/file/local;1"] .createinstance(ci.nsilocalfile); f.i...
List Open Tabs - Archive of obsolete content
the following add-on adds an action button that logs the urls of open tabs when the user clicks it: require("sdk/ui/button/action").actionbutton({ id: "list-tabs", label: "list tabs", icon: "./icon-16.png", onclick: listtabs }); function listtabs() { var tabs = require("sdk/tabs"); for (let tab of tabs) console.log(tab.url); } note: to get this working, you will need to save an icon for the button to your add-on's "data" directory as "icon-16.png".
Developing for Firefox Mobile - Archive of obsolete content
when you need to run the add-on, first ensure that firefox is not running on the device.
Canvas code snippets - Archive of obsolete content
the function returns a promise which resolves when the file has been completely saved.
Finding window handles - Archive of obsolete content
when working on windows platforms, many apis and frameworks require a window handle (hwnd type).
JS XPCOM - Archive of obsolete content
determining which interfaces an xpcom component supports to display a list of all interfaces that an xpcom component supports, do the following: // |c| is the xpcom component instance for each (i in components.interfaces) { if (c instanceof i) { alert(i); } } in this context, instanceof is the same as queryinterface except that it returns false instead of throwing an exception when |c| doesn't support interface |i|.
LookupNamespaceURI - Archive of obsolete content
this function is not necessary for gecko-based browsers (though the function will quickly return the standard value for mozilla browsers) when used to reflect on static documents.
On page load - Archive of obsolete content
if you need finer control over custom code execution—for example, as documents are loading or when tabs are switched—see progress listeners.
SVG General - Archive of obsolete content
svg image also requires the use of xlink for the href attribute, which can be tricky to remember, especially when you're mixing svg with html or xul.
Delayed Execution - Archive of obsolete content
queuing a task in the main event loop when a task needs to be only briefly delayed, such that it runs after the current call chain returns, it can be added directly to the main thread's event queue rather than scheduled as a timeout: function executesoon(func) { services.tm.mainthread.dispatch(func, ci.nsithread.dispatch_normal); } using nsitimers to schedule tasks in instances where settimeout() and setinterval() are unavailable, or insufficient, tasks can be scheduled with delays using nsitimer instances.
URI parsing - Archive of obsolete content
when dealing with the facilities of nsiuri, the task of parsing a uri can still require additional work.
Windows - Archive of obsolete content
similarly, you can get the current inner window id using the nsidomwindowutils attribute currentinnerwindowid: var util = win.queryinterface(components.interfaces.nsiinterfacerequestor).getinterface(components.interfaces.nsidomwindowutils); var windowid = util.currentinnerwindowid; programatically modifying html when attempting to modify html elements, it is important to specify the namespace.
Code snippets - Archive of obsolete content
autocomplete code used to enable form autocomplete in a browser boxes tips and tricks when using boxes as containers tabbox removing and manipulating tabs in a tabbox windows-specific finding window handles (hwnd) (firefox) how to use windows api calls to find various kinds of mozilla window handles.
Communication between HTML and your extension - Archive of obsolete content
as a last ditch effort i tried setting a timeout using settimeout when i got the event in the extension to wait a few milliseconds before looking for the desired element.
Custom about: URLs - Archive of obsolete content
trar); 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 aboutpage_uri = 'chrome://myaboutaddon/content/index.html'; class aboutpage { static get classid() { return components.id(`{${aboutpage_id}}`); } static get classdescription() { return aboutpage_description; } static get contractid() { return `@mozilla.org/network/protocol/about;1?what=${aboutpage_word}`; } static get queryinterface() { return xp...
Default Preferences - Archive of obsolete content
inside your file you set preferences using the pref() function: pref("name", "value") example: pref('extensions.defaultprefs.example.int', 1); pref('extensions.defaultprefs.example.float', 0.1); pref('extensions.defaultprefs.example.string', 'fadf'); pref('extensions.defaultprefs.example.bool', true); notice that unlike when you're reading preferences, writing default preferences uses the same function no matter the data type of the preference.
Downloading JSON and JavaScript in extensions - Archive of obsolete content
downloading javascript of course there are times when javascript code modules are downloaded and injected into the extension.
Extension Theming Guidelines - Archive of obsolete content
css selectors when writing stylesheet rules for windows that you are overlaying always try to be specific with the css selector.
Chapter 2: Technologies used in developing extensions - Archive of obsolete content
by separating the structure of the data, expressed through html or xml, and the display style, indicated by css, data can be reused better than it is when structural and stylistic markup are both embedded in html.
Firefox addons developer guide - Archive of obsolete content
these days, we recommend using the add-on sdk instead, but there are times when you need the additional control offered by a more direct approach.
Appendix A: Add-on Performance - Archive of obsolete content
this is evident when opening a firefox profile that has many add-ons installed; some profiles can take minutes to load, which is a serious inconvenience for users that gives them a negative view of firefox.
Supporting search suggestions in search plugins - Archive of obsolete content
when the browser wants to fetch possible matches for a search term, it then sends an http get request to the url specified by the <url> element.
Using Dependent Libraries In Extension Components - Archive of obsolete content
when the process terminates, the library // will be properly unloaded.
Using the Stylesheet Service - Archive of obsolete content
be very careful with your css when using agent_sheet stylesheets.
Add-ons - Archive of obsolete content
extension etiquette this article describes best practices when making extensions, including how to be kind to your users.
Underscores in class and ID Names - Archive of obsolete content
given this fact, authors who write css often attempt to employ the underscore in a similar fashion when creating class and id names.
Creating reusable content with CSS and XBL - Archive of obsolete content
challenges change the xbl file so that the square doubles in width when it changes color, instead of jumping to the right.
XUL user interfaces - Archive of obsolete content
using this knowledge, add a rule to the stylesheet that makes the background of the date box pale blue when it has keyboard focus (but white when keyboard focus is somewhere else).
DOMSubtreeModified - Archive of obsolete content
this event has been deprecated in favor of the mutation observer api this event can cause infinite loops if you decide to change the dom inside the event handler, hence it has been disabled in a number of browsers (see domattrmodified and domsubtreemodified events are no longer fired when style attribute is changed via cssom for example).
MozAudioAvailable - Archive of obsolete content
the mozaudioavailable event is fired when the audio buffer is full and the corresponding raw samples are available.
cached - Archive of obsolete content
the cached event is fired when the resources listed in the application cache manifest have been downloaded, and the application is now cached.
chargingchange - Archive of obsolete content
the chargingchange event is fired when the charging attribute of the battery api has changed.
chargingtimechange - Archive of obsolete content
the chargingtimechange event is fired when the chargingtime attribute of the battery api has changed.
checking - Archive of obsolete content
the checking event is fired when the user agent is checking for an update, or attempting to download the cache manifest for the first time.
dischargingtimechange - Archive of obsolete content
the dischargingtimechange event is fired when the dischargingtime attribute of the battery api has changed.
error - Archive of obsolete content
the error event is fired when an error occurred while downloading the cache manifest or updating the content of the application.
levelchange - Archive of obsolete content
the levelchange event is fired when the level attribute of the battery api has changed.
obsolete - Archive of obsolete content
the obsolete event is fired when the manifest was found to have become a 404 or 410 page, so the application cache is being deleted.
progress - Archive of obsolete content
the progress event is fired when the user agent is downloading resources listed by the manifest.
updateready - Archive of obsolete content
the updateready event is fired when the resources listed in the application cache manifest have been newly redownloaded, and the script can use swapcache() to switch to the new cache.
Getting the page URL in NPAPI plugin - Archive of obsolete content
or whenever you make network requests yourself, you almost always need to enforce same-origin policy.
Index of archived content - Archive of obsolete content
scheme uris and urls uriloader using addresses of stack variables with nspr threads on win16 using cross commit using gdb on wimpy computers venkman using breakpoints in venkman venkman internals venkman introduction video presentations when to use ifdefs writing textual data xml in mozilla xpinstall creating xpi installer modules install wizards (aka: stub installers) mac stub installer unix stub installer windows stub installer learn ...
No Proxy For configuration - Archive of obsolete content
note: when ipv6 support is added, additional addresses will need to be added and tested.
Using XML Data Islands in Mozilla - Archive of obsolete content
when putting xml in a data block, you need to make sure that the xml content you are embedding does not have an end tag that case-insensitively matches "</script>".
Misc top level - Archive of obsolete content
images, tables, and mysterious gapsalmost no matter when you started creating web pages, odds are pretty high you have one or more designs based on the classic "convoluted tables and lots of images" paradigm.
ActiveX Control for Hosting Netscape Plug-ins in IE - Archive of obsolete content
the default plug-in will redirect you to this page when you do not have the correct plug-in installed.
Bookmark Keywords - Archive of obsolete content
you just need to fill in whatever piece of a url it is you want to be able to "fill in" when you use the keymark.
Compiling The npruntime Sample Plugin in Visual Studio - Archive of obsolete content
when loaded from local disk on windows.
Creating a Firefox sidebar extension - Archive of obsolete content
the second is it provides attributes to the menuitem, some of which are changed automatically when togglesidebar is called.
Adding the structure - Archive of obsolete content
"done" in mozilla when a document finishes loading) and graphical messages (f.e.
Conclusion - Archive of obsolete content
how could you modify the extension to load the tinderbox page when you click on the status icon?
Enabling the behavior - updating the status bar panel - Archive of obsolete content
when it finds a color, it sets the panel's status attribute to the corresponding status, which causes the previously defined css rules to switch to the icon appropriate for that status.
Finding the code to modify - Archive of obsolete content
when you select a node in the tree, a red border flashes for several seconds around the visual representation of that node in the browser window.
Making it into a dynamic overlay and packaging it up for distribution - Archive of obsolete content
we need to change some urls in the copy of tinderstatusoverlay.xul to point to the new locations the files will be in when they get installed via the xpi: <?xml version="1.0"?> <?xml-stylesheet href="chrome://tinderstatus/content/tinderstatus.css" type="text/css"?> <overlay id="tinderstatusoverlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script type="application/javascript" src="chrome://tinderstatus/content/tinderstatus.js" /> <statusbar id="status-bar">...
Getting Started - Archive of obsolete content
what you do is put your folder(s) into a .zip file and then when it's compressed make the .zip into a .jar ...
FAQ - Archive of obsolete content
when the mozilla developers make changes like this, they increase the skin version number.
Creating a Skin for Mozilla - Archive of obsolete content
you cannot change what happens when the user right clicks on an image, but you can change the look of the right click menu (make it blue with pink polka dots, for example).
Creating a Skin for Firefox/Getting Started - Archive of obsolete content
what you do is put your folder(s) into a .zip file and then when it's compressed make the .zip into a .jar ...
DTrace - Archive of obsolete content
dtrace is sun microsystem's dynamic tracing framework that allows developers to instrument a program with probes that have little to no effect on performance when not in use and very little when active.
Editor Embedding Guide - Archive of obsolete content
the first parameter is the nsidomwindow you just retrieved, the second is the editor type you want to create, and the third is whether you want the window editable immediately or when the document is done loading.
Document Loading - From Load Start to Finding a Handler - Archive of obsolete content
the final goal is to find the correct stream listener to pump the data into when necko calls ondataavailable (e.g., we may find the html parser as the stream listener to give the data to).
Downloading Nightly or Trunk Builds - Archive of obsolete content
when people talk of "nightlies", they often mean "trunk nightlies", though there exist also "branch nightlies" which are somewhat less buggy but also not as "newest & greatest".
Code snippets - Archive of obsolete content
envelope.payload = json.stringify(payload); r.put(json.stringify(envelope)); generate new keys // clients always wipe the server when they generate new keys.
Syncing custom preferences - Archive of obsolete content
when preferences sync is enabled, firefox sync will synchronize preferences between the same application based on a whitelist.
GRE - Archive of obsolete content
initialize xpcom and do your work; when finished, shut down xpcom.
Helper Apps (and a bit of Save As) - Archive of obsolete content
when this fails, uriloader asks an nsiexternalhelperappservice to handle the load.
Hidden prefs - Archive of obsolete content
for example: when that mail gets sent, approved: test@test.com will be in the message in the headers.
Java in Firefox Extensions - Archive of obsolete content
i've had problems with stability in the latest xquseme when testing in firefox 3.5b4, especially apparently on linux (i haven't so far been able to find any workarounds/incompatibilities, but everything is working in firefox 3.0.10.).
Basics - Archive of obsolete content
blah(lengthstringfocusedstringtostringstringpopstringpushstringreversestringshiftstringsortstringsplicestringunshiftstring)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.
Content - Archive of obsolete content
execute callbacks when certain pages are opened siteboost allows a jetpack to empower a domain with extended abilities beyond those native to web pages ...
Enabling Experimental Jetpack Features - Archive of obsolete content
jetpack.future.import("clipboard"); the goal here is to be able to remove the jetpack.future.import() call when the feature has been formally accepted into the core without additionally changing the script (barring any other changes made during integration).
Enabling - Archive of obsolete content
jetpack.future.import("clipboard"); the goal here is to be able to remove the jetpack.future.import() call when the feature has been formally accepted into the core without additionally changing the script (barring any other changes made during integration).
slideBar - Archive of obsolete content
when a slidebar feature is selected, its contents will be revealed from behind the current web page.
Enabling Experimental Jetpack Features - Archive of obsolete content
ArchiveMozillaJetpackdocsMetaFuture
jetpack.future.import("clipboard"); the goal here is to be able to remove the jetpack.future.import() call when the feature has been formally accepted into the core without additionally changing the script (barring any other changes made during integration).
Measuring add-on startup performance - Archive of obsolete content
sessionrestored is fired later in the process, when firefox has loaded all tabs from the saved session.
Mozilla Application Framework in Detail - Archive of obsolete content
furthermore, when embedding gecko, developers are free to choose what modules to include.
Mozilla Application Framework - Archive of obsolete content
lxr a web interface to the mozilla codebase that shows you every file in the repository as well as a line-by-line breakdown of who changed which line when in each file bonsai a web interface to the checkin log that you can query for checkins between certain dates, of certain files, or by certain developers.
Mozilla Crypto FAQ - Archive of obsolete content
when will mozilla get full support for ssl and s/mime?
LIR - Archive of obsolete content
category op code code name return type featured description miscellaneous 0 start void start of a fragment 1 regfence void a register fence causes no code to be generated, but it affects register allocation so that no registers are live when it is reached.
New Security Model for Web Services - Archive of obsolete content
when an attempt is made to access a resource at a previously-unknown uri, the sandbox reads a file at that domain with declarations to determine whether access is permitted to the script.
Configuration - Archive of obsolete content
this identifier becomes the name of the profile folder where your webapp is installed: google.mail@your.name uri the uri/url of the web app: http://mail.google.com name the display name of the application: gmail icon the icon you want to use for the prism window when running this web app.
Extensions - Archive of obsolete content
since prism is a totally separate host application, there are some prism-specific issues that you need to handle when creating your extension.
Installer - Archive of obsolete content
this means that when you double-click or launch a *.webapp file, prism is launched and automatically opens the web application.
Scripting - Archive of obsolete content
it can contain the following functions: startup when the app starts, before the user interface is displayed.
Priority Content - Archive of obsolete content
keller licensing: these css charts appear to be under a cc:by-nc-sa license, please make note of that on the page when you do the migration.
Hacking wiki - Archive of obsolete content
for anonymous access use: svn co http://svn.mozilla.org/projects/deve...lla.org/trunk/ to see the skins properly, you'll need to also check out <tt>mozilla-org/css</tt> to get the css files needed: export cvsroot=:pserver:anonymous@cvs-mirror.mozilla.org:/www cvs login cvs co mozilla-org/css (when prompted to enter a password, type <tt>anonymous</tt>) setting up copy the contents of the <tt>trunk</tt> folder and the <tt>css</tt> folder (note: the folder itself) into the <tt>www</tt> directory on your server.
PyDOM - Archive of obsolete content
for example, when a top-level window has something like: <window ...
Remotely debugging Firefox for Metro - Archive of obsolete content
the toolbox will open in its own window, attached to the firefox for metro tab that's currently hosting mozilla.org: the toolbox, and the tools it hosts (including the console, debugger, style editor, profiler, etc.), work in just the same way as they do when attached to local content.
Same origin policy for XBL - Archive of obsolete content
when mozilla needs to decide whether or not xbl is allowed to be loaded, it looks at the nsiprincipal originating the load and the nsiuri to be loaded.
Standalone XPCOM - Archive of obsolete content
link errors when building xpcom standalone this is usually due to xpcom not being built standalone.
Static Analysis for Windows Code under Linux - Archive of obsolete content
the static check will be done when compiling is going on.
String Quick Reference - Archive of obsolete content
function declarations what: use abstract classes instead of concrete classes when passing strings across function boundaries why: using abstract classes allows the caller to choose the storage mechanism, allowing for possible sharing or more efficient handling of string fragments.
Table Cellmap - Archive of obsolete content
further the table header and footer will be repeated on every page when printed out.
Table Layout Regression Tests - Archive of obsolete content
execute the baseline test shutdown the layoutdebugger execute mozilla -layoutdebug - p foo >selftest.txt execute the verify test make a note which tests have failed grep 'failed' selftest.txt (these are false positives, quite frequently they indicate reflow problems, pages showing differently when loaded from cache) make your changes to the source, recompile.
Abc Assembler Tests - Archive of obsolete content
when run, the assembler tests include the abcasm/abs_helper.as file which defines the following functions: start(summary:string):void - start a new test section described by summary end():void - test section finished compare_stricteq(name:string, expected:*, actual:*):void - compare the results of a testcase where name is the testcase name compare_typeerror(name:string, expected:*, actual:*):void - special function for comparing typeerrors (runtimeerrors) - will only compare the first 22 chars of expected...
Actionscript Performance Tests - Archive of obsolete content
when the number of iterations is greater than 2 all times are displayed in [], faster time is displayed in the output column, and the 95% confidence interval is calculated.
Tamarin-central rev 703:2cee46be9ce0 - Archive of obsolete content
buildsize flash10576k tc-700740k tc-703655k known issues known failures in the acceptance testsuite include: number failures in testsuite when running on linux windows mobile system.privatebytes and -memstats privatebytes always returns 0 amd64 longjmp hack needs reengineering on non-windows platforms different runtime errors when -dforcemir set in acceptance test run arm: math failures running with thumb or arm jit and interp.
Tamarin mercurial commit hook - Archive of obsolete content
when a violation is found the following will be displayed: > hg commit -m "change with a tab" tab(s) found in test/test.txt for rev 1458 (change 53543674b8e6): @@ -65,4 +65,6 @@ +# tab here ^ (n)o, (y)es, (a)llow tabs for current file are you sure you want to commit this change?
Treehydra - Archive of obsolete content
treehydra is included in dehydra source, and is built when a plugin-enabled cxx is detected.
DOM Interfaces - Archive of obsolete content
when content at the document-level scope is passed in as an argument, the property's value is null.
Install Wizards (aka: Stub Installers) - Archive of obsolete content
subsequently, when users click the "install" button the install wizard downloads and installs only the selected software packages.
InstallTrigger.installChrome - Archive of obsolete content
when a user clicks the link "install the new blue theme" in the example below, xpinstall downloads, registers, and installs the theme contained in newblue.xpi to the user's profile directory.
File Object - Archive of obsolete content
overview the file object has methods for analyzing the file system and preparing it (as when new directories, program shortcuts, version comparisons, or deletions are required) for newly installed software packages.
init - Archive of obsolete content
when maj, min, rev, and bld are provided as parameters, all four parameters are required, but all of them can be zero.
InstallVersion Object - Archive of obsolete content
overview this object and its methods are used both when triggering a download, to see whether a particular version needs to be installed, and when installing the software.
confirm - Archive of obsolete content
acheckstate an object with a boolean value property representing the state of the checkbox: when the dialog box is shown, its checkbox will be checked when this object's value is true.
getFolder - Archive of obsolete content
ws" "win appdata" "win common files" "win desktop" "win desktop common" "win program files" "win programs" "win programs common" "win startmenu" "win startmenu common" "win startup" "win startup common" "win system" the "file:///" form is only valid when the subdirectory parameter is used.
refreshPlugins - Archive of obsolete content
when you use this method in an installation script, as the example below demonstrates, you can install new plug-ins and use them to display the requested media in a web page without interrupting the experience of the user.
registerChrome - Archive of obsolete content
description when the third parameter is omitted (pointing to a specific location within the xpi file), this function is being used in a somewhat deprecated way.
setPackageFolder - Archive of obsolete content
when the package folder is set, it is used as the default for forms of addfile and other methods that have an optional localdirspec parameter.
getValueNumber - Archive of obsolete content
getvaluenumber gets the value of a key when that value is a number.
getValueString - Archive of obsolete content
getvaluestring retrieves the value of a key when that value is a string.
setRootKey - Archive of obsolete content
when you create a winreg object, it is set to access keys under the hkey_classes_root portion of the registry.
WinReg Object - Archive of obsolete content
when you construct a winreg object, it is set to operate with hkey_classes_root as its root key.
browserid - Archive of obsolete content
this attribute is only used when the findbar is constructed.
highlightnonmatches - Archive of obsolete content
« xul reference home highlightnonmatches new in thunderbird 3 requires seamonkey 2.0 type: boolean if true, then the autocomplete field will be highlighted when no match has been found.
norestorefocus - Archive of obsolete content
« xul reference home norestorefocus type: boolean if false, the default value, then when the panel is hidden, the keyboard focus will be restored to whatever had the focus before the panel was opened.
treelines - Archive of obsolete content
« xul reference home treelines type: boolean when set to true, lines are drawn connecting the lines in the tree; when false, the lines are not drawn.
activetitlebarcolor - Archive of obsolete content
« xul reference home activetitlebarcolor type: color string specify background color of the window's titlebar when it is active (foreground).
afterselected - Archive of obsolete content
this is automatically set when needed and you shouldn't adjust it manually.
align - Archive of obsolete content
« xul reference home align type: one of the values below the align attribute specifies how child elements of the box are aligned, when the size of the box is larger than the total size of the children.
allowevents - Archive of obsolete content
this behavior is used for menus, for instance, to allow a menu button to behave as a menu when clicking on it, yet have part of the menu behave as a button.
allownegativeassertions - Archive of obsolete content
when multiple datasources are used, one may override an assertion from another.
alwaysopenpopup - Archive of obsolete content
« xul reference home alwaysopenpopup obsolete since gecko 1.9.1 type: boolean note: applies to: thunderbird and seamonkeyif true, the autocomplete popup will be displayed even when there are no matches.
attribute - Archive of obsolete content
when the value of the attribute changes, the broadcast event is called on the observer.
autocheck - Archive of obsolete content
when autocheck is true, the button type should be "checkbox" or "radio".
beforeselected - Archive of obsolete content
this is set automatically set when needed and you shouldn't adjust it manually.
button.type - Archive of obsolete content
unlike the menu type, this type requires the user to press the arrow to open the menu, but a different command may be invoked when the main part of the button is pressed.
buttons - Archive of obsolete content
the following values can be used in the list: accept: the ok button, which will accept the changes when pressed.
closemenu - Archive of obsolete content
« xul reference home closemenu type: one of the values below indicates if the menu closes when the menuitem is activated.
coalesceduplicatearcs - Archive of obsolete content
when multiple datasources are used, one may override an assertion from another.
color - Archive of obsolete content
this is modified when the user selects a color.
colorpicker.type - Archive of obsolete content
when the user clicks the button, a popup appears for the user to select a color.
containment - Archive of obsolete content
when generating content from a template this is used to determine which resources from the datasource are containers and thus can have child nodes and which ones are not containers.
context - Archive of obsolete content
« xul reference home context type: id should be set to the value of the id of the popup element that should appear when the user context-clicks on the element.
control - Archive of obsolete content
when the user clicks on the label, the associated element is given focus.
crop - Archive of obsolete content
ArchiveMozillaXULAttributecrop
for example, for a menuitem in a menu you can add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } ...
currentset - Archive of obsolete content
this will be modified when the user customizes the toolbar.
datasources - Archive of obsolete content
when the xul document is contained on a remote web site, the datasources may only be loaded from the same domain as the document.
datepicker.type - Archive of obsolete content
popup a datepicker with three entry fields but an additional dropdown button, which, when pressed, will display a popup calendar grid.
defaultButton - Archive of obsolete content
typically, this means that the button will be activated when the enter key is pressed.
disablechrome - Archive of obsolete content
this is used to hide chrome when showing in-browser ui such as the about:addons page, and causes the toolbars to be hidden, with only the tab strip (and, if currently displayed, the add-on bar) left showing.
disablefastfind - Archive of obsolete content
this is used to prevent the find bar from being displayed when it's not supported by the content (such as in the add-ons manager tab).
droppedLinkHandler - Archive of obsolete content
« xul reference home droppedlinkhandler type: function this function is called when links are dropped to the browser element, with the following arguments.
emptytext - Archive of obsolete content
« xul reference home emptytext deprecated since gecko 2 type: string a string that appears in the textbox when it has no value.
enableColumnDrag - Archive of obsolete content
« xul reference home enablecolumndrag type: boolean when set to true, the user may drag the column headers around to change the order in which they are displayed.
enablehistory - Archive of obsolete content
enablehistory new in thunderbird 1requires seamonkey 2.0 type: boolean if true, an arrow button will appear on the end of the textbox which, when pressed, will open a dropdown menu of all available results.
grippytooltiptext - Archive of obsolete content
« xul reference home grippytooltiptext seamonkey only type: string the text to appear on the tooltip for the toolbar's grippy when the toolbar is collapsed.
handleCtrlTab - Archive of obsolete content
« xul reference home handlectrltab type: boolean if set to true or omitted, the tabbox will switch to the next tab when the control and tab keys are pressed.
helpURI - Archive of obsolete content
the uri will be opened using the help viewer when the help button is pressed.
href - Archive of obsolete content
ArchiveMozillaXULAttributehref
« xul reference home href type: string defines a url to open when this element is clicked.
ignorecase - Archive of obsolete content
« xul reference home ignorecase type: boolean set to true to indicate that the case does not matter when making comparisons.
inactivetitlebarcolor - Archive of obsolete content
« xul reference home inactivetitlebarcolor type: color string specify background color of the window's titlebar when it is inactive (background).
increment - Archive of obsolete content
« xul reference home increment type: integer the amount by which the curpos (for scroll bars) or value (for number boxes and scale) attribute changes when the arrows are clicked(or scales are dragged).
insertafter - Archive of obsolete content
« xul reference home insertafter type: id when an element is in an overlay, the insertafter attribute specifies the id of the element in the base window that the element should appear after.
insertbefore - Archive of obsolete content
« xul reference home insertbefore type: id when an element is in an overlay, the insertbefore attribute specifies the id of the element in the base window that the element should appear before.
linkedpanel - Archive of obsolete content
« xul reference home linkedpanel type: id the id of the linked tabpanel element that will be displayed when the tab is selected.
next - Archive of obsolete content
ArchiveMozillaXULAttributenext
when set, the page with this pageid is displayed when the next button is pressed.
noautofocus - Archive of obsolete content
« xul reference home noautofocus type: boolean if false, the default value, the currently focused element will be unfocused whenever the popup is opened or closed.
noautohide - Archive of obsolete content
if this attribute is set to true, this will not happen and the tooltip will only hide when the user moves the mouse to another element.
noinitialfocus - Archive of obsolete content
« xul reference homenoinitialfocustype: booleanif false, the default value, the element is considered when determining which element should be initially focused in a dialog.
onbeforeaccept - Archive of obsolete content
« xul reference home onbeforeaccept type: script code the code in this attribute is called when the ok button is pressed or the acceptdialog method is called.
onbookmarkgroup - Archive of obsolete content
« xul reference home onbookmarkgroup not in firefox type: script code this code executes when the user chooses the "bookmark this group of tabs" command.
onchange - Archive of obsolete content
a change event is fired in different ways for different xul input elements as listed below: onchange type: script code textbox when enter key is pressed radio/check box when the state is changed select list when the selected item is changed what is accessible the script context at this point can only access the following things: global values/functions i.e.
onclick - Archive of obsolete content
« xul reference home onclick type: script code this event handler is called when the object is clicked.
onclosetab - Archive of obsolete content
« xul reference home onclosetab type: script code this script will be called when the close tab button is clicked.
oncommandupdate - Archive of obsolete content
« xul reference home oncommandupdate type: script code this event occurs when a command update occurs.
onerror - Archive of obsolete content
« xul reference home onerror type: script code this event is sent to an image element when an error occurs loading the image.
onerrorcommand - Archive of obsolete content
« xul reference home onerrorcommand type: script code this event handler is called when an error occurs when selecting a result from the popup.
onnewtab - Archive of obsolete content
« xul reference home onnewtab not in firefox type: script code this script will be called when the new tab button is clicked.
onpaneload - Archive of obsolete content
« xul reference home onpaneload type: script code code defined here is called when the pane has been loaded, much like the load event for a window.
onpopuphidden - Archive of obsolete content
this event may also be received while the popup is still open, but when sub-menus contained within this popup are hidden.
onpopuphiding - Archive of obsolete content
« xul reference home onpopuphiding type: script code this event is sent to a popup when it is about to be hidden.
onpopupshowing - Archive of obsolete content
this handler is usually used to dynamically set the contents when the user requests to display it.
onpopupshown - Archive of obsolete content
« xul reference home onpopupshown type: script code this event is sent to a popup after it has been opened, much like the onload event is sent to a window when it is opened.
onsearchbegin - Archive of obsolete content
« xul reference home onsearchbegin type: script code this event handler is called when the autocomplete search begins.
onsearchcomplete - Archive of obsolete content
« xul reference home onsearchcomplete new in thunderbird 3requires seamonkey 2.0 type: script code this event handler is called when the autocomplete search is finished and results are available.
ontextcommand - Archive of obsolete content
« xul reference home ontextcommand obsolete since gecko 1.9.1 type: script code note: applies to: thunderbird, seamonkeythis event handler is called when a result is selected for the textbox.
ontextentered - Archive of obsolete content
« xul reference home ontextentered new in thunderbird 3requires seamonkey 2.0 type: script code this event handler is called when a result is selected for the textbox.
ontextrevert - Archive of obsolete content
« xul reference home ontextrevert obsolete since gecko 1.9.1 type: script code note: applies to: thunderbird, seamonkey this event handler is called when the user presses escape to revert the textbox to its original uncompleted value.
ontextreverted - Archive of obsolete content
« xul reference home ontextreverted new in thunderbird 3requires seamonkey 2.0 type: script code this event handler is called when the user presses escape to revert the textbox to its original uncompleted value.
open - Archive of obsolete content
ArchiveMozillaXULAttributeopen
« xul reference home open type: boolean for the menu type buttons, the open attribute is set to true when the menu is open.
pack - Archive of obsolete content
ArchiveMozillaXULAttributepack
« xul reference home pack type: one of the values below the pack attribute specifies where child elements of the box are placed when the box is larger that the size of the children.
pageincrement - Archive of obsolete content
« xul reference home pageincrement type: integer the amount by which the value of the curpos or value attribute changes when the tray of the scroll bar (the area in which the scroll bar thumb moves) is clicked, or when the page up or page down keys are pressed.
panel.level - Archive of obsolete content
on mac, the panel is only visible when the application is active.
panel.type - Archive of obsolete content
for example, the site identity panel that appears when you click on the favicon in the url bar in firefox is an arrow panel: note: the arrow will draw as long as the panel doesn't overlap the anchor.
placeholder - Archive of obsolete content
« xul reference home placeholder type: string a string that appears in the textbox when it has no value.
popup - Archive of obsolete content
« xul reference home popup type: id should be set to the value of the id of the popup element that should appear when the user clicks on the element.
position - Archive of obsolete content
« xul reference home position type: string (representing an integer) when an element is in an overlay, the position is an index where the child is inserted.
preference-editable - Archive of obsolete content
the element should fire change, command, or input event when the value is changed so that the preference will update accordingly.
preference - Archive of obsolete content
this attribute only has any effect when used inside a prefwindow.
prefwindow.onload - Archive of obsolete content
« xul reference home prefwindow.onload type: script code when a window finishes loading, it calls this event handler on the prefwindow element.
prefwindow.type - Archive of obsolete content
this ensures that the preferences are only saved when the main dialog is closed, if this is the appropriate behaviour for the platform.
progressmeter.mode - Archive of obsolete content
an undeterminedprogressmeter can be used when you don't and will typically be drawn as a spinning barber pole.
removeelement - Archive of obsolete content
« xul reference home removeelement type: id when placed on an element in an overlay, it indicates that the element in the base file should be removed from the window.
reserved - Archive of obsolete content
example here, the command to open a new browser window is reserved: <command id="cmd_newnavigator" oncommand="openbrowserwindow()" reserved="true"/> if the keyboard shortcut for that is accel-t, then this code will not work as expected, as compared to when it is run from web content: document.addeventlistener("keydown", handlekey, true); function handlekey(event) { // listen for the "new tab" shortcut if (event.metakey && (event.key == "t")) { // log a message console.log("intercepted accel-t"); // prevent the default browser action event.preventdefault(); event.stoppropagation(); } } currently, this event ...
resizebefore - Archive of obsolete content
« xul reference home resizebefore type: one of the values below this attribute indicates which element to the left or above the splitter should be resized when the splitter is repositioned.
script.type - Archive of obsolete content
if you omit this attribute, the default (and older) javascript version is used (like you get when including a javascript file from web content without specifying a version number).
setfocus - Archive of obsolete content
« xul reference home setfocus type: boolean if true or omitted, the focus will be given to the first element in the corresponding tabpanel when the tabs are navigated via the keyboard.
suppressonselect - Archive of obsolete content
« xul reference home suppressonselect type: boolean if this attribute is not specified, a select event is fired whenever an item is selected, either by the user or by calling one of the select methods.
tabindex - Archive of obsolete content
the tab order is the order in which the focus is moved when the user presses the "tab" key.
tabs.onselect - Archive of obsolete content
« xul reference home onselect type: script code this event is sent to the tabs element when this tab is changed.
targets - Archive of obsolete content
the command update will only occur when the event occurs to one of the specified elements.
textbox.onblur - Archive of obsolete content
« xul reference home onblur type: script code this event is sent when a textbox loses keyboard focus.
textbox.onchange - Archive of obsolete content
« xul reference home onchange type: script code this event is sent when the value of the textbox is changed.
textbox.onfocus - Archive of obsolete content
« xul reference home onfocus type: script code this event is sent when a textbox receives keyboard focus.
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).
textbox.value - Archive of obsolete content
the attribute only holds the default value and is never modified when the user enters text.
toolbarbutton.type - Archive of obsolete content
unlike the menu type, this type requires the user to press the arrow to open the menu, but a different command may be invoked when the main part of the button is pressed.
tooltiptext - Archive of obsolete content
« xul reference home tooltiptext type: string used to set the text which appears in the tooltip when the user moves the mouse over the element.
tooltiptextnew - Archive of obsolete content
« xul reference home tooltiptextnew not in firefox type: string used to set the text which appears in the tooltip when the user moves the mouse over the new button in the tab row.
tree.onselect - Archive of obsolete content
« xul reference home onselect type: script code this event is sent to a tree when a row is selected, or whenever the selection changes.
wait-cursor - Archive of obsolete content
in order to revert to the normal cursor state call the method removeattribute("wait-cursor") when the process effectively has ended otherwise the wait cursor might never disappear.
width - Archive of obsolete content
<vbox width="30" align="start" style="background-color: red;"> <label value="vbox xul width 10px red"/> </vbox> note: when used on treecol objects, the width attribute can be used to allow a tree to be scrolled horizontally if the column widths add up to be wider than the containing object.
wraparound - Archive of obsolete content
« xul reference home wraparound type: boolean if true, the value of the number box will wrap around when the maximum or minimum value is exceeded.
CheckboxStateChange - Archive of obsolete content
the checkboxstatechange event is executed when the state of a <checkbox> element has changed.
DOMMenuItemActive - Archive of obsolete content
the dommenuitemactive event is executed when a <menu> or a <menuitem> has been hovered or highlighted.
DOMMenuItemInactive - Archive of obsolete content
the dommenuiteminactive event is executed when a <menu> or a <menuitem> in no longer hovered or highlighted.
RadioStateChange - Archive of obsolete content
the radiostatechange event is executed when the state of a <radio> element has changed.
ValueChange - Archive of obsolete content
the valuechange event is executed when the value of an element, <progress> for example, has changed.
broadcast - Archive of obsolete content
the broadcast event is executed when the attributes of the element (such as a broadcaster) being listened to are changed.
commandupdate - Archive of obsolete content
the commandupdate event is executed when a command update occurs on a <commandset>.
popuphidden - Archive of obsolete content
the popuphidden event is executed when a <menupopup>, <panel> or <tooltip> has become hidden.
popuphiding - Archive of obsolete content
the popuphiding event is executed when a <menupopup>, <panel> or <tooltip> is about to be hidden.
popupshowing - Archive of obsolete content
the popupshowing event is executed when a <menupopup>, <panel> or <tooltip> is about to become visible.
popupshown - Archive of obsolete content
the popupshown event is executed when a <menupopup>, <panel> or <tooltip> has become visible.
Uploading and Downloading Files - Archive of obsolete content
when the user selects a file, it can be uploaded to a server.
findbar - Archive of obsolete content
this attribute is only used when the findbar is constructed.
Menus - Archive of obsolete content
firefox context menu element id description relevant context contentareacontextmenu the popup for the context menu when a web page is displayed in the browser area.
International characters in XUL JavaScript - Archive of obsolete content
how the character encoding is determined in gecko 1.8 and later when the javascript file is loaded from a chrome:// url, a byte order mark (fixme: )(bom) is used to determine the character encoding of the script.
advanceSelectedTab - Archive of obsolete content
if the wrap argument is true, the adjustment will wrap around when the first or last tab is reached.
getBrowserIndexForDocument - Archive of obsolete content
the returned index is dependent on the tabs in the tabbrowser and is invalidated when the tab ordering changes.
getNotificationWithValue - Archive of obsolete content
the value is specified when adding the notification with appendnotification.
getSelectedItem - Archive of obsolete content
« xul reference home getselecteditem( index ) return type: element when multiple items are selected, you can retrieve each selected item using this method.
goTo - Archive of obsolete content
ArchiveMozillaXULMethodgoTo
the onwizardback and onwizardnext code is not called when using this function.
openSubDialog - Archive of obsolete content
if the child dialog is also a prefwindow, set its type attribute to child so that preferences will be saved properly when the main dialog is closed.
reloadWithFlags - Archive of obsolete content
this is the flag used when the reload button is pressed while the shift key is held down.
MoveResize - Archive of obsolete content
this method will change the left and top attributes to match the supplied arguments, so if these attributes are persisted the values will be restored when the window is displayed again.
anchorNode - Archive of obsolete content
« xul reference anchornode type: nsidomelement this read-only property holds the dom node that was specified as the anchor when opening the popup.
buttons - Archive of obsolete content
the following values can be used in the list: accept: the ok button, which will accept the changes when pressed.
clickSelectsAll - Archive of obsolete content
« xul reference clickselectsall type: boolean if set to true, the contents of the textbox are selected when focused; otherwise, the cursor is left unchanged.
color - Archive of obsolete content
ArchiveMozillaXULPropertycolor
this is modified when the user selects a color.
database - Archive of obsolete content
« xul reference database type: nsirdfcompositedatasource returns the composite datasource created when all the datasources of an element are combined.
dateLeadingZero - Archive of obsolete content
« xul reference dateleadingzero type: boolean a read only value indicating whether a leading zero should be displayed before the date when it is less than 10.
defaultButton - Archive of obsolete content
typically, this means that the button will be activated when the enter key is pressed.
emptyText - Archive of obsolete content
« xul reference emptytext deprecated since gecko 2 type: string gets and sets a string that appears in the textbox when it has no value.
enableColumnDrag - Archive of obsolete content
« xul reference enablecolumndrag type: boolean when set to true, the user may drag the column headers around to change the order in which they are displayed.
hourLeadingZero - Archive of obsolete content
« xul reference hourleadingzero type: boolean a read only value indicating whether a leading zero should be displayed before the hour when it is less than 10.
instantApply - Archive of obsolete content
« xul referenceinstantapplytype: booleanyou can set this attribute to true to make the preference apply instantly, even when the global setting is not to use instant apply.
isWaiting - Archive of obsolete content
« xul reference iswaiting type: boolean this property is set to true during the period while waiting for the timeout between the time when a user has pressed a key and a search is performed.
menu.open - Archive of obsolete content
« xul reference open type: boolean this property will be set to true when the menu is open.
minuteLeadingZero - Archive of obsolete content
« xul reference minuteleadingzero type: boolean a read only value indicating whether a leading zero should be displayed before the minute when it is less than 10.
monthLeadingZero - Archive of obsolete content
« xul reference monthleadingzero type: boolean a read only value indicating whether a leading zero should be displayed before the month when it is less than 10.
next - Archive of obsolete content
ArchiveMozillaXULPropertynext
when set, the page with this pageid is displayed when the next button is pressed.
placeholder - Archive of obsolete content
« xul reference placeholder type: string gets and sets a string that appears in the textbox when it has no value.
popup - Archive of obsolete content
ArchiveMozillaXULPropertypopup
« xul reference popup new in thunderbird 14 requires seamonkey 2.11 type: popup element should be set to the popup element that should appear when the user clicks on the textbox.
scrollIncrement - Archive of obsolete content
« xul reference scrollincrement type: integer a read only property that lets you retrieve the number of pixels by which scrolling will occur when the arrowscrollbox is clicked.
secondLeadingZero - Archive of obsolete content
« xul reference secondleadingzero type: boolean a read only value indicating whether a leading zero should be displayed before the second when it is less than 10.
selectedItem - Archive of obsolete content
the listbox, richlistbox, radiogroup, etc., not the list item that was selected) when it is changed either via this property, the selectedindex property, or changed by the user.
selectedPanel - Archive of obsolete content
a select event will be sent when the selected panel is changed.
selstyle - Archive of obsolete content
« xul reference selstyle type: string if set to the value primary, only the label of the primary column will be highlighted when an item in the tree is selected.
tag - Archive of obsolete content
ArchiveMozillaXULPropertytag
for example, by using a value of treechildren, the condition will only match when placing elements directly inside a treechildren tag.
uri - Archive of obsolete content
ArchiveMozillaXULPropertyuri
when a rule is evaluated, it scans through each resource in the rdf datasource looking for a match.
yearLeadingZero - Archive of obsolete content
« xul reference yearleadingzero type: boolean a read only value indicating whether a leading zero should be displayed before the year when it is less than 1000.
Notes - Archive of obsolete content
implementing an nsicommandlinehandler on windows may trigger a bug that causes an error message ("windows cannot find the file specified") to be displayed when opening external links (like from a shortcut or from an external application).
chromeclass-toolbar - Archive of obsolete content
« xul reference home chromeclass-toolbar when this class is used, the toolbar will be hidden when a window is opened by setting the toolbar option to no in the window.open method.
Actions - Archive of obsolete content
<template> <query> <content uri="?start"/> <triple subject="?start" predicate="http://www.xulplanet.com/rdf/relateditem" object="?relateditem"/> </query> <action> <button uri="?relateditem" label="?relateditem"/> </action> </template> </vbox> in this example, we omit the <xul:rule> element around the <xul:action> as it is optional when we want to generate content unconditionally.
Multiple Rule Example - Archive of obsolete content
although the builder actually generates mutliple matches for one resource, in many cases it isn't necessary to be aware of this detail when creating templates.
RDF Query Syntax - Archive of obsolete content
it indicates that we are going to use a starting point when navigating the graph.
Special Condition Tests - Archive of obsolete content
this technique is useful when you know that the content will be different at each level.
The Joy of XUL - Archive of obsolete content
but later, when the original developer (oeone corporation) contributed the source to the mozilla project, the calendar had to be migrated to the windows and macintosh platforms.
Creating toolbar buttons (Customize Toolbar Window) - Archive of obsolete content
set the command to be executed when the button is clicked in the oncommand attribute.
Toolbars - Archive of obsolete content
code snippets: toolbar code snippets that are helpful when working with toolbars.
Adding Buttons - Archive of obsolete content
when the user presses alt (or a similar key that varies on each platform) and the access key, the button will be focused from anywhere in the window.
Adding more elements - Archive of obsolete content
> <menuitem label="date modified"/> </menupopup> </menulist> <spacer style="width: 10px;"/> <menulist id="searchmode"> <menupopup> <menuitem label="is"/> <menuitem label="is not"/> </menupopup> </menulist> <spacer style="width: 10px;"/> <textbox id="find-text" flex="1" style="min-width: 15em;"/> </hbox> <spacer style="height: 10px" flex="1"/> <hbox> now when the dialog is resized, the two buttons will move so that they are always along the bottom of the dialog.
Additional Install Features - Archive of obsolete content
for example, you may want to install a package only when certain conditions are met, such as having a particular library installed.
Box Model Details - Archive of obsolete content
the left box has a flexiblity that is 3 times greater than the right one so it will always receive 3 times as much of the extra space when the window size is increased.
Cross Package Overlays - Archive of obsolete content
it is automatically generated and modified when mozilla is first run or when new packages are installed.
Install Scripts - Archive of obsolete content
when a new component is installed, the registry gets updated.
Introduction - Archive of obsolete content
this is used when you don't want to have the larger size of a complete xulrunner application, but don't mind requiring a mozilla browser to be installed to be able to run the application.
Introduction to RDF - Archive of obsolete content
this is how mozilla works when it reads data such as bookmarks, the history or mail messages.
Localization - Archive of obsolete content
entities may be used whenever text occurs, including the values of attributes.
Modifying the Default Skin - Archive of obsolete content
this directory should be created when you create a profile and some examples placed there.
More Tree Features - Archive of obsolete content
when the user expands and collapses the parent, the view's toggleopenstate function will be called to toggle the item between open and closed.
Persistent Data - Archive of obsolete content
remembering state when building a large application, you will typically want to be able to save some of the state of a window across sessions.
Property Files - Archive of obsolete content
properties dtd files are suitable when you have text in a xul file.
RDF Datasources - Archive of obsolete content
the files datasource is an example of a datasource that determines its resources only when necessary.
Scrolling Menus - Archive of obsolete content
you could use it to implement a list when you don't want it to be a drop-down.
Toolbars - Archive of obsolete content
when more than one toolbar is placed next to each other, they are typically grouped together in something called a 'toolbox'.
XBL Attribute Inheritance - Archive of obsolete content
<xul:textbox xbl:inherits="flex"/> <xul:button xbl:inherits="label"/> when the content is generated, the textbox grabs the flex attribute from the searchbox and the button grabs the label attribute from the searchbox.
XUL Template Primer - Bindings - Archive of obsolete content
when displayed in mozilla, something like this appears: note that even though poor lumpy has no nc:address property, he still appears in the content model!
XUL and RDF - Archive of obsolete content
the second section describes the xul/rdf architecture itself and outlines enhancements to the xul language in order to allow the markup language to reference local data and to indicate how and when it would like to be annotatable with local data.
XUL Coding Style Guidelines - Archive of obsolete content
<?xml version="1.0" encoding='utf-8'?> <!-- do not localize this file: [reason...] it isn't part of the build; --> when translators see this line, they won't bother to look at the rest of the file.
attribute.align - Archive of obsolete content
summary the align attribute specifies how child elements of the box are aligned, when the size of the box is larger than the total size of the children.
clicktoscroll - Archive of obsolete content
if false, the content will scroll automatically when the cursor hovers over either arrow.
conditions - Archive of obsolete content
when evaluating the rule for a particular rdf resource, the variables are replaced with values from the resource.
dialogheader - Archive of obsolete content
for example, for a menuitem in a menu you can add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } description type: string descriptive text to appear in addition to the dialog title.
promptBox - Archive of obsolete content
onclosecallback the callback routine to be called when the prompt is closed.
queryset - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] a container for query elements when more than one query is used.
richlistitem - Archive of obsolete content
the tab order is the order in which the focus is moved when the user presses the "tab" key.
rule - Archive of obsolete content
ArchiveMozillaXULrule
when no query element is used in a template, a default query is used and the simple query syntax may be used for rdf datasources.
script - Archive of obsolete content
if you omit this attribute, the default (and older) javascript version is used (like you get when including a javascript file from web content without specifying a version number).
scrollbox - Archive of obsolete content
it is intended to be used when an application wants to be able to adjust the scroll position itself.
stack - Archive of obsolete content
ArchiveMozillaXULstack
when using these attributes to set width or height, both attributes for the given axis must be explicitly set, eg, if setting width, both "left" and "right" must be set.
<statusbarpanel> - Archive of obsolete content
for example, for a menuitem in a menu you can add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } image type: uri the uri of the image to appear on the element.
tabpanels - Archive of obsolete content
a select event will be sent when the selected panel is changed.
textnode - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] normally when substituting rdf resources in template rules, you place the rdf property name inside an attribute value preceded with rdf:.
titlebar - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] boxes created with the titlebar element behave just like a normal window titlebar: when the element is clicked and dragged, the window moves with it.
toolbargrippy - Archive of obsolete content
this element is used internally by the toolbar and should only be used directly when modifying its theme.
toolbox - Archive of obsolete content
if you'd like to detect when toolbars in a toolbox are changed, see toolbar customization events.
where - Archive of obsolete content
ArchiveMozillaXULwhere
attributes ignorecase, multiple, negate, rel, subject, value examples (example needed) attributes ignorecase type: boolean set to true to indicate that the case does not matter when making comparisons.
Application Update - Archive of obsolete content
pref("app.update.interval", 86400); // interval: time before prompting the user to download a new version that // is available (in seconds) default=1 day pref("app.update.nagtimer.download", 86400); // interval: time before prompting the user to restart to install the latest // download (in seconds) default=30 minutes pref("app.update.nagtimer.restart", 1800); // interval: when all registered timers should be checked (in milliseconds) // default=5 seconds pref("app.update.timer", 600000); // whether or not we show a dialog box informing the user that the update was // successfully applied.
Dialogs in XULRunner - Archive of obsolete content
whenever possible, it is a good idea to reuse these "native" dialogs so users get a consistent experience across applications.
XULRunner FAQ - Archive of obsolete content
when will firefox be based on xulrunner?
Using LDAP XPCOM with XULRunner - Archive of obsolete content
when configuring build options, just add: ac_add_options --enable-ldap to your .mozconfig file.
Windows and menus in XULRunner - Archive of obsolete content
when you launch your xul application, you’ll notice that xulrunner gives your windows a default icon (top left corner on windows).
XUL Application Packaging - Archive of obsolete content
example: enableextensionmanager=1 enableprofilemigrator specifies whether, when the application is launched for the first time and there are no profiles, to enable profile migration code through the nsiprofilemigrator interface.
toolkit.defaultChromeFeatures - Archive of obsolete content
type: string specified by: default prefs of xulrunner applications default: "chrome,dialog=no,all" example: pref("toolkit.defaultchromefeatures", "chrome,resizable=no,dialog=no"); the toolkit.defaultchromefeatures preference allows simple xulrunner-based applications to specify what features are passed to window.open() when the main application window is opened.
toolkit.defaultChromeURI - Archive of obsolete content
type: string specified by: default prefs of xulrunner applications default: none example: pref("toolkit.defaultchromeuri", "chrome://myapp/content/"); the toolkit.defaultchromeuri preference allows simple xulrunner-based applications to open a new window when the application is launched.
calICalendarView - Archive of obsolete content
for instance, when the showdate method of the the calendar-multiday-view (an implementation of this interface) will sometimes show an entire week of dates, and sometimes show only the single date passed in.
calICalendarViewController - Archive of obsolete content
deleteoccurrence void deleteoccurrence (in caliitemoccurrence aoccurrence); the deleteoccurrence method is called when by the calicalendarview when caliitem should be deleted.
Mozprofile - Archive of obsolete content
ces preferences can be set in several ways: using the api: you can pass preferences in to the profile class's constructor: obj = firefoxprofile(preferences=[("accessibility.typeaheadfind.flashbar", 0)]) using a json blob file: mozprofile --preferences myprefs.json using a .ini file: mozprofile --preferences myprefs.ini via the command line: mozprofile --pref key:value --pref key:value [...] when setting preferences from an .ini file or the --pref switch, the value will be interpolated as an integer or a boolean (true/false) if possible.
reftest opportunities files - Archive of obsolete content
note that bugs with the testcase keyword already have one or more testcases attached to the bug that can be used when creating the reftest.
Format - Archive of obsolete content
this is an example of what a newsgroup summary should look like when completed.
2006-10-20 - Archive of obsolete content
when the method is executed firefox crashes.
2006-11-03 - Archive of obsolete content
firing pageshow/pagehide when users change tabs discussion about using events that could be fired when the user changes a tab.
2006-11-04 - Archive of obsolete content
pageshow/pagehide when users change tabs discussion about using events that could be fired when the user changes a tab.
2006-11-10 - Archive of obsolete content
firefox 2.0 - net accessed when bookmark properties viewed question about whether firefox 2.0 downlads the web page again when the properties of the bookmark are viewed.
2006-12-01 - Archive of obsolete content
question regarding how to access the functionality that arises when window.blur() is called.
2006-11-17 - Archive of obsolete content
solution is provided by jay lee should there be an additional options for account configuration that just delete the messages from the server whenever they are deleted in tb?
2006-11-24 - Archive of obsolete content
thunderbird losing emails tb seems to be deleting mail folders when they reach 4gb in size.
2006-10-06 - Archive of obsolete content
summary: mozilla.dev.builds - september 30th to october 6th 2006 tb mozilla_1_8_branch build problem on mac os x (10.4.7, universal build) ludwig hügelschäfer stated that he has been encountering an error when he executes a "make export" operation on thunderbird (part of the mozilla_1_8_branch) since september 15th.
2006-11-10 - Archive of obsolete content
discussions help about firefox 3 a discussion on how to syncronise mozilla_1_8_branch with the trunk, which tag should be used to check-in files on trunk, and when files will be pulled from trunk to create another branch (mozilla_1_9_branch?) for firefox 3.
2006-12-01 - Archive of obsolete content
bon echo project status: remaining "to-do" items beltzner starts a discussion on when to offer 1.5.0.8+ users the chance to upgrade to ff2.x (now or when ff2.0.0.1 is released).
2006-09-29 - Archive of obsolete content
when he runs xulrunner from the command line, it fails silently without any errors.
2006-11-17 - Archive of obsolete content
summary: mozilla.dev.platform - november 11th - november 17th, 2006 announcements no announcements this week traffic xulrunner: <browser> not allowing javascript popup windows b notes that when using xul elements <browser/> and <tabbrowser/> the javascript popup windows don't work out of the box and asks what needs to be implement.
2006-18-24 - Archive of obsolete content
summary: mozilla.dev.platform - november 18th - november 24th, 2006 announcements no announcements this week traffic xulrunner: <browser> not allowing javascript popup windows b notes that when using xul elements <browser/> and <tabbrowser/> the javascript popup windows don't work out of the box and asks what needs to be implement.
2006-11-17 - Archive of obsolete content
discussions js_addnamedroot a user is wondering where and when he would need to call js_addnamedroot in c code.
JS-Engine FAQ - Archive of obsolete content
even when rhino is pre-compiled with high optimization, it still is no match for a compiled java program.
2006-10-27 - Archive of obsolete content
help for getting html element width info discussion on retrieving width information on html elements when using the gecko engine.
2006-11-10 - Archive of obsolete content
discussions how to know the full height and width of a webpage discussion on how to determine the full height and width of a web page when embedding a browser into an application.
2006-09-06 - Archive of obsolete content
how to build xpcom component on mac os x a tutorial on how to build xpcom component on mac os x firefox crashes when calling a function provided by a .so library a solution to the problem loading a shared library when using xpcom firefoxes crashes while getting url in xpcom solutions to resolve the problem of the firefox crash when trying to get the path and the prepath of the url of the current page in xpcom meetings none during this week.
2006-10-20 - Archive of obsolete content
handling of multiple calendars discusstion regarding the bug when handling multiple calendars calendar views improving the looking of calendar view.
2006-11-10 - Archive of obsolete content
discussions hunting down the "sunbird fails to start" bug -- please help discussion about a crash when starting sunbird 0.2.
External resources for plugin creation - Archive of obsolete content
please note that even when using these, it is still a good idea to have an understanding of what is going on under the hood, regardless of the level of abstraction provided.
NPAPI plugin developer guide - Archive of obsolete content
mac os windows unix event handling for windowed plug-ins windowless plug-ins specifying that a plug-in is windowless invalidating the drawing area forcing a paint message making a plug-in opaque making a plug-in transparent creating pop-up menus and dialog boxes event handling for windowless plug-ins streams receiving a stream telling the plug-in when a stream is created telling the plug-in when a stream is deleted finding out how much data the plug-in can accept writing the stream to the plug-in sending the stream in random-access mode sending the stream in file mode sending a stream creating a stream pushing data into the stream deleting the stream example of sending a stream urls getting urls getting the url and displa...
Logging Multi-Process Plugins - Archive of obsolete content
when multi-process plugins are enabled, firefox has the ability to dump additional information about interactions between the browser and a plugin.
NPAnyCallbackStruct - Archive of obsolete content
when the plug-in is done, it should leave the file open, as the browser can continue to write additional postscript data to the file.
NPByteRange - Archive of obsolete content
the plug-in is responsible for deleting npbyterange objects when finished with them.
NPClass - Archive of obsolete content
deallocate called by npn_releaseobject() when an object's reference count reaches zero.
NPEmbedPrint - Archive of obsolete content
the npembedprint structure is used when the mode field of npprint is set to np_embed.
NPFullPrint - Archive of obsolete content
the npfullprint structure is used when the mode field of npprint is set to np_full.
NPN_Enumerate - Archive of obsolete content
note: the caller must call npn_memfree() on the pointer received through the identifiers parameter of a successful call to npn_enumerate to release the array of string identifiers when it is no longer needed.
NPN_Evaluate - Archive of obsolete content
note: the caller must call npn_releasevariantvalue() to release the returned value when it's no longer needed.
NPN_ForceRedraw - Archive of obsolete content
note: as of firefox 4, this function no longer has any effect when running with separate plugin processes.
NPN_GetProperty - Archive of obsolete content
note: the caller must call npn_releasevariantvalue() to release the returned value when it's no longer needed.
NPN_GetValueForURL - Archive of obsolete content
when multiple cookies are returned for a given url, the format of the return value is: cookie1=value1;cookie2=value2;cookie3=value3 len out parameter.
NPN_InvalidateRect - Archive of obsolete content
« gecko plugin api reference « browser side plug-in api summary invalidates the specified portion of the plugin's drawing area, adding it to the region that needs to be redrawn when the plugin next repaints its contents.
NPN_Invoke - Archive of obsolete content
when the caller no longer needs the result, it must call npn_releasevariantvalue() to release it.
NPN_InvokeDefault - Archive of obsolete content
when the caller no longer needs the result, it must call npn_releasevariantvalue() to release it.
NPN_MemAlloc - Archive of obsolete content
you only need to use npn_memflush in situations where you cannot use npn_memalloc, for example, when calling system methods that allocate memory indirectly.
NPN_MemFlush - Archive of obsolete content
description the plug-in calls npn_memflush() when it is not possible to call npn_memalloc(), for example, when calling system apis that indirectly allocate memory.
NPN NewStream - Archive of obsolete content
when the plug-in has written all of its data into the stream, npn_destroystream terminates the stream and deallocates the npstream object.
NPN_PluginThreadAsyncCall - Archive of obsolete content
description causes asynchronous execution of the specified function pointer on the "plug-in thread", passing in the specified user data pointer when it is called.
NPN_PostURL - Archive of obsolete content
when you use npn_posturl to send data to the server, you can handle the response in several different ways by specifying different target parameters.
NPN_PostURLNotify - Archive of obsolete content
description npn_posturlnotify functions identically to npn_posturl, with these exceptions: npn_posturlnotify supports specifying headers when posting a memory buffer.
NPN_Status - Archive of obsolete content
if your plug-in has a button or other object that acts as a link when clicked, you can call npn_status() to display a description or url when the user moves the cursor over it.
NPN_UserAgent - Archive of obsolete content
this can be used to handle variations in different browsers (or versions thereof) when implementing your plug-in.
NPN_Version - Archive of obsolete content
description the values of the major and minor version numbers of the plug-in api are determined when the plug-in and the browser are compiled.
NPN_Write - Archive of obsolete content
example this example pushes a snippet of html over a newly created stream, then destroys the stream when it's done.
NPP - Archive of obsolete content
the npp_destroy() function informs the plug-in when the npp instance is about to be deleted; after this call returns, the npp pointer is no longer valid.
NPP_DestroyStream - Archive of obsolete content
description the browser calls the npp_destroystream function when a data stream sent to the plug-in is finished, either because it has completed successfully or terminated abnormally.
NPP_SetWindow - Archive of obsolete content
« gecko plugin api reference « plug-in side plug-in api summary tells the plug-in when a window is created, moved, sized, or destroyed.
NPP_StreamAsFile - Archive of obsolete content
description when the stream is complete, the browser calls npp_streamasfile to provide the instance with a full path name for a local file for the stream.
NPPrintCallbackStruct - Archive of obsolete content
when the plug-in is done, it should leave the file open, so the browser can continue to write additional postscript data to the file.
NPString - Archive of obsolete content
note: whenever an npstring owns its string data and the data may be released through a call to npn_releasevariantvalue(), the string data must be allocated using npn_memalloc().
NPVariant - Archive of obsolete content
javascript type to npvarianttype enumeration mapping when using npvariants to access javascript objects in the browser, or vise versa, the mapping of javascript values to npvariants is as follows: javascript type npvarianttype undefined npvarianttype_void null npvarianttype_null boolean npvarianttype_bool number npvarianttype_int32 or npvariantty...
NP_Initialize - Archive of obsolete content
description the browser calls this function only once: when a plug-in is loaded, before the first instance is created.
NP_Shutdown - Archive of obsolete content
the browser calls np_shutdown only when the library is finally unloaded.
Supporting private browsing in plugins - Archive of obsolete content
plugins should be updated to monitor the state of private browsing mode and only save private information when private browsing is disabled.
0.90 - Archive of obsolete content
ArchiveRSSVersion0.90
when rss 0.90 was created, the rss initialization stood for rich site summary and not really simple syndication.
Version - Archive of obsolete content
they are listed in chronological order of when they were released.
Confidentiality, Integrity, and Availability - Archive of obsolete content
another example of a failure of integrity is when you try to connect to a website and a malicious attacker between you and the website redirects your traffic to a different website.
Security Controls - Archive of obsolete content
when usability is an issue, many users will attempt to circumvent security controls; for example, if passwords must be long and complex, users may write them down.
Vulnerabilities - Archive of obsolete content
an attacker could craft a fraudulent email message that contains hyperlinks that, when rendered in html, appear to the recipient to be benign but actually take the recipient to a malicious web site when they are clicked on.
Tamarin Tracing Build Documentation - Archive of obsolete content
an email with the build status will be sent to this address when a builder completes whether it is passes or fails.
Creating a Skin for Firefox - Archive of obsolete content
you can't change what happens when the user right clicks on an image, but you can change the look of the right click menu (make it blue with pink polka dots, for example).
Making sure your theme works with RTL locales - Archive of obsolete content
instead, just use the opposite arrow when in rtl context.
Theme changes in Firefox 3.5 - Archive of obsolete content
the value of this attribute is normal when the private browsing mode is inactive, and private when it's active.
Updating an extension to support multiple Mozilla applications - Archive of obsolete content
update the chrome manifest remember way back in the first article in this series when we created our chrome manifest, which we haven't touched since?
-moz-border-bottom-colors - Archive of obsolete content
/* single <color> value */ -moz-border-bottom-colors: #f0f0f0; /* multiple <color> values */ -moz-border-bottom-colors: #f0f0f0 #a0a0a0 #505050 #000000; /* global values */ -moz-border-bottom-colors: inherit; -moz-border-bottom-colors: initial; -moz-border-bottom-colors: unset; when an element has a border that is larger than a single css pixel, each line of pixels uses the next color specified in this property, from the outside in.
-moz-border-left-colors - Archive of obsolete content
/* single <color> value */ -moz-border-left-colors: #f0f0f0; /* multiple <color> values */ -moz-border-left-colors: #f0f0f0 #a0a0a0 #505050 #000000; /* global values */ -moz-border-left-colors: inherit; -moz-border-left-colors: initial; -moz-border-left-colors: unset; when an element has a border that is larger than a single css pixel, each line of pixels uses the next color specified in this property, from the outside in.
-moz-border-right-colors - Archive of obsolete content
/* single <color> value */ -moz-border-right-colors: #f0f0f0; /* multiple <color> values */ -moz-border-right-colors: #f0f0f0 #a0a0a0 #505050 #000000; /* global values */ -moz-border-right-colors: inherit; -moz-border-right-colors: initial; -moz-border-right-colors: unset; when an element has a border that is larger than a single css pixel, each line of pixels uses the next color specified in this property, from the outside in.
-moz-border-top-colors - Archive of obsolete content
/* single <color> value */ -moz-border-top-colors: #f0f0f0; /* multiple <color> values */ -moz-border-top-colors: #f0f0f0 #a0a0a0 #505050 #000000; /* global values */ -moz-border-top-colors: inherit; -moz-border-top-colors: initial; -moz-border-top-colors: unset; when an element has a border that is larger than a single css pixel, each line of pixels uses the next color specified in this property, from the outside in.
-moz-stack-sizing - Archive of obsolete content
ignore the stack won't consider this child when calculating its size.
-ms-content-zooming - Archive of obsolete content
the top-level element can also be zoomed via double-tap when it is zoom-enabled.
-ms-filter - Archive of obsolete content
when you use -ms-filter, enclose the progid in single quotes (') or double quotes (").
-ms-scrollbar-3dlight-color - Archive of obsolete content
code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/scrollbarcolor.htm <!doctype html> <html> <head> <title>scrollbar-3dlight-color</title> <style> .blue3dlight { -ms-scrollbar-3dlight-color: blue; scrollbar-3dlight-color: blue; /* use the standard when available.
-ms-text-autospace - Archive of obsolete content
ideograph-space extends the width of the space character when it is adjacent to ideographs.
Introduction - Archive of obsolete content
the most basic is appendchild var element1 = <foo/>; var element2 = <bar/>; element1.appendchild(element2); which produces exactly the xml document you'd expect <foo> <bar/> </foo> javascript variables the true power of e4x only begins to come to light, however, when the xml document can interact closely with other javascript.
Using JavaScript Generators in Firefox - Archive of obsolete content
function grabevent(event) { generator.send(event); } // when we're all done we can close the generator, but that must happen outside // of the generator so we use a timeout.
ArrayBuffer.transfer() - Archive of obsolete content
the ability to detach an arraybuffer gives the developer explicit control over when the underlying memory is released.
Date.prototype.toLocaleFormat() - Archive of obsolete content
polyfill when using the datejs library you can polyfill date.prototype.tolocaledatestring() like this: if (!date.prototype.tolocaleformat) { (function() { date.prototype.tolocaleformat = function(formatstring) { return this.format(formatstring); }; }()); } specifications not part of any standard.
Date.getVarDate() - Archive of obsolete content
remarks the getvardate() method is used when javascript code interacts with com objects, activex objects, or other objects that accept and return date values in vt_date format.
Debug.msTraceAsyncCallbackCompleted - Archive of obsolete content
remarks call this function when the asynchronous operation completes.
Debug.msUpdateAsyncCallbackRelation - Archive of obsolete content
this function may be called when an asynchronous operation is aborted, when a join operation is used, or in other scenarios.
@cc_on - Archive of obsolete content
when you write a script for a web page, always put conditional compilation code in comments.
New in JavaScript 1.2 - Archive of obsolete content
string.prototype.substring(): no longer swaps index numbers when the first index is greater than the second.
New in JavaScript 1.5 - Archive of obsolete content
when non-capturing parentheses are used, matched subexpressions are not available as back-references.
New in JavaScript 1.7 - Archive of obsolete content
in html or xul code, use: <script type="application/javascript;version=1.7"></script> when using the javascript shell, you need to set the version you wish to use using the -version 170 switch on the command line or using the version() function: version(170); the features that require the use of the new keywords "yield" and "let" require you to specify version 1.7 because existing code might use those keywords as variable or function names.
New in JavaScript 1.8.5 - Archive of obsolete content
function.prototype.bind() creates a new function that, when called, itself calls this function in the context provided (with a given sequence of arguments).
Object.prototype.__noSuchMethod__ - Archive of obsolete content
the __nosuchmethod__ property used to reference a function to be executed when a non-existent method is called on an object, but this function is no longer available.
Object.prototype.unwatch() - Archive of obsolete content
in addition, using watchpoints has a serious negative impact on performance, which is especially true when used on global objects, such as window.
JSException - Archive of obsolete content
ry the public class jsexception extends runtimeexception java.lang.object | +----java.lang.throwable | +----java.lang.exception | +----java.lang.runtimeexception | +----netscape.javascript.jsexception description jsexception is an exception which is thrown when javascript code returns an error.
LiveConnect Reference - Archive of obsolete content
jsexception the public class jsexception extends runtimeexception, and is thrown when javascript returns an error.
LiveConnect - Archive of obsolete content
note: liveconnect blocked under some conditions liveconnect calls from javascript to java api are blocked when the java control panel security slider is set to very high level, or when the slider is at the default high level and the jre has either expired or is below the security baseline.
MSX Emulator (jsMSX) - Archive of obsolete content
as you may have realized, many challenges on performance are faced when developing in javascript.
forEach - Archive of obsolete content
if (value>1){ return false;//we could have some way to break when we return false } }); //woulld print 1 2 --porfirio 11:17, 22-06-2008 another option would be to throw stopiteration and catch it within foreach().
Troubleshooting XForms Forms - Archive of obsolete content
introduction the idea of this page is to collect some solutions to some of the common errors typically made when creating an xforms form.
Mozilla XForms Specials - Archive of obsolete content
(limitation tracked in bug 271724) optional parameters in xpath functions optional parameters in xpath functions are not supported, you will have to specify all parameters when calling a function.
RFE to the Custom Controls Interfaces - Archive of obsolete content
in short, we have the following interfaces: nsixformsaccessors - serves to get/set the value of the instance data node that the xforms element is bound to as well as getting the various states of that node nsixformsdelegate - used to obtain the nsixformsaccessors interface nsixformsuiwidget - used by the xforms processor to update the value/state of an xforms element when its bound node's value/state is changed our current mechanism that allows authors to build custom controls assumes that the controls will be bound to instance nodes of simple content type.
XForms Alert Element - Archive of obsolete content
introduction this message will be shown when the form control cannot properly bind to instance data or when the instance data value is invalid or out of the specified range of selectable values (see the spec).
XForms Hint Element - Archive of obsolete content
the hint is displayed when the mouse moves and pauses over the containing form control.
XForms Label Element - Archive of obsolete content
focus behavior - when a label element is clicked or its accesskey is activated then the form control that contains the label will be given the focus.
XForms Message Element - Archive of obsolete content
introduction used in combination with xml event listeners to display a message to the user when the specified event occurs (see the spec).
XForms Submit Element - Archive of obsolete content
representations the xforms submit element can be represented by the following widgets for the specified appearance attribute values: button - default representation (xhtml/xul) link/clickable text - used when appearance = 'minimal' (xhtml only) button displaying a button is the default presentation (xhtml/xul).
XForms Switch Module - Archive of obsolete content
the toggle element is an action that when triggered will make a case selected and visible and thereby hiding all other case elements contained by the same switch.
XForms Trigger Element - Archive of obsolete content
representations the xforms trigger element can be represented by the following widgets for the specified appearance attribute values: button - default representation (xhtml/xul) link/clickable text - used when appearance = 'minimal' (xhtml only) button displaying a button is the default presentation (xhtml/xul).
Using XForms and PHP - Archive of obsolete content
the same problem exists when using a single php/html file.
Window: devicelight event - Archive of obsolete content
the devicelight event is fired when fresh data is available from a light sensor.
Archived open Web documentation - Archive of obsolete content
rethinking the basics of when and how to detect user agents is crucial to creating maintainable, cross browser web content.
Correctly Using Titles With External Stylesheets - Archive of obsolete content
thus, when the document is loaded, the browser will use all of the persistent stylesheets and one preferred stylesheet (but remember, there should only be one preferred stylesheet).
Parsing microformats in JavaScript - Archive of obsolete content
this api is primarily intended to be used when implementing new microformats.
Using the Right Markup to Invoke Plugins - Archive of obsolete content
however, there are a few caveats that developers ought to bear in mind when using the object element with mozilla-based browsers such as netscape 7 and in ie: caveats if you use one single object element for both browsers (as in the above example), it is not possible to provide a cross-browserobtainment mechanism for streamlined download.
Windows Media in Netscape - Archive of obsolete content
when scripting the player, ensure that you use the syntax document.playerelementname.property as opposed to playerelementname.property.
XUL Parser in Python - Archive of obsolete content
i will make these adjustments and change it into a real module when i get a second, so that someone can instantiate the parser from their own scripts and use it more flexibly: >>> import xultool >>> myxp = xulparser() >>> chrome_dir = 'd:\src\mozilla\xpfe' >>> res = myxp.parsexul(chrome_dir, 'window', 'id') where something like the above would write out all the xul window ids in the build.
Archive of obsolete content
or whenever you make network requests yourself, you almost always need to enforce same-origin policy.
2D collision detection - Game development
narrow phase when you have a small list of entities to check you will want to use a narrow phase algorithm (like the ones listed above) to provide a certain answer as to whether there is a collision or not.
Bounding volume collision detection with THREE.js - Game development
it takes into account the child meshes when computing the size of the bounding box, so the original mesh and all its children are wrapped.
Building up a basic demo with A-Frame - Game development
when creating new objects in the demo, we will be adding them all to the scene to make them visible on the screen.
Building up a basic demo with the PlayCanvas engine - Game development
app.setcanvasfillmode(pc.fillmode_fill_window); app.setcanvasresolution(pc.resolution_auto); camera now when the setup code is in place we need to think about implementing the standard scene components: camera, lights and objects.
3D games on the Web - Game development
collision detection it's hard to imagine a game without collision detection — we always need to work out when something is hitting something else.
Square tilemaps implementation: Scrolling maps - Game development
note: when writing this article, we assumed previous reader knowledge of canvas basics such as how get a 2d canvas context, load images, etc., which is all explained in the canvas api tutorial, as well as the basic information included in our tilemaps introduction article.
Square tilemaps implementation: Static maps - Game development
note: when writing this article, we assumed previous reader knowledge of canvas basics such as how get a 2d canvas context, load images, etc., which is all explained in the canvas api tutorial, as well as the basic information included in our tilemaps introduction article.
Techniques for game development - Game development
using async scripts for asm.js especially when creating medium to large-sized games, async scripts are an essential technique to take advantage of, so that your game's javascript can be compiled off the main thread and be cached for future game running, resulting in a significant performance improvement for your users.
Collision detection - Game development
:- exercise: change the color of the ball when it hits the brick.
Game over - Game development
compare your code here's the working code for you to compare yours against: exercise: make the ball move faster when it hits the paddle.
Build the brick field - Game development
the newly created brick is enabled for the arcade physics engine, it's body is set to be immovable (so it won't move when hit by the ball), and we're also setting the anchor to be in the middle and adding the brick to the group.
Game over - Game development
when you click on the resulting alert, the page will be reloaded so you can play again.
Initialize the framework - Game development
preload takes care of preloading the assets create is executed once when everything is loaded and ready update is executed on every frame.
The score - Game development
updating the score when bricks are destroyed we will increase the number of points every time the ball hits a brick and update the scoretext to display the current score.
Visual JS GE - Game development
if you use editor.js to visually create game objects, you must start the build_from_editor_to_visual_js_file.js when you have finished.
502 - MDN Web Docs Glossary: Definitions of Web-related terms
when you request to access a url, the gateway server can relay your request to the upstream server.
Base64 - MDN Web Docs Glossary: Definitions of Web-related terms
base64 encoding schemes are commonly used when there is a need to encode binary data that needs to be stored and transferred over media that are designed to deal with ascii.
BiDi - MDN Web Docs Glossary: Definitions of Web-related terms
even when both directionalities occur in the same paragraph, the text in each language must appear in its proper directionality.
Boolean - MDN Web Docs Glossary: Definitions of Web-related terms
// code to execute if the conditional is true } if (boolean conditional) { console.log("boolean conditional resolved to true"); } else { console.log("boolean conditional resolved to false"); } /* javascript for loop */ for (control variable; boolean conditional; counter) { // code to execute repeatedly if the conditional is true } for (var i=0; i < 4; i++) { console.log("i print only when the boolean conditional is true"); } the boolean value is named after english mathematician george boole, who pioneered the field of mathematical logic.
CORS-safelisted request header - MDN Web Docs Glossary: Definitions of Web-related terms
when containing only these headers (and values that meet the additional requirements laid out below), a requests doesn't need to send a preflight request in the context of cors.
CORS-safelisted response header - MDN Web Docs Glossary: Definitions of Web-related terms
a cors-safelisted response header is an http header which has been safelisted so that it will not be filtered when responses are processed by cors, since they're considered safe (as the headers listed in access-control-expose-headers).
Client hints - MDN Web Docs Glossary: Definitions of Web-related terms
accept-ch: dpr, width, viewport-width, downlink and / or <meta http-equiv="accept-ch" content="dpr, width, viewport-width, downlink"> when a client receives the accept-ch header, if supported, it appends client hint headers that match the advertised field-values.
Compile time - MDN Web Docs Glossary: Definitions of Web-related terms
the compile time is the time from when the program is first loaded until the program is parsed.
Cookie - MDN Web Docs Glossary: Definitions of Web-related terms
it may contain the user’s preferences or inputs when accessing that website.
DOM (Document Object Model) - MDN Web Docs Glossary: Definitions of Web-related terms
dom was not originally specified—it came about when browsers began implementing javascript.
DoS attack - MDN Web Docs Glossary: Definitions of Web-related terms
when these are exhausted, the program can freeze or crash, making it unavailable.
Denial of Service - MDN Web Docs Glossary: Definitions of Web-related terms
when these are exhausted, the program can freeze or crash, making it unavailable.
Doctype - MDN Web Docs Glossary: Definitions of Web-related terms
its sole purpose is to prevent a browser from switching into so-called “quirks mode” when rendering a document; that is, the "<!doctype html>" doctype ensures that the browser makes a best-effort attempt at following the relevant specifications, rather than using a different rendering mode that is incompatible with some specifications.
frame rate (FPS) - MDN Web Docs Glossary: Definitions of Web-related terms
when moving on a computer screen there are no motion blurs (unless you are animating an image sprite with motion blurs).
FTU - MDN Web Docs Glossary: Definitions of Web-related terms
ftu (first time use) is the app that loads when you run a newly-installed version of gecko on a firefox os device.
Favicon - MDN Web Docs Glossary: Definitions of Web-related terms
when a familiar icon is seen in the browser's address bar, for example, it helps users know they are in the right place.
First paint - MDN Web Docs Glossary: Definitions of Web-related terms
first paint, part of the paint timing api, is the time between navigation and when the browser renders the first pixels to the screen, rendering anything that is visually different from what was on the screen prior to navigation.
Global object - MDN Web Docs Glossary: Definitions of Web-related terms
in a web browser, when scripts create global variables, they're created as members of the global object.
Grid Areas - MDN Web Docs Glossary: Definitions of Web-related terms
grid areas are created when you place an item using line-based placement or when defining areas using named grid areas.
Grid Axis - MDN Web Docs Glossary: Definitions of Web-related terms
in css the block or column axis is the axis used when laying out blocks of text.
Grid Tracks - MDN Web Docs Glossary: Definitions of Web-related terms
track sizing in the explicit grid when defining grid tracks using grid-template-columns and grid-template-rows you may use any length unit, and also the flex unit, fr which indicates a portion of the available space in the grid container.
Hoisting - MDN Web Docs Glossary: Definitions of Web-related terms
now, let's see what happens when we call the function before we write it: catname("chloe"); function catname(name) { console.log("my cat's name is " + name); } /* the result of the code above is: "my cat's name is chloe" */ even though we call the function in our code first, before the function is written, the code still works.
Hotlink - MDN Web Docs Glossary: Definitions of Web-related terms
the practice is often frowned upon as it can cause unwanted bandwidth usage on the website hosting the linked-to object, and copyright concerns — it is considered stealing when it is done without permission.
Internationalization - MDN Web Docs Glossary: Definitions of Web-related terms
internationalization is the process of architecting your web application so that it can be quickly and easily adapted to various languages and regions without much engineering effort when new languages and regions are supported.
Keyword - MDN Web Docs Glossary: Definitions of Web-related terms
when you use a search engine, you use keywords to specify what you are looking for, and the search engine returns relevant webpages.
Lazy load - MDN Web Docs Glossary: Definitions of Web-related terms
lazy loading is a strategy that delays the loading of some assets (e.g., images) until they are needed by the user based on the user's activity and navigation pattern; typically, these assets are only loaded when they are scrolled into view.
Localization - MDN Web Docs Glossary: Definitions of Web-related terms
the following are common factors to consider: language unit of measure (e.g., kilometers in europe, miles in u.s.) text direction (e.g., european languages are left-to-right, arabic right-to-left) capitalization in latin script (e.g., english uses capitals for weekdays, spanish uses lowercase) adaptation of idioms (e.g., "raining cats and dogs" makes no sense when translated literally) use of register (e.g., in japanese respectful speech differs exceptionally from casual speech) number format (e.g., 10 000,00 in germany vs.
Media - MDN Web Docs Glossary: Definitions of Web-related terms
the term media is an overloaded one when talking about the web; it takes on different meanings depending on the context.
Node - MDN Web Docs Glossary: Definitions of Web-related terms
another use of the word is when talking about node.js ...
Operand - MDN Web Docs Glossary: Definitions of Web-related terms
for example, when you add two numbers, the numbers are the operand and "+" is the operator.
PDF - MDN Web Docs Glossary: Definitions of Web-related terms
pdf provides a digital image of a printed document, and keeps the same appearance when printed.
Page load time - MDN Web Docs Glossary: Definitions of Web-related terms
in addition, web performance isn't just about when the load event happens.
Page prediction - MDN Web Docs Glossary: Definitions of Web-related terms
page prediction is a browser feature or script which, when enabled, tells the browser to download resources the user is likely to visit before the user requests the content.
Preflight request - MDN Web Docs Glossary: Definitions of Web-related terms
it appears when request is qualified as "to be preflighted" and omitted for simple requests.
Privileged - MDN Web Docs Glossary: Definitions of Web-related terms
users are said to be privileged when they are granted additional rights to a system, or given ultimate access to content in a higher priority level when compared to normal users.
Promise - MDN Web Docs Glossary: Definitions of Web-related terms
when the called function finishes its work asynchronously, a function on the promise object called a resolution (or fulfillment, or completion) handler is called to let the original caller know that the task is complete.
Proxy server - MDN Web Docs Glossary: Definitions of Web-related terms
a proxy server is an intermediate program or computer used when navigating through different networks of the internet.
Quality values - MDN Web Docs Glossary: Definitions of Web-related terms
when not present, the default value is 1.
Random Number Generator - MDN Web Docs Glossary: Definitions of Web-related terms
truly random numbers (say, from a radioactive source) are utterly unpredictable, whereas all algorithms are predictable, and a prng returns the same numbers when passed the same starting parameters or seed.
RSS - MDN Web Docs Glossary: Definitions of Web-related terms
when you subscribe to a website's rss feed, the website sends information and updates to your rss reader in an rss document called a feed, so you don't need to check all your favorite websites manually.
RTSP: Real-time streaming protocol - MDN Web Docs Glossary: Definitions of Web-related terms
basically, rtsp is the protocol that describes what happens when you click "pause"/"play" when streaming a video.
Reflow - MDN Web Docs Glossary: Definitions of Web-related terms
reflow happens when a browser must process and draw part or all of a webpage again, such as after an update on an interactive site.
Resource Timing - MDN Web Docs Glossary: Definitions of Web-related terms
the resource timing api is a javascript api that is able to capture timing information for each individual resource that is fetched when a page is loaded.
SMTP - MDN Web Docs Glossary: Definitions of Web-related terms
primary complications include supporting various authentication mechanisms (gssapi, cram-md5, ntlm, msn, auth login, auth plain, etc.), handling error responses, and falling back when authentication mechanisms fail (e.g., the server claims to support a mechanism, but doesn't).
SPA (Single-page application) - MDN Web Docs Glossary: Definitions of Web-related terms
an spa (single-page application) is a web app implemention that loads only a single web document, and then updates the body content of that single document via javascript apis such as xmlhttprequest and fetch when different content is to be shown.
SVG - MDN Web Docs Glossary: Definitions of Web-related terms
the w3c began work on svg in the late 1990s, but svg only became popular when internet explorer 9 came out with svg support.
Scroll container - MDN Web Docs Glossary: Definitions of Web-related terms
a scroll container is created by applying overflow: scroll to a container, or overflow: auto when there is enough content to cause overflow.
Scrollport - MDN Web Docs Glossary: Definitions of Web-related terms
a scroll container is created by applying overflow: scroll to a container, or overflow: auto when there is enough content to cause overflow.
Semantics - MDN Web Docs Glossary: Definitions of Web-related terms
the page's search rankings (see seo) screen readers can use it as a signpost to help visually impaired users navigate a page finding blocks of meaningful code is significantly easier than searching though endless divs with or without semantic or namespaced classes suggests to the developer the type of data that will be populated semantic naming mirrors proper custom element/component naming when approaching which markup to use, ask yourself, "what element(s) best describe/represent the data that i'm going to populate?" for example, is it a list of data?; ordered, unordered?; is it an article with sections and an aside of related information?; does it list out definitions?; is it a figure or image that needs a caption?; should it have a header and a footer in addition to the global site-w...
Session Hijacking - MDN Web Docs Glossary: Definitions of Web-related terms
session hijacking occurs when an attacker takes over a valid session between two computers.
Sloppy mode - MDN Web Docs Glossary: Definitions of Web-related terms
ecmascript 5 and later let scripts opt in to a new strict mode, which alters the semantics of javascript in several ways to improve its resiliency and which make it easier to understand what's going on when there are problems.
Slug - MDN Web Docs Glossary: Definitions of Web-related terms
it may also just be the final component when a new document is created under a parent document; for example, this page's slug is glossary/slug .
State machine - MDN Web Docs Glossary: Definitions of Web-related terms
a transition is a set of actions to execute when a condition is fulfilled or an event received.
Style origin - MDN Web Docs Glossary: Definitions of Web-related terms
the style origins are used to determine where to stop rolling back (or backtracking through) the cascade of styles that have been applied to an element when removing styles, such as when using the unset or revert keywords.
Symmetric-key cryptography - MDN Web Docs Glossary: Definitions of Web-related terms
symmetric-key algorithms should be secure when used properly and are highly efficient, so they can be used to encrypt large amounts of data without having a negative effect on performance.
Synchronous - MDN Web Docs Glossary: Definitions of Web-related terms
many programming commands are also synchronous — for example when you type in a calculation, the environment will return the result to you instantly, unless you program it not to.
Syntax error - MDN Web Docs Glossary: Definitions of Web-related terms
for example, if you leave off a closing brace (}) when defining a javascript function, you trigger a syntax error.
TCP handshake - MDN Web Docs Glossary: Definitions of Web-related terms
this handshake step happens after a dns lookup and before the tls handshake, when creating a secure connection.
Texel - MDN Web Docs Glossary: Definitions of Web-related terms
when texture mapping occurs the renderer maps texel’s to the appropriate pixels.
Tree shaking - MDN Web Docs Glossary: Definitions of Web-related terms
in modern javascript applications, we use module bundlers (e.g., webpack or rollup) to automatically remove dead code when bundling multiple javascript files into single files.
Truthy - MDN Web Docs Glossary: Definitions of Web-related terms
in javascript, a truthy value is a value that is considered true when encountered in a boolean context.
Type conversion - MDN Web Docs Glossary: Definitions of Web-related terms
implicit conversion happens when the compiler automatically assigns data types, but the source code can also explicitly require a conversion to take place.
UDP (User Datagram Protocol) - MDN Web Docs Glossary: Definitions of Web-related terms
udp (user datagram protocol) is a long standing protocol used together with ip for sending data when transmission speed and efficiency matter more than security and reliability.
Visual Viewport - MDN Web Docs Glossary: Definitions of Web-related terms
this can be smaller than the layout viewport, such as when the user has pinched-zoomed.
Web performance - MDN Web Docs Glossary: Definitions of Web-related terms
web performance is the objective time from when a request for content is made until the requested content is displayed in the user's browser, objective render times, and the subjective user experience of load time and runtime.
XInclude - MDN Web Docs Glossary: Definitions of Web-related terms
when used in conjunction with xpointer (firefox supports a subset of it, and is used in the code sample below), xinclude can also target just specific portions of a document for inclusion.
Cacheable - MDN Web Docs Glossary: Definitions of Web-related terms
when both, the method of the request and the status of the response, are cacheable, the response to the request can be cached: get /pagex.html http/1.1 (…) 200 ok (…) a put request cannot be cached.
document environment - MDN Web Docs Glossary: Definitions of Web-related terms
when the javascript global environment is a window or an iframe, it is called a document environment.
First Meaningful Paint - MDN Web Docs Glossary: Definitions of Web-related terms
it is when the answer to "is it useful?" becomes "yes", upon first meaningful paint completion.
HTTPS - MDN Web Docs Glossary: Definitions of Web-related terms
this secure connection allows clients to safely exchange sensitive data with a server, such as when performing banking activities or online shopping.
Origin - MDN Web Docs Glossary: Definitions of Web-related terms
two objects have the same origin only when the scheme, host, and port all match.
Prerender - MDN Web Docs Glossary: Definitions of Web-related terms
when the user navigates to the prerendered content, the current content is replaced by the prerendered content instantly.
Time to first byte - MDN Web Docs Glossary: Definitions of Web-related terms
time to first byte (ttfb) refers to the time between the browser requesting a page and when it receives the first byte of information from the server.
Viewport - MDN Web Docs Glossary: Definitions of Web-related terms
this can be smaller than the layout viewport, such as when the user has pinched-zoomed.
About Scriptable Interfaces - Interfaces
when we label an interface as scriptable, we're saying that components exporting this interface can be referenced (through this interface) from scripts (e.g javascript), and that we can write new components implementing the interface using script languages.
Assessment: Accessibility troubleshooting - Learn web development
semantic html the content is still not very accessible — report on what happens when you try to navigate it using a screenreader.
Test your skills: WAI-ARIA - Learn web development
the problem we have now is that when the dom changes to show a new decription, screenreaders cannot see what has changed.
Fundamental CSS comprehension - Learn web development
when trying to work out the em value you need to represent a certain pixel length, think about what base font size the root (<html>) element has, and what it needs to be multiplied by to get the desired value.
Floats - Learn web development
this exists only to create a bfc without using hacks — there will be no unintended consequences when you use it.
Test Your Skills: Fundamental layout comprehension - Learn web development
the navigation bar should scroll with the content and then become stuck at the top of the viewport when it reaches it.
Grids - Learn web development
the implicit grid is created when content is placed outside of that grid — such as into our rows.
Test your skills: Media Queries and Responsive Design - Learn web development
your task is to create a desktop version of this layout which displays when there is enough screen width to accomodate it.
CSS layout - Learn web development
beginner's guide to media queries the css media query gives you a way to apply css only when the browser and device environment matches a rule that you specify, for example "viewport is wider than 480 pixels".
Using your new knowledge - Learn web development
if you prefer you could move this css to a separate file when you create the example on your local computer.
Use CSS to solve common problems - Learn web development
LearnCSSHowto
the following links provide solutions to common problems you may face when working with css.
Styling lists - Learn web development
handling list spacing when styling lists, you need to adjust their styles so they keep the same vertical spacing as their surrounding elements (such as paragraphs and images; sometimes called vertical rhythm), and the same horizontal spacing as each other (you can see the finished styled example on github, and find the source code too.) the css used for the text styling and spacing is as follows: /* general styles */ ht...
Typesetting a community school homepage - Learn web development
make it so that links are underlined by default, but when you hover or focus them, the underline disappears.
Styling text - Learn web development
styling links when styling links, it is important to understand how to make use of pseudo-classes to style link states effectively, and how to style links for use in common varied interface features such as navigation menus and tabs.
What HTML features promote accessibility? - Learn web development
<a href="inept.html" title="why i'm rubbish at writing link text: an explanation and an apology.">click here</a> to find out more.</p> access keys access keys provide easier navigation by assigning a keyboard shortcut to a link, which will usually gain focus when the user presses alt or ctrl + the access key.
What is the difference between webpage, website, web server, and search engine? - Learn web development
this is what you would generally do when visiting a library: find a search index and look for the title of the book you want.
How do you upload your files to a web server? - Learn web development
let's first look at http://demozilla.examplehostingprovider.net/ — as you can see, so far there is nothing there: note: depending on your hosting provider, most of the time you'll see a page saying something like “this website is hosted by [hosting service].” when you first go to your web address.
How do I use GitHub Pages? - Learn web development
here's what you'd type if you've put your website in a directory called test-site on your desktop: cd desktop/test-site when the command line is pointing inside your website directory, type the following command, which tells the git tool to turn the directory into a git repository: git init an aside on command line interfaces the best way to upload your code to github is via the command line — this is a window where you type in commands to do things like create files and run programs, rather than clicking insi...
What are browser developer tools? - Learn web development
in example.js, a breakpoint has been set on the statement listitems.push(inputnewitem.value); the final two sections only appear when the code is running.
What is accessibility? - Learn web development
the basics of web accessibility a few necessities for basic web accessibility include: whenever your site needs an image to convey meaning, include text as an alternative for visually-challenged users or those with slow connections.
Test your skills: HTML5 controls - Learn web development
if you do this correctly, the javascript included on the page will automatically update the output value when the slider is moved.
Test your skills: Other controls - Learn web development
associate the list with your text input, so that when you type characters, any of the list options that match the character sequence are given in a dropdown list as autocomplete suggestions.
The web and web standards - Learn web development
when doing web development, the main cause of uncertainty comes from the fact that you don't know what combination of technology each user will use to view your web site: user 1 might be looking at it on an iphone, with a small, narrow screen.
HTML Cheatsheet - Learn web development
it's always possible to totally change the look and feel of a given tag using css so, when using html, take the time to focus on the meaning rather than the appearance.
Structuring a page of content - Learn web development
the provided css is designed so that when the correct structural elements are added to the markup, they will appear green in the rendered page.
Introduction to HTML - Learn web development
metadata in html the head of an html document is the part that is not displayed in the web browser when the page is loaded.
Test your skills: HTML images - Learn web development
html images 2 in this task you already have a full-featured image, but we'd like you to add a tooltip that appears when the image is moused over.
Mozilla splash page - Learn web development
in each case (except one — which one is inherently responsive?) we want the browser to serve the 120px wide version when the viewport width is 500px wide or less, or the 400px wide version otherwise.
Test your skills: Multimedia and embedding - Learn web development
display the text tracks contained in the media folder, in a file called subtitles_en.vtt, when the video is playing.
Multimedia and Embedding - Learn web development
unlike regular formats like png/jpg, they don't distort/pixelate when zoomed in — they can remain smooth when scaled.
Asynchronous JavaScript - Learn web development
choosing the right approach to finish this module off, we'll consider the different coding techniques and features we've discussed throughout, looking at which ones you should use when, with recommendations and reminders of common pitfalls where appropriate.
Test your skills: Functions - Learn web development
you'll want to clear the canvas before drawing, so that when the code is updated in the case of the live version, you don't get lots of rectangles drawn on top of one another.
Test your skills: Loops - Learn web development
isprime() — a function that, when passed a number, returns true if the number is a prime number, and false if not.
JavaScript building blocks - Learn web development
functions allow you to store a piece of code that does a single task inside a defined block, and then call that code whenever you need it using a single short command — rather than having to type out the same code multiple times.
Test your skills: JSON - Learn web development
the json is loaded into the page as a text string and made available in the catstring parameter of the displaycatinfo() function, called when the provided promise chain (which starts by fetching the json data) is fulfilled.
Test your skills: Object-oriented JavaScript - Learn web development
when invoking the constructor, you should therefore just need to provide the sidelength property.
Test your skills: Object basics - Learn web development
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.
Introducing JavaScript objects - Learn web development
in addition, we present some advice on when and where you might use oojs.
Measuring performance - Learn web development
performance apis when writing code for the web, there are a large number of web apis available that allow you to create your own performance measuring tools.
Multimedia: video - Learn web development
do this only when playback is very likely.
Learning area release notes - Learn web development
learn why frameworks exist, when you should use one (and when you shouldn't), what kinds of features are common to all frameworks, and how they relate to the vanilla javascript you may already know.
Server-side website programming - Learn web development
displaying all of these using different static pages would be extremely inefficient, so instead such sites display static templates (built using html, css, and javascript), and then dynamically update the data displayed inside those templates when needed, such as when you want to view a different product on amazon.
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 progressive web apps (pwas) ember works best when it is the entire front end of your application.
Vue resources - Learn web development
you are required to be explicit about "reactive" properties when using this api.
Styling Vue components with CSS - Learn web development
while this tutorial will not be using such tools, it's good to know that when including such code in the assets folder it will be processed automatically.
Cross browser testing - Learn web development
what browsers, devices, and other segments should you make sure are tested), lo-fi testing strategies (get yourself a range of devices and some virtual machines and do ad-hoc tests when needed), higher tech strategies (automation, using dedicated testing apps), and testing with user groups.
Accessibility Features in Firefox
view selection source (techies only): when you select some text and right click or press shift+f10, you can "view selection source".
Embedding API for Accessibility
for the most part, an automatic reframe is performed when one of these prefs is changed.
Information for External Developers Dealing with Accessibility
accessible toolkit checklist a list of what needs to be done for accessibility when building new toolkits, widget by widget.
Accessibility and Mozilla
since this is a worldwide effort, there is always a good chance to find someone to chat with there, day or night.accessibility information for ui designers and developerswhen you design user interfaces with accessibility in mind, they will work for more people.
Frequently Asked Questions for Lightweight themes
preview any theme by clicking "tap to preview"; the design appears in your browser header so you can "try it on." when you're ready, just click the blue install theme button.
Testopia
do not ask when we plan to release 3.0, because we really don't know.
Building SpiderMonkey with UBSan
when you hit a bug and want a stack trace, run under gdb with a breakpoint at the end of __ubsan::diag::~diag().
Cookies Preferences in Mozilla
if you have the old-style prefs, they will be migrated when starting the application.
Creating a spell check dictionary add-on
if you set em:minversion to a lower value, gecko 10-17 will not be able to update your dictionary add-on once the restartless dictionary is installed (bug 782118), and gecko 10-16 may warn the user that your dictionary is not compatible, when users try to update to a newer version of firefox/thunderbird (bug 782115).
Capturing a minidump
when the program is about to crash, windbg will spit out more data, and the prompt at the bottom will change from saying "*busy*" to having a number in it.
Articles for new developers
when first getting started as a contributor to the mozilla project, there's a lot of information to sort through and understand.
Gmake vs. Pymake
the working directory must be your objdir when you invoke configure to get paths that will work in gmake and pymake.
Updating NSPR or NSS in mozilla-central
if you check in an individual change by mistake, your change will be lost when the nspr and nss teams push a new hg tag to mozilla-central.
Interface development guide
idl interface rules design guidelines and rules when creating and changing xpcom interfaces.
Index
172 security best practices for firefox front-end engineers best practices, developing firefox, developing mozilla, firefox, front-end, mozilla, performance this article will help firefox developers understand the security controls in place and avoid common pitfalls when developing front-end code for firefox.
Limitations of frame scripts
by default, about: pages (except for a small whitelist) are loaded in the chrome process when browsed to from the awesomebar.
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 sub...
Firefox
always keep in mind the side effects your changes may have, from blocking other tasks, to interfering with other user interface elements.privacythis document lists privacy-related documentation.security best practices for firefox front-end engineersthis article will help firefox developers understand the security controls in place and avoid common pitfalls when developing front-end code for firefox.site identity buttonthe site identity button is a feature in firefox that gives users more information about the sites they visit.
HTMLIFrameElement.clearMatch()
examples the following function is taken from our browser api demo, and (amongst other things) clears the search results when the search bar is hidden, if an existing search is active.
HTMLIFrameElement.findAll()
casesensitivity a string to declare whether you want the search to be case sensitive (case-sensitive) or insensitive (case-insensitive.) example the following function is taken from our browser api demo, and executes a search when a search form is submitted.
mozbrowseraudioplaybackchange
the mozbrowseraudioplaybackchange event is fired when audio starts or stops playing within a browser <iframe>.
mozbrowsercaretstatechanged
the mozbrowsercaretstatechanged event is fired when the user selects content in a page loaded in a browser <iframe>.
mozbrowserclose
the mozbrowserclose event is fired when the content of a browser <iframe> calls the window.close() method.
mozbrowserdocumentfirstpaint
the mozbrowserdocumentfirstpaint event is fired when a new paint occurs on any document in the browser <iframe>.
mozbrowsererror
the mozbrowsererror event is fired when an error occurs while trying to load content within a browser <iframe>.
mozbrowserfindchange
the mozbrowserfindchange event is fired when a search method is invoked in the browser <iframe> content.
mozbrowserfirstpaint
the mozbrowserfirstpaint event is fired when the <iframe> paints content for the first time (this doesn't include the initial paint from about:blank).
mozbrowsericonchange
the mozbrowsericonchange event is sent when a new icon (e.g.
mozbrowserlocationchange
the mozbrowserlocationchange event is fired when a browser <iframe>'s location changes — it is fired every time navigation occurs.
mozbrowsermanifestchange
the mozbrowsermanifestchange event is fired when the manifest location of the app loaded in the browser <iframe> changes.
mozbrowsermetachange
the mozbrowsermetachange event is fired when a <meta> element related to web applications is added, removed or changed.
mozbrowseropentab
the mozbrowseropentab event is fired when a new tab is opened within a browser <iframe> as a result of the user issuing a command to open a link target in a new tab (for example ctrl/cmd + click.) general info specification non standard interface customevent bubbles yes cancelable yes target <iframe> default action none properties property type description target read only eventtarget the browser iframe type read only domstring the t...
mozbrowseropenwindow
the mozbrowseropenwindow event is fired when a new window is required — usually when the content of a browser <iframe> successfully calls the window.open() method, or the user clicks on a link with an unknown target.
mozbrowserresize
the mozbrowserresize event is fired when a browser <iframe> viewport is resized in some way.
mozbrowserscroll
the mozbrowserscroll event is fired when the browser <iframe> content scrolls.
mozbrowserscrollviewchange
the mozbrowserscrollviewchange event is fired when asynchronous scrolling (i.e.
mozbrowsersecuritychange
the mozbrowsersecuritychange event is fired when the browser <iframe> has connected to the server, and when the mixed content state changes.
mozbrowserselectionstatechanged
the mozbrowserselectionstatechanged event is fired when the text selected inside the browser <iframe> content changes.
mozbrowsertitlechange
the mozbrowsertitlechange event is fired when the title of a browser <iframe> (i.e.
mozbrowserusernameandpasswordrequired
the mozbrowserusernameandpasswordrequired event is fired when the content within a browser <iframe> requires an http authentification.
mozbrowservisibilitychange
the mozbrowservisibilitychange event is fired when the visibility state of the current browser iframe <iframe> changes, for example due to a call to setvisible().
HTMLIFrameElement.setVisible()
however, if the visible state is set to false, window.requestanimationframe will be called only when there are free resources to do it.
CSS -moz-bool-pref() @supports function
example warning: this will only work when loaded from a gecko chrome stylesheet.
-moz-window-dragging
the property was added in firefox 35 to solve intermittent problems related to firefox windows not being moveable when busy (bug 944836).
:-moz-lwtheme-brighttext
the :-moz-lwtheme-brighttext pseudo-class matches in chrome documents when :-moz-lwtheme is true and a lightweight theme with a bright text color is selected.
:-moz-lwtheme-darktext
the :-moz-lwtheme-darktext pseudo-class matches in chrome documents when :-moz-lwtheme is true and a lightweight theme with a dark text color is selected.
:-moz-lwtheme
the :-moz-lwtheme pseudo-class matches in chrome documents when the root element's lightweightthemes attribute is true and a theme is selected.
::-moz-tree-progressmeter
activated when the type attribute is set to progressmeter.
overflow-clip-box-block
the overflow-clip-box-block css property specifies relative to which box the clipping happens when there is an overflow — in the block direction.
overflow-clip-box-inline
the overflow-clip-box-inline css property specifies relative to which box the clipping happens when there is an overflow — in the inline direction.
overflow-clip-box
the overflow-clip-box css property specifies relative to which box the clipping happens when there is an overflow.
smartcard-insert
the smartcard-insert event is fired when the insertion of a smart card has been detected specification mozilla specific interface event bubbles no cancelable no target document default action none properties property type description targetread only eventtarget the event target (the topmost target in the dom tree).
smartcard-remove
the smartcard-remove event is fired when the removal of a smart card has been detected.
Roll your own browser: An embedding how-to
you will also want to shut this down when you quit.
Gecko SDK
issues with the os x sdk if you need to use the xpidl utility to compile idl files on os x, it's likely that you will receive a strange error when running the tool that looks something along the lines of this: dyld: library not loaded: /opt/local/lib/libintl.3.dylib referenced from: /users/varmaa/xulrunner-sdk/bin/./xpidl reason: image not found trace/bpt trap unfortunately, this is caused by a problem with the sdk build process which cannot currently be resolved (see bugzilla bug #430274).
Gecko's "Almost Standards" Mode
this means that sliced-images-in-tables layouts are less likely to fall apart in gecko-based browsers based on the rendering engine found in mozilla 1.0.1 or later when in either "quirks" or "almost standards" mode.
Getting from Content to Layout
to give a trivial example of when this might be necessary, consider: "<span>foo <div></div> bar</span>".
How to get a stacktrace with WinDbg
q: should i click yes or no when windbg asks me to "save information for workspace?" a: click yes and windbg will save you from having to enter in the symbol location for firefox.exe in the future.
Implementing Download Resuming
detecting when a file changed if the file changed (that is, the entity id does not match), then necko will notify the stream listener with an ns_error_entity_changed error code.
Code Samples
onbyid("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.
Add-on Manager
the callbacks may be called immediately while the initial function is still executing or shortly after, depending on when the requested data becomes available.
Add-on Repository
these searches are asynchronous; results are passed to the provided searchcallback object when the search is completed.
AsyncShutdown.jsm
used for providing more details when logging errors or crashing.
FxAccountsOAuthClient.jsm
oncomplete function gets called when the firefox accounts oauth flow successfully completes.
OSFile.jsm
we are talking about several seconds to execute operations that look trivial, such as closing a file, or checking when it was last modified.
Encodings for localization files
when creating a localization for mozilla products, it’s important to be aware of the encoding of the files that you generate.
L10n Checks
+fullzoomenlargecmd.commandkey3 +fullzoomreducecmd.commandkey2 +fullzoomresetcmd.commandkey2 +organizebookmarks.label -showallbookmarkscmd2.label migration/migration.dtd -importfromfile.accesskey -importfromfile.label +importfromhtmlfile.accesskey +importfromhtmlfile.label you can assume changed strings when you see entities removed and added with a similar name.
L10n testing with xcode
navigate to the newly opened ios simulator window many strings are accessibility strings and are only revieled when a user hovers their finger over the button.
Localizing XLIFF files for iOS
the goal of the standard is to have an xml-based format to use when exchanging localization data between tools without the potential of data loss or corruption.
Localizing extension descriptions
if there is more than one locale with the same number of matching parts, then use the most general one (e.g., en in preference to en-gb when searching for en-us).
Localizing with Mercurial
when you get the comm-central repository, this will include the mozilla-central repository as well.
Localizing with Pontoon
translate strings when using pontoon for localization, you have a couple of options to translate your strings.
Patching a Localization
whenever you see gl in blue text, replace it with the locale code for your language.
Translation phase
the l10n tools are meant to help you maintain your localized content from release to release and leverage already localized materials when localizing new content.
Setting up the infrastructure
this is useful when a localizer submits a new version of the messages.po file.
Basics
when you left-click any individual entry, it should toggle between its expanded and unexpanded forms.
MathML3Testsuite
when the markup is intentionally errorous, the correct behavior is not defined by the recommendation and hence the tests are considered passed if there is no fatal error (crash, etc).
Mozilla Style System
when script dynamically changes the data represented by a css style rule, we create a new nsistylerule object; keeping the old one around briefly helps to determine what changed and how we need to handle that change.
about:memory
single memory report files can also be loaded automatically when about:memory is loaded by appending a file query string, for example: about:memory?file=/home/username/reports.json.gz this is most useful when loading memory reports files obtained from a firefox os device.
tools/power/rapl
note that if you do change this file, its contents may reset when the machine is next rebooted.
accessibility.tabfocus
the preference accessibility.tabfocus controls what elements receive focus when the user presses the tab key.
javascript.options.strict
javascript warnings are generated when code is executed that doesn't cause a run-time error, but is non-standard, poorly written, or prone to cause logic errors.
Preference reference
accessibility.tabfocusthe preference accessibility.tabfocus controls what elements receive focus when the user presses the tab key.browser.altclicksavethe preference browser.altclicksave controls whether clicking a link while holding the alt key starts the download of that link.browser.dom.window.dump.enabledthis setting enables the dump function, which sends messages to the system console.
Preferences system
usage in xulrunner applications when calling opendialog() to open a preferences dialog, "toolbar" should be included in the features string.
A guide to searching crash reports
when a search is performed, the page's url is updated to include the search parameters.
Leak Monitor
it will pop-up an alert when a window is closed and javascript still links to that window (for example, an observer that is not cleared when the window closes).
McCoy
this is located in: %appdata%\mozilla\mccoy (windows) ~/.mozilla/mccoy (linux) ~/library/application support/mccoy (mac os x) it is highly recommended that you back up your profile folder and store it in a safe location whenever you create a new key; without a backup, there is no way to recover your private keys if they are lost!
Midas editor module security preferences
only change these settings as needed to try the demo above and to test your own add-on or firefox-internal code, and be sure to restore the default settings when you're done!
NSPR Poll Method
if new_flags contains pr_poll_read, you should try pr_recv or pr_send when the underlying network transport is readable if new_flags contains pr_poll_write, you should try pr_recv or pr_send when the underlying network transport is writable important do not use out_flags in any way other than testing if (new_flags & out_flags) is 0.
NSPR build instructions
--target=x86_64-pc-mingw32 for 64-bit builds on windows, when using the mozillabuild environment.
Anonymous Shared Memory
further, when all processes using an anonymous shared memory terminate, the backing file is deleted.
Cached Monitors
this chapter describes the functions you use when you work with cached monitors.
I/O Types
file info types prfileinfo prfileinfo64 prfiletype network address types prnetaddr pripv6addr types used with socket options functions prsocketoptiondata prsockoption prlinger prmcastrequest type used with memory-mapped i/o prfilemap offset interpretation for seek functions prseekwhence ...
Locks
when a programmer associates a mutex with an arbitrary collection of data, the mutex provides a protective monitor around the data.
Logging
set one of the compile-time defines when you build your application.
NSPR Error Handling
pr_file_exists_error attempt to create or rename a file when the new name is already being used.
NSPR LOG FILE
nspr logging, when enabled, writes to the file named in this environment variable.
NSPR LOG MODULES
examples log everything from the toolkit::storage component that happens, prefixing each line with the timestamp when it was logged to the file /tmp/foo.log (which will be replaced each time the executable is run).
NSPR Types
other chapters describe more specialized types when describing the functions that use them.
PLHashEnumerator
when all the table entries are enumerated, each entry is passed to a user-specified function of type plhashenumerator with the hash table entry, an integer index, and an arbitrary piece of user data as argument.
PL_HashTableDestroy
the entries are freed by the freeentry function (with the ht_free_entry flag) in the allocops structure supplied when the table was created.
PL_NewHashTable
when the allocation functions in allocops are invoked, the allocation private data allocpriv is passed as the first argument (pool).
PRDescIdentity
a string may be associated with a layer when the layer is created.
PRExplodedTime
when an nspr function returns a prexplodedtime object or sets a prexplodedtime object as output, all of the prexplodedtime members are set, including the nonessential members.
PRMonitor
clients create them when needed and must destroy them when no longer needed.
PRProcessAttr
pass a pointer to a prprocessattr into pr_createprocess when you create a new process, specifying information such as standard input/output redirection and file descriptor inheritance.
PRThreadPrivateDTOR
if the data associated with the index is not null, nspr passes a reference to the data to the destructor function when the thread terminates.
PRThreadType
pr_system_thread nspr ignores threads of type pr_system_thread when determining when a call to pr_cleanup should return.
PRTimeParamFn
syntax #include <prtime.h> typedef prtimeparameters (pr_callback_decl *prtimeparamfn) (const prexplodedtime *gmt); description the type prtimeparamfn represents a callback function that, when given a time instant in gmt, returns the time zone information (offset from gmt and dst offset) at that time instant.
PR_Bind
description when a new socket is created, it has no address bound to it.
PR_Cleanup
when the primordial thread returns from main, the process immediately and silently exits.
PR_CloseDir
description when a prdir object is no longer needed, it must be closed and freed with a call to pr_closedir call.
PR_CloseFileMap
description when a file mapping created with a call to pr_createfilemap is no longer needed, it should be closed with a call to pr_closefilemap.
PR_CreateFileMap
the file-mapping object should be closed with a pr_closefilemap call when it is no longer needed.
PR_CreatePipe
when the pipe is no longer needed, both ends should be closed with calls to pr_close.
PR_CreateThread
when you are ready for the thread to run, exit the lock.
PR EnumerateAddrInfo
the enumeration is complete when a value of null is returned.
PR_EnumerateHostEnt
the enumeration is complete when a value of zero is returned.
PR_FREEIF
description this macro returns memory to the heap when _ptr is not null.
PR_FindSymbol
getting a pointer to a symbol in a library does indicate that the library is available when the search was made.
PR GetAddrInfoByName
when no longer needed, this pointer must be destroyed with a call to pr_freeaddrinfo.
PR_GetConnectStatus
when pr_poll returns, call pr_getconnectstatus on the socket to determine whether the nonblocking connect has succeeded or failed.
PR_GetLibraryName
when it is no longer used, free it using pr_freelibraryname.
PR_GetLibraryPath
when it is no longer used, free it using pr_freelibraryname.
PR_GetNameForIdentity
description a string may be associated with a layer when the layer is created.
PR_GetUniqueIdentity
description a string may be associated with a layer when the layer is created.
PR ImportTCPSocket
warning in theory, code that uses pr_importtcpsocket may break when nspr's implementation changes.
PR_Interrupt
when the interrupted thread reaches the prearranged point, it can communicate with its peer to discover the real reason behind the change in plans.
PR_LOG_TEST
possible values are: pr_log_none = 0 pr_log_always = 1 pr_log_error = 2 pr_log_warning = 3 pr_log_debug = 4 pr_log_notice = pr_log_debug pr_log_warn = pr_log_warning pr_log_min = pr_log_debug pr_log_max = pr_log_debug returns pr_true when logging is enabled for the given module and level, otherwise pr_false.
PR_Lock
description when pr_lock returns, the calling thread is "in the monitor," also called "holding the monitor's lock." any thread that attempts to acquire the same lock blocks until the holder of the lock exits the monitor.
PR_MemMap
when the file-mapping memory region is no longer needed, it should be unmapped with a call to pr_memunmap.
PR_MkDir
mode the access permission bits of the file mode of the new directory if the file is created when pr_create_file is on.
PR_NETDB_BUF_SIZE
recommended size to use when specifying a scratch buffer for pr_gethostbyname, pr_gethostbyaddr, pr_getprotobyname, or pr_getprotobynumber.
PR_NewMonitor
the caller is responsible for the object and is expected to destroy it when appropriate.
PR_NewUDPSocket
when the socket is no longer needed, it should be closed with a call to pr_close.
PR_NormalizeTime
for example, if the input argument time is in time zone a and the input argument params represents time zone b, when pr_normalizetime() returns, time will be in time zone b.
PR_Notify
when the notification occurs, the runtime promotes a thread that is waiting on the monitor to a ready state.
PR_NotifyCondVar
when the notification occurs, the runtime promotes a thread that is waiting on the condition variable to a ready state.
PR_Open
mode when pr_create_file flag is set and the file is created, these flags define the access permission bits of the newly created file.
PR_OpenSemaphore
mode unix style file mode to be used when creating the semaphore.
PR OpenUDPSocket
when the socket is no longer needed, it should be closed with a call to pr_close.
PR_Poll
detects when i/o is ready for a set of socket file descriptors.
PR_PushIOLayer
the destructor will be called on all layers when the stack is closed (see pr_close).
PR_QueueJob
fn the function to be executed when the job is executed.
PR_SetError
the runtime merely stores the value and returns it when requested.
PR_SetLogFile
returns pr_true when successful.
PR_SetThreadPriority
it is preferable for a thread to specify itself in the thread parameter when it calls pr_setthreadpriority.
PR_dtoa
possible modes are: 0 shortest string that yields d when read in and rounded to nearest.
Threads
you set a thread's nspr priority when you create it with pr_createthread.
Running NSPR tests
since none of our operating systems is a real-time os, such test programs may fail when the test machine is heavily loaded.
Function_Name
a match is found when the issuer and serial number of the der-encoded certificate are found on a certificate in the certificate database.
CERT_FindCertByDERCert
a match is found when the issuer and serial number of the der-encoded certificate are found on a certificate in the certificate database.
NSS FAQ
MozillaProjectsNSSFAQ
nss source code and binaries (when they become available) are completely free.
HTTP delegation
(when issueing get requests, the "?query-string=data" portion should already be appended to the request path) after creation, nss might call functions to provide additional details of the http request (e.g.
HTTP delegation
(when issuing get requests, the "?query-string=data" portion should already be appended to the request path) after creation, nss might call functions to provide additional details of the http request (e.g.
JSS
MozillaProjectsNSSJSS
when nss is put in fips mode, jss ensures fips compliance by ensuring that all cryptographic operations are performed by the nss cryptographic module.
NSS_3.11.10_release_notes.html
bug 291384: certutil -k behavior doesn't match usage bug 374247: modutil -disable command not disabling modules' slots bug 384459: certification path validation fails when authority key identifier extension contains key identifier bug 385946: can't import certificate into cert database in fips mode (certutil).
NSS 3.12.9 release notes
bug 609068: implement j-pake in freebl bug 607058: crash [@ nss_cms_decoder_work_data] bug 613394: november/december 2010 batch of nss root ca changes bug 610843: need way to recover softoken in child after fork() bug 617492: add pk11_keygenwithtemplate function to pk11wrap (for firefox sync) bug 610162: sha-512 and sha-384 hashes are incorrect for inputs of 512mb or larger when running under windows and other 32-bit platforms (fx 3.6.12 and 4.0b6) bug 518551: vfychain crashes in pkits tests.
NSS 3.15.1 release notes
notable changes in nss 3.15.1 bug 856060 - enforce name constraints on the common name in libpkix when no subjectaltname is present.
NSS 3.15.2 release notes
new in nss 3.15.2 new functionality aes-gcm ciphersuites: aes-gcm cipher suite (rfc 5288 and rfc 5289) support has been added when tls 1.2 is negotiated.
NSS 3.17.2 release notes
bug 1078669: certutil crashes when an argument is passed to the --certversion option.
NSS 3.17 release notes
nss 3.17 source distributions are available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_17_rtm/src/ new in nss 3.17 new functionality when using ecdhe, the tls server code may be configured to generate a fresh ephemeral ecdh key for each handshake, by setting the ssl_reuse_server_ecdhe_key socket option to pr_false.
NSS 3.18.1 release notes
but when firefox 38 went into beta, there was a huge spike in the number of certificate verification errors attributed to this change.
NSS 3.19.2.1 release notes
because nss includes portions of the affected nspr code at build time, it is necessary to use nspr 4.10.10 when building nss.
NSS 3.19.2.3 release notes
an attacker could create a specially-crafted certificate which, when parsed by nss, would cause a crash or execution of arbitrary code with the permissions of the user.
NSS 3.19.4 release notes
because nss includes portions of the affected nspr code at build time, it is necessary to use nspr 4.10.10 when building nss.
NSS 3.20.1 release notes
because nss includes portions of the affected nspr code at build time, it is necessary to use nspr 4.10.10 when building nss.
NSS 3.21.1 release notes
an attacker could create a specially-crafted certificate which, when parsed by nss, would cause a crash or execution of arbitrary code with the permissions of the user.
NSS 3.22.2 release notes
an attacker could create a specially-crafted certificate which, when parsed by nss, would cause a crash or execution of arbitrary code with the permissions of the user.
NSS 3.23 release notes
an attacker could create a specially-crafted certificate which, when parsed by nss, would cause a crash or execution of arbitrary code with the permissions of the user.
NSS 3.25 release notes
removed the limitation that allowed nss to only support certificate_verify messages that used the same signature hash algorithm as the prf when using tls 1.2 client authentication.
NSS 3.27.1 release notes
previous versions of nss made tls 1.3 (draft) available only when compiled with nss_enable_tls_1_3.
NSS 3.27.2 Release Notes
previous versions of nss leaked the memory used to store distinguished names when ssl_settrustanchors() was used.
NSS 3.27 release notes
the tls 1.3 (draft) protocol can be disabled, by defining symbol nss_disable_tls_1_3 when building nss.
NSS 3.29.3 release notes
notable changes in nss 3.29.3 a rare crash when initializing an ssl socket fails has been fixed.
NSS 3.31 release notes
this is used only when seed_only_dev_urandom is set at compile time.
NSS 3.42 release notes
bug 1513913 - a fix for solaris where firefox 60 core dumps during start when using profile from version 52 this bugzilla query returns all the bugs fixed in nss 3.42: https://bugzilla.mozilla.org/buglist.cgi?resolution=fixed&classification=components&query_format=advanced&product=nss&target_milestone=3.42 compatibility nss 3.42 shared libraries are backward compatible with all older nss 3.x shared libraries.
NSS 3.44 release notes
ificate sequences 1533616 - sdb_getattributevaluenolock should make at most one sql query, rather than one for each attribute 1531236 - provide accessor for certcertificate.dercert 1536734 - lib/freebl/crypto_primitives.c assumes a big endian machine 1532384 - in nss test certificates, use @example.com (not @bogus.com) 1538479 - post-handshake messages after async server authentication break when using record layer separation 1521578 - x25519 support in pk11pars.c 1540205 - freebl build fails with -dnss_disable_chachapoly 1532312 - post-handshake auth doesn't interoperate with openssl 1542741 - certutil -f crashes with segmentation fault 1546925 - allow preceding text in try comment 1534468 - expose chacha20 primitive 1418944 - quote cc/cxx variables passed to nspr 1543545 - allow...
NSS 3.48 release notes
the master password pbe now uses 10,000 iterations by default when using the default sql (key4.db) storage.
NSS 3.49 release notes
notable changes in nss 3.49 the legacy dbm database, libnssdbm, is no longer built by default when using gyp builds.
NSS 3.51 release notes
est for mp_int clamping bug 1582169 - don't attempt to read the fips_enabled flag on the machine unless nss was built with fips enabled bug 1431940 - fix a null pointer dereference in blake2b_update bug 1617387 - fix compiler warning in secsign.c bug 1618400 - fix a openbsd/arm64 compilation error: unused variable 'getauxval' bug 1610687 - fix a crash on unaligned cmaccontext.aes.keyschedule when using aes-ni intrinsics this bugzilla query returns all the bugs fixed in nss 3.51: https://bugzilla.mozilla.org/buglist.cgi?resolution=fixed&classification=components&query_format=advanced&product=nss&target_milestone=3.51 compatibility nss 3.51 shared libraries are backward compatible with all older nss 3.x shared libraries.
NSS 3.55 release notes
bug 1653202 - fix initialization bug in blapitest when compiled with nss_disable_deprecated_seed.
NSS 3.56 release notes
bug 1588941 - send empty certificate message when scheme selection fails.
Enc Dec MAC Using Key Wrap CertReq PKCS10 CSR
r_stderr, "could not allocate item for certificate data.\n"); goto cleanup; } rv = sec_dersigndata(arena, result, der.data, der.len, privkey, algid); if (rv != secsuccess) { pr_fprintf(pr_stderr, "could not sign encoded certificate data : %s\n", port_errortostring(rv)); /* result allocated out of the arena, it will be freed * when the arena is freed */ result = null; goto cleanup; } cert->dercert = *result; cleanup: if (caprivatekey) { seckey_destroyprivatekey(caprivatekey); } return result; } /* * makev1cert */ static certcertificate * makev1cert(certcertdbhandle *handle, certcertificaterequest *req, char * issuerni...
NSS Sample Code Sample1
as an alternative, new keys may be sent to the // current set of secondary hosts when they are generated by the // primary.
NSS Sample Code sample2
* when not using cbc mode, ivitem.data and ivitem.len can be 0, or you * can simply pass null for the iv parameter in pk11_paramfromiv func */ ivitem.type = sibuffer; ivitem.data = giv; ivitem.len = sizeof(giv); secparam = pk11_paramfromiv(ciphermech, &ivitem); if (secparam == null) { fprintf(stderr, "failure to set up pkcs11 param (err %d)\n", pr_geterror()); goto ...
NSS Sample Code sample6
* (enter "test" when prompted for password) */ #include "nss.h" #include "pk11pub.h" /* the key id can be any sequence of bytes.
sample2
renazalloc (arena, sizeof (secitem)); if (result == null) { pr_fprintf(pr_stderr, "could not allocate item for certificate data.\n"); goto cleanup; } rv = sec_dersigndata(arena, result, der.data, der.len, privkey, algid); if (rv != secsuccess) { pr_fprintf(pr_stderr, "could not sign encoded certificate data : %s\n", port_errortostring(rv)); /* result allocated out of the arena, it will be freed * when the arena is freed */ result = null; goto cleanup; } cert->dercert = *result; cleanup: if (caprivatekey) { seckey_destroyprivatekey(caprivatekey); } return result; } /* * makev1cert */ static certcertificate * makev1cert(certcertdbhandle *handle, certcertificaterequest *req, char * issuernickname, prbool selfsign, unsigned int serialnumber, int warpmonths, int validitymonths) { prexplodedtime pri...
NSS sources building testing
when adding new features to nss, tests for the new feature should be added as well.
nss tech note2
or example, 1024[805ef10]: c_initialize 1024[805ef10]: pinitargs = 0x4010c938 1024[805ef10]: rv = 0x0 1024[805ef10]: c_getinfo 1024[805ef10]: pinfo = 0xbffff340 1024[805ef10]: rv = 0x0 1024[805ef10]: c_getslotlist 1024[805ef10]: tokenpresent = 0x0 1024[805ef10]: pslotlist = 0x0 1024[805ef10]: pulcount = 0xbffff33c 1024[805ef10]: *pulcount = 0x2 1024[805ef10]: rv = 0x0 note that when a pkcs #11 function takes a pointer argument for which it will set a value (c_getslotlist above), this mode will display the value upon return.
nss tech note4
if ssl server, this will get you the client's cert handle if client auth is enabled certcertificate* cert = ssl_localcertificate(prfiledesc *fd); if ssl client, this will get you the client cert's handle, if client auth happened if ssl server, this will get you the server's cert handle don't forget to clean up the cert handle when you're done with it void cert_destroycertificate(certcertificate *cert); some info is readily available cert->subjectname (char*) cert->issuername (char*) cert->emailaddr (char*) or char *cert_getcertificateemailaddress(certcertificate *cert); cert->keyusage (unsigned int) to break the issuer and subject names in...
nss tech note6
when in fips 140 mode, the softoken is required to compute its checksum and compare it with the value in libsoftokn3.chk/softokn3.chk.
NSS release notes template
draft (remove line when document is finished) introduction the nss team has released network security services (nss) 3.xx, which is a minor release.
PKCS11 module installation
choose "browse..." to find the location of the pkcs #11 module on your local computer, and choose "ok" when done.
Build instructions
on windows, in both debug and optimized builds, when using msvc, tells nss to put symbols in a .pdb file.
FC_InitPIN
fc_initpin() must be called when the pkcs #11 security officer (so) is logged into the token and the session is read/write, that is, the session must be in the "r/w so functions" state (cks_rw_so_functions).
FC_InitToken
application usage fc_inittoken() is used to reset the password for the key database when the user forgets the password.
NSC_InitToken
examples application usage nsc_inittoken() is used to reset the password for the key database when the user forgets the password.
troubleshoot.html
building jss windows only: the shell invoked by gmake, shmsdos.exe, is likely to crash when invoking some java tools on windows.
gtstd.html
verifying the server and client certificates when you have finished setting up the server and client certificate databases, verify that the client and server certificates are valid, as follows: >certutil -v -d server_db -u v -n myco.mcom.org certutil: certificate is valid >certutil -v -d client_db -u c -n "joe client" certutil: certificate is valid building nss programs on unix, use the gnu utility gmake to run the makefile.
TLS Cipher Suite Discovery
when a new version of a tls implementation is made available for use by applications, those applications may wish to immediately use the newly supported cipher suites found in the new version, without the application needing to be modified and re-released to know about these new cipher suites.
NSS Tools
the links will become active when information is available.
NSS tools : signver
MozillaProjectsNSStoolssignver
extended examples verifying a signature the -v option verifies that the signature in a given signature file is valid when used to sign the given object (from the input file).
Necko FAQ
todo when is the next stable release of this library going to be available?
Necko Interfaces Overview
:onstartrequest - notifies start of async download nsistreamlistener::ondataavailable - notifies presence of downloaded data nsirequestobserver::onstoprequest - notifies completion of async download, possibly w/ error nsiloadgroup : nsirequest attribute of a nsirequest channel impl adds itself to its load group during invocation of asyncopen channel impl removes itself from its load group when download completes load groups in gecko own all channels used to load a particular page (until the channels complete) all channels owned by a load group can be canceled at once via the load group's nsirequest::cancel method nsitransport represents a physical connection, such as a file descriptor or a socket used directly by protocol handler implementations (as well as by mailnews and chatz...
Multithreading in Necko
when a socket can be read, the socket's listener is notified either synchronously (on the same thread) or asynchronously via a nsistreamlistenerproxy impl.
Pork Tool Development
macro expansion this section refers to macro expansion when using mcpp (see installing pork).
Rhino FAQ
for example, creating an array of seven ints can be done with the code var intarray = java.lang.reflect.array.newinstance(java.lang.integer.type, 7); when i try to execute a script i get the exception required security context missing.
Rhino JavaScript compiler
note that the top-level functions available to the shell (such as print) are not available to compiled scripts when they are run outside the shell.
Rhino optimization
for maximal optimization, use level 9, but retest your application when upgrading to new versions.
Rhino requirements and limitations
limitations liveconnect if a javaobject's field's name collides with that of a method, the value of that field is retrieved lazily, and can be counter-intuitively affected by later assignments: javaobj.fieldandmethod = 5; var field = javaobj.fieldandmethod; javaobj.fieldandmethod = 7; // now, field == 7 you can work around this by forcing the field value to be converted to a javascript type when you take its value: javaobj.fieldandmethod = 5; var field = javaobj.fieldandmethod + 0; // force conversion now javaobj.fieldandmethod = 7; // now, field == 5 jsobject rhino does not support the netscape.javascript.jsobject class.
The JavaScript Runtime
when scripts are compiled in interpretive mode, an internal representation of the compiled form is created and stored rather than generating a java class.
Rhino serialization
to understand the answer we must know what goes on behind the scenes when rhino serializes objects.
Rhino shell
arguments the arguments object is an array containing the strings of all the arguments given at the command line when the shell was invoked.
Shumway
shumway has certain limitations compared to adobe flash player especially when unavoidable patents (such as those surrounding flash drm) get in the way.
Future directions
whenever practical, new code and changes should move code closer to the ideal future.
How to embed the JavaScript engine
run the helloworld executable at the command line: ./helloworld how to call c functions from javascript say the c function is named doit and it would like at least two actual parameters when called (if the caller supplies fewer, the js engine should ensure that undefined is passed for the missing ones): #define doit_minargs 2 // [spidermonkey 24] use jsbool instead of bool.
Exact Stack Rooting
when passed to an out-param, &handle would convert correctly to js::handlet*, but &local is a compile error.
Self-hosted builtins in SpiderMonkey
this is to prevent accidentally calling content functions when assuming that content can't interfere with behavior.
JS::AutoIdArray
examples { js::autoidarray ids(cx, js_enumerate(cx, obj)); if (!ids) // check the returned value from js_enumerate return false; for (int32_t i = 0, len = ids.length(); i < len; i++) { somefunc(cx, ids[i]); } /* when leaving this scope, the jsidarray returned by js_enumerate is freed.
JS::AutoVectorRooter
for use when space has already been reserved.
JS::Call
thisobj js::handleobject / js::handlevalue the "current" object on which the function operates; the object specified here is "this" when the function executes.
JS::CloneFunctionObject
js::clonefunctionobject takes care to choose a prototype that shares a global object with the given parent whenever possible.
JS::CompileOffThread
callback js::offthreadcompilecallback a callback function invoked when the compilation.
JS::Rooted
js::rooted<t> should be used whenever a local variable's value may be held live across a call which can trigger a gc.
JS::SetLargeAllocationFailureCallback
added in spidermonkey 38 description if a large allocation fails when calling pod_{calloc,realloc}cangc, the js engine may call the large-allocation- failure callback, if set, to allow the embedding to flush caches, possibly perform shrinking gcs, etc.
JS::ToPrimitive
hint jstype the hint to pass to the toprimitive and @@toprimitive method when converting the object.
JSCheckAccessOp
jsclass hooks jsclass offers the following hook: the jsclass.checkaccess callback is called when a script attempts to access an object property.
JSConvertOp
hint jstype the hint to pass to the [[defaultvalue]] hook when converting the object.
JSErrorReport
to counter this attack, html5 specifies that script errors should be sanitized ("muted") when the script is not same-origin with the global for which it is loaded.
JSFastNative
when a jsfastnative is called, no jsstackframe is generated.
JSID_VOID
embeddings must not pass jsid_void into jsapi entry points expecting a jsid and do not need to handle jsid_void in hooks receiving a jsid except when explicitly noted in the api contract.
JSNative
this has limited use cases; it's used to implement firefox's "slow script" dialog, for example.) when a jsnative is called, no jsstackframe is generated.
JSObjectOps.defineProperty
the jsobjectops.defineproperty callback is called whenever an object property is defined.
JSObjectOps.destroyObjectMap
the jsobjectops.destroyobjectmap callback is called to destroy a jsobjectmap when its reference count goes to zero.
JSObjectOps.lookupProperty
the jsobjectops.lookupproperty callback is called for every property access (except when a higher-level callback, such as jsobjectops.getproperty, is overloaded in a way that does not call lookupproperty).
JSPRINCIPALS_HOLD
application code that stores a pointer to a jsprincipals object must call jsprincipals_hold(cx, principals) before storing it and jsprincipals_drop(cx, principals) when done with it.
JSSecurityCallbacks.contentSecurityPolicyAllows
the jssecuritycallbacks.contentsecuritypolicyallows callback is called when a script attempts to access an object property.
JSTraceOp
the only exception for this rule is the case when the embedding needs a tight integration with gc.
JSVAL_TO_BOOLEAN
that function has well-defined behavior even when the argument is an object, number, or something else.
JSVAL_TO_GCTHING
when possible, it is better to use a more specific macro, such as jsval_to_object or jsval_to_string.
JSVAL_TO_OBJECT
to convert a value to an object, use the js_valuetoobject function, which has well-defined behavior even when the argument is not an object or null.
JS_AddArgumentFormatter
when called from js_pushargumentsva, the formatter is invoked thus: formatter(cx, "aa...", js_false, &sp, &ap); where js_false for fromjs means to wrap the c values at ap according to the format specifier and store them at sp, updating ap and sp appropriately.
JS_AddExternalStringFinalizer
the callback may use js_getstringchars(str) to get a pointer to the character buffer, which is the pointer which the application passed to js_newexternalstring() when creating the string.
JS_CallFunction
obj js::handleobject the "current" object on which the function operates; the object specified here is "this" when the function executes.
JS_CheckAccess
jsacc_write when bitwise-ored with one of the above values, check for permission to write the property, not read it.
JS_ClearPendingException
(there is a pending exception if the most recently thrown exception in cx has not yet been caught or cleared.) when any jsapi call fails with an exception, the caller must either use js_clearpendingexception to catch the exception; or return false to allow the exception to propagate to the caller.
JS_CloneFunctionObject
js_clonefunctionobject takes care to choose a prototype that shares a global object with the given parent whenever possible.
JS_ConcatStrings
when the string concatenation fails null is returned.
JS_DefineFunction
nargs unsigned number of arguments that are passed to the function when it is called.
JS_DefineProperty
it differs from js_setproperty in that: it does not behave like ordinary property assignment in the javascript language; it allows the application to specify additional details (getter, setter, and attrs) governing the new property's behavior; it never calls a setter; it can call the jsclass.addproperty callback when js_setproperty would not, because it can replace an existing property.
JS_DumpNamedRoots
when js_dumpnamedroots calls it, it passes three arguments: argument type description name const char * the name of the named root.
JS_EnterLocalRootScope
ok = my_getpropertybody(cx, obj, id, vp); // when we leave the local root scope, this protection ends.
JS_ForgetLocalRoot
(here the term gc-thing refers to any value that is subject to garbage collection: a jsobject, jsstring, jsfunction, or jsdouble.) js_forgetlocalroot works on any gc-thing allocated in the current local root scope, but it's more time-efficient when called on references to more recently created gc-things.
JS_GC
when your scripts create many objects, you may want to call js_gc directly in your code, particularly when a script terminates or when the application has idle time.
JS_GET_CLASS
this macro was removed in spidermonkey 1.8.8 when the signature of js_getclass() was changed to take only an object pointer.
JS_GetFunctionCallback
returns the callback currently configured to be called when javascript functions are invoked or exited, as established by a prior call to js_setfunctioncallback.
JS_GetFunctionName
the return value is either the name of a function, or the string "anonymous", which indicates that the function was not assigned a name when created.
JS_GetGlobalObject
if a function is executing, the global object used by that function is determined when the function is created.
JS_GetNaNValue
nan is typically used in javascript as the return value of a numeric operation when an argument is invalid or conversion fails.
JS_GetParent
each object is assigned a parent when it is created: the standard library objects and functions all have the global object as their parent.
JS_GetPropertyAttrsGetterAndSetter
when this attribute is present, the value stored in getterp (or setterp) does not really point to a c/c++ function; it is a jsobject *, pointing to a javascript function, cast to type jspropertyop.
JS_GetReservedSlot
reserved slots may also contain private values to store pointer values (whose lowest bit is 0) or uint32_t, when non-javascript values must be stored; the garbage collector ignores such values when it sees them.
JS_GetRuntime
each context is associated with a particular jsruntime when it is created (see js_newcontext); js_getruntime provides a convenient, programmatic way to look up the association.
JS_GetStringBytes
the array returned by js_getstringbytes or js_getstringbytesz is automatically freed when str is finalized by the javascript garbage collection mechanism.
JS_GetVersion
when a context is created, its version is initially jsversion_default.
JS_HasArrayLength
this function differs from js_getarraylength in the treatment of errors and unusual cases, like when an object's length is negative or not a number.
JS_HasInstance
when providing a prototype as obj, the prototype's jsclass must have its hasinstance method set.
JS_IsConstructing
js_isconstructing returns js_true if the native was defined with jsfun_constructor (js_initclass automatically sets that flag when defining a constructor) and it was called as a constructor, either from javascript, using the new keyword, or from c/c++ using a jsapi function such as js_constructobject.
JS_LeaveLocalRootScopeWithResult
this slot is rooted, but the value will eventually be overwritten by some other operation, and it is very difficult to figure out exactly when this will happen—or more to the point, guarantee that it won't happen in the time it takes some specific chunk of code to run.
JS_LockGCThing
js_unlockgcthing removes a lock from a specified item, thing, allowing it to be garbage collected when the javascript engine determines it is unreachable.
JS_MakeStringImmutable
(when an application shares a string by storing it in a javascript object that another thread can read, the javascript engine automatically makes the string thread-safe.) after a successful call to js_makestringimmutable, subsequent calls to js_getstringcharsz on the same string are guaranteed to succeed, and subsequent calls to js_getstringchars on the same string are guaranteed to return a null-termi...
JS_NewContext
the application must call js_destroycontext when it is done using the context.
JS_NewGlobalObject
when that happens, the global should not be in a half-baked state.
JS_NewObject
if the global object's class's flags include jsclass_global_flags, then the global object always retains the original constructors for each standard class; we use these original constructors when they are available.
JS_NewScriptObject
as long as the script object is reachable, the jsscript and its components are protected from garbage collection; when the script object is collected, the jsscript and its contents are freed.
JS_NewStringCopyZ
js_newstringcopy(cx, s) is equivalent to js_newstringcopyn(cx, s, strlen(s)) when s is a null-terminated string.
JS_PushArguments
the application must call js_poparguments using the supplied markp stack pointer when done with this stack frame, to free the memory and unroot the jsvals.
JS_ScheduleGC
when it reaches zero, we do either a full or a compartmental gc.
JS_SetCheckObjectAccessCallback
this callback is also used to check access to the caller property of function objects (as, for example, when the javascript engine creates a stack trace) and to check access from scripts to properties with scripted getters or setters.
JS_SetCompartmentNameCallback
jscompartmentnamecallback will be called when visiting the compartment, and it should store the name of the compartment into buf with null terminated string.
JS_SetDestroyCompartmentCallback
description js_setdestroycompartmentcallback sets callback function which will be called when sweeping each compartment of the runtime, before deleting the compartment.
JS_SetErrorReporter
the reporter you define is automatically passed a jserrorreport structure when an error occurs and has been parsed by js_reporterror.
JS_SetExtraGCRoots
this is the data value that was passed to js_setextragcroots when this callback function was installed.
JS_SetOperationCallback
it must be called only when an operation callback is installed.
JS_SetOptions
mxr id search for jsoption_native_branch_callback jsoption_dont_report_uncaught when returning from the outermost api call, prevent uncaught exceptions from being converted to error reports.
JS_SetPrototype
ordinarily you set a prototype for an object when you create the object with js_newobject, but if you do not set a prototype at that time, you can later call js_setprototype to do so.
JS_SetScriptStackQuota
description set the quota on the number of bytes that stack-like data structures can use when the runtime compiles and executes scripts.
JS_SuspendRequest
description in js_threadsafe builds, when a multi-threaded application is in a request but needs to block or perform lengthy computation that can race safely with the garbage collector, it should call js_suspendrequest before the time-consuming operation and js_resumerequest after.
JS_ThrowStopIteration
the .next method may throw stopiteration when there are no more values left to iterate.
JS_malloc
when p is not null, js_realloc(cx, p, 0) behaves like js_free(cx, p) and returns null.
PRIVATE_TO_JSVAL
it is the application's responsibility to determine when it is safe to dereference a private data pointer.
jsid
embeddings must not pass jsid_void into jsapi entry points expecting a jsid and do not need to handle jsid_void in hooks receiving a jsid except when explicitly noted in the api contract.
Profiling SpiderMonkey
when we have js scriptable profiling options available for all tier 1 platforms, we'll look at adding global start/stop profiling functions.
SpiderMonkey 24
in the long run we anticipate removing the environment variable-based overriding when we drop support for versions of visual studio prior to 2010.
SpiderMonkey 31
when all jsapi operation has completed, the corresponding js_shutdown method (currently non-mandatory, but highly recommended as it may become mandatory in the future) uninitializes spidermonkey, cleaning up memory and allocations performed by js_init.
Setting up CDT to work on SpiderMonkey
eclipse's cdt has some pretty decent features that make it an attractive environment to work in when you are interested in getting code hints, autocompletion, function, and field usage information and general ide goodness for c/c++.
TPS Formdata Lists
note 2, sync currently does not sync formdata dates, so the date field is ignored when performing verify and verify-not actions.
TPS History Lists
an integer representing when the visit took place, expressed in hours from the present.
Zest usecase: Reporting Security Vulnerabilities to Developers
when security teams find vulnerabilities they typically describe them to developers using words, for example in a pdf or via a bug tracker.
compare-locales
+fullzoomenlargecmd.commandkey3 +fullzoomreducecmd.commandkey2 +fullzoomresetcmd.commandkey2 +organizebookmarks.label -showallbookmarkscmd2.label migration/migration.dtd -importfromfile.accesskey -importfromfile.label +importfromhtmlfile.accesskey +importfromhtmlfile.label you can assume changed strings when you see entities removed and added with a similar name.
Exploitable crashes
finding exploitable crashes exploitable crashes are most often discovered through normal testing and usage, when developers recognize a crash stack in gdb or submitted to a bug as exploitable.
Pinning violation reports
the error page displayed by firefox when you encounter a pin violation gives you the option of reporting this error.
Security and the jar protocol
firefox 2.0.0.10 (and firefox 1.5.0.15) fixed a potential security issue in the same origin policy when the jar: protocol was used to load data.
Browser security
secure development guidelinesthe following content will likely see significant revision, though can be used as a reference for security best practices to follow when developing code for mozilla.security and the jar protocolthis article discusses security concerns with the jar: protocol, which only firefox has ever implemented for web content.
Task graph
the outputs from each task, log files, firefox installers, and so on, appear attached to each task when it completes.
ROLE_ALERT
mapped to at-spi: role_alert atk: atk_role_alert msaa/ia2: role_system_alert ua: nsaccessibilitywindowrole events event_alert - fires when the widget is shown.
Gecko states
a speech-based accessibility aid does not announce information when an object with this state has the focus because the object automatically announces information.
Implementation Details
msaa/iaccessible2 at-spi avoiding memory leaks it is the assistive technology's responsibility to watch for events that indicate when windows or content subtrees are being destroyed, and to release all accessible objects related to that window.
XUL Accessibility
aggregating 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 elemen...
Feed content access API
nsifeedresultlistener implemented by the program that wants to parse an rss or atom feed to receive notification when parsing is complete.
The Places database
when no pages reference a favicon, the icon entry will be deleted.
Using the Places keywords API
each keyword can be associated with post data, in such a case a post action will be executed when the given url is selected from the awesomebar.
The Publicity Stream API
publicizeactivity( <activity>, [ { [ onsuccess: <function> ], [ onerror: <function> ] } ]): applications should call this method when an user-initiated activity deemed attractive to potential consumers occurs.
Bundling multiple binary components
the stub component is an xpcom component itself and when registered by xpcom, the code would sniff the runtime version and operating system then the stub load the appropriate "real" xpcom component for the current configuration.
Creating a Python XPCOM component
this is not necessary when your components are loaded by mozilla as the python loader modifies sys.path.
Generating GUIDs
com/xpcom format when #define-ing iids and cids in mozilla c++ code, you generally use the following format: // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx #define ns_...id \ { 0xxxxxxxxx, 0xxxxx, 0xxxxx, \ { 0xxx, 0xxx, 0xxx, 0xxx, 0xxx, 0xxx, 0xxx, 0xxx } } you can generate code in this format using one of the following tools.
How to build an XPCOM component in JavaScript
when set to true, and only if 'value' is not // specified, the concatenation of the string "service," and the object's contractid // is passed as avalue parameter of addcategoryentry.
Packaging WebLock
the following html specifies a complete webpage in which the trigger script is defined as a javascript function, installweblock, that gets called when the user clicks the hyperlink.
Setting up the Gecko SDK
when you extract the sdk, it should have the layout seen below: layout of the extracted sdk the directories represent different modules in the sdk.
Creating XPCOM components
add-ons should try to use the new add-on sdk as much as possible; however, there may be cases when it's unavoidable.
XPCOM hashtable guide
when should i use a hashtable?
Inheriting from implementation classes
given that idl interfaces map to abstract classes in c++, a common problem when dealing with idl is when you have an idl inheritance hierarchy, and a corresponding c++ implementation hierarchy, you run into multiple inheritance.
mozilla::services namespace
the 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.
Components.interfaces
this includes nsisupports.queryinterface(), the optional parameter accepted by nsijscid.getservice(), nsijscid.createinstance() when called from javascript, and nsiclassinfo.getinterfaces().
Components.utils.evalInSandbox
the sandbox will become the global scope object when you pass it to evalinsandbox(text, sandbox).
Components.utils.exportFunction
a content script function loguser(getuser) { console.log(getuser()); // "bill" } exportfunction(loguser, unsafewindow, { defineas: "loguser" }); // less-privileged scope: for example, a page script function getuser() { return "bill"; } var test = document.getelementbyid("test"); test.addeventlistener("click", function() { window.loguser(getuser); }, false); cross-origin checking when the exported function is called each argument, including this, is checked to make sure that the caller subsumes that argument.
Components.utils.getGlobalForObject
this is the global object in place at the time the object was created, which is to say the global object used when executing the script that created the object.
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.
Components.utils.importGlobalProperties
indexeddb nodefilter firefox 60 nsidomnodefilter obsolete since gecko 60 rtcidentityprovider textdecoder textencoder url urlsearchparams xmlhttprequest nsixmlhttprequest obsolete since gecko 60 for string/object in table without a minimum firefox version, it is not exactly known since when it was available, however it is guranteed available from firefox 28 and up.
Components.utils.isXrayWrapper
when privileged javascript in gecko accesses objects belonging to less-privileged code (such as untrusted web content), it does so, by default, with "xray vision": a mechanism that filters out certain changes to the objects that could cause them to behave in unexpected ways.
Components.utils.unload
this can be particularly handy with restartless (boostrapped) extensions, so that you can unload an old version of a code module when a new version of your add-on is installed.
Components.utils.waiveXrays
when privileged javascript in gecko accesses objects belonging to less-privileged code (such as untrusted web content), it does so, by default, with "xray vision": a mechanism that filters out certain changes to the objects that could cause them to behave in unexpected ways.
Components object
utils.scheduleprecisegc requests that garbage collection occur sometime in the future when no javascript code is running; accepts a callback function to receive notification once collection is complete.
PyXPCOM
please update this page if/when the links can be found.
HOWTO
however, when you start your script, it exits immediately, before the network request returns.
NS_GetComponentManager
the interface pointer should be release'd when it is no longer needed.
NS_GetComponentRegistrar
the interface pointer should be release'd when it is no longer needed.
NS_GetMemoryManager
the interface pointer should be release'd when it is no longer needed.
NS_GetServiceManager
the interface pointer should be release'd when it is no longer needed.
NS_InitXPCOM2
the resulting interface pointer is addref'd upon return and must either be release'd explicitly or passed to ns_shutdownxpcom when the application is finished with xpcom.
NS_InitXPCOM3
the resulting interface pointer is addref'd upon return and must either be release'd explicitly or passed to ns_shutdownxpcom when the application is finished with xpcom.
nsAutoRefTraits
when the handle to the resource is a pointer to t the specialization may be derived from nspointerreftraits<t>, so that only definitions of the release(t*) static method and possibly the addref(t*) static method need to be added.
Alloc
the result must be freed with a call to nsmemory::free() when it is no longer needed.
Clone
the result must be freed with a call to nsmemory::free when it is no longer needed.
HeapMinimize
if false, the flush will be scheduled to happen when the app is idle.
Realloc
the result must be freed with a call to nsmemory::free when it is no longer needed.
XPCOM glue classes
when these classes are used by a component, you may need to link the component against the xpcom glue library.
IAccessibleHypertext
this is the case when a link spans the given character index.
IAccessibleImage
some examples are: the accessible name and description() are not enough to fully describe the image, for example when the accessible description() is used to define the behavior of an actionable image and the image itself conveys semantically significant information.
amIInstallTrigger
toolkit/mozapps/extensions/amiinstalltrigger.idlscriptable called when an install completes or fails.
amIWebInstallPrompt
toolkit/mozapps/extensions/amiwebinstalllistener.idlscriptable called when installation by websites is currently disabled.
imgIContainer
when aflags includes flag_clamp, the image will be extended to this area by clamping image sample coordinates.
imgIContainerObserver
methods native code only!framechanged called when the frame for an image container has changed.
inIDOMUtils
may be omitted when checking the regular elements.
mozIJSSubScriptLoader
ignorecache boolean if present and set to true, the cache will be bypassed when reading the file.
mozIRepresentativeColorCallback
nents/places/mozicoloranalyzer.idlscriptable provides callback methods for mozicoloranalyzer 1.0 66 introduced gecko 17.0 inherits from: nsisupports last changed in gecko 17.0 (firefox 17.0 / thunderbird 17.0 / seamonkey 2.14) method overview void oncomplete(in boolean success, [optional] in unsigned long color); methods oncomplete() will be called when color analysis finishes.
mozIStorageBindingParamsArray
the appended parameters will be used when mozistoragestatement.executeasync() is called.
mozIStorageCompletionCallback
last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) inherits from: nsisupports method overview void complete(); methods complete() called when an asynchronous storage routine has completed.
mozIStorageFunction
this is called by the database engine when the function registered with mozistorageconnection.createfunction() is used in an executing sql statement or trigger.
mozIStorageStatementWrapper
when you call the mozistorageconnection interface's createstatement() method, you get a mozistoragestatement which has just direct bindings to sqlite.
mozITXTToHTMLConv
citeleveltxt() returns the "cite level" of the specified text; that is, it indicates how many levels of email reply quotes are used, when the text uses "quote" characters (such as ">") at the beginning of the line to indicate cite levels.
mozIVisitStatusCallback
ces/moziasynchistory.idlscriptable this interface provides callback handling functionality for moziasynchistory.isurivisited 1.0 66 introduced gecko 11.0 inherits from: nsisupports last changed in gecko 11.0 (firefox 11.0 / thunderbird 11.0 / seamonkey 2.8) method overview void isvisited(in nsiuri auri, in boolean avisitedstatus); methods isvisited() called when the moziasynchistory.isurivisited() method's check to determine whether a given uri has been visited has completed.
nsIAccessNode
when accessibility is active in gecko, every dom node can have one nsiaccessnode.
nsIAccessibleDocument
when accessibility is turned on in gecko, there is an nsiaccessibledocument for each document whether it is xul, html or whatever.
nsIAccessibleEvent
server applications send this event when a user needs to know that a user interface element has changed.
nsIAccessibleStates
a speech-based accessibility aid does not announce information when an object with this state has the focus because the object automatically announces information.
nsIApplicationCache
inactive caches are removed from the cache when no longer referenced.
nsIApplicationCacheChannel
1.0 66 introduced gecko 1.9.1 inherits from: nsiapplicationcachecontainer last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview void markofflinecacheentryasforeign(); attributes attribute type description chooseapplicationcache boolean when true, the channel will choose an application cache if one was not explicitly provided and none is available from the notification callbacks.
nsIArray
exceptions thrown ns_error_illegal_value when index > length-1.
nsIAsyncStreamCopier
the specified observer is notified when the copy completes.
nsIAuthModule
unwrap() this method is used to unpack, decrypt, and verify the checksums on data returned by a server when security layers are in use.
nsIAuthPrompt
if a username is specified (http://user@site.com) it will be used when matching existing logins or saving new ones.
nsIAutoCompleteListener
methods onautocomplete() called by the autocomplete session when the search is done or over.
nsIAutoCompleteObserver
inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview void onsearchresult(in nsiautocompletesearch search, in nsiautocompleteresult result); void onupdatesearchresult(in nsiautocompletesearch search, in nsiautocompleteresult result); methods onsearchresult() called when a search is complete and the results are ready.
nsICacheEntryDescriptor
the object will be released when the cache entry is destroyed.
nsICacheService
as a result, devices excluded by the storage policy will not be searched when opening entries from the returned session.
nsICategoryManager
this pointer must be released using nsimemory.free() when it is no longer needed.
nsIChromeFrameMessageManager
aallowdelayedload if true, the script will be loaded when the remote frame becomes available; otherwise, the script will only be loaded if the frame is already available.
nsIClassInfo
it has no meaning when returned from the flags attribute of a nsiclassinfo implementation.
nsIClipboardDragDropHooks
onpasteordrop() provide an alternative action to the built-in behavior when something is dropped on the browser or in an editor.
nsICommandLineHandler
rg/composer/clh;1 command-line-handler m-irc @mozilla.org/chatzilla/clh;1 command-line-handler y-final @mozilla.org/browser/clh-final;1 method overview void handle(in nsicommandline acommandline); attributes attribute type description helpinfo autf8string when the application is launched with the -help argument, this attribute is retrieved and displayed to the user (on stdout).
nsICommandLineRunner
exceptions thrown ns_error_abort thrown when the handler aborts.
nsIConsoleListener
inherits from: nsisupports last changed in gecko 1.7 method overview void observe(in nsiconsolemessage amessage); methods observe() called by the nsiconsoleservice when a message is posted to the console.
nsIContentPrefService
useful for removing references to the sites the user has visited when the user clears their private data.
nsIController
inherits from: nsisupports last changed in gecko 1.7 method overview void docommand(in string command); boolean iscommandenabled(in string command); void onevent(in string eventname); boolean supportscommand(in string command); methods docommand() when this method is called, your implementation should execute the command with the specified name.
nsIConverterOutputStream
areplacementcharacter the replacement character to use when an unsupported character is found.
nsICookieManager2
this is useful when e.g.
nsICrashReporter
minidumppath nsilocalfile get or set the path on the local system to which minidumps will be written when a crash happens.
nsIDNSListener
inherits from: nsisupports last changed in gecko 1.7 method overview void onlookupcomplete(in nsicancelable arequest, in nsidnsrecord arecord, in nsresult astatus); methods onlookupcomplete() called when an asynchronous host lookup completes.
nsIDOMFile
this allows the file reference to be saved when the form is submitted while the user is using a web application offline, so that the data can be retrieved and uploaded once the internet connection is restored.
nsIDOMFontFace
attributes only available when specified with @font-face these attributes only have meaningful values when the font is a user font defined using @font-face.
nsIDOMGeoPositionErrorCallback
the nsidomgeopositionerrorcallback interface is used to represent an object that receives callback notifications when geolocation errors occur.
nsIDOMStorage
keys are stored in a particular order with the condition that this order not change by merely changing the value associated with a key, but the order may change when a key is added or removed.
nsIDOMStorageEventObsolete
1.0 66 introduced gecko 1.8 obsolete gecko 2.0 inherits from: nsidomevent last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) when a dom storage event is received, the recipient can check its domain attribute to determine which domain's data store has changed.
nsIDOMStorageList
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 nsidomstorage nameditem(in domstring domain); methods nameditem() called when the list of available access points changes.
nsIDOMWindow
when setting this attribute, an ns_error_not_implemented error may be returned by implementations not supporting zoom.
nsIDOMXPathEvaluator
null is common for html documents or when no name space prefixes are used.
nsIDOMXPathResult
constants type constants constant value description any_type 0 used when evaluating an xpath expression; the evaluator will return the most appropriate type.
nsIDOMXULLabeledControlElement
when the user presses the appropriate modifier and the access key, the element will be focused and/or activated from anywhere in the window.
nsIDeviceMotion
methods addlistener() when called, the accelerometer support implementation must begin to notify the specified nsidevicemotionlistener by calling its nsidevicemotionlistener.onaccelerationchange() method as appropriate to share updated acceleration data.
nsIDeviceMotionListener
1.0 66 introduced gecko 1.9.2 inherits from: nsisupports last changed in gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3) method overview void onmotionchange(in nsidevicemotiondata amotiondata); methods onmotionchange() called when new orientation or acceleration data is available.
nsIDirectoryEnumerator
it is similar to nsisimpleenumerator except the retrieved entries are qi'ed to nsifile, and there is a mechanism for closing the directory when the enumeration is complete.
nsIDirectoryService
the providers will be released when the service is destroyed at xpcom shutdown.
nsIDirectoryServiceProvider
method overview nsifile getfile(in string prop, out prbool persistent); methods getfile() the directory service calls this method when it gets the first request for a prop or on every request if the prop is not persistent.
nsIDirectoryServiceProvider2
inherits from: nsidirectoryserviceprovider last changed in gecko 0.9.6 method overview nsisimpleenumerator getfiles(in string prop); methods getfiles() the directory service calls this when it gets a request for a prop and the requested type is nsisimpleenumerator.
nsIEditor
« xpcom api reference editor/nsieditor.idlscriptable provides methods and attributes used when editing page content.
nsIEditorObserver
editor/idl/nsieditorobserver.idlscriptable used by applications wishing to be notified when the editor has completed a user action.
nsIEventTarget
when this flag is specified, dispatch() returns immediately after the event is queued.
nsIExternalHelperAppService
when the onstoprequest is issued, the stream listener implementation will launch the helper app with this data.
nsIFaviconDataCallback
1.0 66 introduced gecko 2.0 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview void oncomplete(in nsiuri auri, in unsigned long adatalen, [const,array,size_is(adatalen)] in octet adata, in autf8string amimetype); methods oncomplete() called when the required favicon's information is available.
nsIFeedContainer
keep in mind that some feeds have no title, and some use markup in their titles, so be cautious when decoding this attribute.
nsIFeedElementBase
most derived interfaces provide convenience accessors for their standard fields, so this is only useful when looking for nonstandard fields.
nsIFeedProcessor
void parseasync( in nsirequestobserver requestobserver, in nsiuri uri ); parameters requestobserver the observer to be notified when parsing starts and stops.
nsIFeedResult
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 registerextensionprefix(in astring anamespace, in astring aprefix); attributes attribute type description bozo boolean the feed processor sets the bozo bit when a feed triggers a fatal error during xml parsing.
nsIFeedResultListener
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 handleresult(in nsifeedresult result); methods handleresult() called when feed processing is complete.
nsIJSID
an unnamed jsid also results when you implement a function that is passed an nsiidref parameter, such as queryinterface().
nsIJumpListBuilder
tasks are given the highest priority of all lists when space is limited.
nsILoadGroup
groupobserver nsirequestobserver the group observer is notified when requests are added to and removed from this load group.
nsILocale
a locale code is of the form language[-country[-region]], where "language" is an iso 639 language code (two letter codes preferred over three letter codes when available), "country" is an iso 3166 two letter country code, and "region" is a string of up to 5 letters.
Using nsILoginManager
enticate.cgi"> <div>please log in.</div> <label>username:</label> <input type="text" name="uname"> <label>password:</label> <input type="password" name="pword"> </form> creating a site authentication login var authlogininfo = new nslogininfo( 'http://www.example.com', null, 'exampleco login', 'alice', 'secret321', "", "" ); this would correspond to a login on http://www.example.com when the server sends a reply such as: http/1.0 401 authorization required server: apache/1.3.27 www-authenticate: basic realm="exampleco login" creating a local extension login var extlogininfo = new nslogininfo( 'chrome://firefoo', null, 'user registration', 'bob', '123secret', "", "" ); from a component creating a new info block is done slightly differently: var nslogininfo = new c...
nsILoginManagerCrypto
uibusy boolean true when a master password prompt is being displayed.
nsILoginManagerIEMigrationHelper
note: in some cases, multiple logins may be created from a single input when the format is ambiguous.
nsILoginManagerPrompter
prompttochangepasswordwithusernames() ask the user if they want to change the password for one of multiple logins, when the caller can not determine exactly which login should be changed.
nsIMIMEInputStream
ance, use: var mimeinputstream = components.classes["@mozilla.org/network/mime-input-stream;1"] .createinstance(components.interfaces.nsimimeinputstream); method overview void addheader(in string name, in string value); void setdata(in nsiinputstream stream); attributes attribute type description addcontentlength boolean when true a "content-length" header is automatically added to the stream.
nsIMemoryMultiReporter
method overview void collectreports(in nsimemorymultireportercallback callback, in nsisupports closure); methods collectreports() void collectreports( in nsimemorymultireportercallback callback, in nsisupports closure ); parameters callback the nsimemorymultireportercallback to call when collection is complete.
nsIMemoryMultiReporterCallback
closure an nsisupports object providing any additional data the callback might need; you provide this when you call nsimemorymultireporter.collectreports().
nsIMessageBroadcaster
throws ns_error_failure when the message receiver cannot be found.
nsIMessageSender
throws ns_error_failure when the message receiver cannot be found.
nsIMessageWakeupService
content/base/public/nsimessagewakeupservice.idlscriptable implements the message manager wakeup service; this lets other components be woken up when specific message manager messages arrive.
nsIMessenger
alistener an nsiurllistener to be notified when the file is saved.
nsIMsgCompFields
it should be initialized to true and set to false when 'send anyway' is selected by a user.
nsIMsgCustomColumnHandler
the interface inherits from nsitreeview, however when you're implementing a custom handler in javascript its not necessary to implement all of nsitreeview's methods.
nsIMsgDBHdr
any children of the ignored message will be marked as read when added to the database.
nsIMsgFilterCustomAction
call onstopcopy when done * using the copylistener to continue.
nsIMsgFolder
parentmsgfolder nsimsgfolder readonly: handy accessor when we want a msg folder.
nsIMsgIdentity
sigbottom boolean what should our signature be at the end of the quoted text when replying above it?
nsIMsgSearchNotify
void onsearchdone(in nsresult status); /* * until we can encode searches with a uri, this will be an * out-of-bound way to connect a set of search terms to a datasource */ /* * called when a new search begins */ void onnewsearch(); }; ...
nsIMsgSearchSession
void addallscopes(in nsmsgsearchscopevalue attrib); parameters attrib search() void search(in nsimsgwindow awindow); parameters awindow interruptsearch() void interruptsearch(); pausesearch() these two methods are used when the search session is using a timer to do local search, and the search adapter needs to run a url (e.g., to reparse a local folder) and wants to pause the timer while running the url.
nsIMsgWindow
void stopurls(); closewindow() when the msg window is being unloaded from the content window, this notification can be used to force a flush on anything the message window hangs on.
nsINavHistoryVisitResultNode
1.0 66 introduced gecko 1.9 inherits from: nsinavhistoryresultnode last changed in gecko 1.9 (firefox 3) attributes attribute type description sessionid long long the session id of the visit, used for session grouping when a tree view is sorted by date.
nsIObserver
inherits from: nsisupports last changed in gecko 0.9.6 method overview void observe(in nsisupports asubject, in string atopic, in wstring adata); methods observe() this method will be called when there is a notification for the topic that the observer has been registered for.
nsIOutputStream
exceptions thrown ns_base_stream_would_block a non-blocking stream may throw this exception when written to if space for the data is not immediately available.
nsIParserUtils
the sanitizer is designed to protect against xss when sanitized content is inserted into a different-origin context without an iframe-equivalent sandboxing mechanism.
nsIPermission
this string is specified by the consumer when adding a permission via nsipermissionmanager read only.
nsIPluginHost
it may or may not be already opened when this function is called.
nsIProcessScriptLoader
if you used aallowdelayedload, you should call this as part of your cleanup (for example, when your add-on is disabled or uninstalled).
nsIProperties
nsmemory.h defines the macro ns_free_xpcom_allocated_pointer_array, which can be used to free akeys when it is no longer needed.
nsIProtocolProxyCallback
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 onproxyavailable(in nsicancelable arequest, in nsiuri auri, in nsiproxyinfo aproxyinfo, in nsresult astatus); methods onproxyavailable() this method is called when proxy info is available or when an error in the proxy resolution occurs.
nsIProxyInfo
last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) inherits from: nsisupports attributes attribute type description failoverproxy nsiproxyinfo this attribute specifies the proxy to failover to when this proxy fails.
nsIPushMessage
when called from javascript, nsipushmessage.binary() returns data.
nsIPushSubscription
when called from javascript, nsipushsubscription.getkey() only takes name as a parameter, and returns key.
nsISelection2
aissynchronous when true, scrolls the selection into view before returning.
nsIServerSocket
void asynclisten( in nsiserversocketlistener alistener ); parameters alistener the listener to be notified when client connections are accepted.
nsIServiceManager
when they are finished they should call nsisupports.release() on the service as they would with any interface pointer.
nsIStandardURL
this corresponds to the charset that should be used when communicating this uri to an origin server, for example.
nsIStreamListener
method overview void ondataavailable(in nsirequest arequest, in nsisupports acontext, in nsiinputstream ainputstream, in unsigned long aoffset, in unsigned long acount); methods ondataavailable() this method is called when the next chunk of data for the ongoing request may be read without blocking the calling thread.
nsIStringBundleService
flushbundles() flushes the string bundle cache - useful when the locale changes or when we need to get some extra memory back.
nsISupports
note: the interface pointer, aresult, returned by queryinterface must be released by a call to release() when it is no longer needed.
nsISupportsPriority
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) this interface does not strictly define what happens when the priority of an object is changed.
nsISyncMessageSender
throws ns_error_failure when the message receiver cannot be found.
nsITaskbarPreview
tooltip domstring a string containing the text displayed in the tooltip above the preview when the user hovers over it.
nsITaskbarPreviewButton
dismissonclick boolean if true, the array of previews should be dismissed when the button is clicked.
nsITaskbarWindowPreview
when made invisible, the window disappears from the list of the application's windows in the taskbar.
nsITelemetry
returns false if the user has not opted into "extended telemetry" on the release channel, when the user has explicitly opted out of telemetry on nightly/aurora/beta or if manually set to false during tests.
nsITextInputProcessorCallback
}, } method overview boolean onnotify(in nsitextinputprocessor atextinputprocessor, in nsitextinputprocessornotification anotification); methods onnotify() this is called when gecko requests or notifies something to ime.
nsIThreadInternal
when an event queue is popped, any events remaining in the queue are appended to the elder queue.
nsIToolkitProfileService
this may throw an ns_error_failure (0x80004005) when trying to get the current profile if it's unavailable or if permissions restrict access.
nsITransferable
for example, we try to delete data that you copy to the clipboard when you close a private browsing window.
nsITreeBoxObject
the view is responsible for calling this notification method when rows are added or removed.
nsITreeColumns
invalidatecolumns() this method is called whenever a treecol is added or removed and the column cache needs to be rebuilt.
nsIURI
if the uri stores information from the nsiioservice interface's nsiioservice.newuri() call that created it, other than just the parsed string, the behavior of this information when setting the spec attribute is undefined.
nsIURIFixupInfo
docshell/base/nsiurifixup.idlscriptable interface indicating what we found/corrected when fixing up a uri.
nsIURL
filename, query, and so forth are always returned except when uris are identical.
nsIUpdate
showprompt boolean whether to show the update prompt which requires user confirmation when an update is found during a background update check.
nsIUpdatePatch
hashfunction astring the hash function to use when determining the integrity of the patch file.
nsIUpdatePrompt
the nsiupdate object will not be the actual update when the error occurred during an update check and will instead be an nsiupdate object with the error information for the update check.
nsIWebBrowser
for optimal performance, set it to false when appropriate.
nsIWebBrowserChrome
setstatus() called when the status text in the chrome needs to be updated.
nsIWebBrowserChrome2
1.0 66 introduced gecko 1.9 inherits from: nsiwebbrowserchrome last changed in gecko 1.9 (firefox 3) method overview void setstatuswithcontext(in unsigned long statustype, in astring statustext, in nsisupports statuscontext); methods setstatuswithcontext() called when the status text in the chrome needs to be updated.
nsIWebBrowserFindInFrames
embedding/components/find/public/nsiwebbrowserfind.idlscriptable controls how find behaves when multiple frames or iframes are present.
nsIWebContentHandlerRegistrar
permission denied to add http://mail.live.com/secure/start?action=compose&to=%s as a content or protocol handler'permission denied to add http://mail.live.com/secure/start?action=compose&to=%s as a content or 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.js...
nsIWebPageDescriptor
adisplaytype the display type to use when displaying the loaded page; see display type constants for possible values.
nsIWebProgress
void addprogresslistener( in nsiwebprogresslistener alistener, in unsigned long anotifymask ); parameters alistener the listener interface to be called when a progress event occurs.
nsIWebProgressListener2
progress totals are reset to zero when all requests in awebprogress complete (corresponding to onstatechange being called with astateflags including the state_stop and state_is_window flags).
nsIWinTaskbar
this id is used by the taskbar for grouping windows and when associating pinned shortcuts with running instances and jump lists.
nsIWindowsShellService
hunderbird 3.3 / seamonkey 2.1) method overview string getregistryentry(in long ahkeyconstant, in string asubkeyname, in string avaluename); obsolete since gecko 1.8 void restorefilesettings(in boolean aforallusers); obsolete since gecko 1.9 void shortcutmaintenance(); attributes attribute type description desktopbackgroundcolor unsigned long the desktop background color, visible when no background image is used, or if the background image is centered and does not fill the entire screen.
nsIWorker
method overview void postmessage(in domstring amessage, [optional] in nsiworkermessageport amessageport); attributes attribute type description onmessage nsidomeventlistener an object to receive notifications when messages are received on the worker's message port.
nsIXMLHttpRequestUpload
content/base/public/nsixmlhttprequest.idlscriptable this interface provides access to the features needed when uploading data using nsixmlhttprequest.
nsIXPCException
js/src/xpconnect/idl/xpcexception.idlscriptable these exception objects are the preferred types of exceptions when implementing xpcom interfaces in javascript.
nsIXULBrowserWindow
this may be used, for example, to redirect links into new tabs or windows when it's not desirable to replace the content in the current tab (such as when the link is clicked in an app tab).
nsIXULBuilderListener
content/xul/templates/public/nsixulbuilderlistener.idlscriptable this object is a listener that will be notified when a template builder rebuilds its content.
nsIXULTemplateResult
this method is provided as a convenience when sorting results.
NS_ADDREF
do not use when the pointer might be null; use ns_if_addref in those cases.
NS_RELEASE
do not use when the pointer might be null; use ns_if_release in those cases.
nsIAbCard/Thunderbird3
if such a property is deleted, an error may be thrown when the card is modified at the database level.
Status, Recent Changes, and Plans
eliminated the need to cast getter_addrefs when an nsisupports** is needed.
Using nsCOMPtr
you'll know when to stop.
Using the Gecko SDK
when those classes or functions are used, the component must link with the corresponding static library.
XPCOM ownership guidelines
as for instance, when it owns you.
Xptcall Porting Status
the invokebyindex code works correctly when used with testxptcinvoke.
XPIDL Syntax
MozillaTechXPIDLSyntax
unlike the c preprocessor, when a file is included multiple times, it acts as if the subsequent includes did not happen; this prevents the need for include guards.
XTF
MozillaTechXTF
xtf: when xbl just won't cut it more recent primer to xtf by alex vincent.
The Valgrind Test Job
when running locally, you may see errors that do not occur on the test machines.
Testing Mozilla code
there are different types of coverage metrics (see also the wikipedia entry), but when we speak of code coverage here, we usually mean line and branch coverage.
Account Provisioner
the account provisioner is the dialog that first comes up when starting thunderbird.
Address book sync client design
// // step 1: // when the user begins a sync, run through the local database and update the // sync mapping table.
Buddy icons in mail
for the message pane, the icon we will show is on disk at: <profile home>/nim/<value of pref aim.session.screenname>/picture/<screenname for sender email address>.gif when trying to determine the screenname for the sender, we search the addressbook that we are using for collection.
MailNews Protocols
these implement nsimsgprotocol, inherit from nsmsgprotocol, and implement their own protocol-specific interface (nsiimapprotocol, nsipop3protocol, nsinntpprotocol) in addition, in mailnews/db/msgdb/public, we have protocol-specific msg db classes (and in the case of news, a nsinewsdatabase interface), so that we can use polymorphism when msg db operations need to be specialized for different kinds of folders.
Mail client architecture overview
whenever multiple messages are stored in one file, the berkeley mailbox format is used.
Mailbox
this may seem like a lot of infrastructure just to read messages from a flat file, but it allows us to do it asynchronously, and to have reading local messages fit into the same kind of mechanisms that reading nntp and imap messages do - running urls, getting onstart/stoprunningurl notifications when the url starts/stops, etc.
Mailnews and Mail code review requirements
mailnews and mail review rules patches affecting thunderbird user experience or interfaces note: it is recommended that when working on bugs that affect user experience or interfaces, that ui-review is obtained at an early stage in the patch development process.
Spam filtering
when does purging happens?
Thunderbird Binaries
many developers prefer to work on areas of the code which are too risky to change when approaching a release.
Thunderbird Configuration Files
the path examples above refers to the default profile that is automatically created when you start thunderbird for the first time.
Building a Thunderbird extension 2: extension file layout
when this tutorial is finished, our extension will look like this: myfirstext.xpi: //created in step 8 /install.rdf //created in step 3 /chrome.manifest //created in step 4 /chrome/ /content/ /content/myhelloworld.xul //created in step 5 /conten...
Building a Thunderbird extension 5: XUL
when parsing our overlay file, the xul engine will take all child elements of the <statusbar> tag and merge them with the original xul document's <statusbar> tag.
Building a Thunderbird extension 6: Adding JavaScript
ction() { startup(); }, 60000); //update date every minute function startup() { var mypanel = document.getelementbyid("my-panel"); var date = new date(); var day = date.getday(); var datestring = date.getfullyear() + "." + (date.getmonth()+1) + "." + date.getdate(); mypanel.label = "date: " + datestring; } the first part registers a new event listener that will be executed automatically when thunderbird loads.
Access Thunderbird Window Areas
an alternative to these methods is to directly access the element by it's id as in the detect when a folder opens example.
Theme Packaging
preview.png is a preview image which will show when double-clicked on a theme in the appearance section of the add-ons manager.
Tips and Tricks from the newsgroups
nk) get extension metadata call java from thunderbird extensions (also an example here, written for firefox but compatible with thunderbird 3.x) define a custom protocol handler to call an external program save attachment and send it repeat image display using css sprites messages use reminderfox to open a message in the default thunderbird message window (when messageuri, folderuri and gdbview are unknown) determine whether a message has been flagged as junk imap: getting message key of copied message by nsimsgcopyservice::copyfilemessage access the plain text content of the email body get information about attachment without selecting message repeat image display using css sprites scan for new messages at startup and manually scan a fol...
Using the Mozilla symbol server
you will need to source this script before loading symbols (the part where it spends a few seconds loading each .so when you attach gdb).
Using COM from js-ctypes
when used from c or js-ctypes, the order of the vtable methods should match the order of the c++ vtable.
Using Objective-C from js-ctypes
*/ // struct is seen here in docs: http://clang.llvm.org/docs/block-abi-apple.html var block_descriptor_1 = ctypes.structtype('block_descriptor_1', [ { reserved: ctypes.unsigned_long_long }, { size: ctypes.unsigned_long_long } ]); /** * we have to simulate what the llvm compiler does when it encounters a block * literal expression (see `block-abi-apple.txt` above).
Examples
the js-macosx bridge has dependency on bridgesupport metadata: whenever a cocoa class, function, struct or const is encountered in the javascript code, js-macosx will replace it with the corresponding js-ctypes declaration based on the bridgesupport file from the framework that object belongs to.
Int64
string tostring( [radix] ); parameters radix optional the radix (base) to use when constructing the string.
UInt64
string tostring( [radix] ); parameters radix optional the radix (base) to use when constructing the string.
Blocking By Domain - Plugins
third-party plugin block list sites on this list may not use plugins when they are loaded into a third-party iframe in another site.
Memory - Plugins
you need to use npn_memflush only when it is not possible to call npn_memalloc, for example, when calling system methods that allocate memory indirectly.
Plug-in Side Plug-in API - Plugins
npp_setwindow tells the plug-in when a window is created, moved, sized, or destroyed.
Gecko Plugin API Reference - Plugins
mac os windows unix event handling for windowed plug-ins windowless plug-ins specifying that a plug-in is windowless invalidating the drawing area forcing a paint message making a plug-in opaque making a plug-in transparent creating pop-up menus and dialog boxes event handling for windowless plug-ins streams receiving a stream telling the plug-in when a stream is created telling the plug-in when a stream is deleted finding out how much data the plug-in can accept writing the stream to the plug-in sending the stream in random-access mode sending the stream in file mode sending a stream creating a stream pushing data into the stream deleting the stream example of sending a stream urls getting urls getting the url and displa...
Preferences System
usage in xulrunner applications when calling opendialog() to open a preferences dialog, "toolbar" should be included in the features string.
Access debugging in add-ons - Firefox Developer Tools
the following items are accessible in the context of chrome://browser/content/debugger.xul (or, in version 23 beta, chrome://browser/content/devtools/debugger.xul): window.addeventlistener("debugger:editorloaded") - called when the read-only script panel loaded.
Breaking on exceptions - Firefox Developer Tools
to instruct the debugger to pause on an exception, tick these checkboxes in the breakpoints list: pause on exceptions pause on caught exceptions when an exception occurs, the line where it occurs is highlighted in the source pane, with a squiggly red line under the problematic code.
Use a source map - Firefox Developer Tools
javascript running in a page is often machine-generated, as when compiled from a language like coffeescript or typescript.
Debugger keyboard shortcuts - Firefox Developer Tools
ent file ctrl + w cmd + w ctrl + w search for a string in the current file ctrl + f cmd + f ctrl + f search for a string in all files ctrl + shift + f cmd + shift + f ctrl + shift + f find next in the current file ctrl + g cmd + g ctrl + g search for scripts by name ctrl + p cmd + p ctrl + p resume execution when at a breakpoint f8 f8 1 f8 step over f10 f10 1 f10 step into f11 f11 1 f11 step out shift + f11 shift + f11 1 shift + f11 toggle breakpoint on the currently selected line ctrl + b cmd + b ctrl + b toggle conditional breakpoint on the currently selected line ctrl + shift + b cmd + shift + b ctrl + sh...
Eyedropper - Firefox Developer Tools
now, when you click the eyedropper, the color in the rules view is set to the color you selected.
Basic operations - Firefox Developer Tools
the tool then shows you the differences between the two snapshots: when you're looking at a comparison, you can't use the dominators view or the tree map view.
Monster example - Firefox Developer Tools
.push(new monster()); } for (var i = 0; i &lt; monster_count; i++) { monsters.fierce.push(new monster()); } for (var i = 0; i &lt; monster_count; i++) { monsters.undecided.push(new monster()); } console.log(monsters); } var makemonstersbutton = document.getelementbyid("make-monsters"); makemonstersbutton.addeventlistener("click", makemonsters); the page contains a button: when you push the button, the code creates some monsters.
Inspecting web sockets - Firefox Developer Tools
accessing the inspector when you are inspecting a web app that utilizes a web socket connection, the web socket requests are listed in the list of requests in the network monitor along with all other requests.
Network monitor toolbar - Firefox Developer Tools
when you select persist logs, the log is not cleared on page load.
Page inspector 3-pane mode - Firefox Developer Tools
when activated, this allows you to see the following simultaneously: the html pane on the left hand side, as usual.
Examine and edit the box model - Firefox Developer Tools
with the select element button pressed, if you hover over an element in the page, the box model for the element is shown overlaid on the page: it's also shown overlaid if you hover over an element's markup in the html pane: if the element is inline and is split over multiple line boxes, the highlighter shows each individual line box that together make up the element: the box model view when an element's selected, you can get a detailed look at the box model in the box model view: if you hover over a value, you'll see a tooltip telling you which rule the value comes from: if you hover over part of the box model in the box model view, the corresponding part of the page is highlighted: editing the box model you can also edit the values in the box model view, and see the resul...
Select an element - Firefox Developer Tools
the highlighted element is the element that's overlaid in the page with a graphic showing the box model, and a tooltip showing its tag and size: with the context menu to open the inspector and select an element immediately, activate the context menu over the element in the page and select "inspect element": with the html pane when the inspector is open, as you move the mouse around the elements listed in the html pane, the corresponding elements are highlighted in the page.
Select and highlight elements - Firefox Developer Tools
the highlighted element is the element that's overlaid in the page with a graphic showing the box model, and a tooltip showing its tag and size: with the context menu to open the inspector and select an element immediately, activate the context menu over the element in the page and select "inspect element": with the html pane when the inspector is open, as you move the mouse around the elements listed in the html pane, the corresponding elements are highlighted in the page.
UI Tour - Firefox Developer Tools
changes view when you are editing in the rules view, you can see the changes you have made in the changes view.
Call Tree - Firefox Developer Tools
samples is the number of samples that were taken when we were executing this particular function, including its children (the other functions called by this particular function).
Flame Chart - Firefox Developer Tools
but while the call tree organizes this data to show you where your program is spending most time in aggregate across the recording, the flame chart uses it to show you when in the recording particular functions are executing.
Frame rate - Firefox Developer Tools
it takes a timestamp when the browser finishes a frame, and uses this to keep track of the frame rate over the course of the recording.
Performance - Firefox Developer Tools
flame chart see which javascript functions are executing, and when, over the course of the recording.
Rulers - Firefox Developer Tools
behavior to keep in mind when using rulers: the rulers command must be reapplied in new tabs and after each page refresh.
Shader Editor - Firefox Developer Tools
javascript code running in the page then sends them for compilation using the webgl apis, and they're executed on the device's gpu when needed.
Local Storage / Session Storage - Firefox Developer Tools
when an origin corresponding to local storage or session storage is selected within the storage inspector, the names and values of all the items corresponding to local storage or session storage will be listed in a table.
Storage Inspector - Firefox Developer Tools
add and refresh storage you'll also have buttons available to add a new storage entry or refresh the view of the currently viewed storage type where applicable (you can't add new entries to indexeddb or cache): sidebar when you select any row in the storage table widget, the sidebar is shown with details about that row.
Web console keyboard shortcuts - Firefox Developer Tools
r pane ctrl + click ctrl + click ctrl + click clear the object inspector pane esc esc esc focus on the command line ctrl + shift + k cmd + opt + k ctrl + shift + k clear output ctrl + shift + l ctrl + l from firefox 67: cmd + k ctrl + shift + l command line interpreter these shortcuts apply when you're in the command line interpreter.
Split console - Firefox Developer Tools
as usual, $0 works as a shorthand for the element currently selected in the inspector: when you use the split console with the debugger, the console's scope is the currently executing stack frame.
ANGLE_instanced_arrays.drawArraysInstancedANGLE() - Web APIs
note: when using webgl2, this method is available as gl.drawarraysinstanced() by default.
AbortSignal: abort event - Web APIs
the abort event of the fetch api is fired when a fetch request is aborted, i.e.
AbstractWorker.onerror - Web APIs
the abstractworker.onerror property of the abstractworker interface represents an eventhandler, that is a function to be called when the error event occurs and bubbles through the worker.
AddressErrors.city - Web APIs
an object based on addresserrors includes a city property when validation of the address fails for the value given for the address's city property.
AddressErrors.country - Web APIs
the text should also include, when possible, advice about how to go about correcting the error.
AddressErrors.dependentLocality - Web APIs
an object based on addresserrors includes a dependentlocality property when the address's dependentlocality property couldn't be validated.
AddressErrors.languageCode - Web APIs
an object based on addresserrors includes a languagecode property when the address's languagecode property couldn't be validated.
AddressErrors.organization - Web APIs
an object based on addresserrors includes an organization property when the address's organization property couldn't be validated.
AddressErrors.phone - Web APIs
an object based on addresserrors includes a phone property when the address's phone property couldn't be validated.
AddressErrors.postalCode - Web APIs
an object based on addresserrors includes a postalcode property when the address's postalcode property couldn't be validated.
AddressErrors.recipient - Web APIs
an object based on addresserrors includes a recipient property when the address's recipient property couldn't be validated.
AddressErrors.region - Web APIs
an object based on addresserrors includes a region property when the address's region property couldn't be validated.
AddressErrors.regionCode - Web APIs
an object based on addresserrors includes a regioncode property when the address's regioncode property couldn't be validated.
AddressErrors.sortingCode - Web APIs
an object based on addresserrors includes a sortingcode property when the address's sortingcode property couldn't be validated.
AddressErrors - Web APIs
handling address changes the handleaddresschange() method, called when shippingaddresschange events occur, is where we'll look to see if the country is one of those we allow as shipping destinations.
AesCbcParams - Web APIs
the aescbcparams dictionary of the web crypto api represents the object that should be passed as the algorithm parameter into subtlecrypto.encrypt(), subtlecrypto.decrypt(), subtlecrypto.wrapkey(), or subtlecrypto.unwrapkey(), when using the aes-cbc algorithm.
AesCtrParams - Web APIs
the aesctrparams dictionary of the web crypto api represents the object that should be passed as the algorithm parameter into subtlecrypto.encrypt(), subtlecrypto.decrypt(), subtlecrypto.wrapkey(), or subtlecrypto.unwrapkey(), when using the aes-ctr algorithm.
AesGcmParams - Web APIs
the aesgcmparams dictionary of the web crypto api represents the object that should be passed as the algorithm parameter into subtlecrypto.encrypt(), subtlecrypto.decrypt(), subtlecrypto.wrapkey(), or subtlecrypto.unwrapkey(), when using the aes-gcm algorithm.
AesKeyGenParams - Web APIs
the aeskeygenparams dictionary of the web crypto api represents the object that should be passed as the algorithm parameter into subtlecrypto.generatekey(), when generating an aes key: that is, when the algorithm is identified as any of aes-cbc, aes-ctr, aes-gcm, or aes-kw.
AnalyserNode.fftSize - Web APIs
the fftsize property of the analysernode interface is an unsigned long value and represents the window size in samples that is used when performing a fast fourier transform (fft) to get frequency domain data.
Animation.finished - Web APIs
every time the animation leaves the finished play state (that is, when it starts playing again), a new promise is created for this property.
Animation.pause() - Web APIs
WebAPIAnimationpause
upcake slowly getting eaten up var nommingcake = document.getelementbyid('eat-me_sprite').animate( [ { transform: 'translatey(0)' }, { transform: 'translatey(-80%)' } ], { fill: 'forwards', easing: 'steps(4, end)', duration: alicechange.effect.timing.duration / 2 }); // doesn't actually need to be eaten until a click event, so pause it initially: nommingcake.pause(); additionally, when resetting : // an all-purpose function to pause the animations on alice, the cupcake, and the bottle that reads "drink me." var stopplayingalice = function() { alicechange.pause(); nommingcake.pause(); drinking.pause(); }; // when the user releases the cupcake or the bottle, pause the animations.
AnimationEvent() - Web APIs
elapsedtime optional a float giving the amount of time the animation has been running, in seconds, when this event fired, excluding any time the animation was paused.
AnimationEvent.elapsedTime - Web APIs
the animationevent.elapsedtime read-only property is a float giving the amount of time the animation has been running, in seconds, when this event fired, excluding any time the animation was paused.
AnimationEvent - Web APIs
animationevent.elapsedtime read only is a float giving the amount of time the animation has been running, in seconds, when this event fired, excluding any time the animation was paused.
AudioBuffer.getChannelData() - Web APIs
// this is the audionode to use when we want to play an audiobuffer var source = audioctx.createbuffersource(); // set the buffer in the audiobuffersourcenode source.buffer = myarraybuffer; // connect the audiobuffersourcenode to the // destination so we can hear the sound source.connect(audioctx.destination); // start the source playing source.start(); } specification specification status comment ...
AudioBuffer - Web APIs
// this is the audionode to use when we want to play an audiobuffer var source = audioctx.createbuffersource(); // set the buffer in the audiobuffersourcenode source.buffer = myarraybuffer; // connect the audiobuffersourcenode to the // destination so we can hear the sound source.connect(audioctx.destination); // start the source playing source.start(); specifications specification status comment web au...
AudioBufferSourceNode.buffer - Web APIs
// this is the audionode to use when we want to play an audiobuffer var source = audioctx.createbuffersource(); // set the buffer in the audiobuffersourcenode source.buffer = myarraybuffer; specifications specification status comment web audio apithe definition of 'buffer' in that specification.
AudioBufferSourceNode.loopEnd - Web APIs
when the audio is played to the end, it loops, but you can control how long the loops last by altering loopstart and loopend.
AudioBufferSourceNode.playbackRate - Web APIs
when set to another value, the audiobuffersourcenode resamples the audio before sending it to the output.
AudioConfiguration - Web APIs
the audioconfiguration dictionary of the media capabilities api defines the audio file being tested when calling mediacapabilities.encodinginfo() or mediacapabilities.decodinginfo() to query whether a specific audio configuration is supported, smooth, and/or power efficient.
AudioContext.createMediaStreamSource() - Web APIs
r.frequency.value = 1000; biquadfilter.gain.value = range.value; // connect the audiobuffersourcenode to the gainnode // and the gainnode to the destination, so we can play the // music and adjust the volume using the mouse cursor source.connect(biquadfilter); biquadfilter.connect(audioctx.destination); // get new mouse pointer coordinates when mouse is moved // then set new gain value range.oninput = function() { biquadfilter.gain.value = range.value; } }) .catch(function(err) { console.log('the following gum error occured: ' + err); }); } else { console.log('getusermedia not supported on your browser!'); } // dump script to pre element pre.innerhtml = myscript.innerhtml; ...
AudioContext.getOutputTimestamp() - Web APIs
audiotimestamp.performancetime: an estimation of the moment when the sample frame corresponding to the stored contexttime value was rendered by the audio output device, in the same units and origin as performance.now().
AudioContextOptions.latencyHint - Web APIs
the audiocontextoptions dictionary (used when instantiating an audiocontext) may contain a property named latencyhint, which indicates the preferred maximum latency in seconds for the audio context.
AudioDestinationNode - Web APIs
it can also be the node that will "record" the audio data when used with an offlineaudiocontext.
AudioListener.dopplerFactor - Web APIs
the deprecated dopplerfactor property of the audiolistener interface is a double value representing the amount of pitch shift to use when rendering a doppler effect.
AudioListener.forwardX - Web APIs
note: the parameter is a-rate when used with a pannernode whose panningmodel is set to equalpower, or k-rate otherwise.
AudioListener.forwardY - Web APIs
note: the parameter is a-rate when used with a pannernode whose panningmodel is set to equalpower, or k-rate otherwise.
AudioListener.forwardZ - Web APIs
note: the parameter is a-rate when used with a pannernode whose panningmodel is set to equalpower, or k-rate otherwise.
AudioListener.positionX - Web APIs
note: the parameter is a-rate when used with a pannernode whose pannernode is set to equalpower, or k-rate otherwise.
AudioListener.positionY - Web APIs
note: the parameter is a-rate when used with a pannernode whose pannernode is set to equalpower, or k-rate otherwise.
AudioListener.positionZ - Web APIs
note: the parameter is a-rate when used with a pannernode whose pannernode is set to equalpower, or k-rate otherwise.
AudioListener.upX - Web APIs
WebAPIAudioListenerupX
note: the parameter is a-rate when used with a pannernode whose pannernode is set to equalpower, or k-rate otherwise.
AudioListener.upY - Web APIs
WebAPIAudioListenerupY
note: the parameter is a-rate when used with a pannernode whose pannernode is set to equalpower, or k-rate otherwise.
AudioListener.upZ - Web APIs
WebAPIAudioListenerupZ
note: the parameter is a-rate when used with a pannernode whose pannernode is set to equalpower, or k-rate otherwise.
AudioNode.channelCount - Web APIs
the channelcount property of the audionode interface represents an integer used to determine how many channels are used when up-mixing and down-mixing connections to any inputs to the node.
AudioNode.channelInterpretation - Web APIs
when the number of channels doesn't match between an input and an output, up- or down-mixing happens according the following rules.
AudioParam.linearRampToValueAtTime() - Web APIs
example in this example, we have a media source with two control buttons (see the audio-param repo for the source code, or view the example live.) when these buttons are pressed, linearramptovalueattime() is used to fade the gain value up to 1.0, and down to 0, respectively.
AudioParam.setTargetAtTime() - Web APIs
constant 39.3% 1 * timeconstant 63.2% 2 * timeconstant 86.5% 3 * timeconstant 95.0% 4 * timeconstant 98.2% 5 * timeconstant 99.3% n * timeconstant 1-e-n1 - e^{-n} examples in this example, we have a media source with two control buttons (see the webaudio-examples repo for the source code, or view the example live.) when these buttons are pressed, settargetattime() is used to fade the gain value up to 1.0, and down to 0, respectively, with the effect starting after 1 second, and the length of time the effect lasts being controlled by the timeconstant.
AudioParam.setValueAtTime() - Web APIs
when the buttons are pressed, the currgain variable is incremented/decremented by 0.25, then the setvalueattime() method is used to set the gain value equal to currgain, one second from now (audioctx.currenttime + 1.) // create audio context var audiocontext = window.audiocontext || window.webkitaudiocontext; var audioctx = new audiocontext(); // set basic variables for example var myaudio = documen...
AudioParam.value - Web APIs
WebAPIAudioParamvalue
one solution is to use the math.fround() method, which returns the single-precision value equivalent to the 64-bit javascript value specified—when setting value, like this: const source = new audiobuffersourcenode(...); const rate = math.fround(5.3); source.playbackrate.value = rate; console.log(source.playbackrate.value === rate); in this case, the log output will be true.
AudioTrack.id - Web APIs
WebAPIAudioTrackid
syntax var trackid = audiotrack.id; value a domstring which identifies the track, suitable for use when calling gettrackbyid() on an audiotracklist such as the one specified by a media element's audiotracks property.
AudioTrackList: addtrack event - Web APIs
the addtrack event is fired when a track is added to an audiotracklist.
AudioTrackList: change event - Web APIs
the change event is fired when an audio track is enabled or disabled, for example by changing the track's enabled property.
AudioTrackList: removetrack event - Web APIs
the removetrack event is fired when a track is removed from an audiotracklist.
AudioWorkletNode - Web APIs
event handlers audioworkletnode.onprocessorerror fired when an error is thrown in associated audioworkletprocessor.
AudioWorkletProcessor.process - Web APIs
for example, take the audiobuffersourcenode — the processor behind such a node should return true from the process method while the buffer is playing, and start returning false when the buffer playing has ended (there's no way to call play on the same audiobuffersourcenode again).
AuthenticatorAssertionResponse - Web APIs
the authenticatorassertionresponse interface of the web authentication api is returned by credentialscontainer.get() when a publickeycredential is passed, and provides proof to a service that it has a key pair and that the authentication request is valid and approved.
AuthenticatorAttestationResponse.getTransports() - Web APIs
such transports may be usb, nfc, ble or internal (applicable when the authenticator is not removable from the device).
AuthenticatorAttestationResponse - Web APIs
the authenticatorattestationresponse interface of the web authentication api is returned by credentialscontainer.create() when a publickeycredential is passed, and provides a cryptographic root of trust for the new key pair that has been generated.
BaseAudioContext.createGain() - Web APIs
example the following example shows basic usage of an audiocontext to create a gainnode, which is then used to mute and unmute the audio when a mute button is clicked by changing the gain property value.
BaseAudioContext.onstatechange - Web APIs
the onstatechange property of the baseaudiocontext interface defines an event handler function to be called when the statechange event fires: this occurs when the audio context's state changes.
Using the Beacon API - Web APIs
ndbeacon) return; var url = "https://example.com/analytics"; // create the data to send var data = "state=" + event.type + "&location=" + location.href; // send the beacon var status = navigator.sendbeacon(url, data); // log the data and result console.log("sendbeacon: url = ", url, "; data = ", data, "; status = ", status); }; the following example creates a submit handler and when that event is fired, the handler calls sendbeacon().
BiquadFilterNode.gain - Web APIs
when it takes a positive value it is a real gain, when negative it is an attenuation.
BlobBuilder - Web APIs
when you're done building your blob, call getblob() to retrieve a blob containing the data you sent into the blob builder.
Bluetooth.getDevices() - Web APIs
the program can detect when a device comes online or into range by watching for bluetooth advertisements by calling bluetoothdevice.watchadvertisements() on that device.
Bluetooth - Web APIs
WebAPIBluetooth
events bluetooth.onavailabilitychanged an event handler that runs when an event of type availabilitychanged has fired.
BluetoothRemoteGATTCharacteristic.startNotifications() - Web APIs
the bluetoothremotegattcharacteristic.startnotifications() method returns a promise to the bluetoothremotegattcharacteristic instance when there is an active notification on it.
BluetoothRemoteGATTCharacteristic.stopNotifications() - Web APIs
the bluetoothremotegattcharacteristic.stopnotifications() method returns a promise to the bluetoothremotegattcharacteristic instance when there is no longer an active notification on it.
BluetoothRemoteGATTCharacteristic.value - Web APIs
this value gets updated when the value of the characteristic is read or updated via a notification or indication.
value - Web APIs
this value gets updated when the value of the descriptor is read.
BluetoothRemoteGATTDescriptor - Web APIs
this value gets updated when the value of the descriptor is read.
Body.blob() - Web APIs
WebAPIBodyblob
when the fetch is successful, we read a blob out of the response using blob(), put it into an object url using url.createobjecturl, and then set that url as the source of an <img> element to display the image.
Body.body - Web APIs
WebAPIBodybody
const image = document.getelementbyid('target'); // fetch the original image fetch('./tortoise.png') // retrieve its body as readablestream .then(response => response.body) .then(body => { const reader = body.getreader(); return new readablestream({ start(controller) { return pump(); function pump() { return reader.read().then(({ done, value }) => { // when no more data needs to be consumed, close the stream if (done) { controller.close(); return; } // enqueue the next data chunk into our target stream controller.enqueue(value); return pump(); }); } } }) }) .then(stream => new response(stream)) .then(response => response.blob()) .then(blob => url.createobj...
Body.bodyUsed - Web APIs
WebAPIBodybodyUsed
when the fetch is successful, we read a blob out of the response using blob(), put it into an object url using url.createobjecturl, and then set that url as the source of an <img> element to display the image.
Body.json() - Web APIs
WebAPIBodyjson
when the fetch is successful, we read and parse the data using json(), then read values out of the resulting objects as you'd expect and insert them into list items to display our product data.
BroadcastChannel.close() - Web APIs
syntax var str = channel.close(); example // connect to a channel var bc = new broadcastchannel('test_channel'); // more operations (like postmessage, …) // when done, disconnect from the channel bc.close(); specifications specification status comment html living standardthe definition of 'broadcastchannel.close()' in that specification.
BroadcastChannel: messageerror event - Web APIs
the messageerror event is fired on a broadcastchannel object when a message arrives on the channel that can't be deserialized.
BroadcastChannel.name - Web APIs
syntax var str = channel.name; examples // connect to a channel var bc = new broadcastchannel('test_channel'); // more operations (like postmessage, …) // log the channel name to the console console.log(bc.name); // "test_channel" // when done, disconnect from the channel bc.close(); specifications specification status comment html living standardthe definition of 'broadcastchannel.name' in that specification.
BroadcastChannel.onmessage - Web APIs
the broadcastchannel.onmessage event handler is a property that specifies the function to execute when a message event, of type messageevent, is received by this broadcastchannel.
BroadcastChannel.onmessageerror - Web APIs
the onmessageerror event handler of the broadcastchannel interface is an eventlistener, called whenever an messageevent of type messageerror is fired on the broadcastchannel instance — that is, when it receives a message that cannot be deserialized.
ByteLengthQueuingStrategy - Web APIs
the bytelengthqueuingstrategy interface of the the streams api provides a built-in byte length queuing strategy that can be used when constructing streams.
ByteString - Web APIs
bytestring maps to a string when returned in javascript; generally, it's only used when interfacing with protocols that use bytes and strings interchangably, such as http.
CDATASection - Web APIs
the symbols < and & don’t need escaping as they normally do when inside a cdata section.
CSSKeywordValue - Web APIs
the interface instance name is a stringifier meaning that when used anywhere a string is expected it will return the value of csskeyword.value.
CSSMathSum - Web APIs
a cssmathsum is the object type returned when the stylepropertymapreadonly.get() method is used on a css property whosevalue is created with a calc() function.
CSSNumericValue.equals() - Web APIs
some of the following examples illustrate what happens when they are not.
CSSNumericValue.max() - Web APIs
some of the following examples illustrate what happens when they are not.
CSSNumericValue.min() - Web APIs
some of the following examples illustrate what happens when they are not.
CSSStyleDeclaration - Web APIs
an alternative to accessing nodelist[i] (which instead returns undefined when i is out-of-bounds).
CSSStyleSheet - Web APIs
a cssstylesheet object is created and inserted into the document's document.stylesheets list automatically by the browser, when a stylesheet is loaded for a document.
CSSUnparsedValue.forEach() - Web APIs
thisarg optional value to use as this (i.e the reference object) when executing callback.
CSS Font Loading API - Web APIs
fontfacesetloadevent fired whenever a fontfaceset loads.
Determining the dimensions of elements - Web APIs
most of the time these are the same as width and height of element.getboundingclientrect(), when there aren't any transforms applied to the element.
Managing screen orientation - Web APIs
adjusting layout based on the orientation one of the most common cases for orientation changes is when you want to revise the layout of your content based on the orientation of the device.
CSS Typed Object Model API - Web APIs
when used where a string is expected, it will return the value of csskeyword.value.
Cache.add() - Web APIs
WebAPICacheadd
exceptions exception happens when typeerror the url scheme is not http or https.
Cache.addAll() - Web APIs
WebAPICacheaddAll
exceptions exception happens when typeerror the url scheme is not http or https.
CacheStorage - Web APIs
those that aren't using https, although this definition will likely become more complex in the future.) when testing, you can get around this by checking the "enable service workers over http (when toolbox is open)" option in the firefox devtools options/gear menu.
CanvasCaptureMediaStreamTrack - Web APIs
this lets applications that wish to specify the frame capture times directly do so, if they specified a framerate of 0 when calling capturestream().
CanvasPattern.setTransform() - Web APIs
the pattern gets applied if you set it as the current fillstyle and gets drawn onto the canvas when using the fillrect() method, for example.
CanvasRenderingContext2D.arcTo() - Web APIs
note: be aware that you may get unexpected results when using a relatively large radius: the arc's connecting line will go in whatever direction it must to meet the specified radius.
CanvasRenderingContext2D.beginPath() - Web APIs
call this method when you want to create a new path.
CanvasRenderingContext2D.createLinearGradient() - Web APIs
when applied to a shape, the coordinates are not relative to the shape's coordinates.
CanvasRenderingContext2D.createRadialGradient() - Web APIs
when applied to a shape, the coordinates are not relative to the shape's coordinates.
CanvasRenderingContext2D.drawFocusIfNeeded() - Web APIs
the drawfocusifneeded() method is used to draw a focus ring when appropriate.
CanvasRenderingContext2D.drawWindow() - Web APIs
constant value description drawwindow_draw_caret 0x01 show the caret if appropriate when drawing.
CanvasRenderingContext2D.font - Web APIs
the canvasrenderingcontext2d.font property of the canvas 2d api specifies the current text style to use when drawing text.
CanvasRenderingContext2D.getLineDash() - Web APIs
if the number, when setting the elements, is odd, the elements of the array get copied and concatenated.
CanvasRenderingContext2D.globalCompositeOperation - Web APIs
the canvasrenderingcontext2d.globalcompositeoperation property of the canvas 2d api sets the type of compositing operation to apply when drawing new shapes.
CanvasRenderingContext2D.imageSmoothingEnabled - Web APIs
when enlarging images, the default resizing algorithm will blur the pixels.
CanvasRenderingContext2D.isPointInPath() - Web APIs
html <canvas id="canvas"></canvas> <p>in path: <code id="result">false</code></p> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); const result = document.getelementbyid('result'); ctx.rect(10, 10, 100, 100); ctx.fill(); result.innertext = ctx.ispointinpath(30, 70); result checking a point in the specified path whenever you move the mouse, this example checks whether the cursor is in a circular path2d path.
CanvasRenderingContext2D.isPointInStroke() - Web APIs
html <canvas id="canvas"></canvas> <p>in stroke: <code id="result">false</code></p> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); const result = document.getelementbyid('result'); ctx.rect(10, 10, 100, 100); ctx.stroke(); result.innertext = ctx.ispointinstroke(50, 10); result checking a point in the specified path whenever you move the mouse, this example checks whether the cursor is in the stroke of an elliptical path2d path.
CanvasRenderingContext2D.resetTransform() - Web APIs
const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // draw a rotated rectangle ctx.rotate(45 * math.pi / 180); ctx.fillrect(60, 0, 100, 30); // reset transformation matrix to the identity matrix ctx.resettransform(); result continuing with a regular matrix whenever you're done drawing transformed shapes, you should call resettransform() before rendering anything else.
CanvasRenderingContext2D.setLineDash() - Web APIs
the setlinedash() method of the canvas 2d api's canvasrenderingcontext2d interface sets the line dash pattern used when stroking lines.
CanvasRenderingContext2D.textAlign - Web APIs
the canvasrenderingcontext2d.textalign property of the canvas 2d api specifies the current text alignment used when drawing text.
CanvasRenderingContext2D.textBaseline - Web APIs
the canvasrenderingcontext2d.textbaseline property of the canvas 2d api specifies the current text baseline used when drawing text.
Advanced animations - Web APIs
> canvas.width || ball.x + ball.vx < 0) { ball.vx = -ball.vx; } raf = window.requestanimationframe(draw); } canvas.addeventlistener('mouseover', function(e) { raf = window.requestanimationframe(draw); }); canvas.addeventlistener('mouseout', function(e) { window.cancelanimationframe(raf); }); ball.draw(); trailing effect until now we have made use of the clearrect method when clearing prior frames.
Compositing example - Web APIs
hile adopting the hue of the top layer.', 'preserves the luma and hue of the bottom layer, while adopting the chroma of the top layer.', 'preserves the luma of the bottom layer, while adopting the hue and chroma of the top layer.', 'preserves the hue and chroma of the bottom layer, while adopting the luma of the top layer.' ].reverse(); var width = 320; var height = 340; main program when the page loads, this code runs to set up and run the example: window.onload = function() { // lum in srgb var lum = { r: 0.33, g: 0.33, b: 0.33 }; // resize canvas canvas1.width = width; canvas1.height = height; canvas2.width = width; canvas2.height = height; lightmix() colorsphere(); runcomposite(); return; }; and this co...
Compositing and clipping - Web APIs
globalcompositeoperation = type this sets the type of compositing operation to apply when drawing new shapes, where type is a string identifying which of the twelve compositing operations to use.
Finale - Web APIs
WebAPICanvas APITutorialFinale
other web apis these apis might be useful when working further with canvas and graphics: webgl advanced api for rendering complex graphics, including 3d.
Hit regions and accessibility - Web APIs
focus rings when working with the keyboard, focus rings are a handy indicator to help navigating on a page.
Pixel manipulation with canvas - Web APIs
zoomctx.drawimage(canvas, math.min(math.max(0, x - 5), img.width - 10), math.min(math.max(0, y - 5), img.height - 10), 10, 10, 0, 0, 200, 200); }; canvas.addeventlistener('mousemove', zoom); } saving images the htmlcanvaselement provides a todataurl() method, which is useful when saving images.
Transformations - Web APIs
when the second restore() statement is called, the original state (the one we set up before the first call to save) is restored and the last rectangle is once again drawn in black.
ChannelMergerNode - Web APIs
in that case, when the signal is sent to the audiocontext.listener object, supernumerary channels will be ignored.
Clients.claim() - Web APIs
WebAPIClientsclaim
when a service worker is initially registered, pages won't use it until they next load.
Clients.openWindow() - Web APIs
in firefox, the method is allowed to show popups only when called as the result of a notification click event.
Clients - Web APIs
WebAPIClients
examples the following example shows an existing chat window or creates a new one when the user clicks a notification.
Clipboard.read() - Web APIs
WebAPIClipboardread
the read() method of the clipboard interface requests a copy of the clipboard's contents, delivering the data to the returned promise when the promise is resolved.
Clipboard.writeText() - Web APIs
the "clipboard-write" permission of the permissions api, is granted automatically to pages when they are in the active tab.
Clipboard - Web APIs
WebAPIClipboard
when the data has been retrieved, the promise is resolved with a datatransfer object that provides the data.
CompositionEvent.data - Web APIs
this value doesn't change even if content changes the selection range; rather, it indicates the string that was selected when composition started.
Console.timeEnd() - Web APIs
WebAPIConsoletimeEnd
examples console.time("answer time"); alert("click to continue"); console.timelog("answer time"); alert("do a bunch of other stuff..."); console.timeend("answer time"); the output from the example above shows the time taken by the user to dismiss the first alert box, followed by the time it took for the user to dismiss the second alert: notice that the timer's name is displayed when the timer value is logged using timelog() and again when it's stopped.
Console.timeLog() - Web APIs
WebAPIConsoletimeLog
examples console.time("answer time"); alert("click to continue"); console.timelog("answer time"); alert("do a bunch of other stuff..."); console.timeend("answer time"); the output from the example above shows the time taken by the user to dismiss the first alert box, followed by the time it took for the user to dismiss the second alert: notice that the timer's name is displayed when the timer value is logged using timelog() and again when it's stopped.
ConstantSourceNode.offset - Web APIs
the read-only offset property of the constantsourcenode interface returns a audioparam object indicating the numeric a-rate value which is always returned by the source when asked for the next sample.
ConvolverNode.buffer - Web APIs
at the time when this attribute is set, the buffer and the state of the attribute will be used to configure the convolvernode with this impulse response having the given normalization.
ConvolverNode - Web APIs
convolvernode.normalize a boolean that controls whether the impulse response from the buffer will be scaled by an equal-power normalization when the buffer attribute is set, or not.
CountQueuingStrategy - Web APIs
the countqueuingstrategy interface of the the streams api provides a built-in chunk counting queuing strategy that can be used when constructing streams.
CrashReportBody - Web APIs
a crash report is generated when a document becomes unusable due to the browser (or one of its processes) crashing.
Credential Management API - Web APIs
credentialscontainer exposes methods to request credentials and notify the user agent when interesting events occur such as successful sign in or sign out.
CredentialsContainer - Web APIs
the credentialscontainer interface of the the credential management api exposes methods to request credentials and notify the user agent when events such as successful sign in or sign out happen.
Crypto.getRandomValues() - Web APIs
user agents are instead urged to provide the best entropy they can when generating random numbers, using a well-defined, efficient pseudorandom number generator built into the user agent itself, but seeded with values taken from an external source of pseudorandom numbers, such as a platform-specific random number function, the unix /dev/urandom device, or other source of random or pseudorandom data.
CryptoKeyPair - Web APIs
a cryptokeypair object can be obtained using subtlecrypto.generatekey(), when the selected algorithm is one of the asymmetric algorithms: rsassa-pkcs1-v1_5, rsa-pss, rsa-oaep, ecdsa, or ecdh.
CustomElementRegistry.define() - Web APIs
ntent return text.split(/\s+/g).length; } var count = 'words: ' + countwords(wcparent); // create a shadow root var shadow = this.attachshadow({mode: 'open'}); // create text node and add word count to it var text = document.createelement('span'); text.textcontent = count; // append it to the shadow root shadow.appendchild(text); // update count when element content changes setinterval(function() { var count = 'words: ' + countwords(wcparent); text.textcontent = count; }, 200) } } // define the new element customelements.define('word-count', wordcount, { extends: 'p' }); <p is="word-count"></p> specifications specification status comment html living standardthe definition of 'customelements.d...
CustomEvent.detail - Web APIs
the detail readonly property of the customevent interface returns any data passed when initializing the event.
CustomEvent.initCustomEvent() - Web APIs
detail the data passed when initializing the event.
CustomEvent - Web APIs
properties customevent.detail read only any data passed when initializing the event.
DOMPointInit.w - Web APIs
WebAPIDOMPointInitw
the dompointinit dictionary's w property is used to specify the w perspective value of a point in space when either creating or serializing to json a dompoint or dompointreadonly object.
DOMQuad - Web APIs
WebAPIDOMQuad
returning domquads lets getboxquads() return accurate information even when arbitrary 2d or 3d transforms are present.
Binary strings - Web APIs
WebAPIDOMStringBinary
the reason that brought to use utf-16 code units as placeholders for uint8 numbers is that as web applications become more and more powerful (adding features such as audio and video manipulation, access to raw data using websockets, and so forth) it has become clear that there are times when it would be helpful for javascript code to be able to quickly and easily manipulate raw binary data.
DOMTokenList.entries() - Web APIs
we when retrieve an iterator containing the key/value pairs using entries(), then iterate through each one using a for...of loop, writing them to the <span>'s node.textcontent.
DOMTokenList.keys() - Web APIs
WebAPIDOMTokenListkeys
we when retrieve an iterator containing the keys using values(), then iterate through those keys using a for ...
DOMTokenList.values() - Web APIs
we when retrieve an iterator containing the values using values(), then iterate through those values using a for ...
DataTransfer.effectAllowed - Web APIs
uninitialized the default value when the effect has not been set, equivalent to all.
DataTransfer.mozSourceNode - Web APIs
the datatransfer.mozsourcenode property is used to determine the node over which the mouse cursor was located when the the drag operation was initiated (for example, when a <button> was clicked).
DataTransfer.setData() - Web APIs
that is, the order of the types list is not changed when replacing data of the same type.
DataTransfer.setDragImage() - Web APIs
when a drag occurs, a translucent image is generated from the drag target (the element the dragstart event is fired at), and follows the mouse pointer during the drag.
DataTransfer - Web APIs
datatransfer.mozsourcenode read only the node over which the mouse cursor was located when the button was pressed to initiate the drag operation.
DedicatedWorkerGlobalScope: messageerror event - Web APIs
the messageerror event is fired on a dedicatedworkerglobalscope object when it receives a message that can't be deserialized.
DedicatedWorkerGlobalScope.name - Web APIs
the name read-only property of the dedicatedworkerglobalscope interface returns the name that the worker was (optionally) given when it was created.
DedicatedWorkerGlobalScope.onmessageerror - Web APIs
the onmessageerror event handler of the dedicatedworkerglobalscope interface is an eventlistener, called whenever an messageevent of type messageerror is fired on the worker—that is, when it receives a message that cannot be deserialized.
DelayNode - Web APIs
WebAPIDelayNode
when creating a graph that has a cycle, it is mandatory to have at least one delaynode in the cycle, or the nodes taking part in the cycle will be muted.
Using light sensors - Web APIs
when the light sensor of the device detects a change in light intensity, the browser is notified of the change and fires a devicelightevent event.
DisplayMediaStreamConstraints.video - Web APIs
constraints specific to screen sharing these constraints apply to mediatrackconstraints objects specified as part of the displaymediastreamconstraints object's video property when using getdisplaymedia() to obtain a stream for screen sharing.
Document: DOMContentLoaded event - Web APIs
the domcontentloaded event fires when the initial html document has been completely loaded and parsed, without waiting for stylesheets, images, and subframes to finish loading.
Document: animationend event - Web APIs
the animationend event is fired when a css animation has completed.
Document: animationiteration event - Web APIs
the animationiteration event is fired when an iteration of a css animation ends, and another one begins.
Document.applets - Web APIs
WebAPIDocumentapplets
example // when you know the second applet is the one you want my_java_app = document.applets[1]; specifications specification status comment html living standardthe definition of 'document.applets' in that specification.
Document.caretRangeFromPoint() - Web APIs
example basic demo: when clicking in a paragraph insert a line break at the caret position: html <p>lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
Document: copy event - Web APIs
the copy event fires when the user initiates a copy action through the browser's user interface.
Document.createElement() - Web APIs
when called on an html document, createelement() converts tagname to lower case before creating the element.
Document: cut event - Web APIs
the cut event is fired when the user has initiated a "cut" action through the browser's user interface.
Document: drag event - Web APIs
alse); document.addeventlistener("dragend", function(event) { // reset the transparency event.target.style.opacity = ""; }, false); /* events fired on the drop targets */ document.addeventlistener("dragover", function(event) { // prevent default to allow drop event.preventdefault(); }, false); document.addeventlistener("dragenter", function(event) { // highlight potential drop target when the draggable element enters it if (event.target.classname == "dropzone") { event.target.style.background = "purple"; } }, false); document.addeventlistener("dragleave", function(event) { // reset background of potential drop target when the draggable element leaves it if (event.target.classname == "dropzone") { event.target.style.background = ""; } }, false); document.addev...
Document: dragend event - Web APIs
the dragend event is fired when a drag operation is being ended (by releasing a mouse button or hitting the escape key).
Document: dragenter event - Web APIs
the dragenter event is fired when a dragged element or text selection enters a valid drop target.
Document: dragexit event - Web APIs
the dragexit event is fired when an element is no longer the drag operation's immediate selection target.
Document: dragleave event - Web APIs
the dragleave event is fired when a dragged element or text selection leaves a valid drop target.
Document: dragover event - Web APIs
the dragover event is fired when an element or text selection is being dragged over a valid drop target (every few hundred milliseconds).
Document: dragstart event - Web APIs
the dragstart event is fired when the user starts dragging an element or text selection.
Document: drop event - Web APIs
the drop event is fired when an element or text selection is dropped on a valid drop target.
Document.evaluate() - Web APIs
WebAPIDocumentevaluate
null is common for html documents or when no namespace prefixes are used.
Document.exitFullscreen() - Web APIs
example this example causes the current document to toggle in and out of a full-screen presentation whenever the mouse button is clicked within it.
Document.fullscreenEnabled - Web APIs
example in this example, before attempting to request full-screen mode for a <video> element, the value of fullscreenenabled is checked, in order to avoid making the attempt when not available.
Document: fullscreenerror event - Web APIs
the fullscreenerror event is fired when the browser cannot switch to full-screen mode.
Document.getElementById() - Web APIs
when creating an element and assigning it an id, you have to insert the element into the document tree with node.insertbefore() or a similar method before you can access it with getelementbyid(): var element = document.createelement('div'); element.id = 'testqq'; var el = document.getelementbyid('testqq'); // el will be null!
Document.getElementsByClassName() - Web APIs
when called on the document object, the complete document is searched, including the root node.
Document.getElementsByTagNameNS() - Web APIs
note that when the node on which getelementsbytagname is invoked is not the document node, in fact the element.getelementsbytagnamens method is used.
Document: gotpointercapture event - Web APIs
the gotpointercapture event is fired when an element captures a pointer using setpointercapture().
Document.hasFocus() - Web APIs
WebAPIDocumenthasFocus
when viewing a document, an element with focus is always the active element in the document, but an active element does not necessarily have focus.
Document.hasStorageAccess() - Web APIs
if the promise gets resolved and a user gesture event was being processed when the function was originally called, the resolve handler will run as if a user gesture was being processed, so it will be able to call apis that require user activation.
Document.lastModified - Web APIs
here is a possible example of how to show an alert message when the page changes (see also: javascript cookies api): if (date.parse(document.lastmodified) > parsefloat(document.cookie.replace(/(?:(?:^|.*;)\s*last_modif\s*\=\s*([^;]*).*$)|^.*$/, "$1") || "0")) { document.cookie = "last_modif=" + date.now() + "; expires=fri, 31 dec 9999 23:59:59 gmt; path=" + location.pathname; alert("this page has changed!"); } …the same example, but skipping the first...
Document.onfullscreenchange - Web APIs
syntax targetdocument.onfullscreenchange = fullscreenchangehandler; value an event handler which is invoked whenever the document receives a fullscreenchange event, indicating that the document is transitioning into or out of full-screen mode.
Document.onfullscreenerror - Web APIs
the document.onfullscreenerror property is an event handler for the fullscreenerror event that is sent to the document when it fails to transition into full-screen mode after a prior call to element.requestfullscreen().
Document.onoffline - Web APIs
the document.onoffline event handler is called when an offline is fired on the <body> element and bubbles up, when navigator.online property changes and becomes false.
Document.onvisibilitychange - Web APIs
the document.onvisibilitychange property represents the event handler that is called when a visibilitychange event reaches this object.
Document.open() - Web APIs
WebAPIDocumentopen
document.open(); document.write("<p>hello world!</p>"); document.write("<p>i am a fish</p>"); document.write("<p>the number is 42</p>"); document.close(); notes an automatic document.open() call happens when document.write() is called after the page has loaded.
Document: paste event - Web APIs
the paste event is fired when the user has initiated a "paste" action through the browser's user interface.
Document: pointercancel event - Web APIs
the pointercancel event is fired when the browser determines that there are unlikely to be any more pointer events, or if after the pointerdown event is fired, the pointer is then used to manipulate the viewport by panning, zooming, or scrolling.
Document: pointerenter event - Web APIs
the pointerenter event fires when a pointing device is moved into the hit test boundaries of an element or one of its descendants, including as a result of a pointerdown event from a device that does not support hover (see pointerdown).
Document: pointerlockchange event - Web APIs
the pointerlockchange event is fired when the pointer is locked/unlocked.
Document: pointerlockerror event - Web APIs
the pointerlockerror event is fired when locking the pointer failed (for technical reasons or because the permission was denied).
Document: pointermove event - Web APIs
the pointermove event is fired when a pointer changes coordinates, and the pointer has not been canceled by a browser touch-action.
Document: pointerout event - Web APIs
the pointerout event is fired for several reasons including: pointing device is moved out of the hit test boundaries of an element; firing the pointerup event for a device that does not support hover (see pointerup); after firing the pointercancel event (see pointercancel); when a pen stylus leaves the hover range detectable by the digitizer.
Document: pointerover event - Web APIs
the pointerover event is fired when a pointing device is moved into an element's hit test boundaries.
Document: pointerup event - Web APIs
the pointerup event is fired when a pointer is no longer active.
Document.queryCommandEnabled() - Web APIs
notes for 'cut' and 'copy' commands the method only returns true when called from a user-initiated thread.
Document.querySelector() - Web APIs
since javascript also uses backslash escaping, be especially careful when writing string literals using these characters.
Document.readyState - Web APIs
when the value of this property changes, a readystatechange event fires on the document object.
Document: readystatechange event - Web APIs
the readystatechange event is fired when the readystate attribute of a document has changed.
Document: scroll event - Web APIs
the scroll event fires when the document view or an element has been scrolled.
Document.scrollingElement - Web APIs
when in quirks mode, the scrollingelement attribute returns the html body element if it exists and is not potentially scrollable, otherwise it returns null.
Document: selectionchange event - Web APIs
the selectionchange event of the selection api is fired when the current text selection on a document is changed.
Document: selectstart event - Web APIs
the selectstart event of the selection api is fired when a user starts a new selection.
Document: touchcancel event - Web APIs
the touchcancel event is fired when one or more touch points have been disrupted in an implementation-specific manner (for example, too many touch points are created).
Document: touchend event - Web APIs
the touchend event fires when one or more touch points are removed from the touch surface.
Document: touchmove event - Web APIs
the touchmove event is fired when one or more touch points are moved along the touch surface.
Document: touchstart event - Web APIs
the touchstart event is fired when one or more touch points are placed on the touch surface.
Document: transitioncancel event - Web APIs
the transitioncancel event is fired when a css transition is canceled.
Document: transitionrun event - Web APIs
the transitionrun event is fired when a css transition is first created, i.e.
DocumentFragment - Web APIs
changes made to the fragment don't affect the document (even on reflow) or incur any performance impact when changes are made.
Events and the DOM - Web APIs
when an event occurs, an event object is created and passed sequentially to the event listeners.
Using the W3C DOM Level 1 Core - Web APIs
for example, the following document <html> <head> <title>my document</title> </head> <body> <h1>header</h1> <p>paragraph</p> </body> </html> has a dom tree that looks like this: (note that, although the above tree is similar to the above document's dom tree, it's not identical, as the actual dom tree preserves whitespace.) when a web browser parses an html document, it builds a dom tree and then uses it to display the document.
DynamicsCompressorNode() - Web APIs
that can occur when multiple sounds are played and multiplexed together at once.
DynamicsCompressorNode.attack - Web APIs
it defines how quickly the signal is adapted when its volume is increased.
DynamicsCompressorNode.release - Web APIs
it defines how quick the signal is adapted when its volume is reduced.
DynamicsCompressorNode - Web APIs
the dynamicscompressornode interface provides a compression effect, which lowers the volume of the loudest parts of the signal in order to help prevent clipping and distortion that can occur when multiple sounds are played and multiplexed together at once.
EXT_float_blend - Web APIs
usage notes on devices that support the ext_float_blend extension, it is automatically, implicitly, enabled when any one or more of ext_color_buffer_float, oes_texture_float, or webgl_color_buffer_float are enabled.
EXT_shader_texture_lod - Web APIs
dgradext(sampler2d sampler, vec2 p, vec2 dpdx, vec2 dpdy) vec4 texture2dprojgradext(sampler2d sampler, vec3 p, vec2 dpdx, vec2 dpdy) vec4 texture2dprojgradext(sampler2d sampler, vec4 p, vec2 dpdx, vec2 dpdy) vec4 texturecubegradext(samplercube sampler, vec3 p, vec3 dpdx, vec3 dpdy) examples enabling the extensions: gl.getextension('ext_shader_texture_lod'); shader code that avoids artifacts when wrapping texture coordinates: <script type="x-shader/x-fragment"> #extension gl_ext_shader_texture_lod : enable #extension gl_oes_standard_derivatives : enable uniform sampler2d mytexture; varying vec2 texcoord; void main(){ gl_fragcolor = texture2dgradext(mytexture, mod(texcoord, vec2(0.1, 0.5)), dfdx(texcoord), dfdy(texcoord)); } </script> specifications ...
EXT_texture_filter_anisotropic - Web APIs
af improves the quality of mipmapped texture access when viewing a textured primitive at an oblique angle.
EcKeyGenParams - Web APIs
the eckeygenparams dictionary of the web crypto api represents the object that should be passed as the algorithm parameter into subtlecrypto.generatekey(), when generating any elliptic-curve-based key pair: that is, when the algorithm is identified as either of ecdsa or ecdh.
EcKeyImportParams - Web APIs
the eckeyimportparams dictionary of the web crypto api represents the object that should be passed as the algorithm parameter into subtlecrypto.importkey() or subtlecrypto.unwrapkey(), when generating any elliptic-curve-based key pair: that is, when the algorithm is identified as either of ecdsa or ecdh.
EcdhKeyDeriveParams - Web APIs
the ecdhkeyderiveparams dictionary of the web crypto api represents the object that should be passed as the algorithm parameter into subtlecrypto.derivekey(), when using the ecdh algorithm.
EcdsaParams - Web APIs
the ecdsaparams dictionary of the web crypto api represents the object that should be passed as the algorithm parameter into subtlecrypto.sign() or subtlecrypto.verify() when using the ecdsa algorithm.
Element: DOMActivate event - Web APIs
the domactivate event is fired at an element when it becomes active, such as when it is clicked on using the mouse or a keypress is used to navigate to it.
Element: MSGestureChange event - Web APIs
the msgesturechange event is fired when touch contact positions move and also while inertia-based movements are being processed.
Element: MSGestureEnd event - Web APIs
the msgestureend event is fired when all associated touch points have stopped contacting the touch surface, and any associated inertial movements have ended; thus ending the gesture.
Element: MSGestureHold event - Web APIs
the msgesturehold event is fired when the user contacts the touch surface and remains in the same position for a while.
Element: MSGestureTap event - Web APIs
the msgesturetap event is fired when the user "taps" the pointing device (e.g., touches the touch surface with their finger, taps the touch surface with a pen device, clicks with a mouse).
Element: MSInertiaStart event - Web APIs
the msinertiastart event is fired when contact with the touch surface stops when a scroll has enough inertia to continue scrolling.
Element: MozMousePixelScroll event - Web APIs
the firefox-only, non-standard, and obsolete mozmousepixelscroll event is fired at an element asynchronously when a mouse wheel or similar device is operated.
Element.animate() - Web APIs
WebAPIElementanimate
this is primarily of use when sequencing animations based on the end time of another animation.
Element: beforescriptexecute event - Web APIs
the beforescriptexecute event is fired when a script is about to be executed.
Element: blur event - Web APIs
the blur event fires when an element has lost focus.
Element: click event - Web APIs
an element receives a click event when a pointing device button (such as a mouse's primary mouse button) is both pressed and released while the pointer is located inside the element.
Element.clientHeight - Web APIs
when clientheight is used on the root element (the <html> element), (or on <body> if the document is in quirks mode), the viewport's height (excluding any scrollbar) is returned.
Element.clientWidth - Web APIs
when clientwidth is used on the root element (the <html> element), (or on <body> if the document is in quirks mode), the viewport's width (excluding any scrollbar) is returned.
Element: compositionend event - Web APIs
the compositionend event is fired when a text composition system such as an input method editor completes or cancels the current composition session.
Element: compositionstart event - Web APIs
the compositionstart event is fired when a text composition system such as an input method editor starts a new composition session.
Element: compositionupdate event - Web APIs
the compositionupdate event is fired when a new character is received in the context of a text composition session controlled by a text composition system such as an input method editor.
Element: copy event - Web APIs
the copy event fires when the user initiates a copy action through the browser's user interface.
Element.createShadowRoot() - Web APIs
when shadow dom is created, it is always attached to an existing element.
Element: cut event - Web APIs
WebAPIElementcut event
the cut event is fired when the user has initiated a "cut" action through the browser's user interface.
Element: error event - Web APIs
the error event is fired on an element object when a resource failed to load, or can't be used.
Element: focus event - Web APIs
the focus event fires when an element has received focus.
Element: focusin event - Web APIs
the focusin event fires when an element is about to receive focus.
Element: focusout event - Web APIs
the focusout event fires when an element is about to lose focus.
Element: fullscreenerror event - Web APIs
the fullscreenerror event is fired when the browser cannot switch to full-screen mode.
Element: gesturechange event - Web APIs
the gesturechange event is fired when digits move during a touch gesture.
Element: gestureend event - Web APIs
the gestureend event is fired when there are no longer multiple fingers contacting the touch surface, thus ending the gesture.
Element.getAttributeNode() - Web APIs
example // html: <div id="top" /> let t = document.getelementbyid("top"); let idattr = t.getattributenode("id"); alert(idattr.value == "top") notes when called on an html element in a dom flagged as an html document, getattributenode lower-cases its argument before proceeding.
Element.getBoundingClientRect() - Web APIs
the amount of scrolling that has been done of the viewport area (or any other scrollable element) is taken into account when computing the bounding rectangle.
Element.getElementsByClassName() - Web APIs
examples matching a single class to look for elements that include among their classes a single specified class, we just provide that class name when calling getelementsbyclassname(): element.getelementsbyclassname('test'); this example finds all elements that have a class of test, which are also a descendant of the element that has the id of main: document.getelementbyid('main').getelementsbyclassname('test'); matching multiple classes to find elements whose class lists include both the red and test classes: element.getelementsbyclassna...
Element.id - Web APIs
WebAPIElementid
another common case is to use an element's id as a selector when styling the document with css.
Element.insertAdjacentElement() - Web APIs
when one is clicked, it becomes selected and you can then press the insert before and insert after buttons to insert new divs before or after the selected element using insertadjacentelement().
Element: mousewheel event - Web APIs
when a user operates the device for scrolling to right, the value is negative.
Element: msContentZoom event - Web APIs
the mscontentzoom event fires when a user zooms the element (changes the scale of the content).
Element.name - Web APIs
WebAPIElementname
when used with a form or elements collection, it may return a single element or a collection.
Element.onfullscreenerror - Web APIs
the element interface's onfullscreenerror property is an event handler for the fullscreenerror event which is sent to the element when an error occurs while attempting to transition into or out of full-screen mode.
Element: overflow event - Web APIs
the overflow event is fired when an element has been overflowed by its content or has been rendered for the first time in this state (only works for elements styled with overflow != visible).
Element.part - Web APIs
WebAPIElementpart
here the part attribute is used to find the shadow parts, and the part property is then used to change the part identifiers of each tab so the correct styling is applied to the active tab when tabs are clicked.
Element: paste event - Web APIs
the paste event is fired when the user has initiated a "paste" action through the browser's user interface.
Element.removeAttributeNode() - Web APIs
the replacing attribute has the same namespace uri and local name, as well as the original prefix, when applicable.
Element.scrollHeight - Web APIs
element.scrollheight - element.scrolltop === element.clientheight when the container does not scroll, but has overflowing children, these checks determine if the container can scroll: window.getcomputedstyle(element).overflowy === 'visible' window.getcomputedstyle(element).overflowy !== 'hidden' scrollheight demo associated with the onscroll event, this equivalence can be useful to determine whether a user has read a text or not (see also the element.scrolltop a...
Element.scrollLeft - Web APIs
if the element's direction is rtl (right-to-left), then scrollleft is 0 when the scrollbar is at its rightmost position (at the start of the scrolled content), and then increasingly negative as you scroll towards the end of the content.
Element: select event - Web APIs
the select event fires when some text has been selected.
Element.setAttribute() - Web APIs
the attribute name is automatically converted to all lower-case when setattribute() is called on an html element in an html document.
Element: show event - Web APIs
the show event is fired when a contextmenu event was fired on/bubbled to an element that has a contextmenu attribute.
Element.slot - Web APIs
WebAPIElementslot
when <my-paragraph> is used in the document, the slot is populated by a slotable element by including it inside the element with a slot attribute with the value my-text.
Element.tagName - Web APIs
WebAPIElementtagName
example html <span id="born">when i was born...</span> javascript var span = document.getelementbyid("born"); console.log(span.tagname); in xhtml (or any other xml format), the original case will be maintained, so "span" would be output in case the original tag name was created lowercase.
Element.toggleAttribute() - Web APIs
the attribute name is automatically converted to all lower-case when toggleattribute() is called on an html element in an html document.
Element: touchcancel event - Web APIs
the touchcancel event is fired when one or more touch points have been disrupted in an implementation-specific manner (for example, too many touch points are created).
Element: touchend event - Web APIs
the touchend event fires when one or more touch points are removed from the touch surface.
Element: touchmove event - Web APIs
the touchmove event is fired when one or more touch points are moved along the touch surface.
Element: touchstart event - Web APIs
the touchstart event is fired when one or more touch points are placed on the touch surface.
Element: webkitmouseforcedown event - Web APIs
after a mousedown event has been fired at the element, if and when sufficient pressure has been applied to the mouse or trackpad button to qualify as a "force click," safari begins sending webkitmouseforcedown events to the element.
Element: webkitmouseforceup event - Web APIs
the non-standard webkitmouseforceup event is fired by safari at an element some time after the webkitmouseforcedown event, when pressure on the button has been reduced sufficiently to end the "force click".
Element: webkitmouseforcewillbegin event - Web APIs
this offers the opportunity to tell the system not to trigger any default force touch actions if and when the click turns into a force touch event.
ElementCSSInlineStyle - Web APIs
when getting, it returns a cssstyledeclaration object that contains a list of all styles properties for that element with values assigned for the attributes that are defined in the element's inline style attribute.methodsthis interface has no methods.
Encrypted Media Extensions API - Web APIs
interfaces mediakeymessageevent contains the content and related data when the content decryption module (cdm) generates a message for the session.
Event.composed - Web APIs
WebAPIEventcomposed
child(pelem); } }); we then insert one of each element into our page: <open-shadow text="i have an open shadow root"></open-shadow> <closed-shadow text="i have a closed shadow root"></closed-shadow> then include a click event listener on the <html> element: document.queryselector('html').addeventlistener('click',function(e) { console.log(e.composed); console.log(e.composedpath()); }); when you click on the <open-shadow> element and then the <closed-shadow> element, you'll notice two things.
Event.composedPath() - Web APIs
child(pelem); } }); we then insert one of each element into our page: <open-shadow text="i have an open shadow root"></open-shadow> <closed-shadow text="i have a closed shadow root"></closed-shadow> then include a click event listener on the <html> element: document.queryselector('html').addeventlistener('click',function(e) { console.log(e.composed); console.log(e.composedpath()); }); when you click on the <open-shadow> element and then the <closed-shadow> element, you'll notice two things.
Event.eventPhase - Web APIs
WebAPIEventeventPhase
event listeners registered for capture mode when eventtarget.addeventlistener() was called are triggered during this phase.
Event.explicitOriginalTarget - Web APIs
for example, mouse events are retargeted to their parent node when they happen over text nodes (see bug 185889), and in that case currenttarget will show the parent and explicitoriginaltarget will show the text node.
Event.isTrusted - Web APIs
WebAPIEventisTrusted
the istrusted read-only property of the event interface is a boolean that is true when the event was generated by a user action, and false when the event was created or modified by a script or dispatched via eventtarget.dispatchevent().
Event.preventDefault() - Web APIs
html here's the form: <div class="container"> <p>please enter your name using lowercase letters only.</p> <form> <input type="text" id="my-textbox"> </form> </div> css we use a little bit of css for the warning box we'll draw when the user presses an invalid key: .warning { border: 2px solid #f39389; border-radius: 2px; padding: 10px; position: absolute; background-color: #fbd8d4; color: #3b3c40; } javascript and here's the javascript code that does the job.
EventListener.handleEvent() - Web APIs
the eventlistener method handleevent() method is called by the user agent when an event is sent to the eventlistener, in order to handle events that occur on an observed eventtarget.
EventSource: error event - Web APIs
the error event of the eventsource api is fired when a connection with an event source fails to be opened.
EventSource: message event - Web APIs
the message event of the eventsource api is fired when data is received through an event source.
EventSource.onerror - Web APIs
the onerror property of the eventsource interface is an eventhandler called when an error occurs and the error event is dispatched on an eventsource object.
EventSource.onmessage - Web APIs
the onmessage property of the eventsource interface is an eventhandler called when a message event is received, that is when a message is coming from the source.
EventSource.onopen - Web APIs
the onopen property of the eventsource interface is an eventhandler called when an open event is received, that is when the connection was just opened.
EventSource: open event - Web APIs
the open event of the eventsource api is fired when a connection with an event source is opened.
EventTarget.removeEventListener() - Web APIs
ceeds element.removeeventlistener("mousedown", handlemousedown, false); // succeeds element.removeeventlistener("mousedown", handlemousedown, true); // fails it's worth noting that some browser releases have been inconsistent on this, and unless you have specific reasons otherwise, it's probably wise to use the same values used for the call to addeventlistener() when calling removeeventlistener().
ExtendableMessageEvent.data - Web APIs
examples when the following code is used inside a service worker to respond to a push messages by sending the data received via pushmessagedata to the main context via a channel message, the event object of onmessage will be a extendablemessageevent.
ExtendableMessageEvent.lastEventId - Web APIs
examples when the following code is used inside a service worker to respond to a push messages by sending the data received via pushmessagedata to the main context via a channel message, the event object of onmessage will be a extendablemessageevent.
ExtendableMessageEvent.origin - Web APIs
examples when the following code is used inside a service worker to respond to a push messages by sending the data received via pushmessagedata to the main context via a channel message, the event object of onmessage will be a extendablemessageevent.
ExtendableMessageEvent.ports - Web APIs
examples when the following code is used inside a service worker to respond to a push messages by sending the data received via pushmessagedata to the main context via a channel message, the event object of onmessage will be a extendablemessageevent.
ExtendableMessageEvent.source - Web APIs
examples when the following code is used inside a service worker to respond to a push messages by sending the data received via pushmessagedata to the main context via a channel message, the event object of onmessage will be a extendablemessageevent.
ExtendableMessageEvent - Web APIs
the extendablemessageevent interface of the service worker api represents the event object of a message event fired on a service worker (when a message is received on the serviceworkerglobalscope from another context) — extends the lifetime of such events.
FetchEvent() - Web APIs
isreload read only a boolean that signifies whether the page was reloaded or not when the event was dispatched.
FetchEvent.preloadResponse - Web APIs
when fired, pass a promise that back to the controlled page to fetchevent.respondwith().
FetchEvent.request - Web APIs
when fired, pass a promise that back to the controlled page to fetchevent.respondwith().
FetchEvent.resultingClientId - Web APIs
for example, when navigating from page a to page b resultingclientid is the id of the client associated with page b.
Cross-global fetch usage - Web APIs
when a cross-origin fetch involving a relative url is initiated from an <iframe>, the relative url used to be resolved against the current global location, rather than the iframe's location.
File.File() - Web APIs
WebAPIFileFile
lastmodified: a number representing the number of milliseconds between the unix time epoch and when the file was last modified.
File.webkitRelativePath - Web APIs
when the change event occurs, a list of all files contained within the selected directory hierarchies is generated and displayed.
FileList - Web APIs
WebAPIFileList
it's also used for a list of files dropped into web content when using the drag and drop api; see the datatransfer object for details on this usage.
FileReader.abort() - Web APIs
WebAPIFileReaderabort
syntax instanceoffilereader.abort(); exceptions dom_file_abort_err thrown when abort is called while no read operation is in progress (that is, the state isn't loading).
FileReader: abort event - Web APIs
the abort event is fired when a read has been aborted: for instance because the program called filereader.abort().
FileReader: error event - Web APIs
the error event is fired when the read failed due to an error (for example, because the file was not found or not readable).
FileReader: load event - Web APIs
the load event is fired when a file has been read successfully.
FileReader: loadend event - Web APIs
the loadend event is fired when a file read has completed, successfully or not.
FileReader: loadstart event - Web APIs
the loadstart event is fired when a file read operation has begun.
FileReader.onload - Web APIs
WebAPIFileReaderonload
the filereader.onload property contains an event handler executed when the load event is fired, when content read with readasarraybuffer, readasbinarystring, readasdataurl or readastext is available.
FileReader.readAsArrayBuffer() - Web APIs
when the read operation is finished, the readystate becomes done, and the loadend is triggered.
FileReader.readAsBinaryString() - Web APIs
when the read operation is finished, the readystate becomes done, and the loadend is triggered.
FileReader.readAsDataURL() - Web APIs
when the read operation is finished, the readystate becomes done, and the loadend is triggered.
FileReader.readAsText() - Web APIs
when the read operation is complete, the readystate is changed to done, the loadend event is triggered, and the result property contains the contents of the file as a text string.
FileReader.result - Web APIs
WebAPIFileReaderresult
it works by creating a filereader object and creating a listener for load events such that when then file is read, the result is obtained and passed to the callback function provided to read().
FileSystem - Web APIs
it's not available for use in file or folder picker panels (such as when you use an <input> element with the htmlinputelement.webkitdirectory attribute.firefox full support 50ie no support noopera full support 15prefixed full support 15prefixed prefixed implemented with the vendor prefix: w...
FileSystemDirectoryEntry.createReader() - Web APIs
when it returns an empty array, the end of the directory has beenr reached, and the recursion ends.
FileSystemDirectoryReader.readEntries() - Web APIs
syntax readentries(successcallback[, errorcallback]); parameters successcallback a function which is called when the directory's contents have been retrieved.
FileSystemEntry.getMetadata() - Web APIs
syntax filesystementry.getmetadata(successcallback[, errorcallback]); parameters successcallback a function which is called when the copy operation is succesfully completed.
FileSystemEntry.getParent() - Web APIs
syntax filesystementry.getparent(successcallback[, errorcallback]); parameters successcallback a function which is called when the parent directory entry has been retrieved.
FileSystemEntry.toURL() - Web APIs
syntax filesystementry.tourl([mimetype]); parameters mimetype optional an optional string specifying the mime type to use when interpreting the file.
FileHandle API - Web APIs
); // let's read a 1gb file var action = myfile.readasarraybuffer(1000000000); action.onprogress = function (event) { if (progress) { progress.value = event.loaded; progress.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.
FocusEvent() - Web APIs
when the event has both a source and a destination, the relatedtarget value must be set to the other target.
FocusEvent.relatedTarget - Web APIs
relatedtarget may also be set to null for security reasons, like when tabbing in or out of a page.
FocusEvent - Web APIs
in some cases (such as when tabbing in or out a page), this property may be set to null for security reasons.
FontFace.load - Web APIs
WebAPIFontFaceload
return value a promise that resolves with a reference to the current fontface object when the font loads or rejects with a networkerror if the loading process fails.
FontFace.loaded - Web APIs
WebAPIFontFaceloaded
the loaded read-only property of the fontface interface returns a promise that resolves with the current fontface object when the font specified in the object's constructor is done loading or rejects with a syntaxerror.
FontFaceSet.load() - Web APIs
WebAPIFontFaceSetload
the promise is fulfilled when all the fonts are loaded; it is rejected if one of the fonts failed to load.
FontFaceSetLoadEvent.FontFaceSetLoadEvent() - Web APIs
the fontfacesetloadevent constructor creates a new fontfaceloadevent object which is fired whenever a fontfaceset loads.
FontFaceSetLoadEvent - Web APIs
the fontfacesetloadevent interface of the the css font loading api is fired whenever a fontfaceset loads.
FormData.append() - Web APIs
WebAPIFormDataappend
filename optional the filename reported to the server (a usvstring), when a blob or file is passed as the second parameter.
FormData.set() - Web APIs
WebAPIFormDataset
filename optional the filename reported to the server (a usvstring), when a blob or file is passed as the second parameter.
FormDataEvent.formData - Web APIs
the formdata read only property of the formdataevent interface contains the formdata object representing the data contained in the form when the event was fired.
FullscreenOptions.navigationUI - Web APIs
the fullscreenoptions dictionary's navigationui property is used when calling requestfullscreen() to specify to what extent the user agent should include its standard user interface while the element is presented in full-screen mode.
FullscreenOptions - Web APIs
the fullscreenoptions dictionary is used to provide configuration options when calling requestfullscreen() on an element to place that element into full-screen mode.
GainNode.gain - Web APIs
WebAPIGainNodegain
example the following example shows basic usage of an audiocontext to create a gainnode, which is then used to mute and unmute the audio when a mute button is clicked by changing the gain property value.
GainNode - Web APIs
WebAPIGainNode
example the following example shows basic usage of an audiocontext to create a gainnode, which is then used to mute and unmute the audio when a mute button is clicked by changing the gain property value.
GamepadButton - Web APIs
note: this is the case in firefox gecko 28 and later; chrome and earlier firefox versions still return an array of double values when this property is accessed.
GamepadHapticActuator.pulse() - Web APIs
return value a promise that resolves with a value of true when the pulse has successfully completed.
Geolocation.clearWatch() - Web APIs
syntax navigator.geolocation.clearwatch(id); parameters id the id number returned by the geolocation.watchposition() method when installing the handler you wish to remove.
GeolocationPositionError - Web APIs
the geolocationpositionerror interface represents the reason of an error occurring when using the geolocating device.
GlobalEventHandlers.onloadstart - Web APIs
the loadstart event is fired when progress has begun.
GlobalEventHandlers.onblur - Web APIs
the blur event is raised when an element loses focus.
GlobalEventHandlers.oncancel - Web APIs
the cancel event fires when the user indicates a wish to dismiss a <dialog>.
GlobalEventHandlers.oncanplay - Web APIs
the canplay event is fired when the user agent can play the media, but estimates that not enough data has been loaded to play the media up to its end without having to stop for further buffering of content.
GlobalEventHandlers.oncanplaythrough - Web APIs
the canplaythrough event is fired when the user agent can play the media and estimates that enough data has been loaded to play the media up to its end without having to stop for further buffering of content.
GlobalEventHandlers.onchange - Web APIs
change events fire when the user commits a value change to a form control.
GlobalEventHandlers.onclose - Web APIs
the close event fires when the user closes a <dialog>.
GlobalEventHandlers.oncuechange - Web APIs
the cuechange event fires when a texttrack has changed the currently displaying cues.
GlobalEventHandlers.ondblclick - Web APIs
the dblclick event is raised when the user double clicks an element.
GlobalEventHandlers.ondurationchange - Web APIs
the durationchange event is fired when the duration attribute has been updated.
GlobalEventHandlers.onemptied - Web APIs
the emptied event is fired when the media has become empty; for example, this event is sent if the media has already been loaded (or partially loaded), and the load() method is called to reload it.
GlobalEventHandlers.onended - Web APIs
the ended event is fired when playback has stopped because the end of the media was reached.
GlobalEventHandlers.onfocus - Web APIs
the focus event is raised when the user sets focus on an element.
GlobalEventHandlers.onformdata - Web APIs
this happens when the form is submitted, but can also be triggered by the invocation of a formdata() constructor.
GlobalEventHandlers.oninvalid - Web APIs
the invalid event fires when a submittable element has been checked and doesn't satisfy its constraints.
GlobalEventHandlers.onloadeddata - Web APIs
the loadeddata event is fired when the first frame of the media has finished loading.
GlobalEventHandlers.onloadedmetadata - Web APIs
the loadedmetadata event is fired when the metadata has been loaded.
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 progress 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 progress 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.
GlobalEventHandlers.onmouseenter - Web APIs
the mouseenter event is fired when a pointing device (usually a mouse) is moved over the element that has the listener attached.
GlobalEventHandlers.onmouseleave - Web APIs
the mouseleave event is fired when a pointing device (usually a mouse) is moved off the element that has the listener attached.
GlobalEventHandlers.onmousemove - Web APIs
the mousemove event fires when the user moves the mouse.
GlobalEventHandlers.onmouseover - Web APIs
the mouseover event fires when the user moves the mouse over a particular element.
GlobalEventHandlers.onmousewheel - Web APIs
the mousewheel event is fired asynchronously when a mouse wheel or similar device is operated.
GlobalEventHandlers.onpause - Web APIs
the pause event is fired when media playback has been paused.
GlobalEventHandlers.onplaying - Web APIs
the playing event is fired when playback is ready to start after having been paused or delayed due to lack of media data.
GlobalEventHandlers.onpointerleave - Web APIs
the global event handler for the pointerleave event, which is delivered to a node when the pointer (mouse cursor, fingertip, etc.) exits its hit test area (for example, if the cursor exits an element or window's content area).
GlobalEventHandlers.onscroll - Web APIs
the scroll event fires when the document view or an element has been scrolled, whether by the user, a web api, or the user agent.
GlobalEventHandlers.onselectionchange - Web APIs
the selectionchange event fires when the text selected on a webpage changes.
GlobalEventHandlers.onselectstart - Web APIs
the selectstart event fires when the user starts to make a new text selection on a webpage.
GlobalEventHandlers.onsubmit - Web APIs
the submit event fires when the user submits a form.
GlobalEventHandlers.onwheel - Web APIs
the wheel event fires when the user rotates the mouse (or other pointing device) wheel.
HTMLAreaElement - Web APIs
htmlareaelement.referrerpolicy is a domstring that reflects the referrerpolicy html attribute indicating which referrer to use when fetching the linked resource.
msAudioCategory - Web APIs
game audio needed for the game experience (dancing games, music games) feature films (designed to pause when they go to the background) no gameeffects game sound effects designed to mix with existing audio characters talking all non-music sounds no gamemedia background music played by a game no soundeffects game or other sound effects designed to mix with existing audio: characters talking beeps, din...
msAudioDeviceType - Web APIs
syntax <audio src="sound.mp3" msaudiodevicetype="communications" /> by default, audio on your system will output to your default speakers and be considered a foreground element, meaning that the audio will play only when the element is active in the app.
HTMLCanvasElement.captureStream() - Web APIs
if not set, a new frame will be captured each time the canvas changes; if set to 0, frames will not be captured automatically; instead, they will only be captured when the returned track's requestframe() method is called.
HTMLCanvasElement.height - Web APIs
when the attribute is not specified, or if it is set to an invalid value, like a negative, the default value of 150 is used.
HTMLCanvasElement.mozFetchAsStream() - Web APIs
the htmlcanvaselement.mozfetchasstream() internal method used to create a new input stream that, when ready, would provide the contents of the canvas as image data.
HTMLCanvasElement.mozGetAsFile() - Web APIs
type optional a domstring which specifies the image file format to use when creating the new image file.
HTMLCanvasElement.toBlob() - Web APIs
the third argument is used when creating images using lossy compression (namely, image/jpeg) to specify the quality of the output.
HTMLCanvasElement.width - Web APIs
when the attribute is not specified, or if it is set to an invalid value, like a negative, the default value of 300 is used.
HTMLDetailsElement - Web APIs
toggle fired when the open/closed state of a <details> element is toggled.
HTMLDialogElement.close() - Web APIs
examples the following example shows a simple button that, when clicked, opens a <dialog> containing a form via the showmodal() method.
HTMLDialogElement: close event - Web APIs
the close event is fired on an htmldialogelement object when the dialog it represents has been closed.
HTMLDialogElement.open - Web APIs
examples the following example shows a simple button that, when clicked, opens a <dialog> containing a form via the showmodal() method.
HTMLDialogElement.show() - Web APIs
examples the following example shows a simple button that, when clicked, opens a <dialog> containing a form via the show() method.
HTMLDialogElement.showModal() - Web APIs
examples the following example shows a simple button that, when clicked, opens a <dialog> containing a form via the showmodal() method.
HTMLElement: animationend event - Web APIs
the animationend event is fired when a css animation has completed.
HTMLElement: animationiteration event - Web APIs
the animationiteration event is fired when an iteration of a css animation ends, and another one begins.
HTMLElement: gotpointercapture event - Web APIs
the gotpointercapture event is fired when an element captures a pointer using setpointercapture().
HTMLElement.oncopy - Web APIs
the copy event fires when the user attempts to copy text.
HTMLElement.oncut - Web APIs
WebAPIHTMLElementoncut
the cut event fires when the user attempts to cut text.
HTMLElement.onpaste - Web APIs
the paste event fires when the user attempts to paste text.
HTMLElement: pointercancel event - Web APIs
the pointercancel event is fired when the browser determines that there are unlikely to be any more pointer events, or if after the pointerdown event is fired, the pointer is then used to manipulate the viewport by panning, zooming, or scrolling.
HTMLElement: pointerenter event - Web APIs
the pointerenter event fires when a pointing device is moved into the hit test boundaries of an element or one of its descendants, including as a result of a pointerdown event from a device that does not support hover (see pointerdown).
HTMLElement: pointermove event - Web APIs
the pointermove event is fired when a pointer changes coordinates, and the pointer has not been canceled by a browser touch-action.
HTMLElement: pointerout event - Web APIs
the pointerout event is fired for several reasons including: pointing device is moved out of the hit test boundaries of an element; firing the pointerup event for a device that does not support hover (see pointerup); after firing the pointercancel event (see pointercancel); when a pen stylus leaves the hover range detectable by the digitizer.
HTMLElement: pointerover event - Web APIs
the pointerover event is fired when a pointing device is moved into an element's hit test boundaries.
HTMLElement: pointerup event - Web APIs
the pointerup event is fired when a pointer is no longer active.
HTMLElement.title - Web APIs
WebAPIHTMLElementtitle
the htmlelement.title property represents the title of the element: the text usually displayed in a 'tooltip' popup when the mouse is over the node.
HTMLElement: transitioncancel event - Web APIs
the transitioncancel event is fired when a css transition is canceled.
HTMLFieldSetElement - Web APIs
this can be used when accessing the field set in javascript.
HTMLFormElement.action - Web APIs
the action of a form is the program that is executed on the server when the form is submitted.
HTMLFormElement.elements - Web APIs
the elements included by htmlformelement.elements and htmlformelement.length are the following: <button> <fieldset> <input> (with the exception that any whose type is "image" are omitted for historical reasons) <object> <output> <select> <textarea> no other elements are included in the list returned by elements, which makes it an excellent way to get at the elements most important when processing forms.
HTMLFormElement: formdata event - Web APIs
this happens when the form is submitted, but can also be triggered by the invocation of a formdata() constructor.
HTMLFormElement.length - Web APIs
the elements included by htmlformelement.elements and htmlformelement.length are the following: <button> <fieldset> <input> (with the exception that any whose type is "image" are omitted for historical reasons) <object> <output> <select> <textarea> no other elements are included in the list returned by elements, which makes it an excellent way to get at the elements most important when processing forms.
HTMLFormElement.reportValidity() - Web APIs
when false is returned, cancelable invalid events are fired for each invalid child and validation problems are reported to the user.
HTMLFormElement.requestSubmit() - Web APIs
usage notes the obvious question is: why does this method exist, when we've had the submit() method since the dawn of time?
HTMLIFrameElement.src - Web APIs
the htmliframeelement.src property reflects the html referrerpolicy attribute of the <iframe> element defining which referrer is sent when fetching the resource.
HTMLIFrameElement - Web APIs
htmliframeelement.referrerpolicy is a domstring that reflects the referrerpolicy html attribute indicating which referrer to use when fetching the linked resource.
HTMLImageElement.align - Web APIs
it may be worth noting that vertical-align offers several additional options for its value; you may wish to consider these when changing your code to use it.
HTMLImageElement.complete - Web APIs
but imagine that you have other code that needs to only run when the image has completed loading, such as a command that performs red-eye removal on the image in the lightbox.
HTMLImageElement.currentSrc - Web APIs
this is useful when you provide multiple image options using the sizes and/or htmlimageelement.srcset properties.
HTMLImageElement.decoding - Web APIs
this can be useful when applied to <img> elements, but may be even more so when used for offscreen image objects.
HTMLImageElement.hspace - Web APIs
the obsolete hspace property of the htmlimageelement interface specifies the number of pixels of empty space to leave empty on the left and right sides of the <img> element when laying out the page.
HTMLImageElement.isMap - Web APIs
usage notes when an image marked as being part of a server-side image map is clicked, the browser constructs the string "?x,y", where x and y indicate the coordinates at which the mouse was clicked as offsets from the top-left corner of the image, specified in css pixels.
HTMLImageElement.naturalHeight - Web APIs
this is the height at which the image is naturally drawn when no constraint or specific value is established for the image.
HTMLImageElement.naturalWidth - Web APIs
this is the width at which the image is naturally drawn when no constraint or specific value is established for the image.
HTMLImageElement.referrerPolicy - Web APIs
the htmlimageelement.referrerpolicy property reflects the html referrerpolicy attribute of the <img> element defining which referrer is sent when fetching the resource.
HTMLImageElement.sizes - Web APIs
each source size descriptor is comprised of a media condition, then at least one whitespace character, then the source size value to use for the image when the media condition evaluates to true.
HTMLImageElement.vspace - Web APIs
the obsolete vspace property of the htmlimageelement interface specifies the number of pixels of empty space to leave empty on the top and bottom of the <img> element when laying out the page.
HTMLInputElement: search event - Web APIs
the search event is fired when a search is initiated usinng an <input> element of type="search".
HTMLKeygenElement - Web APIs
properties autofocus is a boolean that reflects the autofocus html attribute, indicating that the form control should have input focus when the page loads.
HTMLLinkElement.referrerPolicy - Web APIs
the htmllinkelement.referrerpolicy property reflect the html referrerpolicy attribute of the <link> element defining which referrer is sent when fetching the resource.
HTMLMediaElement: abort event - Web APIs
the abort event is fired when the resource was not fully loaded, but not as the result of an error.
HTMLMediaElement.audioTracks - Web APIs
once you have a reference to the list, you can monitor it for changes to detect when new audio tracks are added or existing ones removed.
HTMLMediaElement.controlsList - Web APIs
the controlslist property of the htmlmediaelement interface returns a domtokenlist that helps the user agent select what controls to show on the media element whenever the user agent shows its own set of controls.
HTMLMediaElement.error - Web APIs
when an error event is received by the element, you can determine details about what happened by examining this object.
HTMLMediaElement: error event - Web APIs
the error event is fired when the resource could not be loaded due to an error (for example, a network connectivity problem).
HTMLMediaElement.load() - Web APIs
this method is generally only useful when you've made dynamic changes to the set of sources available for the media element, either by changing the element's src attribute or by adding or removing <source> elements nested within the media element itself.
HTMLMediaElement: loadstart event - Web APIs
the loadstart event is fired when the browser has started to load a resource.
HTMLMediaElement.loop - Web APIs
the htmlmediaelement.loop property reflects the loop html attribute, which controls whether the media element should start over when it reaches the end.
HTMLMediaElement.onencrypted - Web APIs
the onencrypted property of the htmlmediaelement is an event handler, fired whenever an encrypted event occurs, denoting the media is encrypted.
HTMLMediaElement.onwaitingforkey - Web APIs
the onwaitingforkey property of the htmlmediaelement is an event handler, fired when a waitingforkey event occurs, when playback is blocked while waiting for an encryption key.
HTMLMediaElement.playbackRate - Web APIs
the audio is muted when the fast forward or slow motion is outside a useful range (for example, gecko mutes the sound outside the range 0.25 to 5.0).
HTMLMediaElement.seekToNextFrame() - Web APIs
this method returns immediately, returning a promise, whose fulfillment handler is called when the seek operation is complete.
HTMLMediaElement.setSinkId() - Web APIs
this only works when the application is authorized to use the specified device.
HTMLMediaElement.videoTracks - Web APIs
once you have a reference to the list, you can monitor it for changes to detect when new video tracks are added or existing ones removed.
HTMLOptionElement - Web APIs
if the option is not part of a list of options, like when it is part of the <datalist> element, the value is 0.
HTMLOrForeignElement.dataset - Web APIs
setting values when an attribute is set, its value is always converted into a string.
HTMLParamElement - Web APIs
htmlparamelement.type is a domstring containing the type of the parameter when valuetype has the "ref" value.
HTMLSelectElement.selectedIndex - Web APIs
selectelem.selectedindex; selectelem.selectedindex = index; example html <p id="p">selectedindex: 0</p> <select id="select"> <option selected>option a</option> <option>option b</option> <option>option c</option> <option>option d</option> <option>option e</option> </select> javascript var selectelem = document.getelementbyid('select') var pelem = document.getelementbyid('p') // when a new <option> is selected selectelem.addeventlistener('change', function() { var index = selectelem.selectedindex; // add that data to the <p> pelem.innerhtml = 'selectedindex: ' + index; }) specifications specification status comment html living standardthe definition of 'htmlselectelement' in that specification.
HTMLSelectElement.selectedOptions - Web APIs
when clicked, the event handler fetches the list of selected options using selectedoptions, then iterates over the options in the list.
HTMLSlotElement: slotchange event - Web APIs
the slotchange event is fired on an htmlslotelement instance (<slot> element) when the node(s) contained in that slot change.
HTMLSlotElement - Web APIs
events slotchange fired on an htmlslotelement instance (<slot> element) when the node(s) contained in that slot change.
HTMLTableCellElement - Web APIs
this alternate label can be used in other contexts, such as when describing the headers that apply to a data cell.
HTMLTableRowElement.rowIndex - Web APIs
even when the <thead>, <tbody>, and <tfoot> elements are out of order in the html, browsers render the table in the right order.
HTMLTableRowElement - Web APIs
the htmlcollection is live and is automatically updated when cells are added or removed.
HTMLTableSectionElement - Web APIs
the htmlcollection is live and is automatically updated when rows are added or removed.
HTMLTrackElement: cuechange event - Web APIs
the cuechange event fires when a texttrack has changed the currently displaying cues.
HTMLVideoElement.msHorizontalMirror - Web APIs
when user moves left, their representation on-screen would move left as well).
HTMLVideoElement.msIsLayoutOptimalForPlayback - Web APIs
you can listen to the onmsvideooptimallayoutchanged event to be notified when the msislayoutoptimalforplayback property changes.
HTMLVideoElement.msZoom - Web APIs
when the mszoom attribute is set to true, the rendered video is trimmed to fit the dimensions of the video object.
onMSVideoFormatChanged - Web APIs
onmsvideoformatchanged is an event which occurs when the video format changes.
onMSVideoFrameStepCompleted - Web APIs
onmsvideoframestepcompleted is an event which occurs when the video frame has been stepped forward or backward one frame.
onMSVideoOptimalLayoutChanged - Web APIs
onmsvideooptimallayoutchanged is an event which occurs when the msislayoutoptimalforplayback state changes.
HashChangeEvent - Web APIs
the hashchangeevent interface represents events that fire when the fragment identifier of the url has changed.
Headers - Web APIs
WebAPIHeaders
note: when header values are iterated over, they are automatically sorted in lexicographical order, and values from duplicate header names are combined.
History.back() - Web APIs
WebAPIHistoryback
add a listener for the popstate event in order to determine when the navigation has completed.
History.forward() - Web APIs
WebAPIHistoryforward
add a listener for the popstate event in order to determine when the navigation has completed.
History.go() - Web APIs
WebAPIHistorygo
add a listener for the popstate event in order to determine when the navigation has completed.
History.pushState() - Web APIs
WebAPIHistorypushState
whenever the user navigates to the new state, a popstate event is fired, and the state property of the event contains a copy of the history entry's state object.
History.replaceState() - Web APIs
this method is particularly useful when you want to update the state object or url of the current history entry in response to some user action.
HkdfParams - Web APIs
the hkdfparams dictionary of the web crypto api represents the object that should be passed as the algorithm parameter into subtlecrypto.derivekey(), when using the hkdf algorithm.
HmacImportParams - Web APIs
the hmacimportparams dictionary of the web crypto api represents the object that should be passed as the algorithm parameter into subtlecrypto.importkey() or subtlecrypto.unwrapkey(), when generating a key for the hmac algorithm.
HmacKeyGenParams - Web APIs
the hmackeygenparams dictionary of the web crypto api represents the object that should be passed as the algorithm parameter into subtlecrypto.generatekey(), when generating a key for the hmac algorithm.
IDBCursor.request - Web APIs
WebAPIIDBCursorrequest
examples when you open a cursor, the request property is then available on that cursor object, to tell you what request object the cursor originated from.
IDBDatabase: abort event - Web APIs
the abort event is fired on idbdatabase when a transaction is aborted and bubbles up to the connection object.
IDBDatabase: close event - Web APIs
the close event is fired on idbdatabase when the database connection is unexpectedly closed.
IDBDatabase.createObjectStore() - Web APIs
example // let us open our database var request = window.indexeddb.open("todolist", 4); // this handler is called when a new version of the database // is created, either when one has not been created before // or when a new version number is submitted by calling // window.indexeddb.open().
IDBDatabase: error event - Web APIs
the error event is fired on idbdatabase when a request returns an error and the event bubbles up to the connection object.
IDBDatabase.onabort - Web APIs
the onabort event handler of the idbdatabase interface handles the abort event, fired when a transaction is aborted and bubbles up to the connection object.
IDBDatabase.onerror - Web APIs
the onerror event handler of the idbdatabase interface handles the error event, fired when a request returns an error and bubbles up to the connection object.
IDBDatabase.transaction() - Web APIs
previously in a readwrite transaction idbtransaction.oncomplete was fired only when all data was guaranteed to have been flushed to disk.
IDBDatabase.version - Web APIs
when a database is first created, this attribute is an empty string.
IDBDatabase: versionchange event - Web APIs
the versionchange event is fired when a database structure change (idbopendbrequest.onupgradeneeded event or idbfactory.deletedatabase) was requested.
IDBDatabaseException - Web APIs
not_allowed_err 6 an operation was called on an object where it is not allowed or at a time when it is not allowed.
IDBDatabaseSync - Web APIs
has the null value when the database is first created.
IDBEnvironment - Web APIs
example the following code creates a request for a database to be opened asychronously, after which the database is opened when the request's onsuccess handler is fired: var db; function opendb() { var dbopenrequest = window.indexeddb.open("todolist"); dbopenrequest.onsuccess = function(e) { db = dbopenrequest.result; }; } browser compatibility the compatibility table on this page is generated from structured data.
IDBFactory.deleteDatabase() - Web APIs
when deletedatabase() is called, any other open connections to this particular database will get a versionchange event.
IDBIndex.count() - Web APIs
WebAPIIDBIndexcount
myindex.count() is then used to count the number of records in the index, and the result of that request is logged to the console when its success callback returns.
IDBIndex.get() - Web APIs
WebAPIIDBIndexget
myindex.get('bungle') is then used to retrieve the record with an lname of bungle, and the result of that request is logged to the console when its success callback returns.
IDBIndex.getKey() - Web APIs
WebAPIIDBIndexgetKey
myindex.getkey('bungle') is then used to retrieve the primary key of the record with an lname of bungle, and the result of that request is logged to the console when its success callback returns.
IDBIndex.unique - Web APIs
WebAPIIDBIndexunique
this is decided when the index is created, using the idbobjectstore.createindex method.
IDBObjectStore.autoIncrement - Web APIs
ta(); }; function adddata() { // create a new object ready to insert into the idb var newitem = [ { tasktitle: "walk dog", hours: 19, minutes: 30, day: 24, month: "december", year: 2013, notified: "no" } ]; // open a read/write db transaction, ready for adding the data var transaction = db.transaction(["todolist"], "readwrite"); // report on the success of the transaction completing, when everything is done transaction.oncomplete = function(event) { note.innerhtml += '<li>transaction completed.</li>'; }; transaction.onerror = function(event) { note.innerhtml += '<li>transaction not opened due to error.
IDBObjectStore.clear() - Web APIs
// this is used a lot below db = dbopenrequest.result; // clear all the data form the object store cleardata(); }; function cleardata() { // open a read/write db transaction, ready for clearing the data var transaction = db.transaction(["todolist"], "readwrite"); // report on the success of the transaction completing, when everything is done transaction.oncomplete = function(event) { note.innerhtml += '<li>transaction completed.</li>'; }; transaction.onerror = function(event) { note.innerhtml += '<li>transaction not opened due to error: ' + transaction.error + '</li>'; }; // create an object store on the transaction var objectstore = transaction.objectstore("todolist"); // make a request to...
IDBObjectStore.count() - Web APIs
example in this simple fragment we create a transaction, retrieve an object store, then count the number of records in the store using count() — when the success handler fires, we log the count value (an integer) to the console.
IDBObjectStore.delete() - Web APIs
this is used a lot below db = dbopenrequest.result; // run the deletedata() function to delete a record from the database deletedata(); }; function deletedata() { // open a read/write db transaction, ready for deleting the data var transaction = db.transaction(["todolist"], "readwrite"); // report on the success of the transaction completing, when everything is done transaction.oncomplete = function(event) { note.innerhtml += '<li>transaction completed.</li>'; }; transaction.onerror = function(event) { note.innerhtml += '<li>transaction not opened due to error: ' + transaction.error + '</li>'; }; // create an object store on the transaction var objectstore = transaction.objectstore("todolist"); // make a request to...
IDBObjectStore.get() - Web APIs
// this is used a lot below db = dbopenrequest.result; // run the getdata() function to get the data from the database getdata(); }; function getdata() { // open a read/write db transaction, ready for retrieving the data var transaction = db.transaction(["todolist"], "readwrite"); // report on the success of the transaction completing, when everything is done transaction.oncomplete = function(event) { note.innerhtml += '<li>transaction completed.</li>'; }; transaction.onerror = function(event) { note.innerhtml += '<li>transaction not opened due to error: ' + transaction.error + '</li>'; }; // create an object store on the transaction var objectstore = transaction.objectstore("todolist"); // make a request to...
IDBObjectStore.getKey() - Web APIs
example let openrequest = indexeddb.open("telemetry"); openrequest.onsuccess = (event) => { let db = event.target.result; let store = db.transaction("netlogs").objectstore("netlogs"); let today = new date(); let yesterday = new date(today); yesterday.setdate(today.getdate() - 1); let request = store.getkey(idbkeyrange(yesterday, today)); request.onsuccess = (event) => { let when = event.target.result; alert("the 1st activity in last 24 hours was occurred at " + when); }; }; specifications specification status comment indexed database api draftthe definition of 'getkey()' in that specification.
IDBObjectStore.indexNames - Web APIs
ta(); }; function adddata() { // create a new object ready to insert into the idb var newitem = [ { tasktitle: "walk dog", hours: 19, minutes: 30, day: 24, month: "december", year: 2013, notified: "no" } ]; // open a read/write db transaction, ready for adding the data var transaction = db.transaction(["todolist"], "readwrite"); // report on the success of the transaction completing, when everything is done transaction.oncomplete = function(event) { note.innerhtml += '<li>transaction completed.</li>'; }; transaction.onerror = function(event) { note.innerhtml += '<li>transaction not opened due to error.
IDBObjectStore.keyPath - Web APIs
ta(); }; function adddata() { // create a new object ready to insert into the idb var newitem = [ { tasktitle: "walk dog", hours: 19, minutes: 30, day: 24, month: "december", year: 2013, notified: "no" } ]; // open a read/write db transaction, ready for adding the data var transaction = db.transaction(["todolist"], "readwrite"); // report on the success of the transaction completing, when everything is done transaction.oncomplete = function(event) { note.innerhtml += '<li>transaction completed.</li>'; }; transaction.onerror = function(event) { note.innerhtml += '<li>transaction not opened due to error.
IDBObjectStore.transaction - Web APIs
ta(); }; function adddata() { // create a new object ready to insert into the idb var newitem = [ { tasktitle: "walk dog", hours: 19, minutes: 30, day: 24, month: "december", year: 2013, notified: "no" } ]; // open a read/write db transaction, ready for adding the data var transaction = db.transaction(["todolist"], "readwrite"); // report on the success of the transaction completing, when everything is done transaction.oncomplete = function(event) { note.innerhtml += '<li>transaction completed.</li>'; }; transaction.onerror = function(event) { note.innerhtml += '<li>transaction not opened due to error.
IDBOpenDBRequest: blocked event - Web APIs
the blocked handler is executed when an open connection to a database is blocking a versionchange transaction on the same database.
IDBOpenDBRequest.onblocked - Web APIs
this event is triggered when the upgradeneeded should be triggered because of a version change but the database is still in use (that is, not closed) somewhere, even after the versionchange event was sent.
IDBOpenDBRequest.onupgradeneeded - Web APIs
the onupgradeneeded property of the idbopendbrequest interface is the event handler for the upgradeneeded event, triggered when a database of a bigger version number than the existing stored database is loaded.
IDBOpenDBRequest: upgradeneeded event - Web APIs
the upgradeneeded event is fired when an attempt was made to open a database with a version number higher than its current version.
IDBRequest: error event - Web APIs
the error handler is executed when an error caused a request to fail.
IDBRequest.result - Web APIs
WebAPIIDBRequestresult
retitlerequest = objectstore.get(title); objectstoretitlerequest.onsuccess = function() { // grab the data object returned as the result var data = objectstoretitlerequest.result; // update the notified value in the object to "yes" data.notified = "yes"; // create another request that inserts the item // back into the database var updatetitlerequest = objectstore.put(data); // when this new request succeeds, run the displaydata() // function again to update the display updatetitlerequest.onsuccess = function() { displaydata(); }; }; specifications specification status comment indexed database api 2.0the definition of 'result' in that specification.
IDBRequest: success event - Web APIs
the success event is fired when an idbrequest succeeds.
IDBTransaction.commit() - Web APIs
note that commit() doesn't normally have to be called — a transaction will automatically commit when all outstanding requests have been satisfied and no new requests have been made.
IDBTransaction: complete event - Web APIs
the complete handler is executed when a transaction successfully completed.
IDBTransaction: error event - Web APIs
the error event is fired on idbtransaction when a request returns an error and the event bubbles up to the transaction object.
IDBVersionChangeEvent.oldVersion - Web APIs
when the opened database doesn't exist yet, the value of oldversion is 0.
IIRFilterNode - Web APIs
as an iir filter, the non-zero input continues forever, but this can be limited after some finite time in practice, when the output has approached zero closely enough.
IdleDeadline.didTimeout - Web APIs
the read-only didtimeout property on the idledeadline interface is a boolean value which indicates whether or not the idle callback is being invoked because the timeout interval specified when window.requestidlecallback() was called has expired.
IdleDeadline - Web APIs
properties idledeadline.didtimeout read only a boolean whose value is true if the callback is being executed because the timeout specified when the idle callback was installed has expired.
IndexedDB API - Web APIs
the process by which the browser works out how much space to allocate to web data storage and what to delete when that limit is reached is not simple, and differs between browsers.
InputDeviceCapabilities - Web APIs
this allows, for example, touchscreen keyboards and physical keyboards to be represented the same way when they produce the same input.
InputDeviceCapabilities API - Web APIs
what about when the mousedown event is triggered?
InputEvent() - Web APIs
this may be an empty string if the change doesn't insert text (such as when deleting characters, for example).
InputEvent.dataTransfer - Web APIs
examples in the following simple example we've set up an event listener on the input event so that when any content is pasted into the contenteditable <p> element, its html source is retrieved via the inputevent.datatransfer.getdata() method and reported in the paragraph below the input.
InputEvent - Web APIs
this may be an empty string if the change doesn't insert text (such as when deleting characters, for example).
InstallEvent - Web APIs
the promise resolves when all resources have been fetched and cached, or when any exception occurs.
getVersion - Web APIs
installing a component with a null version indicates that the component should always be updated when the opportunity arises.
install - Web APIs
callbackfunc an optional callback function invoked when the installation is complete (see example below).
IntersectionObserver.observe() - Web APIs
when the visibility of the specified element crosses over one of the observer's visibility thresholds (as listed in intersectionobserver.thresholds), the observer's callback is executed with an array of intersectionobserverentry objects representing the intersection changes which occurred.
KeyboardEvent.altKey - Web APIs
the keyboardevent.altkey read-only property is a boolean that indicates if the alt key (option or ⌥ on os x) was pressed (true) or not (false) when the event occured.
KeyboardEvent.charCode - Web APIs
when one or more modifier keys are pressed, there are some complex rules for charcode.
KeyboardEvent.ctrlKey - Web APIs
the keyboardevent.ctrlkey read-only property returns a boolean that indicates if the control key was pressed (true) or not (false) when the event occured.
KeyboardEvent.initKeyboardEvent() - Web APIs
for example, specifying "control shift" indicates that the user was holding down the control and shift keys when pressing the key described by the event.
KeyboardEvent.shiftKey - Web APIs
the keyboardevent.shiftkey read-only property is a boolean that indicates if the shift key was pressed (true) or not (false) when the event occurred.
KeyboardLayoutMap.forEach() - Web APIs
thisarg optional value to use as this (i.e the reference object) when executing callback.
KeyframeEffect.KeyframeEffect() - Web APIs
this is primarily of use when sequencing animations based on the end time of another animation.
KeyframeEffect.getKeyframes() - Web APIs
computedoffset the computed offset for this keyframe, calculated when the list of computed keyframes was produced according to keyframeeffect.spacing.
LocalMediaStream - Web APIs
when the source of the stream is a connected device (such as a camera or microphone), capture of media from the device is halted.
Location: ancestorOrigins - Web APIs
you can use location.ancestororigins in the script for a document to determine, for example, whenever the document is being framed by a site which you don’t expect it to be framed by.
Location: assign() - Web APIs
WebAPILocationassign
this happens if the origin of the script calling the method is different from the origin of the page originally described by the location object, mostly when the script is hosted on a different domain.
Location: replace() - Web APIs
WebAPILocationreplace
this happens if the origin of the script calling the method is different from the origin of the page originally described by the location object, mostly when the script is hosted on a different domain.
Locks.mode - Web APIs
WebAPILockmode
the mode read-only property of the lock interface returns the access mode passed to lockmanager.request() when the lock was requested.
LockedFile.abort() - Web APIs
WebAPILockedFileabort
note: when an ongoing operation is canceled, there is no rollback (it is not a database transaction), therefore the file can be corrupted if the canceled operation was performing some writing.
LockedFile.active - Web APIs
WebAPILockedFileactive
typically, a lockedfile object becomes inactive when the lockedfile.abort() method is called or if an error occurs.
LockedFile.getMetadata() - Web APIs
the following metadata are supported: size : will provide the size of the file lastmodified : will provide the date when the file was last modified return a filerequest object.
LockedFile.oncomplete - Web APIs
syntax instanceoflockedfile.oncomplete = funcref; where funcref is a function to be called when the complete event occurs.
MIDIAccess - Web APIs
event handlers midiaccess.onstatechange called whenever a new midi port is added or an existing port changes state.
MIDIInput - Web APIs
WebAPIMIDIInput
event handlers midiinput.onmidimessage when the current port receives a midimessage it triggers a call to this event handler.
MIDIMessageEvent - Web APIs
a midimessage event is fired every time a midi message is sent from a device represented by a midiinput, for example when a midi keyboard key is pressed, a knob is tweaked, or a slider is moved.
MSCandidateWindowShow - Web APIs
} when the ime candidate window changes position or closes, it fires mscandidatewindowupdate or mscandidatewindowhide events.
MSSiteModeEvent - Web APIs
timestamp gets the time, in milliseconds, when an event occurred.
MediaCapabilitiesInfo - Web APIs
the mediacapabilitiesinfo interface of the media capabilities api is made available when the promise returned by the mediacapabilities.encodinginfo() or mediacapabilities.decodinginfo() methods of the mediacapabilities interface fulfills, providing information as to whether the media type is supported, and whether encoding or decoding such media would be smooth and power efficient.
MediaDecodingConfiguration - Web APIs
the mediadecodingconfiguration dictionary of the media capabilities api is used to define the type of media being tested when calling mediacapabilities.decodinginfo() to query whether a specific media configuration is supported, smooth, and/or power efficient.
MediaDeviceInfo.deviceId - Web APIs
it is reset when the user clears cookies.
MediaDeviceInfo.label - Web APIs
only available during active mediastream use, or when persistent permissions have been granted.
MediaDeviceInfo - Web APIs
it is reset when the user clears cookies (for private browsing, a different identifier is used that is not persisted across sessions).
MediaDevices: devicechange event - Web APIs
a devicechange event is sent to a mediadevices instance whenever a media device such as a camera, microphone, or speaker is connected to or removed from the system.
MediaDevices.enumerateDevices() - Web APIs
syntax var enumeratorpromise = navigator.mediadevices.enumeratedevices(); return value a promise that receives an array of mediadeviceinfo objects when the promise is fulfilled.
MediaDevices.getDisplayMedia() - Web APIs
typeerror the specified constraints include constraints which are not permitted when calling getdisplaymedia().
MediaDevices - Web APIs
events devicechange fired when a media input or output device is attached to or removed from the user's computer.
MediaElementAudioSourceNode.mediaElement - Web APIs
this stream was specified when the node was first created, either using the mediaelementaudiosourcenode() constructor or the audiocontext.createmediaelementsource() method.
MediaEncodingConfiguration - Web APIs
the mediaencodingconfiguration dictionary of the media capabilities api is used to define the type of media being tested when calling mediacapabilities.encodinginfo() to query whether a specific media configuration is supported, smooth, and/or power efficient.
MediaKeyMessageEvent - Web APIs
the mediakeymessageevent interface of the encryptedmediaextensions api contains the content and related data when the content decryption module generates a message for the session.
MediaKeySession.closed - Web APIs
the mediakeysession.closed read-only property returns a promise signaling when a mediakeysession closes.
expiration - Web APIs
this value may change during a session lifetime, such as when an action triggers the start of a window.
MediaKeySession.onkeystatuseschange - Web APIs
the onkeystatuseschange property of the mediakeysession is an event handler, fired whenever a keystatuschange event ocurrs, denoting there has been a change in the keys or their statuses within a session.
MediaKeySession.onmessage - Web APIs
the onmessage property of the mediakeysession is an event handler, fired whenever a mediakeymessageevent occurs, denoting a message is generated by the content decryption module.
MediaKeyStatusMap.forEach() - Web APIs
thisarg optional value used as this when executing callback.
MediaPositionState.duration - Web APIs
the mediapositionstate dictionary's duration property is used when calling the mediasession method setpositionstate() to provide the user agent with the overall total duration in seconds of the media currently being performed.
MediaPositionState.playbackRate - Web APIs
the mediapositionstate dictionary's playbackrate property is used when calling the mediasession method setpositionstate() to tell the user agent the rate at which media is currently being played.
MediaQueryList.addListener() - Web APIs
syntax mediaquerylist.addlistener(func) parameters func a function or function reference representing the callback function you want to run when the media query status changes.
MediaQueryList.matches - Web APIs
you can be notified when the value of matches changes by watching for the change event to be fired at the mediaquerylist.
MediaQueryList.onchange - Web APIs
the onchange property of the mediaquerylist interface is an event handler property representing a function that is invoked when the change event fires, i.e when the status of media query support changes.
MediaQueryList.removeListener() - Web APIs
rt is 600 pixels wide or less */ para.textcontent = 'this is a narrow screen — less than 600px wide.'; document.body.style.backgroundcolor = 'red'; } else { /* the viewport is more than than 600 pixels wide */ para.textcontent = 'this is a wide screen — more than 600px wide.'; document.body.style.backgroundcolor = 'blue'; } } mql.addlistener(screentest); // later on, when it is no longer needed mql.removelistener(screentest); specifications specification status comment css object model (cssom) view modulethe definition of 'removelistener' in that specification.
MediaRecorder: dataavailable event - Web APIs
the mediarecorder interface's dataavailable event is fired when the mediarecorder delivers media data to your application for its use.
MediaRecorder: error event - Web APIs
the mediarecorder interface's error event is fired when an error occurs: for example because recording wasn't allowed or was attempted using an unsupported codec.
MediaRecorder.ignoreMutedMedia - Web APIs
the ignoremutedmedia property of the mediarecorder interface indicates whether the mediarecorder instance will record input, when the input mediastreamtrack is muted.
MediaRecorder.onstop - Web APIs
the stop event is thrown either as a result of the mediarecorder.stop() method being invoked, or when the media stream being captured ends.
MediaRecorder.pause() - Web APIs
when a mediarecorder object’s pause()method is called, the browser queues a task that runs the below steps: if mediarecorder.state is "inactive", raise a dom invalidstate error and terminate these steps.
MediaRecorder.stop() - Web APIs
when the stop() method is invoked, the ua queues a task that runs the following steps: if mediarecorder.state is "inactive", raise a dom invalidstate error and terminate these steps.
MediaRecorderErrorEvent() - Web APIs
in general, you won't create these yourself; they are delivered to your implementation of mediarecorder.onerror when errors occur while recording media.
MediaSession.setPositionState() - Web APIs
if the media is still playing when the interval is fired, setpositionstate() is called with an object that specifies the duration, playback rate, and position as reported by a mymedia object that describes the track being played.
MediaSource.duration - Web APIs
exceptions the following exceptions may be thrown when setting a new value for this property.
MediaSource.isTypeSupported() - Web APIs
all web apis that work with media files use a "no/maybe/probably" approach (or, in this case, "no or probably") when determining if a media type can be used.
active - Web APIs
when that stream becomes available (that is, when the returned promise is fulfilled, a button on the page is updated based on whether or not the stream is currently active.
MediaStream: addtrack event - Web APIs
the addtrack event is fired when a new mediastreamtrack object has been added to a mediastream.
MediaStream: removetrack event - Web APIs
the removetrack event is fired when a new mediastreamtrack object has been removed from a mediastream.
MediaStreamAudioSourceNode.mediaStream - Web APIs
this stream was specified when the node was first created, either using the mediastreamaudiosourcenode() constructor or the audiocontext.createmediastreamsource() method.
MediaStreamAudioSourceOptions.mediaStream - Web APIs
the mediastreamaudiosourceoptions dictionary's mediastream property must specify the mediastream from which to retrieve audio data when instantiating a mediastreamaudiosourcenode using the mediastreamaudiosourcenode() constructor.
MediaStreamTrack.getConstraints() - Web APIs
the properties in the returned object are listed in the same order as when they were set, and only properties specifically set by the site or app are included.
MediaStreamTrack.label - Web APIs
when the track is deassociated from its source, the label is not changed.
MediaStreamTrackAudioSourceNode - Web APIs
r.frequency.value = 1000; biquadfilter.gain.value = range.value; // connect the audiobuffersourcenode to the gainnode // and the gainnode to the destination, so we can play the // music and adjust the volume using the mouse cursor source.connect(biquadfilter); biquadfilter.connect(audioctx.destination); // get new mouse pointer coordinates when mouse is moved // then set new gain value range.oninput = function() { biquadfilter.gain.value = range.value; } }) .catch(function(err) { console.log('the following gum error occured: ' + err); }); } else { console.log('getusermedia not supported on your browser!'); } // dump script to pre element pre.innerhtml = myscript.innerhtml; ...
MediaStreamTrackEvent - Web APIs
these events are sent to the stream when these changes occur.
MediaTrackConstraints.cursor - Web APIs
let displaymediaoptions = { cursor: "always" }; example: cursor visible during motion with fallback in this example, the cursor property is configured to request that the cursor be visible when in motion, falling back to always being visible if the user agent doesn't support in-motion only cursor rendering.
MediaTrackConstraints - Web APIs
properties of shared screen tracks these constraints apply to mediatrackconstraints objects specified as part of the displaymediastreamconstraints object's video property when using getdisplaymedia() to obtain a stream for screen sharing.
MediaTrackSettings.aspectRatio - Web APIs
this lets you determine what value was selected to comply with your specified constraints for this property's value as described in the mediatrackconstraints.aspectratio property you provided when calling either getusermedia() or mediastreamtrack.applyconstraints().
MediaTrackSettings.autoGainControl - Web APIs
this lets you determine what value was selected to comply with your specified constraints for this property's value as described in the mediatrackconstraints.autogaincontrol property you provided when calling either getusermedia() or mediastreamtrack.applyconstraints().
MediaTrackSettings.channelCount - Web APIs
this lets you determine what value was selected to comply with your specified constraints for this property's value as described in the mediatrackconstraints.channelcount property you provided when calling either getusermedia() or mediastreamtrack.applyconstraints().
MediaTrackSettings.echoCancellation - Web APIs
this lets you determine what value was selected to comply with your specified constraints for this property's value as described in the mediatrackconstraints.echocancellation property you provided when calling either getusermedia() or mediastreamtrack.applyconstraints().
MediaTrackSettings.facingMode - Web APIs
this lets you determine what value was selected to comply with your specified constraints for this property's value as described in the mediatrackconstraints.facingmode property you provided when calling either getusermedia() or mediastreamtrack.applyconstraints().
MediaTrackSettings.frameRate - Web APIs
this lets you determine what value was selected to comply with your specified constraints for this property's value as described in the mediatrackconstraints.framerate property you provided when calling either getusermedia() or mediastreamtrack.applyconstraints().
MediaTrackSettings.height - Web APIs
this lets you determine what value was selected to comply with your specified constraints for this property's value as described in the mediatrackconstraints.height property you provided when calling either getusermedia() or mediastreamtrack.applyconstraints().
MediaTrackSettings.latency - Web APIs
this lets you determine what value was selected to comply with your specified constraints for this property's value as described in the mediatrackconstraints.latency property you provided when calling either getusermedia() or mediastreamtrack.applyconstraints().
MediaTrackSettings.noiseSuppression - Web APIs
this lets you determine what value was selected to comply with your specified constraints for this property's value as described in the mediatrackconstraints.noisesuppression property you provided when calling either getusermedia() or mediastreamtrack.applyconstraints().
MediaTrackSettings.sampleRate - Web APIs
this lets you determine what value was selected to comply with your specified constraints for this property's value as described in the mediatrackconstraints.samplerate property you provided when calling either getusermedia() or mediastreamtrack.applyconstraints().
MediaTrackSettings.sampleSize - Web APIs
this lets you determine what value was selected to comply with your specified constraints for this property's value as described in the mediatrackconstraints.samplesize property you provided when calling either getusermedia() or mediastreamtrack.applyconstraints().
MediaTrackSettings.volume - Web APIs
this lets you determine what value was selected to comply with your specified constraints for this property's value as described in the mediatrackconstraints.volume property you provided when calling either getusermedia() or mediastreamtrack.applyconstraints().
MediaTrackSettings.width - Web APIs
this lets you determine what value was selected to comply with your specified constraints for this property's value as described in the mediatrackconstraints.width property you provided when calling either getusermedia() or mediastreamtrack.applyconstraints().
MediaTrackSupportedConstraints.frameRate - Web APIs
example this simple example looks to see if your browser supports constraining the frame rate when requesting video tracks.
Media Capture and Streams API (Media Stream) - Web APIs
it provides the interfaces and methods for working with the streams and their constituent tracks, the constraints associated with data formats, the success and error callbacks when using the data asynchronously, and the events that are fired during the process.
MessageEvent.MessageEvent() - Web APIs
in channel messaging or when sending a message to a shared worker).
MessagePort.close() - Web APIs
WebAPIMessagePortclose
example in the following code block, you can see a handlemessage handler function, run when a message is sent back to this document using eventtarget.addeventlistener.
MessagePort.onmessageerror - Web APIs
the onmessageerror event handler of the messageport interface is an eventlistener, called whenever an messageevent of type messageerror is fired on the port—that is, when it receives a message that cannot be deserialized.
Metadata.modificationTime - Web APIs
syntax var modificationtime = metadata.modificationtime; value a date timestamp indicating when the file system entry was last changed.
MouseEvent() - Web APIs
ue meaning 0 main button pressed (usually the left button) or un-initialized 1 auxiliary button pressed (usually the middle button) 2 secondary button pressed (usually the right button) "buttons", optional and defaulting to 0, of type unsigned short, that describes which buttons are pressed when the event is launched: bit-field value meaning 0 no button pressed 1 main button pressed (usually the left button) 2 secondary button pressed (usually the right button) 4 auxiliary button pressed (usually the middle button) "relatedtarget", optio...
MouseEvent.clientX - Web APIs
example this example displays your mouse's coordinates whenever you trigger the mousemove event.
MouseEvent.clientY - Web APIs
example this example displays your mouse's coordinates whenever you trigger the mousemove event.
MouseEvent.screenY - Web APIs
example this example displays your mouse's coordinates whenever you trigger the mousemove event.
msIsBoxed - Web APIs
WebAPIMsIsBoxed
msisboxed is a property which gets or sets when the video player control is in boxed (letterbox or pillarbox) mode.
msPlayToPreferredSourceUri - Web APIs
a forward slash ("/") is appended to the uri string when it is sent over the network to a playto device.
MutationObserverInit.characterDataOldValue - Web APIs
by default, only changes to the text of the node specified as the target parameter when you called observe() are monitored.
MutationObserverInit.childList - Web APIs
syntax var options = { childlist: true | false } value a boolean value indicating whether or not to invoke the callback function when new nodes are added to or removed from the section of the dom being monitored..
MutationObserverInit.subtree - Web APIs
the default, false, indicates that only the target node specified when calling mutationobserver.observe() is to be monitored for changes.
NDEFReader - Web APIs
nfc tags supporting ndef, when these devices are within the reader's magnetic induction field.
NDEFWriter.write() - Web APIs
WebAPINDEFWriterwrite
return value a promise that resolves with undefined when and if the message transfer is successfully completed.
NDEFWriter - Web APIs
nfc tags supporting ndef, when these devices are within the reader's magnetic induction field.
Using Navigation Timing - Web APIs
for example, to measure the perceived loading time for a page: window.addeventlistener("load", function() { let now = new date().gettime(); let loadingtime = now - performance.timing.navigationstart; document.queryselector(".output").innertext = loadingtime + " ms"; }, false); this code, executed when the load event occurs, subtracts from the current time the time at which the navigation whose timing was recorded began (performance.timing.navigationstart), and outputs that information to the screen by inserting it into an element.
Navigator.battery - Web APIs
WebAPINavigatorbattery
the battery read-only property returns a batterymanager which provides information about the system's battery charge level and whether the device is charging and exposes events that fire when these parameters change.
Navigator.clipboard - Web APIs
perhaps this code is being used in a browser extension that displays the current clipboard contents, automatically updating periodically or when specific events fire.
Navigator.cookieEnabled - Web APIs
note: when the browser is configured to block third-party cookies, and navigator.cookieenabled is invoked inside a third-party iframe, it returns true in safari, edge spartan and ie (while trying to set a cookie in such scenario would fail).
Navigator.credentials - Web APIs
the credentialscontainer interface also notifies the user agent when an interesting event occurs, such as a successful sign-in or sign-out.
Navigator.geolocation - Web APIs
note: for security reasons, when a web page tries to access location information, the user is notified and asked to grant permission.
Navigator.mediaSession - Web APIs
in addition, the mediasession interface provides the setactionhandler() method, which lets you receive events when the user engages device controls such as either onscreen or physical play, pause, seek, and other similar controls.
Navigator.share() - Web APIs
WebAPINavigatorshare
examples in our web share test (see the source code) there is a button which, when clicked, invokes the web share api to share mdn's url.
Navigator.vibrate() - Web APIs
WebAPINavigatorvibrate
if a vibration pattern is already in progress when this method is called, the previous pattern is halted and the new one begins instead.
NavigatorLanguage.languages - Web APIs
when its value changes, as the user's preferred languages are changed a languagechange event is fired on the window object.
NavigatorLanguage - Web APIs
the null value is returned when this is unknown.
NetworkInformation.onchange - Web APIs
the networkinformation.onchange event handler contains the code that is fired when connection information changes, and the change is received by the networkinformation object.
NetworkInformation - Web APIs
it will be one of the following values: bluetooth cellular ethernet none wifi wimax other unknown event handlers networkinformation.onchange the event that's fired when connection information changes and the change is fired on this object.
Node.appendChild() - Web APIs
WebAPINodeappendChild
return value the returned value is the appended child (achild), except when achild is a documentfragment, in which case the empty documentfragment is returned.
Node.insertBefore() - Web APIs
WebAPINodeinsertBefore
// get the parent element let parentelement = document.getelementbyid('parentelement') // get the parent's first child let thefirstchild = parentelement.firstchild // create a new element let newelement = document.createelement("div") // insert the new element before the first child parentelement.insertbefore(newelement, thefirstchild) when the element does not have a first child, then firstchild is null.
Node.isEqualNode() - Web APIs
WebAPINodeisEqualNode
two nodes are equal when they have the same type, defining characteristics (for elements, this would be their id, number of children, and so forth), its attributes match, and so on.
Node.lookupPrefix() - Web APIs
WebAPINodelookupPrefix
when multiple prefixes are possible, the result is implementation-dependent.
Node.nextSibling - Web APIs
WebAPINodenextSibling
the possible inclusion of text nodes must be allowed for when traversing the dom using nextsibling.
Node.nodeValue - Web APIs
WebAPINodenodeValue
n content of the cdata section comment content of the comment document null documentfragment null documenttype null element null namednodemap null entityreference null notation null processinginstruction entire content excluding the target text content of the text node when nodevalue is defined to be null, setting it has no effect.
Node.removeChild() - Web APIs
WebAPINoderemoveChild
examples simple examples given this html: <div id="top"> <div id="nested"></div> </div> to remove a specified element when knowing its parent node: let d = document.getelementbyid("top"); let d_nested = document.getelementbyid("nested"); let throwawaynode = d.removechild(d_nested); to remove a specified element without having to specify its parent node: let node = document.getelementbyid("nested"); if (node.parentnode) { node.parentnode.removechild(node); } to remove all children from an element: let element...
Node.setUserData() - Web APIs
WebAPINodesetUserData
note that such data will not be preserved when imported via node.importnode, as with node.clonenode() and node.renamenode() operations (though node.adoptnode does preserve the information), and equality tests in node.isequalnode() do not consider user data in making the assessment.
Node.textContent - Web APIs
WebAPINodetextContent
(reflows can be computationally expensive, and thus should be avoided when possible.) unlike textcontent, altering innertext in internet explorer (version 11 and below) removes child nodes from the element and permanently destroys all descendant text nodes.
NodeIterator.nextNode() - Web APIs
this method returns null when there are no nodes left in the set.
NodeIterator.previousNode() - Web APIs
this method returns null when the current node is the first node in the set.
NodeList.prototype.forEach() - Web APIs
WebAPINodeListforEach
thisarg optional value to use as this when executing callback.
NonDocumentTypeChildNode.nextElementSibling - Web APIs
dereference.nextelementsibling; example <div id="div-01">here is div-01</div> <div id="div-02">here is div-02</div> <script type="text/javascript"> var el = document.getelementbyid('div-01').nextelementsibling; console.log('siblings of div-01:'); while (el) { console.log(el.nodename); el = el.nextelementsibling; } </script> this example outputs the following into the console when it loads: siblings of div-01: div script polyfill for internet explorer 8 this property is unsupported prior to ie9, so the following snippet can be used to add support to ie8: // source: https://github.com/alhadis/snippets/blob/master/js/polyfills/ie8-child-elements.js if(!("nextelementsibling" in document.documentelement)){ object.defineproperty(element.prototype, "nextelementsibling", ...
NonDocumentTypeChildNode.previousElementSibling - Web APIs
> <li>this is another list item</li> <div id="div-03">here is div-03</div> <script> let el = document.getelementbyid('div-03').previouselementsibling; document.write('<p>siblings of div-03</p><ol>'); while (el) { document.write('<li>' + el.nodename + '</li>'); el = el.previouselementsibling; } document.write('</ol>'); </script> this example outputs the following into the page when it loads: siblings of div-03 1.
Notification.actions - Web APIs
the actions read-only property of the notification interface returns the list of notificationaction objects set using the actions option when creating the notification using the notification() constructor.
Notification.badge - Web APIs
the badge property of the notification interface returns the url of the image used to represent the notification when there is not enough space to display the notification itself.
Notification.onclick - Web APIs
these events occur when the user clicks on a displayed notification.
Notification.onclose - Web APIs
these events occur when a notification is closed.
Notification.onerror - Web APIs
these events occur when something goes wrong with a notification (in many cases an error preventing the notification from being displayed.) syntax notification.onerror = function() { ...
Notification.onshow - Web APIs
these events occur when a notification is displayed.
Notification.requireInteraction - Web APIs
note: this can be set when the notification is first created by setting the requireinteraction option to true in the options object of the notification.notification() constructor.
Notification.vibrate - Web APIs
the vibrate read-only property of the notification interface specifies a a vibration pattern for the device's vibration hardware to emit when the notification fires.
NotificationAction - Web APIs
notificationaction.icon read only the url of the image used to represent the notification when there is not enough space to display the notification itself.
NotifyAudioAvailableEvent - Web APIs
the non-standard, obsolete, notifyaudioavailableevent interface defines the event sent to audio elements when the audio buffer is full.
OES_standard_derivatives - Web APIs
glsl built-in functions the following new functions can be used in glsl shader code, if this extension is enabled: gentype dfdx(gentype) gentype dfdy(gentype) gentype fwidth(gentype) examples enabling the extensions: gl.getextension('oes_standard_derivatives'); gl.getextension('ext_shader_texture_lod'); shader code that avoids artifacts when wrapping texture coordinates: <script type="x-shader/x-fragment"> #extension gl_ext_shader_texture_lod : enable #extension gl_oes_standard_derivatives : enable uniform sampler2d mytexture; varying vec2 texcoord; void main(){ gl_fragcolor = texture2dgradext(mytexture, mod(texcoord, vec2(0.1, 0.5)), dfdx(texcoord), dfdy(texcoord)); } </script> specifications ...
OES_vertex_array_object - Web APIs
constants this extension exposes one new constant, which can be used in the gl.getparameter() method: ext.vertex_array_binding_oes returns a webglvertexarrayobject object when used in the gl.getparameter() method as the pname parameter.
OfflineAudioContext.OfflineAudioContext() - Web APIs
this works in exactly the same way as when you create a new audiobuffer with the audiocontext.createbuffer() method.
OfflineAudioContext.resume() - Web APIs
exceptions the promise is rejected when the following exception is encountered.
OfflineAudioContext.suspend() - Web APIs
exceptions the promise is rejected when any exception is encountered.
OffscreenCanvas.convertToBlob() - Web APIs
syntax promise<blob> offscreencanvas.converttoblob(options); parameters optionsoptional you can specify several options when converting your offscreencanvas object into a blob object, for example: const blob = offscreencanvas.converttoblob({ type: "image/jpeg", quality: 0.95 }); options: type: a domstring indicating the image format.
OffscreenCanvas.convertToBlob() - Web APIs
syntax promise<blob> offscreencanvas.converttoblob(options); parameters optionsoptional you can specify several options when converting your offscreencanvas object into a blob object, for example: const blob = offscreencanvas.converttoblob({ type: "image/jpeg", quality: 0.95 }); options: type: a domstring indicating the image format.
OffscreenCanvas.convertToBlob() - Web APIs
syntax promise<blob> offscreencanvas.converttoblob(options); parameters options optional you can specify several options when converting your offscreencanvas object into a blob object, for example: const blob = offscreencanvas.converttoblob({ type: "image/jpeg", quality: 0.95 }); options: type: a domstring indicating the image format.
OscillatorNode.onended - Web APIs
the onended property of the oscillatornode interface is used to set the event handler for the ended event, which fires when the tone has stopped playing.
OscillatorNode.setPeriodicWave() - Web APIs
the setperiodicwave() method of the oscillatornode interface is used to point to a periodicwave defining a periodic waveform that can be used to shape the oscillator's output, when type is custom.
OscillatorNode.start() - Web APIs
syntax oscillator.start(when); // start playing oscillator at the point in time specified by when parameters when optional an optional double representing the time (in seconds) when the oscillator should start, in the same coordinate system as audiocontext's currenttime attribute.
OscillatorNode.stop() - Web APIs
syntax oscillator.stop(when); // stop playing oscillator at when parameters when optional an optional double representing the audio context time when the oscillator should stop.
OscillatorNode - Web APIs
event handlers oscillatornode.onended sets the event handler for the ended event, which fires when the tone has stopped playing.
OverconstrainedError.OverconstrainedError() - Web APIs
when this event is thrown on a mediastreamtrack, it is muted until either the current constraints can be established or until satisfiable constraints are applied.
OverconstrainedError - Web APIs
when this event is thrown on a mediastreamtrack, it is muted until either the current constraints can be established or until satisfiable constraints are applied.
PageTransitionEvent - Web APIs
the pagetransitionevent event object is available inside handler functions for the pageshow and pagehide events, fired when a document is being loaded or unloaded.
ParentNode.querySelector() - Web APIs
since javascript also uses backspace escaping, special care must be taken when writing string literals using these characters.
ParentNode.replaceChildren() - Web APIs
lay out the two select lists in a line alongside one another, with the control buttons in between them: main { display: flex; } div { margin-right: 20px; } label, button { display: block; } .buttons { display: flex; flex-flow: column; justify-content: center; } select { width: 200px; } what we want to do is transfer any selected options in the "no" list over to the "yes" list when the "yes" button is pressed, and transfer any selected options in the "yes" list over to the "no" list when the "no" button is pressed.
Path2D - Web APIs
WebAPIPath2D
the path methods of the canvasrenderingcontext2d interface are also present on this interface, which gives you the convenience of being able to retain and replay your path whenever desired.
PaymentAddress.dependentLocality - Web APIs
it's used to provide disambiguation when a city may include areas that duplicate street names a sublocality is an area within a city, such as a neighborhood, borough, or district.
PaymentAddress.languageCode - Web APIs
this is used while localizing the displayy of the address, allowing the determination of the field separators and the order of fields when formatting the address.
PaymentDetailsBase - Web APIs
paymentdetailsinit provides payment information when calling the paymentrequest() constructor.
PaymentDetailsUpdate - Web APIs
when calling updatewith(), including error in the updated data causes the user agent to display the text as a general error message.
PaymentRequest.prototype.id - Web APIs
WebAPIPaymentRequestid
when constructing an instance of the paymentrequest, you are able to supply an custom id via paymentdetailsinit dictionary's id member.
PaymentRequest: merchantvalidation event - Web APIs
merchantvalidation events are delivered by the payment request api to a paymentrequest object when a payment handler requires that the merchant requesting the purchase validate itself as permitted to use the payment handler.
PaymentRequest: paymentmethodchange event - Web APIs
paymentmethodchange events are delivered by the payment request api to a paymentrequest object when the user changes payment methods within a given payment handler.
PaymentRequest.shippingOption - Web APIs
it is initially null by when no "selected" shipping options are provided.
PaymentRequest: shippingaddresschange event - Web APIs
the shippingaddresschange event is sent to the paymentrequest object when the user selects a shipping address or changes details of their shipping address.
PaymentRequest: shippingoptionchange event - Web APIs
for payment requests that request shipping information, and for which shipping options are offered, the shippingoptionchange event is sent to the paymentrequest whenever the user chooses a shipping option from the list of available options.
PaymentRequestEvent() - Web APIs
the paymentrequestevent constructor creates a new paymentrequestevent object which is a constructor for a paymentrequestevent which is the object passed to a payment handler when a paymentrequest is made..
PaymentRequestEvent - Web APIs
the paymentrequestevent interface of the the payment request api is the object passed to a payment handler when a paymentrequest is made.
PaymentRequestUpdateEvent.updateWith() - Web APIs
when calling updatewith(), including error in the updated data causes the user agent to display the text as a general error message.
PaymentResponse.payerEmail - Web APIs
this option is only present when the requestpayeremail option is set to true in the paymentoptions object passed to the paymentrequest constructor.
PaymentRequest.payerName - Web APIs
this option is only present when the requestpayername option is set to true in the options parameter of the paymentrequest() constructor.
PayerResponse.payerPhone - Web APIs
this option is only present when the requestpayerphone option is set to true in the paymentoptions object passed to the paymentrequest constructor.
PaymentResponse: payerdetailchange event - Web APIs
payerdetailchange events are delivered by the payment request api to a paymentresponse object when the user makes changes to their personal information while filling out a payment request form.
PaymentResponse.shippingOption - Web APIs
this option is only present when the requestshipping option is set to true in the paymentoptions object passed to the paymentrequest constructor.
PaymentValidationErrors - Web APIs
when validation of the paymentresponse returned by the paymentrequest.show() or paymentresponse.retry() methods fails, your code creates a paymentvalidationerrors object to pass into retry() so that the user agent knows what needs to be fixed and what if any error messages to display to the user.
Payment processing concepts - Web APIs
for example, when using a credit card to pay, the credit card processing service is the payment method provider.
Pbkdf2Params - Web APIs
the pbkdf2params dictionary of the web crypto api represents the object that should be passed as the algorithm parameter into subtlecrypto.derivekey(), when using the pbkdf2 algorithm.
performance.now() - Web APIs
WebAPIPerformancenow
the precision of the returned value is subject to change if/when the security concerns are alleviated through other means.
Performance: resourcetimingbufferfull event - Web APIs
the resourcetimingbufferfull event is fired when the browser's resource timing buffer is full.
Performance - Web APIs
resourcetimingbufferfull fired when the browser's resource timing buffer is full.
PerformanceFrameTiming - Web APIs
performanceentry.starttime returns the timestamp when the frame was started.
PerformanceNavigationTiming - Web APIs
performancenavigationtiming.loadeventend read only a domhighrestimestamp representing the time when the load event of the current document is completed.
PerformanceObserver.observe() - Web APIs
when a matching performance entry is recorded, the performance observer's callback function—set when creating the performanceobserver—is invoked.
PerformanceObserver - Web APIs
the performance observer's callback function will be invoked when a performance entry is recorded for one of the specified entrytypes performanceobserver.disconnect() stops the performance observer callback from receiving performance entries.
PerformancePaintTiming - Web APIs
performanceentry.starttime returns the timestamp when the paint ocurred.
PerformanceResourceTiming.domainLookupEnd - Web APIs
if the user agent has the domain information in cache, domainlookupstart and domainlookupend represent the times when the user agent starts and ends the domain data retrieval from the cache.
PerformanceResourceTiming.nextHopProtocol - Web APIs
when a proxy is used, if a tunnel connection is established, this property returns the alpn protocol id of the tunneled protocol.
PerformanceResourceTiming.redirectEnd - Web APIs
when fetching a resource, if there are multiple http redirects, and any of the redirects have an origin that is different from the current document, and the timing allow check algorithm passes for each redirected resource, this property returns the time immediately after receiving the last byte of the response of the last redirect; otherwise, zero is returned.
PerformanceResourceTiming.redirectStart - Web APIs
if there are http redirects when fetching the resource and if any of the redirects are not from the same origin as the current document, but the timing allow check algorithm passes for each redirected resource, this property returns the starting time of the fetch that initiates the redirect; otherwise, zero is returned.
PerformanceTiming.connectEnd - Web APIs
a connection is considered as opened when all secure connection handshake, or socks authentication, is terminated.
PerformanceTiming.domComplete - Web APIs
the legacy performancetiming.domcomplete read-only property returns an unsigned long long representing the moment, in miliseconds since the unix epoch, when the parser finished its work on the main document, that is when its document.readystate changes to 'complete' and the corresponding readystatechange event is thrown.
PerformanceTiming.domInteractive - Web APIs
the legacy performancetiming.dominteractive read-only property returns an unsigned long long representing the moment, in miliseconds since the unix epoch, when the parser finished its work on the main document, that is when its document.readystate changes to 'interactive' and the corresponding readystatechange event is thrown.
PerformanceTiming.domLoading - Web APIs
the legacy performancetiming.domloading read-only property returns an unsigned long long representing the moment, in miliseconds since the unix epoch, when the parser started its work, that is when its document.readystate changes to 'loading' and the corresponding readystatechange event is thrown.
PerformanceTiming.loadEventEnd - Web APIs
the legacy performancetiming.loadeventend read-only property returns an unsigned long long representing the moment, in miliseconds since the unix epoch, when the load event handler terminated, that is when the load event is completed.
PerformanceTiming.loadEventStart - Web APIs
the legacy performancetiming.loadeventstart read-only property returns an unsigned long long representing the moment, in miliseconds since the unix epoch, when the load event was sent for the current document.
PerformanceTiming.redirectEnd - Web APIs
the legacy performancetiming.redirectend read-only property returns an unsigned long long representing the moment, in miliseconds since the unix epoch, the last http redirect is completed, that is when the last byte of the http response has been received.
PerformanceTiming.requestStart - Web APIs
the legacy performancetiming.requeststart read-only property returns an unsigned long long representing the moment, in miliseconds since the unix epoch, when the browser sent the request to obtain the actual document, from the server or from a cache.
PerformanceTiming.responseEnd - Web APIs
the legacy performancetiming.responseend read-only property returns an unsigned long long representing the moment, in miliseconds since the unix epoch, when the browser received the last byte of the response, or when the connection is closed if this happened first, from the server from a cache or from a local resource.
PerformanceTiming.responseStart - Web APIs
the legacy performancetiming.responsestart read-only property returns an unsigned long long representing the moment in time (in milliseconds since the unix epoch) when the browser received the first byte of the response from the server, cache, or local resource.
PeriodicWave - Web APIs
periodicwave has no inputs or outputs; it is used to define custom oscillators when calling oscillatornode.setperiodicwave().
PermissionStatus.onchange - Web APIs
the onchange event handler of the permissionstatus interface is called whenever the permissionstatus.state property changes.
PermissionStatus - Web APIs
event handler permissionstatus.onchange an event called whenever permissionstatus.status changes.
PointerEvent.tangentialPressure - Web APIs
example in this snippet, when a pointerdown event is fired, different functions are called depending on the value of the event's tangentialpressure property.
PointerEvent.twist - Web APIs
example when a pointerdown event is fired, different functions are called depending on the value of the event's twist property.
ProgressEvent.loaded - Web APIs
when downloading a resource using http, this only represent the part of the content itself, not headers and other overhead.
ProgressEvent.total - Web APIs
when downloading a resource using http, this only represent the content itself, not headers and other overhead.
PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable() - Web APIs
at the time of this writing, this method's result only resolves to true on windows when windows hello capabilities are available (on recent versions of this os).
PublicKeyCredential - Web APIs
with the current state of implementation, this method only resolves to true when windows hello is available on the system.
PublicKeyCredentialCreationOptions.attestation - Web APIs
this value is used when the relying party wishes to verify the attestation.
PublicKeyCredentialCreationOptions.authenticatorSelection - Web APIs
note: see publickeycredential.isuserverifyingplatformauthenticatoravailable() which resolves to true when a user-verifiying platform authenticator is available.
PublicKeyCredentialCreationOptions.challenge - Web APIs
note: when the credential is retrieved with a navigator.credentials.get() call, the signature of the challenge is contained in authenticatorassertionresponse.signature.
PublicKeyCredentialCreationOptions.user - Web APIs
this value will later be used when fetching the credentials in authenticatorassertionresponse.userhandle.
PublicKeyCredentialRequestOptions.challenge - Web APIs
note: when the credential is created with a navigator.credentials.create() call, the signature of the challenge is contained within authenticatorattestationresponse.attestationobject.
PushEvent.PushEvent() - Web APIs
when the constructor is invoked, the pushevent.data property of the resulting object will be set to a new pushmessagedata object containing bytes extracted from the eventinitdict data member.
PushManager.unregister() - Web APIs
version undefined when unregister.onsuccess is called.
PushSubscription - Web APIs
pushsubscription.unsubscribe() starts the asynchronous process of unsubscribing from the push service, returning a promise that resolves to a boolean when the current subscription is successfully unregistered.
RTCAnswerOptions - Web APIs
the rtcansweroptions dictionary is used to provide optional settings when creating an sdp answer using rtcpeerconnection.createoffer() after receiving an offer from a remote peer.
RTCConfiguration.bundlePolicy - Web APIs
if any other value is specified, no configuration is specified when creating the rtcpeerconnection, or if the bundlepolicy property isn't included in the rtcconfiguration object specified when creating the connection, balanced is assumed.
RTCConfiguration.iceTransportPolicy - Web APIs
relay the ice agent only considers media relay candidates when evaluating candidates.
RTCDTMFSender.ontonechange - Web APIs
syntax rtcdtmfsender.ontonechange = tonechangehandlerfunction; value a function which is called when a tonechange event is sent to the rtcdtmfsender, indicating that a dtmf tone has either started playing, or if all tones have finished playing.
RTCDTMFSender: tonechange event - Web APIs
the tonechange event is sent to an rtcdtmfsender by the webrtc api to indicate when dtmf tones previously queued for sending (by calling rtcdtmfsender.insertdtmf()) begin and end.
RTCDTMFToneChangeEvent - Web APIs
examples this snippet is derived loosely from the full, working example you'll find in when a tone finishes playing in using dtmf with webrtc.
RTCDataChannel.binaryType - Web APIs
when a binary message is received on the data channel, the resulting message event's messageevent.data property is an object of the type specified by the binarytype.
RTCDataChannel: bufferedamountlow event - Web APIs
a bufferedamountlow event is sent to an rtcdatachannel when the number of bytes currently in the outbound data transfer buffer falls below the threshold specified in bufferedamountlowthreshold.
RTCDataChannel.close() - Web APIs
most of the process of closing the connection is handled asynchronously; you can detect when the channel has finished closing by watching for a close event on the data channel.
RTCDataChannel: close event - Web APIs
the close event is sent to the onclose event handler on an rtcdatachannel instance when the data transport being used for the data channel has closed.
RTCDataChannel: error event - Web APIs
a webrtc error event is sent to an rtcdatachannel object's onerror error handler when an error occurs on the data channel.
RTCDataChannel: message event - Web APIs
the webrtc message event is sent to the onmessage event handler on an rtcdatachannel object when a message has been received from the remote peer.
RTCDataChannel.onclosing - Web APIs
the rtcdatachannel.onclosing property is an eventhandler which specifies a function to be called by the browser when the closing event is received by the rtcdatachannel.
RTCDataChannel.onopen - Web APIs
the rtcdatachannel.onopen property is an eventhandler which specifies a function to be called when the open event is fired; this is a simple event which is sent when the data channel's underlying data transport—the link over which the rtcdatachannel's messages flow—is established or re-established.
RTCDataChannel: open event - Web APIs
the webrtc open event is sent to an rtcdatachannel object's onopen event handler when the underlying transport used to send and receive the data channel's messages is opened or re-opened.
RTCDataChannel.ordered - Web APIs
this is set when the rtcdatachannel is created, by setting the ordered property on the rtcdatachannelinit object passed as rtcpeerconnection.createdatachannel()'s options parameter.
RTCDataChannel.protocol - Web APIs
if no protocol was specified when the data channel was created, then this property's value is "" (the empty string).
RTCDataChannel.readyState - Web APIs
this is the default state of a new rtcdatachannel created by the webrtc layer when the remote peer created the channel and delivered to the site or app in a datachannel event of type rtcdatachannelevent.
RTCDataChannel.send() - Web APIs
for example, if one peer is a modern browser that supports using the eor (end of record) flag to indicate when a received message is the last piece of a multi-part object sent using send().
RTCDtlsTransport.state - Web APIs
its value is one of the following: new the initial state when dtls has not started negotiating yet.
RTCIceCandidate.address - Web APIs
the address field's value is set when the rtcicecandidate() constructor is used.
RTCIceCandidate.candidate - Web APIs
this property can be configured by specifying the value of the candidate property when constructing the new candidate object using rtcicecandidate().
RTCIceCandidate.port - Web APIs
as is the case with most of rtcicecandidate's properties, the value of port is extracted from the candidate a-line string specified when creating the rtcicecandidate.
RTCIceCandidate.priority - Web APIs
as is the case with most of rtcicecandidate's properties, the value of priority is extracted from the candidate a-line string specified when creating the rtcicecandidate.
RTCIceCandidate.relatedAddress - Web APIs
the relatedaddress field's value is set when the rtcicecandidate() constructor is used.
RTCIceCandidate.relatedPort - Web APIs
the relatedport field's value is set when the rtcicecandidate() constructor is used.
RTCIceCandidate.sdpMLineIndex - Web APIs
this value is specified when creating the rtcicecandidate by setting the corresponding sdpmlineindex value in the rtcicecandidateinit object when creating a new candidate with new rtcicecandidate().
RTCIceCandidate.sdpMid - Web APIs
this property can be configured by specifying the value of the sdpmid property when constructing the new candidate object using rtcicecandidate().
RTCIceCandidate.tcpType - Web APIs
the tcptype field's value is set when the rtcicecandidate() constructor is used.
RTCIceCandidate.type - Web APIs
the type field's value is set when the rtcicecandidate() constructor is used.
RTCIceCandidate - Web APIs
when starting a webrtc peer connection, typically a number of candidates are proposed by each end of the connection, until they mutually agree upon one which describes the connection they decide will be best.
RTCIceCandidateInit.candidate - Web APIs
the complete list of attributes for this example candidate is: foundation = 4234997325 component = "rtp" (the number 1 is encoded to this string; 2 becomes "rtcp") protocol = "udp" priority = 2043278322 ip = "192.168.0.56" port = 44323 type = "host" example when a new ice candidate is received by your signaling code from the remote peer, you need to construct the rtcicecandidate object that encapsulates it.
RTCIceCandidateInit - Web APIs
rtcicecandidateinit is used when using new rtcicecandidate() to create a new ice candidate object.
RTCIceCandidatePairStats.consentExpiredTimestamp - Web APIs
this indicates when the current stun bindings — the mapping of the ip address and port configurations for both peers on the webrtc connection — are due to expire.
RTCIceCandidatePairStats.currentRoundTripTime - Web APIs
this information may come from ongoing stun connectivity checks as well as from consent requests made when the connection was initially being opened.
RTCIceCandidatePairStats.priority - Web APIs
the higher the value, the more likely the webrtc layer is to select the candidate pair when the time comes to establish (or re-establish) a connection between the two peers.
RTCIceCandidatePairStats.selected - Web APIs
example the function shown in this example identifies the currently-selected candidate pair from a statistics report by first iterating over each report, looking for a transport report; when one is found, that transport's selectedcandidatepairid is used to get the rtcicecandidatepair describing the connection.
RTCIceCandidatePairStats.state - Web APIs
when a candidate pair is added to the check list, it begins in the frozen state.
RTCIceCandidatePairStats - Web APIs
the circuit breaker is triggered whenever a connection times out or otherwise needs to be automatically aborted.
RTCIceCandidateStats.address - Web APIs
when a domain name is specified, the first ip address selected for that address is used, even if the domain name maps to multiple ip addresses.
RTCIceCandidateType - Web APIs
usage notes the rtcicecandidatetype enumeration is used by the type property of rtcicecandidate objects, as well as when reporting statistics on candidates using rtcicecandidatestats.candidatetype.
RTCIceTransport: gatheringstatechange event - Web APIs
a gatheringstatechange event is sent to an rtcicetransport when its ice candidate gathering state changes.
RTCIceTransport.getLocalParameters() - Web APIs
the local peer's parameters are obtained during ice signaling and delivered to the transport when the client calls rtcpeerconnection.setlocaldescription().
RTCIceTransport.getRemoteParameters() - Web APIs
the remote peer's parameters are received during ice signaling and delivered to the transport when the client calls rtcpeerconnection.setremotedescription().
RTCIceTransport.getSelectedCandidatePair() - Web APIs
note: it's possible for one of the configurations in the selected candidate pair to remain unchanged when a new pairing is chosen.
RTCIceTransport: selectedcandidatepairchange event - Web APIs
a selectedcandidatepairchange event is sent to an rtcicetransport when the ice agent selects a new pair of candidates that describe the endpoints of a viable connection.
RTCIceTransport: statechange event - Web APIs
a statechange event occurs when the rtcicetransport changes state.
RTCIdentityErrorEvent.idp - Web APIs
it is likely that it will correct this name when it will unprefix rtcpeerconnection, once spec and implementation will have been stabilized.
RTCIdentityErrorEvent.loginUrl - Web APIs
it is likely that it will correct this name when it will unprefix rtcpeerconnection, once spec and implementation will have been stabilized.
RTCIdentityErrorEvent.protocol - Web APIs
it is likely that it will correct this name when it will unprefix rtcpeerconnection, once spec and implementation will have been stabilized.
RTCIdentityErrorEvent - Web APIs
it is likely that it will correct this name when it will unprefix rtcpeerconnection, once spec and implementation will have been stabilized.
RTCIdentityEvent.assertion - Web APIs
it is likely that it will correct this name when it will unprefix rtcpeerconnection, once spec and implementation will have been stabilized.
RTCIdentityEvent - Web APIs
it is likely that it will correct this name when it will unprefix rtcpeerconnection, once spec and implementation will have been stabilized.
RTCInboundRtpStreamStats.averageRtcpInterval - Web APIs
the sending endpoint computes this value when sending compound rtcp packets, which must contain at least an rtcp rr or sr packet and an sdes packet with the cname item.
RTCInboundRtpStreamStats.fecPacketsReceived - Web APIs
note: this counter may also be incremented when fec packets arrive in-band along with media content; this can happen with opus, for example.
RTCInboundRtpStreamStats.firCount - Web APIs
the receiver sends a fir packet when the stream falls behind and needs to skip frames in order to catch up.
RTCInboundRtpStreamStats.packetsDuplicated - Web APIs
usage notes duplicate packets are detected when a packet has the same rtp sequence number as another packet that has previously been processed.
RTCInboundRtpStreamStats.perDscpPacketsReceived - Web APIs
note: due to network bleaching and remapping, the numbers seen on this record are not necessarily going to match the values as they were when the data was sent.
RTCInboundRtpStreamStats - Web APIs
this counter may also be incremented when fec packets arrive in-band along with media content; this can happen with opus, for example.
RTCOutboundRtpStreamStats.averageRtcpInterval - Web APIs
the sending endpoint computes this value when sending compound rtcp packets, which must contain at least an rtcp rr or sr packet and an sdes packet with the cname item.
RTCOutboundRtpStreamStats.firCount - Web APIs
a fir packet is sent when the receiver finds that it has fallen behind and needs to skip frames in order to catch up; the sender should respond by sending a full frame instead of a delta frame.
RTCOutboundRtpStreamStats.perDscpPacketsSent - Web APIs
note: due to network bleaching and remapping, the numbers seen on this record are not necessarily going to match the values as they were when the data was sent.
RTCOutboundRtpStreamStats - Web APIs
totalencodedbytestarget a cumulative sum of the target frame sizes (the targeted maximum size of the frame in bytes when the codec is asked to compress it) for all of the frames encoded so far.
RTCPeerConnection: addstream event - Web APIs
the obsolete addstream event is sent to an rtcpeerconnection when new media, in the form of a mediastream object, has been added to it.
RTCPeerConnection.canTrickleIceCandidates - Web APIs
example var pc = new rtcpeerconnection(); // the following code might be used to handle an offer from a peer when // it isn't known whether it supports trickle ice.
RTCPeerConnection.connectionState - Web APIs
when this property's value changes, a connectionstatechange event is sent to the rtcpeerconnection instance.
RTCPeerConnection: idpvalidationerror event - Web APIs
bubbles no cancelable no interface rtcidentityerrorevent event handler property onidpvalidationerror warning: this event is no longer used; instead, you can detect a validation error by detecting when the promise returned by rtcpeerconnection.peeridentity is rejected.
RTCPeerConnection.removeTrack() - Web APIs
example this example adds a video track to a connection and sets up a listener on a close button which removes the track when the user clicks the button.
RTCPeerConnection.setIdentityProvider() - Web APIs
the idp will be used only when an assertion is needed.
RTCPeerConnection: signalingstatechange event - Web APIs
bubbles no cancelable no interface event event handler property rtcpeerconnection.onsignalingstatechange examples given an rtcpeerconnection, pc, and an updatestatus() function that presents status information to the user, this code sets up an event handler to let the user know when the ice negotiation process finishes up.
RTCPeerConnectionIceErrorEvent.address - Web APIs
syntax let address = rtcpeerconnectioniceerrorevent.address; value a domstring which specifies the local ip address of the network connection to the ice server with which negotiations were occurring when the error occurred.
RTCPeerConnection: idpvalidationerror event - Web APIs
an idpvalidationerror event informs the target, a rtcpeerconnection object, that the identity provider (idp) encountered an error when trying to validate an identity assertion.
RTCRemoteOutboundRtpStreamStats.localId - Web APIs
when a match is found, the statistics object is returned.
RTCRtpCodecParameters - Web APIs
in addition to being the type of the rtcrtpparameters.codecs property, it's used when calling rtcrtptransceiver.setcodecpreferences() to configure a transceiver's codecs before beginning the offer/answer process to establish a webrtc peer connection.
RTCRtpReceiver.getCapabilities() static function - Web APIs
it is entirely possible that certain combinations of options may fail to work when you actually try to use them.
RTCRtpSendParameters - Web APIs
the webrtc api's rtcrtpsendparameters dictionary is used to specify the parameters for an rtcrtpsender when calling its setparameters() method.
RTCRtpSender.getCapabilities() static function - Web APIs
it is entirely possible that certain combinations of options may fail to work when you actually try to use them.
RTCRtpSender.getStats() - Web APIs
the rtcrtpsender method getstats() asynchronously requests an rtcstatsreport object which provides statistics about outgoing traffic on the rtcpeerconnection which owns the sender, returning a promise which is fulfilled when the results are available.
RTCRtpSender.replaceTrack() - Web APIs
when the promise is fulfilled, the fulfillment handler receives a value of undefined.
RTCRtpSender.setParameters() - Web APIs
return value a promise that resolves when the rtcrtpsender.track property is updated with the given parameters.
RTCRtpSender - Web APIs
when bundling is in use, more than transceiver may be sharing the same transport object.
RTCRtpTransceiver.stop() - Web APIs
usage notes when you call stop() on a transceiver, the sender immediately stops sending media and each of its rtp streams are closed using the rtcp "bye" message.
RTCRtpTransceiver - Web APIs
this association is established, when possible, whenever either a local or remote description is applied.
RTCSctpTransport.state - Web APIs
its value is one of the following: connecting the initial state when the connection is being estabilished.
RTCSctpTransport - Web APIs
event handlers rtcsctptransport.onstatechange fired when the rtcsctptransport.state changes.
RTCSessionDescription.type - Web APIs
"pranswer", the description is a provisional answer and may be changed when the definitive choice will be given.
RTCSessionDescriptionCallback - Web APIs
the rtcsessiondescriptioncallback type is used to represent the callback function passed into the deprecated callback-based version of createoffer() or createanswer() when using them to create offers or answers.
RTCStatsReport - Web APIs
candidate pairs other than the currently active pair for the transport are deleted when the rtcpeerconnection changes its rtcpeerconnection.icegatheringstate to new during an ice restart.
RTCStatsType - Web APIs
candidate pairs other than the currently active pair for the transport are deleted when the rtcpeerconnection changes its rtcpeerconnection.icegatheringstate to new during an ice restart.
RTCTrackEventInit - Web APIs
the webrtc api's rtctrackeventinit dictionary is used to provide information describing an rtctrackevent when instantiating a new track event using new rtctrackevent().
ReadableStream.pipeThrough() - Web APIs
options optional the options that should be used when piping to the writable stream.
ReadableStream - Web APIs
readablestream.pipeto() pipes the current readablestream to a given writablestream and returns a promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered.
ReadableStreamBYOBReader.releaseLock() - Web APIs
if the associated stream is errored when the lock is released, the reader will appear errored in that same way subsequently; otherwise, the reader will appear closed.
ReadableStreamDefaultController.close() - Web APIs
when a button is pressed, the generation is stopped, the stream is closed using readablestreamdefaultcontroller.close(), and another function is run, which reads the data back out of the stream.
ReadableStreamDefaultController.desiredSize - Web APIs
examples the a readable stream with an underlying push source and backpressure support example in the spec provides a good example of using desiredsize to manually detect when the stream is full and apply backpressure, and also of using readablestreamdefaultcontroller.error() to manually trigger a stream error if another part of the system it relies on fails.
ReadableStreamDefaultController.enqueue() - Web APIs
when a button is pressed, the generation is stopped, the stream is closed using readablestreamdefaultcontroller.close(), and another function is run, which reads the data back out of the stream.
ReadableStreamDefaultController - Web APIs
when a button is pressed, the generation is stopped, the stream is closed using readablestreamdefaultcontroller.close(), and another function is run, which reads the data back out of the stream.
ReadableStreamDefaultReader.closed - Web APIs
when it is closed, the promise fulfills and the message is logged to the console.
ReadableStreamDefaultReader.releaseLock() - Web APIs
if the associated stream is errored when the lock is released, the reader will appear errored in that same way subsequently; otherwise, the reader will appear closed.
ReportingObserver() - Web APIs
syntax new reportingobserver(callback[, options]); parameters callback a callback function that runs when the observer starts to collect reports (i.e.
ReportingObserver - Web APIs
because of this, when the button is pressed only the second report is listed.
ReportingObserverOptions - Web APIs
the reportingobserveroptions dictionary of the reporting api allows options to be set in the constructor when creating a reportingobserver.
Request() - Web APIs
WebAPIRequestRequest
var myimage = document.queryselector('img'); var myrequest = new request('flowers.jpg'); fetch(myrequest).then(function(response) { return response.blob(); }).then(function(response) { var objecturl = url.createobjecturl(response); myimage.src = objecturl; }); in our fetch request with init example (see fetch request init live) we do the same thing except that we pass in an init object when we invoke fetch(): var myimage = document.queryselector('img'); var myheaders = new headers(); myheaders.append('content-type', 'image/jpeg'); var myinit = { method: 'get', headers: myheaders, mode: 'cors', cache: 'default' }; var myrequest = new request('flowers.jpg',myinit); fetch(myrequest).then(function(response) { ...
Request.cache - Web APIs
WebAPIRequestcache
fetch("some.json", {cache: "reload"}) .then(function(response) { /* consume the response */ }); // download a resource with cache busting when dealing with a // properly configured server that will send the correct etag // and date headers and properly handle if-modified-since and // if-none-match request headers, therefore we can rely on the // validation to guarantee a fresh response.
Request.clone() - Web APIs
WebAPIRequestclone
in fact, the main reason clone() exists is to allow multiple uses of body objects (when they are one-use only.) if intend to modify the request, you may prefer the request constructor.
Request.redirect - Web APIs
WebAPIRequestredirect
syntax var myredirect = request.redirect; value a requestredirect enum value, which can be one the following strings: follow error manual if not specified when the request is created, it takes the default value of follow.
ResizeObserver - Web APIs
resizeobserver avoids infinite callback loops and cyclic dependencies that are often created when resizing via a callback function.
ResizeObserverEntry.borderBoxSize - Web APIs
the borderboxsize read-only property of the resizeobserverentry interface returns an array containing the new border box size of the observed element when the callback is run.
ResizeObserverEntry.contentRect - Web APIs
the contentrect read-only property of the resizeobserverentry interface returns a domrectreadonly object containing the new size of the observed element when the callback is run.
ResizeObserverEntry.target - Web APIs
when the viewport size is changed, the box's rounded corners change in proportion to the size of the box.
RsaHashedImportParams - Web APIs
the rsahashedimportparams dictionary of the web crypto api represents the object that should be passed as the algorithm parameter into subtlecrypto.importkey() or subtlecrypto.unwrapkey(), when importing any rsa-based key pair: that is, when the algorithm is identified as any of rsassa-pkcs1-v1_5, rsa-pss, or rsa-oaep.
RsaHashedKeyGenParams - Web APIs
the rsahashedkeygenparams dictionary of the web crypto api represents the object that should be passed as the algorithm parameter into subtlecrypto.generatekey(), when generating any rsa-based key pair: that is, when the algorithm is identified as any of rsassa-pkcs1-v1_5, rsa-pss, or rsa-oaep.
RsaOaepParams - Web APIs
the rsaoaepparams dictionary of the web crypto api represents the object that should be passed as the algorithm parameter into subtlecrypto.encrypt(), subtlecrypto.decrypt(), subtlecrypto.wrapkey(), or subtlecrypto.unwrapkey(), when using the rsa_oaep algorithm.
SVGAnimatedAngle - Web APIs
the object referenced by animval will always be distinct from the one referenced by baseval, even when the attribute is not animated.
SVGAnimatedLengthList - Web APIs
the object referenced by animval will always be distinct from the one referenced by baseval, even when the attribute is not animated.
SVGAnimatedNumberList - Web APIs
the object referenced by animval will always be distinct from the one referenced by baseval, even when the attribute is not animated.
SVGAnimatedPreserveAspectRatio - Web APIs
the object referenced by animval is always distinct from the one referenced by baseval, even when the attribute is not animated.
SVGAnimatedRect - Web APIs
the object referenced by animval will always be distinct from the one referenced by baseval, even when the attribute is not animated.
SVGAnimatedTransformList - Web APIs
the object referenced by animval will always be distinct from the one referenced by baseval, even when the attribute is not animated.
SVGAnimationElement: endEvent event - Web APIs
the endevent event of the svganimationelement interface is fired when at the active end of the animation is reached.
SVGAnimationElement: repeatEvent event - Web APIs
the repeatevent event of the svganimationelement interface is fired when the element's local timeline repeats.
SVGCircleElement - Web APIs
example svg content <svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 250 250" width="250" height="250"> <circle cx="100" cy="100" r="50" fill="gold" id="circle" onclick="clickcircle();"/> </svg> javascript content this function clickcircle() is called when the circle is clicked.
SVGDocument - Web APIs
svg document interface when an "svg" element is embedded inline as a component of a document from another namespace, such as when an "svg" element is embedded inline within an xhtml document, then an svgdocument object will not exist; instead, the root object in the document object hierarchy will be a document object of a different type, such as an htmldocument object.
SVGElement: abort event - Web APIs
the abort event is fired when page loading is stopped before an svg element has been allowed to load completely.
SVGElement: error event - Web APIs
the error event is fired when an svg element does not load properly or when an error occurs during script execution.
SVGElement: load event - Web APIs
the load event fires on an svgelement when it is loaded in the browser, e.g.
SVGElement: resize event - Web APIs
the resize event is fired when an svg document is being resized.
SVGElement: scroll event - Web APIs
the scroll event is fired when an svg document view is being shifted along the x and/or y axes.
SVGElement: unload event - Web APIs
the unload event is fired when the dom implementation removes an svg document from a window or frame.
SVGElement: zoom event - Web APIs
the zoom event occurs when the user initiates an action which causes the current view of the svg document fragment to be rescaled.
SVGGraphicsElement: copy event - Web APIs
the copy event fires on svggraphicselements when the user initiates a copy action through the browser's user interface.
SVGGraphicsElement: cut event - Web APIs
the cut event is fired on an svggraphicselement when the user has initiated a "cut" action through the browserʼs user interface.
SVGGraphicsElement: paste event - Web APIs
the paste event is fired on an svggraphicselement when the user has initiated a "paste" action through the browser's user interface.
Screen.availHeight - Web APIs
in the main window, when it's time to open the panels, code like the following is used.
Screen.height - Web APIs
WebAPIScreenheight
internet explorer will take into account the zoom setting when reporting the screen height.
ScreenOrientation.onchange - Web APIs
the onchange property of the screenorientation is an event handler fired whenever is the eventhandler called when the screen changes orientation.
ScreenOrientation - Web APIs
event handlers screenorientation.onchange the eventhandler called whenever the screen changes orientation.
ScriptProcessorNode: audioprocess event - Web APIs
the audioprocess event of the scriptprocessornode interface is fired when an input buffer of a script processor is ready to be processed.
ScriptProcessorNode.bufferSize - Web APIs
ength; sample++) { // make output equal to the same as the input outputdata[sample] = inputdata[sample]; // add noise to each output sample outputdata[sample] += ((math.random() * 2) - 1) * 0.2; } } } getdata(); // wire up play button playbutton.onclick = function() { source.connect(scriptnode); scriptnode.connect(audioctx.destination); source.start(); } // when the buffer source stops playing, disconnect everything source.onended = function() { source.disconnect(scriptnode); scriptnode.disconnect(audioctx.destination); } specifications specification status comment web audio apithe definition of 'buffersize' in that specification.
ScriptProcessorNode.onaudioprocess - Web APIs
) { // make output equal to the same as the input outputdata[sample] = inputdata[sample]; // add noise to each output sample outputdata[sample] += ((math.random() * 2) - 1) * 0.2; } } } getdata(); // wire up play button playbutton.onclick = function() { source.connect(scriptnode); scriptnode.connect(audioctx.destination); source.start(); } // when the buffer source stops playing, disconnect everything source.onended = function() { source.disconnect(scriptnode); scriptnode.disconnect(audioctx.destination); } specifications specification status comment web audio apithe definition of 'onaudioprocess' in that specification.
ScrollToOptions.behavior - Web APIs
when the form is submitted, an event handler is run that puts the entered values into a scrolltooptions dictionary, and then invokes the window.scrollto() method, passing the dictionary as a parameter: form.addeventlistener('submit', (e) => { e.preventdefault(); var scrolloptions = { left: leftinput.value, top: topinput.value, behavior: scrollinput.checked ?
ScrollToOptions.left - Web APIs
when the form is submitted, an event handler is run that puts the entered values into a scrolltooptions dictionary, and then invokes the window.scrollto() method, passing the dictionary as a parameter: form.addeventlistener('submit', (e) => { e.preventdefault(); var scrolloptions = { left: leftinput.value, top: topinput.value, behavior: scrollinput.checked ?
ScrollToOptions.top - Web APIs
when the form is submitted, an event handler is run that puts the entered values into a scrolltooptions dictionary, and then invokes the window.scrollto() method, passing the dictionary as a parameter: form.addeventlistener('submit', (e) => { e.preventdefault(); var scrolloptions = { left: leftinput.value, top: topinput.value, behavior: scrollinput.checked ?
ScrollToOptions - Web APIs
when the form is submitted, an event handler is run that puts the entered values into a scrolltooptions dictionary, and then invokes the window.scrollto() method, passing the dictionary as a parameter: form.addeventlistener('submit', (e) => { e.preventdefault(); var scrolloptions = { left: leftinput.value, top: topinput.value, behavior: scrollinput.checked ?
SecurityPolicyViolationEvent - Web APIs
the securitypolicyviolationevent interface inherits from event, and represents the event object of an event sent on a document or worker when its content security policy is violated.
Selection.isCollapsed - Web APIs
no text is selected when the selection's start and end points are at the same position in the content.
Selection.setBaseAndExtent() - Web APIs
we also have a button that when pressed invokes a function that runs the setbaseandextent() method with the specified offsets, and copies the selection into the output paragraph at the very bottom of the html.
Selection.toString() - Web APIs
in javascript, this method is called automatically when a function the selection object is passed to requires a string: alert(window.getselection()) // what is called alert(window.getselection().tostring()) // what is actually being effectively called.
Sensor.onactivate - Web APIs
WebAPISensoronactivate
the onactivate eventhandler is called when one of the sensor interface's child interfaces becomes active.
Sensor.onerror - Web APIs
WebAPISensoronerror
the onerror eventhandler is called when an error occurs on one of the child interfaces of the sensor interface.
Sensor.onreading - Web APIs
WebAPISensoronreading
the onreading eventhandler is called when a reading is taken on one of the child interfaces of the sensor interface.
ServiceWorker - Web APIs
event handlers serviceworker.onstatechange read only an eventlistener property called whenever an event of type statechange is fired; it is basically fired anytime the serviceworker.state changes.
ServiceWorkerContainer.oncontrollerchange - Web APIs
the oncontrollerchange property of the serviceworkercontainer interface is an event handler fired whenever a controllerchange event occurs — when the document's associated serviceworkerregistration acquires a new active worker.
ServiceWorkerContainer.onerror - Web APIs
the onerror property of the serviceworkercontainer interface is an event handler fired whenever an error event occurs in the associated service workers.
ServiceWorkerContainer.onmessage - Web APIs
the onmessage property of the serviceworkercontainer interface is an event handler fired whenever a message event occurs — when incoming messages are received to the serviceworkercontainer object (e.g., via a client.postmessage() call).
ServiceWorkerContainer.startMessages() - Web APIs
note: the messages start being sent automatically when setting the handler directly using serviceworkercontainer.onmessage.
ServiceWorkerGlobalScope: activate event - Web APIs
the activate event of the serviceworkerglobalscope interface is fired when a serviceworkerregistration acquires a new serviceworkerregistration.active worker.
ServiceWorkerGlobalScope: contentdelete event - Web APIs
the contentdelete event of the serviceworkerglobalscope interface is fired when an item is removed from the indexed content via the user agent.
ServiceWorkerGlobalScope: install event - Web APIs
the install event of the serviceworkerglobalscope interface is fired when a serviceworkerregistration acquires a new serviceworkerregistration.installing worker.
ServiceWorkerGlobalScope: message event - Web APIs
the message event of the serviceworkerglobalscope interface occurs when incoming messages are received.
ServiceWorkerGlobalScope.oncontentdelete - Web APIs
the oncontentdelete property of the serviceworkerglobalscope interface is an event handler fired when an item is removed from the indexed content via the user agent.
ServiceWorkerGlobalScope.oninstall - Web APIs
the oninstall property of the serviceworkerglobalscope interface is an event handler fired whenever an install event occurs (when the service worker installs).
ServiceWorkerGlobalScope.onmessage - Web APIs
the onmessage property of the serviceworkerglobalscope interface is an event handler fired whenever a message event occurs — when incoming messages are received.
ServiceWorkerGlobalScope.onnotificationclick - Web APIs
the serviceworkerglobalscope.onnotificationclick property is an event handler called whenever the notificationclick event is dispatched on the serviceworkerglobalscope object, that is when a user clicks on a displayed notification spawned by serviceworkerregistration.shownotification().
onnotificationclose - Web APIs
the serviceworkerglobalscope.onnotificationclose property is an event handler called whenever the notificationclose event is dispatched on the serviceworkerglobalscope object, that is when a user closes a displayed notification spawned by serviceworkerregistration.shownotification().
ServiceWorkerGlobalScope.onpush - Web APIs
the serviceworkerglobalscope.onpush event of the serviceworkerglobalscope interface is fired whenever a push message is received by a service worker via a push server.
ServiceWorkerGlobalScope: push event - Web APIs
the push event is sent to a service worker's global scope (represented by the serviceworkerglobalscope interface) when the service worker has received a push message.
ServiceWorkerMessageEvent.data - Web APIs
examples when the following code is used inside the main thread to set up a message channel between it and a service worker for sending messages between the two, the event object of onmessage will be a serviceworkermessageevent.
ServiceWorkerMessageEvent.lastEventId - Web APIs
examples when the following code is used inside the main thread to set up a message channel between it and a service worker for sending messages between the two, the event object of onmessage will be a serviceworkermessageevent.
ServiceWorkerMessageEvent.origin - Web APIs
examples when the following code is used inside the main thread to set up a message channel between it and a service worker for sending messages between the two, the event object of onmessage will be a serviceworkermessageevent.
ServiceWorkerMessageEvent.ports - Web APIs
examples when the following code is used inside the main thread to set up a message channel between it and a service worker for sending messages between the two, the event object of onmessage will be a serviceworkermessageevent.
ServiceWorkerMessageEvent.source - Web APIs
examples when the following code is used inside the main thread to set up a message channel between it and a service worker for sending messages between the two, the event object of onmessage will be a serviceworkermessageevent.
ServiceWorkerRegistration.active - Web APIs
an active worker controls a serviceworkerclient if the client's url falls within the scope of the registration (the scope option set when serviceworkercontainer.register is first called.) note: this feature is available in web workers.
ServiceWorkerRegistration.onupdatefound - Web APIs
the onupdatefound property of the serviceworkerregistration interface is an eventlistener property called whenever an event of type statechange is fired; it is fired any time the serviceworkerregistration.installing property acquires a new service worker.
ServiceWorkerRegistration.update() - Web APIs
example the following simple example registers a service worker example then adds an event handler to a button so you can explicitly update the service worker whenever desired: if ('serviceworker' in navigator) { navigator.serviceworker.register('/sw-test/sw.js', {scope: 'sw-test'}).then(function(registration) { // registration worked console.log('registration succeeded.'); button.onclick = function() { registration.update(); } }).catch(function(error) { // registration failed console.log('registration failed with ' + erro...
ShadowRoot.delegatesFocus - Web APIs
the delegatesfocus read-only property of the shadowroot interface returns a boolean that indicates whether delegatesfocus was set when the shadow was attached (see element.attachshadow()).
ShadowRoot.mode - Web APIs
WebAPIShadowRootmode
when the mode of a shadow root is "closed", the shadow root’s implementation internals are inaccessible and unchangeable from javascript—in the same way the implementation internals of, for example, the <video> element are inaccessible and unchangeable from javascript.
ShadowRoot - Web APIs
properties shadowroot.delegatesfocus read only returns a boolean that indicates whether delegatesfocus was set when the shadow was attached (see element.attachshadow()).
SharedWorker() - Web APIs
options optional an object containing option properties that can set when creating the object instance.
SharedWorkerGlobalScope.name - Web APIs
the name read-only property of the sharedworkerglobalscope interface returns the name that the sharedworker was (optionally) given when it was created.
Slottable: assignedSlot - Web APIs
when <my-paragraph> is used in the document, the slot is populated by a slottable element by including it inside the element with a slot attribute with the value my-text.
SourceBuffer.appendBufferAsync() - Web APIs
return value a promise which is fulfilled when the buffer has been added successfully to the sourcebuffer, or null if the request could not be initiated.
SourceBuffer.appendWindowEnd - Web APIs
exceptions the following exceptions may be thrown when setting a new value for this property.
SourceBuffer.appendWindowStart - Web APIs
exceptions the following exceptions may be thrown when setting a new value for this property.
SourceBuffer.remove() - Web APIs
this method can only be called when sourcebuffer.updating equals false.
SourceBuffer.timestampOffset - Web APIs
exceptions the following exceptions may be thrown when setting a new value for this property.
SourceBuffer.trackDefaults - Web APIs
exceptions the following exceptions may be thrown when setting a new value for this property.
SpeechRecognition: audioend event - Web APIs
the audioend event of the web speech api is fired when the user agent has finished capturing audio for speech recognition.
SpeechRecognition: audiostart event - Web APIs
the audiostart event of the web speech api is fired when the user agent has started to capture audio for speech recognition.
SpeechRecognition: end event - Web APIs
the end event of the web speech api speechrecognition object is fired when the speech recognition service has disconnected.
SpeechRecognition: error event - Web APIs
the error event of the web speech api speechrecognition object is fired when a speech recognition error occurs.
SpeechRecognition: nomatch event - Web APIs
the nomatch event of the web speech api is fired when the speech recognition service returns a final result with no significant recognition.
SpeechRecognition.onaudioend - Web APIs
the onaudioend property of the speechrecognition interface represents an event handler that will run when the user agent has finished capturing audio (when the audioend event fires.) syntax myspeechrecognition.onaudioend = function() { ...
SpeechRecognition.onaudiostart - Web APIs
the onaudiostart property of the speechrecognition interface represents an event handler that will run when the user agent has started to capture audio (when the audiostart event fires.) syntax myspeechrecognition.onaudiostart = function() { ...
SpeechRecognition.onend - Web APIs
the onend property of the speechrecognition interface represents an event handler that will run when the speech recognition service has disconnected (when the end event fires.) syntax myspeechrecognition.onend = function() { ...
SpeechRecognition.onerror - Web APIs
the onerror property of the speechrecognition interface represents an event handler that will run when a speech recognition error occurs (when the error event fires.) syntax myspeechrecognition.onerror = function() { ...
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 degree of recognition, which doesn't meet or exceed the confidence threshold.
SpeechRecognition.onresult - Web APIs
the onresult property of the speechrecognition interface represents an event handler that will run when the speech recognition service returns a result — a word or phrase has been positively recognized and this has been communicated back to the app (when the result event fires.) syntax myspeechrecognition.onresult = function() { ...
SpeechRecognition.onsoundend - Web APIs
the onsoundend property of the speechrecognition interface represents an event handler that will run when any sound — recognisable speech or not — has stopped being detected (when the soundend event fires.) syntax myspeechrecognition.onsoundend = function() { ...
SpeechRecognition.onsoundstart - Web APIs
the onsoundstart property of the speechrecognition interface represents an event handler that will run when any sound — recognisable speech or not — has been detected (when the soundstart event fires.) syntax myspeechrecognition.onsoundstart = function() { ...
SpeechRecognition.onspeechend - Web APIs
the onspeechend property of the speechrecognition interface represents an event handler that will run when speech recognised by the speech recognition service has stopped being detected (when the speechend event fires.) syntax myspeechrecognition.onspeechend = function() { ...
SpeechRecognition.onspeechstart - Web APIs
the onspeechstart property of the speechrecognition interface represents an event handler that will run when sound recognised by the speech recognition service as speech has been detected (when the speechstart event fires.) syntax myspeechrecognition.onspeechstart = function() { ...
SpeechRecognition.onstart - Web APIs
the onstart property of the speechrecognition interface represents an event handler that will run when the speech recognition service has begun listening to incoming audio with intent to recognize grammars associated with the current speechrecognition (when the start event fires.) syntax myspeechrecognition.onstart = function() { ...
SpeechRecognition: result event - Web APIs
the result event of the web speech api is fired when the speech recognition service returns a result — a word or phrase has been positively recognized and this has been communicated back to the app bubbles no cancelable no interface speechrecognitionevent event handler property onresult examples this code is excerpted from our speech color changer example.
SpeechRecognition: soundend event - Web APIs
the soundend event of the web speech api is fired when any sound — recognisable speech or not — has stopped being detected.
SpeechRecognition: soundstart event - Web APIs
the soundstart event of the web speech api is fired when any sound — recognisable speech or not — has been detected.
SpeechRecognition: speechend event - Web APIs
the speechend event of the web speech api is fired when speech recognized by the speech recognition service has stopped being detected.
SpeechRecognition: speechstart event - Web APIs
the speechstart event of the web speech api is fired when sound recognized by the speech recognition service as speech has been detected.
SpeechRecognition: start event - Web APIs
the start event of the web speech api speechrecognition object is fired when the speech recognition service has begun listening to incoming audio with intent to recognize grammars associated with the current speechrecognition.
SpeechRecognitionEvent.results - Web APIs
when subsequent result events are fired, interim results may be overwritten by a newer interim result or by a final result — they may even be removed, if they are at the end of the "results" array and the array length decreases.
SpeechRecognitionResult.length - Web APIs
the length read-only property of the speechrecognitionresult interface returns the length of the "array" — the number of speechrecognitionalternative objects contained in the result (also referred to as "n-best alternatives".) the number of alternatives contained in the result depends on what the speechrecognition.maxalternatives property was set to when the speech recognition was first initiated.
SpeechSynthesis: voiceschanged event - Web APIs
the voiceschanged event of the web speech api is fired when the list of speechsynthesisvoice objects that would be returned by the speechsynthesis.getvoices() method has changed (when the voiceschanged event fires.) bubbles no cancelable no interface event event handler property onvoiceschanged examples this could be used to repopulate a list of voices that the user can choose between when the event fires.
SpeechSynthesisEvent.charIndex - Web APIs
the charindex read-only property of the speechsynthesisutterance interface returns the index position of the character in the speechsynthesisutterance.text that was being spoken when the event was triggered.
SpeechSynthesisEvent - Web APIs
speechsynthesisevent.charindex read only returns the index position of the character in the speechsynthesisutterance.text that was being spoken when the event was triggered.
SpeechSynthesisUtterance.SpeechSynthesisUtterance() - Web APIs
syntax var utterthis = new speechsynthesisutterance(text); parameters text a domstring containing the text that will be synthesized when the utterance is spoken..
SpeechSynthesisUtterance: boundary event - Web APIs
the boundary event of the web speech api is fired when the spoken utterance reaches a word or sentence boundary.
SpeechSynthesisUtterance: end event - Web APIs
the end event of the web speech api speechsynthesisutterance object is fired when the utterance has finished being spoken.
SpeechSynthesisUtterance: error event - Web APIs
the error event of the web speech api speechsynthesisutterance object is fired when an error occurs that prevents the utterance from being succesfully spoken.
SpeechSynthesisUtterance: mark event - Web APIs
the mark event of the web speech api speechsynthesisutterance object is fired when the spoken utterance reaches a named ssml "mark" tag.
SpeechSynthesisUtterance.onboundary - Web APIs
the onboundary property of the speechsynthesisutterance interface represents an event handler that will run when the spoken utterance reaches a word or sentence boundary (when the boundary event fires.) syntax speechsynthesisutteranceinstance.onboundary = function() { ...
SpeechSynthesisUtterance.onend - Web APIs
the onend property of the speechsynthesisutterance interface represents an event handler that will run when the utterance has finished being spoken (when the end event fires.) syntax speechsynthesisutteranceinstance.onend = function() { ...
SpeechSynthesisUtterance.onerror - Web APIs
the onerror property of the speechsynthesisutterance interface represents an event handler that will run when an error occurs that prevents the utterance from being succesfully spoken (when the error event fires.) syntax speechsynthesisutteranceinstance.onerror = function() { ...
SpeechSynthesisUtterance.onmark - Web APIs
the onmark property of the speechsynthesisutterance interface represents an event handler that will run when the spoken utterance reaches a named ssml mark tag (when the mark event fires.) syntax speechsynthesisutteranceinstance.onmark = function() { ...
SpeechSynthesisUtterance.onpause - Web APIs
the onpause property of the speechsynthesisutterance interface represents an event handler that will run when the utterance is paused part way through (when the pause event fires.) this occurs when the speechsynthesis.pause() method is invoked.
SpeechSynthesisUtterance.onresume - Web APIs
the onresume property of the speechsynthesisutterance interface represents an event handler that will run when a paused utterance is resumed (when the resume event fires.) this occurs when the speechsynthesis.resume() method is invoked on a paused speech synthesis instance.
SpeechSynthesisUtterance.onstart - Web APIs
the onstart property of the speechsynthesisutterance interface represents an event handler that will run when the utterance has begun to be spoken (when the start event fires.) this occurs when the speechsynthesis.speak() method is invoked.
SpeechSynthesisUtterance: pause event - Web APIs
the pause event of the web speech api speechsynthesisutterance object is fired when the utterance is paused part way through.
SpeechSynthesisUtterance: resume event - Web APIs
the resume event of the web speech api speechsynthesisutterance object is fired when a paused utterance is resumed.
SpeechSynthesisUtterance: start event - Web APIs
the start event of the web speech api speechsynthesisutterance object is fired when the utterance has begun to be spoken.
SpeechSynthesisUtterance.text - Web APIs
the text property of the speechsynthesisutterance interface gets and sets the text that will be synthesised when the utterance is spoken.
Storage.getItem() - Web APIs
WebAPIStoragegetItem
the getitem() method of the storage interface, when passed a key name, will return that key's value, or null if the key does not exist, in the given storage object.
Storage.key() - Web APIs
WebAPIStoragekey
the key() method of the storage interface, when passed a number n, returns the name of the nth key in a given storage object.
Storage.removeItem() - Web APIs
the removeitem() method of the storage interface, when passed a key name, will remove that key from the given storage object if it exists.
StorageEstimate - Web APIs
the estimate() method returns an object that conforms to this dictionary when its promise resolves.
StylePropertyMapReadOnly.forEach() - Web APIs
thisarg optional value to use as this (i.e the reference object) when executing callback.
SubmitEvent - Web APIs
this event is fired at the <form> when the form's submit action is invoked.
SubtleCrypto.verify() - Web APIs
exceptions the promise is rejected when the following exception is encountered: invalidaccesserror raised when the encryption key is not a key for the requested verifying algorithm or when trying to use an algorithm that is either unknown or isn't suitable for a verify operation.
TextMetrics - Web APIs
(' + baseline + ')'; let textmetrics = ctx.measuretext(text); let y = 50 + index * 50; ctx.beginpath(); ctx.filltext(text, 0, y); let liney = y - math.abs(textmetrics[baseline]); if (baselinesbelowalphabetic.includes(baseline)) { liney = y + math.abs(textmetrics[baseline]); } ctx.moveto(0, liney); ctx.lineto(550, liney); ctx.stroke(); }); result measuring text width when measuring the x-direction of a piece of text, the sum of actualboundingboxleft and actualboundingboxright can be wider than the width of the inline box (width), due to slanted/italic fonts where characters overhang their advance width.
TextTrack: cuechange event - Web APIs
the cuechange event fires when a texttrack has changed the currently displaying cues.
TextTrackCue - Web APIs
texttrackcue.pauseonexit a boolean for whether the video will pause when this cue stops being displayed.
TextTrackList: addtrack event - Web APIs
the addtrack event is fired when a track is added to a texttracklist.
TextTrackList: change event - Web APIs
the change event is fired when a text track is made active or inactive, or a texttracklist is otherwise changed.
TextTrackList.onchange - Web APIs
the texttracklist property onchange is an event handler which is called when the change event occurs, indicating that a change has occurred on a texttrack in the videotracklist.
TextTrackList: removeTrack event - Web APIs
the removetrack event is fired when a track is removed from a texttracklist.
TimeRanges - Web APIs
the timeranges interface is used to represent a set of time ranges, primarily for the purpose of tracking which portions of media have been buffered when loading it for use by the <audio> and <video> elements.
Touch() - Web APIs
WebAPITouchTouch
"target", required, of type eventtarget, the item at which the touch point started when it was first placed on the surface.
Touch.clientX - Web APIs
WebAPITouchclientX
when the touchend event handler is invoked, the changes in the touch.clientx and touch.clienty coordinates, from the starting touch point to the ending touch point, are calculated.
Touch.clientY - Web APIs
WebAPITouchclientY
when the touchend event handler is invoked, the changes in the touch.clientx and touch.clienty coordinates, from the starting touch point to the ending touch point, are calculated.
Touch.pageX - Web APIs
WebAPITouchpageX
when the touchmove event handler is invoked, each touch point's touch.pagex and touch.pagey coordinates are accessed via the event's touchevent.changedtouches list.
Touch.pageY - Web APIs
WebAPITouchpageY
when the touchmove event handler is invoked, each touch point's touch.pagex and touch.pagey coordinates are accessed via the event's touchevent.changedtouches list.
Touch.radiusX - Web APIs
WebAPITouchradiusX
when the src element is touched, the element's width and height will be calculate based on the touch point's radiusx and radiusy values and the element will then be rotated using the touch point's rotationangle.
Touch.screenX - Web APIs
WebAPITouchscreenX
when the touchstart event handler is invoked, each touch point's touch.screenx and touch.screeny coordinates are accessed.
TouchEvent.altKey - Web APIs
WebAPITouchEventaltKey
summary a boolean value indicating whether or not the alt (alternate) key is enabled when the touch event is created.
TouchEvent.ctrlKey - Web APIs
summary a boolean value indicating whether the control (control) key is enabled when the touch event is created.
TouchEvent.metaKey - Web APIs
summary a boolean value indicating whether or not the meta key is enabled when the touch event is created.
TouchEvent.shiftKey - Web APIs
summary a boolean value indicating whether or not the shift key is enabled when the touch event is created.
Multi-touch interaction - Web APIs
see touch move for information about the background color changing when a 2-finger move/pinch/zoom is detected.
TrackDefault.kinds - Web APIs
the kinds read-only property of the trackdefault interface returns default kinds for an associated sourcebuffer to use when an initialization segment does not contain label information for a new track.
TrackDefault.label - Web APIs
the label read-only property of the trackdefault interface returns the default label for an associated sourcebuffer to use when an initialization segment does not contain label information for a new track.
TrackDefault.language - Web APIs
the language read-only property of the trackdefault interface returns a default language for an associated sourcebuffer to use when an initialization segment does not contain language information for a new track.
TransitionEvent() - Web APIs
elapsedtime optional is float giving the amount of time the animation has been running, in seconds, when this event fired, excluding any time the animation was paused.
TransitionEvent.elapsedTime - Web APIs
the transitionevent.elapsedtime read-only property is a float giving the amount of time the animation has been running, in seconds, when this event fired.
TransitionEvent.initTransitionEvent() - Web APIs
elapsedtimearg is float giving the amount of time the transition has been running, in seconds, when this event fired.
TreeWalker.filter - Web APIs
WebAPITreeWalkerfilter
when creating the treewalker, the filter object is passed in as the third parameter, and its method nodefilter.acceptnode() is called on every single node to determine whether or not to accept it.
UIEvent.detail - Web APIs
WebAPIUIEventdetail
the uievent.detail read-only property, when non-zero, provides the current (or next, depending on the event) click count.
UIEvent.layerX - Web APIs
WebAPIUIEventlayerX
syntax var xpos = event.layerx xpos is an integer value in pixels for the x-coordinate of the mouse pointer, when the mouse event fired.
UIEvent.layerY - Web APIs
WebAPIUIEventlayerY
syntax var ypos = event.layery; ypos is an integer value in pixels for the y-coordinate of the mouse pointer, when the mouse event fired.
UIEvent.pageX - Web APIs
WebAPIUIEventpageX
syntax var pos = event.pagex value an integer value, in pixels, indicating the x coordinate at which the mouse pointer was located when the event occurred.
UIEvent.pageY - Web APIs
WebAPIUIEventpageY
syntax var pagey = event.pagey; pagey is an integer value in pixels for the y-coordinate of the mouse pointer, relative to the whole document, when the mouse event fired.
URL.revokeObjectURL() - Web APIs
call this method when you've finished using an object url to let the browser know not to keep the reference to the file any longer.
URL - Web APIs
WebAPIURL
you normally create a new url object by specifying the url as a string when calling its constructor, or by providing a relative url and a base url.
URLSearchParams.set() - Web APIs
line #44: tries to automatically open a new window/tab with the generated url (when uncommented).
URL API - Web APIs
WebAPIURL API
just add parameters to the url when loading the page to see them in the table.
USB.onconnect - Web APIs
WebAPIUSBonconnect
the onconnect property of the usb interface is an event handler called whenever a paired device is connected.
USB.ondisconnect - Web APIs
WebAPIUSBondisconnect
the ondisconnect property of the usb is an event handler called whenever a paired device is disconnected.
USBDevice.claimInterface() - Web APIs
the claiminterface() method of the usbdevice interface returns a promise that resolves when the requested interface is claimed for exclusive access.
USBDevice.close() - Web APIs
WebAPIUSBDeviceclose
the close() method of the usbdevice interface returns a promise that resolves when all open interfaces are released and the device session has ended.
USBDevice.controlTransferIn() - Web APIs
the controltransferin() method of the usbdevice interface returns a promise that resolves with a usbintransferresult when the result of a command or status request has been received from the usb device.
USBDevice.controlTransferOut() - Web APIs
the controltransferout() method of the usbdevice interface returns a promise that resolves with a usbouttransferresult when a command or status operation has been transmitted to the usb device.
USBDevice.isochronousTransferIn() - Web APIs
the isochronoustransferin() method of the usbdevice interface returns a promise that resolves with a usbisochronousintransferresult when time sensitive information has been transmitted received from the usb device.
USBDevice.isochronousTransferOut() - Web APIs
the isochronoustransferout() method of the usbdevice interface returns a promise that resolves with a usbisochronousouttransferresult when time sensitive information has been transmitted to the usb device.
USBDevice.open() - Web APIs
WebAPIUSBDeviceopen
the open() method of the usbdevice interface returns a promise that resolves when a device session has started.
USBDevice.releaseInterface() - Web APIs
the releaseinterface() method of the usbdevice interface returns a promise that resolves when a cliamed interface is released from exclusive access.
USBDevice.reset() - Web APIs
WebAPIUSBDevicereset
the reset() method of the usbdevice interface returns a promise that resolves when the device is reset and all app operations canceled and their promises rejected.
USBDevice.selectAlternateInterface() - Web APIs
the selectalternateinterface() method of the usbdevice interface returns a promise that resolves when the specified alternative endpoint is selected.
USBDevice.selectConfiguration() - Web APIs
the selectconfiguration() method of the usbdevice interface returns a promise that resolves when the specified configuration is selected.
USBDevice.transferIn() - Web APIs
the transferin() method of the usbdevice interface returns a promise that resolves with a usbtransferinresult when bulk or interrupt data is received from the usb device.
USBDevice.transferOut() - Web APIs
the transferout() method of the usbdevice interface returns a promise that resolves with a usbtransferoutresult when bulk or interrupt data is sent to the usb device.
USBEndpoint - Web APIs
this value is used to identify the endpoint when calling methods on usbdevice.
USVString - Web APIs
WebAPIUSVString
usvstring maps to a string when returned in javascript; it's generally only used for apis that perform text processing and need a string of unicode scalar values to operate on.
UserDataHandler - Web APIs
summary when associating user data with a key on a node, node.setuserdata() can also accept, in its third argument, a handler which will be called when the object is cloned, imported, deleted, renamed, or adopted.
ValidityState.rangeOverflow - Web APIs
when true, the element matches the :invalid and :out-of-range css pseudo-classes.
ValidityState.rangeUnderflow - Web APIs
when true, the element matches the :invalid and :out-of-range css pseudo-classes.
ValidityState - Web APIs
typemismatch read only a boolean that is true if the value is not in the required syntax (when type is email or url), or false if the syntax is correct.
VideoConfiguration - Web APIs
the videoconfiguration dictionary of the media capabilities api is used to define the video file being tested when calling the mediacapabilities methods encodinginfo() and decodinginfo() to determine whether or not the described video configuration is supported, and how smoothly and how smoooth and power-efficient it can be handled.
VideoPlaybackQuality.droppedVideoFrames - Web APIs
frames are typically dropped either before or after decoding them, when it's determined that it will not be possible to draw them to the screen at the correct time.
VideoPlaybackQuality.totalVideoFrames - Web APIs
this value is reset when the media is reloaded or replaced.
VideoTrack.id - Web APIs
WebAPIVideoTrackid
syntax var trackid = videotrack.id; value a domstring which identifies the track, suitable for use when calling gettrackbyid() on an videotracklist such as the one specified by a media element's videotracks property.
VideoTrackList: addtrack event - Web APIs
the addtrack event is fired when a track is added to a videotracklist.
VideoTrackList: change event - Web APIs
the change event is fired when a video track is made active or inactive, for example by changing the track's selected property.
VideoTrackList: removetrack event - Web APIs
the removetrack event is fired when a track is removed from a videotracklist.
VisualViewport: resize event - Web APIs
the resize event of the visualviewport interface is fired when the visual viewport is resized.
VisualViewport: scroll event - Web APIs
the scroll event of the visualviewport interface is fired when the visual viewport is scrolled.
WEBGL_draw_buffers.drawBuffersWEBGL() - Web APIs
note: when using webgl2, this method is available as gl.drawbuffers() by default and the constants are named gl.color_attachment1 etc.
WEBGL_draw_buffers - Web APIs
(when using webgl2, this method is available as gl.drawbuffers() by default).
WakeLock.request() - Web APIs
WebAPIWakeLockrequest
exceptions notallowederror thrown when wake lock is not available, which can happen because: document is not allowed to use screen wake lock due to screen-wake-lock policy.
WakeLock - Web APIs
WebAPIWakeLock
the wakelock interface of the screen wake lock api prevents device screens from dimming or locking when an application needs to keep running.
WakeLockSentinel.release() - Web APIs
examples in this example, when a user clicks a button the wakelocksentinel is released.
WakeLockSentinel - Web APIs
event handlers onrelease fired when the release() method is called or the wake lock is released by the user agent.
WaveShaperNode.WaveShaperNode() - Web APIs
oversample: specifies what type of oversampling (if any) should be used when applying the shaping curve.
WebGL2RenderingContext.clientWaitSync() - Web APIs
gl.already_signaled: indicates that the sync object was signaled when this method was called.
WebGL2RenderingContext.drawArraysInstanced() - Web APIs
note: when using webgl 1, the angle_instanced_arrays extension can provide this method, too.
WebGL2RenderingContext.transformFeedbackVaryings() - Web APIs
buffermode a glenum specifying the mode to use when capturing the varying variables.
WebGLBuffer - Web APIs
when working with webglbuffer objects, the following methods of the webglrenderingcontext are useful: webglrenderingcontext.bindbuffer() webglrenderingcontext.createbuffer() webglrenderingcontext.deletebuffer() webglrenderingcontext.isbuffer() examples creating a buffer var canvas = document.getelementbyid('canvas'); var gl = canvas.getcontext('webgl'); var buffer = gl.createbuffer(); specifications specification status comment webgl 1.0the definition of 'webglbuffer' in that specification.
WebGLFramebuffer - Web APIs
when working with webglframebuffer objects, the following methods of the webglrenderingcontext are useful: webglrenderingcontext.bindframebuffer() webglrenderingcontext.createframebuffer() webglrenderingcontext.deleteframebuffer() webglrenderingcontext.isframebuffer() examples creating a frame buffer var canvas = document.getelementbyid('canvas'); var gl = canvas.getcontext('webgl'); var buffer = gl.createframebuffer(); specifications specification status comment webgl 1.0the definition o...
WebGLQuery - Web APIs
when working with webglquery objects, the following methods of the webgl2renderingcontext are useful: webgl2renderingcontext.createquery() webgl2renderingcontext.deletequery() webgl2renderingcontext.isquery() webgl2renderingcontext.beginquery() webgl2renderingcontext.endquery() webgl2renderingcontext.getquery() webgl2renderingcontext.getqueryparameter() examples creating a webglquery object i...
WebGLRenderbuffer - Web APIs
when working with webglrenderbuffer objects, the following methods of the webglrenderingcontext are useful: webglrenderingcontext.bindrenderbuffer() webglrenderingcontext.createrenderbuffer() webglrenderingcontext.deleterenderbuffer() webglrenderingcontext.isrenderbuffer() examples creating a render buffer var canvas = document.getelementbyid('canvas'); var gl = canvas.getcontext('webgl'); var buffer = gl.createrenderbuffer(); specifications specification status commen...
WebGLRenderingContext.bindBuffer() - Web APIs
when using a webgl 2 context, the following values are available additionally: gl.copy_read_buffer: buffer for copying from one buffer object to another.
WebGLRenderingContext.bindFramebuffer() - Web APIs
when using a webgl 2 context, the following values are available additionally: gl.draw_framebuffer: equivalent to gl.framebuffer.
WebGLRenderingContext.bindTexture() - Web APIs
when using a webgl 2 context, the following values are available additionally: gl.texture_3d: a three-dimensional texture.
WebGLRenderingContext.bufferSubData() - Web APIs
when using a webgl 2 context, the following values are available additionally: gl.copy_read_buffer: buffer for copying from one buffer object to another.
WebGLRenderingContext.colorMask() - Web APIs
the webglrenderingcontext.colormask() method of the webgl api sets which color components to enable or to disable when drawing or rendering to a webglframebuffer.
WebGLRenderingContext.disable() - Web APIs
when using a webgl 2 context, the following values are available additionally: constant description gl.rasterizer_discard deactivates that primitives are discarded immediately before the rasterization stage, but after the optional transform feedback stage.
WebGLRenderingContext.drawElements() - Web APIs
possible values are: gl.unsigned_byte gl.unsigned_short when using the oes_element_index_uint extension: gl.unsigned_int offset a glintptr specifying a byte offset in the element array buffer.
WebGLRenderingContext.enable() - Web APIs
when using a webgl 2 context, the following values are available additionally: constant description gl.rasterizer_discard primitives are discarded immediately before the rasterization stage, but after the optional transform feedback stage.
WebGLRenderingContext.enableVertexAttribArray() - Web APIs
others are assigned by the webgl layer when you create the attributes.
WebGLRenderingContext.generateMipmap() - Web APIs
when using a webgl 2 context, the following values are available additionally: gl.texture_3d: a three-dimensional texture.
WebGLRenderingContext.getActiveAttrib() - Web APIs
it is generally used when querying unknown attributes either for debugging or generic library creation.
WebGLRenderingContext.getContextAttributes() - Web APIs
getcontextattributes(); the getcontextattributes method returns an object that describes the attributes set on this context, for example: { alpha: true, antialias: true, depth: true, failifmajorperformancecaveat: false, powerpreference: "default", premultipliedalpha: true, preservedrawingbuffer: false, stencil: false, desynchronized: false } the context attributes can be set when creating the context using the htmlcanvaselement.getcontext() method: canvas.getcontext('webgl', { antialias: false, depth: false }); see getcontext() for more information about the individual attributes.
WebGLRenderingContext.getError() - Web APIs
gl.invalid_framebuffer_operation the currently bound framebuffer is not framebuffer complete when trying to render to or to read from it.
WebGLRenderingContext.getProgramInfoLog() - Web APIs
when a webglprogram object is initially created, its information log will be a string of length 0.
WebGLRenderingContext.getProgramParameter() - Web APIs
when using a webgl 2 context, the following values are available additionally: gl.transform_feedback_buffer_mode: returns a glenum indicating the buffer mode when transform feedback is active.
WebGLRenderingContext.getRenderbufferParameter() - Web APIs
when using a webgl 2 context, the following value is available additionally: gl.renderbuffer_samples: returns a glint indicating the number of samples of the image of the currently bound renderbuffer.
WebGLRenderingContext.getShaderInfoLog() - Web APIs
when a webglshader object is initially created, its information log will be a string of length 0.
WebGLRenderingContext.getUniformLocation() - Web APIs
the webgluniformlocation type is compatible with the glint type when specifying the index or location of a uniform attribute.
WebGLRenderingContext.isEnabled() - Web APIs
when using a webgl 2 context, the following values are available additionally: constant description gl.rasterizer_discard primitives are discarded immediately before the rasterization stage, but after the optional transform feedback stage.
WebGLRenderingContext.makeXRCompatible() - Web APIs
tbutton; let xrstartbutton; window.addeventlistener("load", (event) => { loadsceneresources(currentscene); glstartbutton.addeventlistener("click", handlestartbuttonclick); xrstartbutton.addeventlistener("click", handlestartbuttonclick); }); outputcanvas.addeventlistener("webglcontextlost", (event) => { /* the context has been lost but can be restored */ event.canceled = true; }); /* when the gl context is reconnected, reload the resources for the current scene.
WebGLRenderingContext.pixelStorei() - Web APIs
glenum gl.browser_default_webgl gl.browser_default_webgl, gl.none webgl when using a webgl 2 context, the following values are available additionally: constant description type default value allowed values (for param) specified in gl.pack_row_length number of pixels in a row.
WebGLRenderingContext.scissor() - Web APIs
examples when the scissor test is enabled, only pixels within the scissor box can be modified by drawing commands.
WebGLRenderingContext.stencilFunc() - Web APIs
mask a gluint specifying a bit-wise mask that is used to and the reference value and the stored stencil value when the test is done.
WebGLRenderingContext.stencilFuncSeparate() - Web APIs
mask a gluint specifying a bit-wise mask that is used to and the reference value and the stored stencil value when the test is done.
WebGLRenderingContext.viewport() - Web APIs
examples when you first create a webgl context, the size of the viewport will match the size of the canvas.
WebGLSampler - Web APIs
when working with webglsampler objects, the following methods of the webgl2renderingcontext are useful: webgl2renderingcontext.createsampler() webgl2renderingcontext.deletesampler() webgl2renderingcontext.issampler() webgl2renderingcontext.bindsampler() webgl2renderingcontext.getsamplerparameter() examples creating a webglsampler object in this example, gl must be a webgl2renderingcontext.
WebGLSync - Web APIs
WebAPIWebGLSync
when working with webglsync objects, the following methods of the webgl2renderingcontext are useful: webgl2renderingcontext.fencesync() webgl2renderingcontext.deletesync() webgl2renderingcontext.issync() webgl2renderingcontext.clientwaitsync() webgl2renderingcontext.waitsync() webgl2renderingcontext.getsyncparameter() examples creating a webglsync object in this example, gl must be a webgl2renderingcontext.
WebGLTexture - Web APIs
when working with webgltexture objects, the following methods of the webglrenderingcontext are useful: webglrenderingcontext.bindtexture() webglrenderingcontext.createtexture() webglrenderingcontext.deletetexture() webglrenderingcontext.istexture() examples creating a texture var canvas = document.getelementbyid('canvas'); var gl = canvas.getcontext('webgl'); var texture = gl.createtexture(); specifications specification status comment webgl 1.0the definition of 'webgltexture' in ...
WebGLTransformFeedback - Web APIs
when working with webgltransformfeedback objects, the following methods of the webgl2renderingcontext are useful: webgl2renderingcontext.createtransformfeedback() webgl2renderingcontext.deletetransformfeedback() webgl2renderingcontext.istransformfeedback() webgl2renderingcontext.bindtransformfeedback() webgl2renderingcontext.begintransformfeedback() webgl2renderingcontext.endtransformfeedback() webgl2renderingcontext.pausetransformfeedback() webgl2renderingcontext.resumetransformfeedback() webg...
WebGLUniformLocation - Web APIs
when working with webgluniformlocation objects, the following methods of the webglrenderingcontext are useful: webglrenderingcontext.getuniformlocation() webglrenderingcontext.uniform() examples getting an uniform location var canvas = document.getelementbyid('canvas'); var gl = canvas.getcontext('webgl'); var location = gl.getuniformlocation(webglprogram, 'uniformname'); specifications specification status comment webgl 1.0the definition of 'webgluniformlocation' in that specification.
WebGLVertexArrayObject - Web APIs
when working with webglvertexarrayobject objects, the following methods are useful: webgl2renderingcontext.createvertexarray() webgl2renderingcontext.deletevertexarray() webgl2renderingcontext.isvertexarray() webgl2renderingcontext.bindvertexarray() webgl 1: the oes_vertex_array_object extension allows you to use vertex array objects in a webgl 1 context.
Canvas size and WebGL - Web APIs
the effect is clearly visible when using scissor() and clear() to draw a square in the center of the canvas, by specifying its position and size in pixels.
Clearing by clicking - Web APIs
« previousnext » this example demonstrates how to combine user interaction with webgl graphics operations by clearing the rendering context with a random color when the user clicks.
Clearing with colors - Web APIs
note that css sets the background color of the canvas to black, so when the canvas turns green we know that webgl's magic has worked.
Color masking - Web APIs
note that the calls to colormask() only occur when the user clicks on one of the toggle buttons.
Compressed texture formats - Web APIs
textures are uncompressed on the fly when being accessed by a shader.
Animating objects with WebGL - Web APIs
the first thing we'll need is a variable in which to track the current rotation of the square: var squarerotation = 0.0; now we need to update the drawscene() function to apply the current rotation to the square when drawing it.
Getting started with WebGL - Web APIs
<body> <canvas id="glcanvas" width="640" height="480"></canvas> </body> preparing the webgl context the main() function in our javascript code, is called when our script is loaded.
Using shaders to apply color in WebGL - Web APIs
then, drawscene() can have the following added to it so it actually uses these colors when drawing the square: // tell webgl how to pull out the colors from the color buffer // into the vertexcolor attribute.
Using WebGL extensions - Web APIs
canonical extension names, vendor prefixes and preferences extensions may be supported by browser vendors before being officially ratified (but only when they are in draft stage).
WebGL: 2D and 3D graphics for the web - Web APIs
WebAPIWebGL API
guides data in webgl a guide to variables, buffers, and other types of data used when writing webgl code.
High-level guides - Web APIs
when you're ready to explore webrtc in more depth, be sure to take a look at our low-level guide to webrtc.
WebRTC Statistics API - Web APIs
ion.getstats(null).then(stats => { var statsoutput = ""; stats.foreach(report => { if (report.type === "inbound-rtp" && report.kind === "video") { object.keys(report).foreach(statname => { statsoutput += `<strong>${statname}:</strong> ${report[statname]}<br>\n`; }); } }); document.queryselector(".stats-box").innerhtml = statsoutput; }); } when the promise returned by getstats() is fulfilled, the resolution handler receives as input an rtcstatsreport object containing the statistics information.
WebSocket.bufferedAmount - Web APIs
this value does not reset to zero when the connection is closed; if you keep calling send(), this will continue to climb.
WebSocket: error event - Web APIs
the error event is fired when a connection with a websocket has been closed due to an error (some data couldn't be sent for example).
WebSocket: message event - Web APIs
the message event is fired when data is received through a websocket.
WebSocket.onclose - Web APIs
WebAPIWebSocketonclose
the websocket.onclose property is an eventhandler that is called when the websocket connection's readystate changes to closed.
WebSocket.onmessage - Web APIs
the websocket.onmessage property is an eventhandler that is called when a message is received from the server.
WebSocket.onopen - Web APIs
WebAPIWebSocketonopen
the websocket.onopen property is an eventhandler that is called when the websocket connection's readystate changes to 1; this indicates that the connection is ready to send and receive data.
WebSocket: open event - Web APIs
the open event is fired when a connection with a websocket is opened.
WebSocket.protocol - Web APIs
the websocket.protocol read-only property returns the name of the sub-protocol the server selected; this will be one of the strings specified in the protocols parameter when creating the websocket object, or the empty string if no connection is established.
Writing a WebSocket server in C# - Web APIs
tcpclient client = server.accepttcpclient(); console.writeline("a client connected."); networkstream stream = client.getstream(); //enter to an infinite cycle to be able to handle every change in stream while (true) { while (!stream.dataavailable); byte[] bytes = new byte[client.available]; stream.read(bytes, 0, bytes.length); } handshaking when a client connects to a server, it sends a get request to upgrade the connection to a websocket from a simple http request.
Targeting and hit detection - Web APIs
for instance, if you have a more-or-less rectangular object, use a rectangle as a surrogate for the object when performing hit testing.
Web Speech API - Web APIs
generally you'll use the interface's constructor to create a new speechrecognition object, which has a number of event handlers available for detecting when speech is input through the device's microphone.
Web Workers API - Web APIs
serviceworkers essentially act as proxy servers that sit between web applications, the browser, and the network (when available).
WheelEvent - Web APIs
even when it does, that doesn't mean that the delta* values in the wheel event necessarily reflect the content's scrolling direction.
Window: DOMContentLoaded event - Web APIs
the domcontentloaded event fires when the initial html document has been completely loaded and parsed, without waiting for stylesheets, images, and subframes to finish loading.
Window: animationend event - Web APIs
the animationend event is fired when a css animation has completed.
Window: animationiteration event - Web APIs
the animationiteration event is fired when an iteration of a css animation ends, and another one begins.
Window: appinstalled event - Web APIs
the appinstalled event of the web manifest api is fired when the browser has successfully installed a page as an application.
Window: beforeprint event - Web APIs
the beforeprint event is fired when the associated document is about to be printed or previewed for printing.
Window: beforeunload event - Web APIs
the beforeunload event is fired when the window, the document and its resources are about to be unloaded.
window.cancelIdleCallback() - Web APIs
syntax window.cancelidlecallback(handle); parameters handle the id value returned by window.requestidlecallback() when the callback was established.
Window.captureEvents() - Web APIs
when you call the captureevents() method on the window, events of the type you specify (for example, event.click) no longer pass through to "lower" objects in the hierarchy.
Window: clipboardchange event - Web APIs
the clipboardchange event fires when the system clipboard content changes.
Window.content - Web APIs
WebAPIWindowcontent
see also working with windows in chrome code when accessing content documents from privileged code, be aware of xpcnativewrappers.
Window.controllers - Web APIs
however, the added controllers must be explicitly removed when the window is unloaded, as this is not done automatically.
Window: copy event - Web APIs
WebAPIWindowcopy event
the copy event fires when the user initiates a copy action through the browser's user interface.
Window: cut event - Web APIs
WebAPIWindowcut event
the cut event is fired when the user has initiated a "cut" action through the browser's user interface.
Window: deviceorientation event - Web APIs
the deviceorientation event is fired when fresh data is available from an orientation sensor about the current orientation of the device as compared to the earth coordinate frame.
Window.dialogArguments - Web APIs
this lets you determine what parameters were specified when the modal dialog was created.
window.dump() - Web APIs
WebAPIWindowdump
it is therefore advisable to either check this preference yourself or use a debugging preference of your own to make sure you don't send lots of debugging content to a user's console when they might not be interested in it at all.
Window: error event - Web APIs
the error event is fired on a window object when a resource failed to load or couldn't be used — for example if a script has an execution error.
Window.event - Web APIs
WebAPIWindowevent
this property is not universally supported and even when supported introduces potential fragility to your code.
Window: gamepadconnected event - Web APIs
the gamepadconnected event is fired when the browser detects that a gamepad has been connected or the first time a button/axis of the gamepad is used.
Window: gamepaddisconnected event - Web APIs
the gamepaddisconnected event is fired when the browser detects that a gamepad has been disconnected.
Window.getAttention() - Web APIs
getattention will still work when used from chrome in a gecko application.
Window.getComputedStyle() - Web APIs
the returned style is a live cssstyledeclaration object, which updates automatically when the element's styles are changed.
Window: hashchange event - Web APIs
the hashchange event is fired when the fragment identifier of the url has changed (the part of the url beginning with and following the # symbol).
Window: languagechange event - Web APIs
the languagechange event is fired at the global scope object when the user's preferred language changes.
window.location - Web APIs
WebAPIWindowlocation
syntax var oldlocation = location; location = newlocation; examples basic example alert(location); // alerts "/docs/web/api/window/location" example #1: navigate to a new page whenever a new value is assigned to the location object, a document will be loaded using the url as if location.assign() had been called with the modified url.
Window.matchMedia() - Web APIs
WebAPIWindowmatchMedia
the window interface's matchmedia() method returns a new mediaquerylist object that can then be used to determine if the document matches the media query string, as well as to monitor the document to detect when it matches (or stops matching) that media query.
Window: message event - Web APIs
the message event is fired on a window object when the window receives a message, for example from a call to window.postmessage() from another browsing context.
Window: messageerror event - Web APIs
the messageerror event is fired on a window object when it receives a message that can't be deserialized.
Window.mozPaintCount - Web APIs
the window.mozpaintcount value is a long long, and starts at zero when the document is first created, incrementing by one each time the document is painted.
Window: offline event - Web APIs
the offline event of the window interface is fired when the browser has lost access to the network and the value of navigator.online switches to false.
Window.onbeforeinstallprompt - Web APIs
the window.onbeforeinstallprompt property is an event handler for processing a beforeinstallprompt, which is dispatched on devices when a user is about to be prompted to "install" a web application.
Window.ongamepadconnected - Web APIs
the ongamepadconnected property of the window interface represents an event handler that will run when a gamepad is connected (when the gamepadconnected event fires).
Window.ongamepaddisconnected - Web APIs
the ongamepaddisconnected property of the window interface represents an event handler that will run when a gamepad is disconnected (when the gamepaddisconnected event fires).
Window: online event - Web APIs
the online event of the window interface is fired when the browser has gained access to the network and the value of navigator.online switches to true.
Obsolete features - Web APIs
the windows taskbar, as well as the titlebar and the status bar of the window are not visible, nor accessible when fullscreen is enabled in msie 5.x.
Window: orientationchange event - Web APIs
the orientationchange event is fired when the orientation of the device has changed.
Window.pageYOffset - Web APIs
html the html is extremely simple and has just two elements: an <iframe> that contains the document we're going to scroll, and a <div> into which we'll output the value of pageyoffset when we've finished the scroll.
Window: pageshow event - Web APIs
the pageshow event is sent to a window when the browser displays the window's document due to navigation.
Window.parent - Web APIs
WebAPIWindowparent
when a window is loaded in an <iframe>, <object>, or <frame>, its parent is the window with the element embedding the window.
Window: paste event - Web APIs
the paste event is fired when the user has initiated a "paste" action through the browser's user interface.
Window.personalbar - Web APIs
<!doctype html> <html> <head> <title>various dom tests</title> <script> // changing bar states on the existing window netscape.security.privilegemanager.enableprivilege("universalbrowserwrite"); window.personalbar.visible = !window.personalbar.visible; </script> </head> <body> <p>various dom tests</p> </body> </html> notes when you load the example page above, the browser displays the following dialog: to toggle the visibility of these bars, you must either sign your scripts or enable the appropriate privileges, as in the example above.
Window.prompt() - Web APIs
WebAPIWindowprompt
; } // there are many ways to use the prompt feature sign = window.prompt(); // open the blank prompt window sign = prompt(); // open the blank prompt window sign = window.prompt('are you feeling lucky'); // open the window with text "are you feeling lucky" sign = window.prompt('are you feeling lucky', 'sure'); // open the window with text "are you feeling lucky" and default value "sure" when the user clicks the ok button, text entered in the input field is returned.
Window.requestFileSystem() - Web APIs
successcallback a function which is invoked when the file system has been successfully obtained.
window.requestIdleCallback() - Web APIs
parameters callback a reference to a function that should be called in the near future, when the event loop is idle.
Window: resize event - Web APIs
the resize event fires when the document view (window) has been resized.
Window.scrollY - Web APIs
WebAPIWindowscrollY
} window.scrollbypages(1); notes use this property to check that the document hasn't already been scrolled when using relative scroll functions such as scrollby(), scrollbylines(), or scrollbypages().
Window.self - Web APIs
WebAPIWindowself
if (window.parent.frames[0] != window.self) { // this window is not the first frame in the list } furthermore, when executing in the active document of a browsing context, window is a reference to the current global object and thus all of the following are equivalent: var w1 = window; var w2 = self; var w3 = window.window; var w4 = window.self; // w1, w2, w3, w4 all strictly equal, but only w2 will function in workers specifications specification status comment html living standardt...
Window.sessionStorage - Web APIs
sessionstorage is similar to localstorage; the difference is that while data in localstorage doesn't expire, data in sessionstorage is cleared when the page session ends.
Window.sizeToContent() - Web APIs
in order for it to work, the dom content should be loaded when this function is called—for example, once the domcontentloaded event has been thrown.
Window.statusbar - Web APIs
WebAPIWindowstatusbar
<!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <title>various dom tests</title> <script> // changing bar states on the existing window netscape.security.privilegemanager.enableprivilege("universalbrowserwrite"); window.statusbar.visible=!window.statusbar.visible; </script> </head> <body> <p>various dom tests</p> </body> </html> notes when you load the example page above, the browser displays the following dialog: to toggle the visibility of these bars, you must either sign your scripts or enable the appropriate privileges, as in the example above.
Window.toolbar - Web APIs
WebAPIWindowtoolbar
<!doctype html> <html> <head> <title>various dom tests</title> <script> // changing bar states on the existing window netscape.security.privilegemanager.enableprivilege("universalbrowserwrite"); window.toolbar.visible=!window.toolbar.visible; </script> </head> <body> <p>various dom tests</p> </body> </html> notes when you load the example page above, the browser displays the following dialog: to toggle the visibility of these bars, you must either sign your scripts or enable the appropriate privileges, as in the example above.
Window.top - Web APIs
WebAPIWindowtop
this property is especially useful when you are dealing with a window that is in a subframe of a parent or parents, and you want to get to the top-level frameset.
Window: transitioncancel event - Web APIs
the transitioncancel event is fired when a css transition is canceled.
Window: transitionrun event - Web APIs
the transitionrun event is fired when a css transition is first created, i.e.
Window: transitionstart event - Web APIs
the transitionstart event is fired when a css transition has actually started, i.e., after any transition-delay has ended.
Window: unhandledrejection event - Web APIs
the unhandledrejection event is sent to the global scope of a script when a javascript promise that has no rejection handler is rejected; typically, this is the window, but may also be a worker.
WindowEventHandlers.onmessage - Web APIs
the onmessage property of the windoweventhandlers mixin is the eventhandler called whenever an object receives a message event.
WindowEventHandlers.onmessageerror - Web APIs
the onmessageerror event handler of the windoweventhandlers interface is an eventlistener, called whenever an messageevent of type messageerror is fired on a window—that is, when it receives a message that cannot be deserialized.
WindowEventHandlers.onrejectionhandled - Web APIs
these events are raised when promises are rejected.
WindowEventHandlers.onunhandledrejection - Web APIs
syntax window.onunhandledrejection = function; value function is an eventhandler or function to call when unhandledrejection events are received by the window.
WindowEventHandlers.onunload - Web APIs
these events fire when the window is unloading its content and resources.
WindowOrWorkerGlobalScope.indexedDB - Web APIs
example the following code creates a request for a database to be opened asychronously, after which the database is opened when the request's onsuccess handler is fired: var db; function opendb() { var dbopenrequest = window.indexeddb.open('todolist'); dbopenrequest.onsuccess = function(e) { db = dbopenrequest.result; } } specifications specification status comment indexed database api draftthe definition of 'indexeddb' in that specification.
WindowProxy - Web APIs
when a browsing context is navigated, the window object its windowproxy wraps is changed.
Worker() - Web APIs
WebAPIWorkerWorker
options optional an object containing option properties that can be set when creating the object instance.
Worker: messageerror event - Web APIs
the messageerror event is fired on a worker object when it receives a message that can't be deserialized.
Worker.onmessageerror - Web APIs
the onmessageerror event handler of the worker interface is an eventlistener, called whenever an messageevent of type messageerror is fired on the worker instance — that is, when it receives a message that cannot be deserialized.
Worker.prototype.postMessage() - Web APIs
when either of two form inputs (first and second) have their values changed, change events invoke postmessage() to send the value of both inputs to the current worker.
WorkerGlobalScope: languagechange event - Web APIs
the languagechange event is fired at the global scope object when the user's preferred language changes.
WorkerGlobalScope.onclose - Web APIs
summary the onclose property of the workerglobalscope interface represents an eventhandler to be called when the close event occurs and bubbles through the worker.
WorkerGlobalScope.onerror - Web APIs
the onerror property of the workerglobalscope interface represents an eventhandler to be called when the error event occurs and bubbles through the worker.
WorkerGlobalScope.onlanguagechange - Web APIs
the onlanguagechange property of the workerglobalscope interface represents an eventhandler to be called when the languagechange event occurs and bubbles through the worker.
WorkerGlobalScope.onoffline - Web APIs
the onoffline property of the workerglobalscope interface represents an eventhandler to be called when the offline event occurs and bubbles through the worker.
WorkerGlobalScope.ononline - Web APIs
the ononline property of the workerglobalscope interface represents an eventhandler to be called when the online event occurs and bubbles through the worker.
WorkerNavigator - Web APIs
the null value is returned when this is unknown.
Worklet.addModule() - Web APIs
WebAPIWorkletaddModule
cookies and http authentification) when loading the module.
WritableStream.abort() - Web APIs
// abort the stream later on, when required writablestream.abort(); specifications specification status comment streamsthe definition of 'abort()' in that specification.
WritableStreamDefaultController - Web APIs
when constructing a writablestream, the underlying sink is given a corresponding writablestreamdefaultcontroller instance to manipulate.
WritableStreamDefaultWriter.abort() - Web APIs
// abort the stream when desired writer.abort.then((reason) => { console.log(reason); }) specifications specification status comment streamsthe definition of 'abort()' in that specification.
WritableStreamDefaultWriter.ready - Web APIs
the ready read-only property of the writablestreamdefaultwriter interface returns a promise that resolves when the desired size of the stream's internal queue transitions from non-positive to positive, signaling that it is no longer applying backpressure.
XDomainRequest.onload - Web APIs
an event handler for when an xdomainrequest has finished receiving the response from the server.
XDomainRequest.onprogress - Web APIs
syntax xdr.onprogress = funcref; parameters funcref a function to call when progress events occur.
XMLHttpRequest() - Web APIs
const request = new xmlhttprequest(paramsdictionary); parameters (non-standard) objparameters there are two flags you can set: mozanon boolean: setting this flag to true will cause the browser not to expose the origin and user credentials when fetching resources.
XMLHttpRequest.abort() - Web APIs
when a request is aborted, its readystate is changed to xmlhttprequest.unsent (0) and the request's status code is set to 0.
XMLHttpRequest: abort event - Web APIs
the abort event is fired when a request has been aborted, for example because the program called xmlhttprequest.abort().
XMLHttpRequest.channel - Web APIs
xmlhttprequest.channel is an nsichannel that used by the object when performing the request.
XMLHttpRequest: error event - Web APIs
the error event is fired when the request encountered an error.
XMLHttpRequest.getResponseHeader() - Web APIs
example in this example, a request is created and sent, and a readystatechange handler is established to look for the readystate to indicate that the headers have been received; when that is the case, the value of the content-type header is fetched.
XMLHttpRequest: load event - Web APIs
the load event is fired when an xmlhttprequest transaction completes successfully.
XMLHttpRequest: loadend event - Web APIs
the loadend event is fired when a request has completed, whether successfully (after load) or unsuccessfully (after abort or error).
XMLHttpRequest: loadstart event - Web APIs
the loadstart event is fired when a request has started to load data.
XMLHttpRequest.multipart - Web APIs
note: when this is set, the onload handler and other event handlers are not reset after the first xmldocument is loaded, and the onload handler is called after each part of the response is received.
XMLHttpRequest.overrideMimeType() - Web APIs
the xmlhttprequest method overridemimetype() specifies a mime type other than the one provided by the server to be used instead when interpreting the data being transferred in a request.
XMLHttpRequest: progress event - Web APIs
the progress event is fired periodically when a request receives more data.
XMLHttpRequest.responseText - Web APIs
you know the entire content has been received when the value of readystate becomes xmlhttprequest.done (4), and status becomes 200 ("ok").
XMLHttpRequest.send() - Web APIs
}; xhr.send(null); // xhr.send('string'); // xhr.send(new blob()); // xhr.send(new int8array()); // xhr.send(document); example: post var xhr = new xmlhttprequest(); xhr.open("post", '/server', true); //send the proper header information along with the request xhr.setrequestheader("content-type", "application/x-www-form-urlencoded"); xhr.onreadystatechange = function() { // call a function when the state changes.
XMLHttpRequest.sendAsBinary() - Web APIs
however, on google chrome, when you try to send an arraybuffer, the following warning message will appear: arraybuffer is deprecated in xmlhttprequest.send().
XMLHttpRequest.timeout - Web APIs
when a timeout happens, a timeout event is fired.
XMLHttpRequest: timeout event - Web APIs
the timeout event is fired when progression is terminated due to preset time expiring.
XMLHttpRequest.withCredentials - Web APIs
in addition, this flag is also used to indicate when cookies are to be ignored in the response.
XMLHttpRequestEventTarget.onprogress - Web APIs
the xmlhttprequesteventtarget.onprogress is the function called periodically with information when an xmlhttprequest before success completely.
XMLHttpRequestResponseType - Web APIs
these values are used when getting or setting the responsetype on the request.
XPathExpression - Web APIs
this is useful when an expression will be reused in an application, because it is just compiled once and all namespace prefixes which occur within the expression are preresolved.
XRBoundedReferenceSpace - Web APIs
this is typically used when the xr system is capable of tracking the user's physical movement within a limited distance of their starting position.
XRInputSource.profiles - Web APIs
note: the profiles list is always empty when the webxr session is in inline mode.
XRInputSource.targetRayMode - Web APIs
syntax let raymode = xrinputsource.targetraymode; value a domstring taken from the xrtargetraymode enumerated type, indicating which method to use when generating and presenting the target ray to the user.
XRInputSourceArray.length - Web APIs
[ { label: "shop now", url: "https://www.amazon.com/s?k=vr+controllers" }, { label: "quit" handler: quitgame } ]); } here, if length is 0, a hypothetical showalertdialog() function is called with a prompt string explaining the need for a controller, and an array of objects, each describing a button and what should happen when it's clicked.
XRInputSourceEvent.frame - Web APIs
then, if the result isn't null, the target ray pose's transform is passed into a function called mycheckandhandlehit() to see if the ray was pointing at anything when the select was triggered.
XRInputSourceEventInit.inputSource - Web APIs
the xrinputsourceeventinit dictionary's inputsource property is used when calling the xrinputsourceevent() constructor to specify the xrinputsource from which the newly-created event is being sent.
XRInputSourceEventInit - Web APIs
the xrinputsourceeventinit dictionary is used when calling the xrinputsourceevent() constructor to provide configuration options for the newly-created xrinputsourceevent object to take on.
XRInputSourcesChangeEvent() - Web APIs
event types inputsourceschange delivered to the xrsession when the set of input devices available to it changes.
XRPermissionDescriptor.optionalFeatures - Web APIs
it's particularly useful when determining the distance between the viewer and an input, or when working with offset spaces.
XRPermissionDescriptor.requiredFeatures - Web APIs
it's particularly useful when determining the distance between the viewer and an input, or when working with offset spaces.
XRPermissionDescriptor - Web APIs
when the returned promise resolves, we check the returned status.
XRPermissionStatus.granted - Web APIs
it's particularly useful when determining the distance between the viewer and an input, or when working with offset spaces.
XRPermissionStatus - Web APIs
any feature which was specified in either the optionalfeatures or requiredfeatures when calling navigator.permissions.query() are listed in granted if and only if permission to use them is granted.
XRPose.transform - Web APIs
WebAPIXRPosetransform
the transform read-only attribute of the xrpose interface is a xrrigidtransform object providing the position and orientation of the pose relative to the base xrspace as specified when the pose was obtained by calling xrframe.getpose().
XRReferenceSpaceEvent - Web APIs
event types reset the reset event is sent to a reference space when its native origin is changed due to a discontinuity, recalibration, or device reset.
XRReferenceSpaceEventInit.referenceSpace - Web APIs
the xrreferencespaceeventinit property referencespace is used to establish the value of a newly-constructed xrreferencespaceevent object when calling the xrreferencespaceevent() constructor.
XRReferenceSpaceEventInit - Web APIs
the xrreferencespaceeventinit dictionary is used when calling the xrreferencespaceevent() constructor to provide the values for its properties.
XRRenderState.inlineVerticalFieldOfView - Web APIs
the inlineverticalfieldofview read-only property of the xrrenderstate interface defines the angle of the field of view in radians used when computing projection matrices for "inline" xrsession objects.
XRRenderState.baseLayer - Web APIs
syntax var xrwebgllayer = xrrenderstate.baselayer; value a xrwebgllayer object which is used as the source of the world's contents when rendering each frame of the scene.
XRSession.environmentBlendMode - Web APIs
you should use caution when using its features.
XRSession.inputSources - Web APIs
usage notes you can add a handler for the xrsession event inputsourceschange to be advised when the contents of the session's connected devices list changes.
XRSession: inputsourceschange event - Web APIs
the inputsourceschange event is sent to an xrsession when the set of available webxr input devices changes.
XRSession.oninputsourceschange - Web APIs
the oninputsourcechange attribute of the xrsession object is the event handler for the inputsourcechange event, which is dispatched when session's list of active xr input sources has changed.
XRSession.onselectend - Web APIs
the onselectend attribute of the xrsession object is the event handler for the selectend event, which is dispatched when user finishes making some sort of selection by releasing a trigger, touchpad, or button, finishes speaking a command, or makes a hand gesture.
XRSession.onselectstart - Web APIs
the onselectstart attribute of the xrsession object is the event handler for the selectstart event, which is dispatched when user starts making some sort of selection by pressing a trigger, touchpad, or button, speaking a command, or making a hand gesture.
XRSession.onvisibilitychange - Web APIs
the onvisibilitychange attribute of the xrsession object is the event handler for the visibilitychange event, which is dispatched when the visibility state of the xr session changes.
XRSession.renderState - Web APIs
the information provided covers the minimum and maximum distance at which to render objects, the vertical field of view to use when rendering the in the inline session mode, and the xrwebgllayer to render into for inline composition.
XRSession.requestReferenceSpace() - Web APIs
it's particularly useful when determining the distance between the viewer and an input, or when working with offset spaces.
XRSession: squeezestart event - Web APIs
the webxr event squeezestart is sent to an xrsession when the user begins a primary squeeze action on one of its input sources.
XRSession.updateRenderState() - Web APIs
inlineverticalfieldofview optional a floating-point value indicating the default field of view, in radians, to be used when computing the projection matrix for an inline xrsession.
XRSession.visibilityState - Web APIs
usage notes it's important to keep in mind that because an immersive webxr session is potentially being shown using a different display than the html document in which it's running (such as when being shown on a headset), the value of a session's visibilitystate may not necessarily be the same as the owning document's visibilitystate.
XRSessionEvent.session - Web APIs
examples in this example, the session property is used to obtain the session object to manage when an event is received.
XRSessionEventInit - Web APIs
the xrsessioneventinit dictionary is used when calling the xrsessionevent() constructor to provide the new event's initial values.
XRSessionInit - Web APIs
the webxr device api dictionary xrsessioninit specifies required and/or optional features when requesting a new xrsession by calling the navigator.xr.requestsession() method.
XRSessionMode - Web APIs
usage notes the xrsessionmode type indicates the values that can be specified when calling xr.issessionsupported() to determine whether or not the specified session type is supported and available to be used, and by requestsession() to attempt to open a new webxr session.
XRSystem: isSessionSupported() - Web APIs
if a session is already underway when the button is clicked, we call the xrsession object's end() method to shut down the webxr session.
XRSystem: ondevicechange - Web APIs
the ondevicechange property of the xrsystem interface is passed a devicechange event whenever availability of an immersive device changes.
XRView.eye - Web APIs
WebAPIXRVieweye
when rendering that eye, if the flag is true, that view is skipped instead of being rendered.
XRView.transform - Web APIs
WebAPIXRViewtransform
the read-only transform property of the xrview interface is an xrrigidtransform object which provides the position and orientation of the viewpoint relative to the xrreferencespace specified when the xrframe.getviewerpose() method was called to obtain the view object.
XRWebGLLayer() - Web APIs
antialias optional a boolean value which is true if anti-aliasing is to be used when rendering in the context; otherwise false.
XRWebGLLayer.framebuffer - Web APIs
opaque framebuffers will not have an alpha channel available unless the alpha property is true when creating the layer.
XRWebGLLayer.getViewport() - Web APIs
since the framebuffer is split in half, one half for each eye, setting the webgl viewport to match the webxr layer's viewport will ensure that when rendering the scene for the current eye's pose, it is rendered into the correct half of the framebuffer.
XRWebGLLayer - Web APIs
let gllayer = xrsession.renderstate.baselayer; gl.bindframebuffer(gl.framebuffer, gllayer.framebuffer); rendering every view in a frame each time the gpu is ready to render the scene to the xr device, the xr runtime calls the function you specified when you called the xrsession method requestanimationframe() to ask to render the frame.
XRWebGLLayerInit.antialias - Web APIs
let options = { antialias: getpreferencevalue("antialiasing") }; let gllayer = new xrwebgllayer(xrsession, gl, options); if (gllayer) { xrsession.updaterenderstate({ baselayer: gllayer }); } offering the user features such as the ability to enable or disable things like anti-aliasing can provide them with optiions to try when your app isn't performing as well as they'd like.
XRWebGLLayerInit.depth - Web APIs
when using the xrwebgllayer() constructor to create a new webgl rendering layer for webxr, providing as the layerinit parameter an object whose depth property is false will request that the new layer be created without a depth buffer.
XRWebGLLayerInit.framebufferScaleFactor - Web APIs
the xrwebgllayerinit dictionary's framebufferscalefactor property, when specified upon instantiating a new xrwebgllayer using its constructor, xrwebgllayer(), specifies the scaling factor to use when determining the size of the frame buffer to use when rendering the scene, relative to the default xr device display resolution.
XRWebGLLayerInit.stencil - Web APIs
when using the xrwebgllayer() constructor to create a new webgl rendering layer for webxr, providing as the layerinit parameter an object whose stencil property is false requests that the new layer be created without a stencil buffer.
XSL Transformations in Mozilla FAQ - Web APIs
when printing a document, mozilla tries to render the page on paper as closely to what you see as possible.
msRegionOverflow - Web APIs
when the region is an actual element, msregionoverflow provides the ability to find out if content fully fits into the region or not.
mssitemodejumplistitemremoved - Web APIs
the mssitemodejumplistitemremoved event occurs when mssitemodeshowjumplist is called and an item has been removed from a jump list by the user.
Web APIs
WebAPI
when writing code for the web, there are a large number of web apis available.
Using the aria-hidden attribute - Accessibility
</p> accessibility concerns best practices aria-hidden="true" should not be added when: the html hidden attribute is present the element or the element's ancestor is hidden with display: none the element or the element's ancestor is hidden with visibility: hidden in all three scenarios, the attribute is unnecessary to add because the element has already been removed from the accessibility tree.
Using the aria-labelledby attribute - Accessibility
value a space-separated list of element ids possible effects on user agents and assistive technology when user agents compute the accessible name property of elements that have both an aria-labelledby attribute and an aria-label attribute, the user agents give precedence to aria-labelledby.
Using the aria-relevant attribute - Accessibility
aria-relevant is commonly used when a web page contains content that may be updated while viewing the page.
Using the aria-valuenow attribute - Accessibility
when the rendered value cannot be accurately represented as a number, authors should use the aria-valuetext attribute in conjunction with aria-valuenow to provide a user-friendly representation of the range's current value.
Using the aria-valuetext attribute - Accessibility
authors should only set the aria-valuetext attribute when the rendered value cannot be accurately represented as a number.
Using the article role - Accessibility
possible effects on user agents and assistive technology when the user navigates an element assigned the role of article, assistive technologies that typically intercept standard keyboard events should switch to document browsing mode, as opposed to passing keyboard events through to the web application.
Using the slider role - Accessibility
when the user tabs focus to the slider, it should land on the thumb: the control a mouse user would drag.
Using ARIA: Roles, states, and properties - Accessibility
roles widget roles button checkbox gridcell link menuitem menuitemcheckbox menuitemradio option progressbar radio scrollbar searchbox separator (when focusable) slider spinbutton switch tab tabpanel textbox treeitem composite roles the techniques below describe each composite role as well as their required and optional child roles.
How to file ARIA-related bugs - Accessibility
here's where to file bugs: when finding a bug, please also update the relevant compatibility tables in the examples page.
ARIA: timer role - Accessibility
for instance, when the clock changes from "17:33" to "17:34", assistive technologies will only announce "4", which won't be very useful to users.
ARIA: application role - Accessibility
to be able to interact with a web page, a standard set of widgets is recognized that, when pressing a certain key (usually the enter key) this mode is switched off.
ARIA: article role - Accessibility
changing attribute values when constructing a feed, set the aria-posinset and aria-setsize attributes on each article role to the appropriate values, bearing in mind that aria-posinset is 1-based.
ARIA: Complementary role - Accessibility
the complementary landmark role is used to designate a supporting section that relates to the main content, yet can stand alone when separated.
ARIA: contentinfo role - Accessibility
best practices prefer html when it is an immediate descendant of the <body> element, using the <footer> element will automatically communicate a section has a role of contentinfo (save for a known issue in voiceover).
ARIA: grid role - Accessibility
keyboard interactions when a keyboard user encounters a grid, they navigate the rows and columns using the left, right, top and down keys.
ARIA: gridcell role - Accessibility
er" aria-colindex="6">zip</div> </div> </div> <div role="rowgroup"> <div role="row"> <div role="gridcell" aria-colindex="1">debra</div> <div role="gridcell" aria-colindex="2">burks</div> <div role="gridcell" aria-colindex="5">new york</div> <div role="gridcell" aria-colindex="6">14127</div> </div> </div> … </div> describing the position of gridcells when the overall structure is unknown in situations where the table-style grouping of content does not provide information about the columns and rows, gridcells must have their positions programatically described by using aria-describedby.
ARIA: List role - Accessibility
group a collection of related objects, limited to list items when nested in a list, not important enough to have their own place in a pages table of contents.
ARIA: Listitem role - Accessibility
group a collection of related objects, limited to list items when nested in a list, not important enough to have their own place in a pages table of contents.
ARIA: Main role - Accessibility
if a document contains two main roles, say updating page content when triggered by javascript, the inactive main role's presence should be removed from assistive technology via techniques such as toggling the hidden attribute.
ARIA: Region role - Accessibility
it is used to provide a generic landmark for people to be able to navigate to easily when none of the other landmark roles are appropriate.
ARIA: search role - Accessibility
when a <form> is a search form, use the search role instead of form.
Multipart labels: Using ARIA for labels with embedded fields inside them - Accessibility
if you’re using a screen reader, have you noticed that, when you go to this setting in firefox, it tells you “delete history after 21 days”?, followed by the announcement that you’re in a textbox, and that it contains the number 21.
Accessibility and Spacial Patterns - Accessibility
for example, "how" an object looks when it is rotated, from different angles, how they look sliced, and how they relate to each other in space all make a difference in an ability to understand math in spatial terms.
Mobile accessibility checklist - Accessibility
wcag 2.1: orientation examples of when an orientation is esssential is a piano application or a bank cheque.
Understanding the Web Content Accessibility Guidelines - Accessibility
target wcag 2.0 first when allocating resources.
-moz-image-rect - CSS: Cascading Style Sheets
the javascript code this code handles the click event when the container receives a mouse click.
-webkit-line-clamp - CSS: Cascading Style Sheets
when applied to anchor elements, the truncating can happen in the middle of the text, not necessarily at the end.
-webkit-overflow-scrolling - CSS: Cascading Style Sheets
syntax values auto use "regular" scrolling, where the content immediately ceases to scroll when you remove your finger from the touchscreen.
:-moz-drag-over - CSS: Cascading Style Sheets
the :-moz-drag-over css pseudo-class is a mozilla extension that matches an element when a dragover event is called on it.
:-moz-focusring - CSS: Cascading Style Sheets
note: developers tend to use :-moz-focusring to differentiate between the focus state when the user focuses an element via a mouse click versus keyboard tabbing.
:-moz-locale-dir(ltr) - CSS: Cascading Style Sheets
(this can vary from window to window, and even from tab to tab.) it also allows extensions to work even when they don't support the user's default locale, since they can support both left-to-right and right-to-left layouts regardless of locale specifics.
:-moz-locale-dir(rtl) - CSS: Cascading Style Sheets
(this can vary from window to window, and even from tab to tab.) it also allows extensions to work even when they don't support the user's default locale, since they can support both left-to-right and right-to-left layouts regardless of locale specifics.
:-moz-submit-invalid - CSS: Cascading Style Sheets
you can use this pseudo-class to customize the appearance of the submit button when there are invalid form fields.
:-webkit-autofill - CSS: Cascading Style Sheets
the :-webkit-autofill css pseudo-class matches when an <input> element has its value autofilled by the browser.
::-moz-page - CSS: Cascading Style Sheets
the ::-moz-page css pseudo-element is a mozilla extension that represents an individual page when printed or in a print preview.
::-webkit-inner-spin-button - CSS: Cascading Style Sheets
changing the cursor in the spin controls in this example, the css cursor is changed to pointer whenever the cursor is positioned over the inner part of the input's spin controls.
::-webkit-meter-optimum-value - CSS: Cascading Style Sheets
the ::-webkit-meter-optimum-value css pseudo-element styles the <meter> element when its value is inside the low-high range.
::-webkit-meter-suboptimum-value - CSS: Cascading Style Sheets
the ::-webkit-meter-suboptimum-value pseudo-element gives a yellow color to the <meter> element when the value attribute falls outside of the low-high range.
::-webkit-search-results-button - CSS: Cascading Style Sheets
the ::-webkit-search-results-button css pseudo-element represents a button (the "search results button") at the left edge of an <input> of type="search" which when clicked displays a menu which allows the user to choose from previous recent search queries.
::after (:after) - CSS: Cascading Style Sheets
WebCSS::after
html <p>here we have some <span tabindex="0" data-descr="collection of words and punctuation">text</span> with a few <span tabindex="0" data-descr="small popups that appear when hovering">tooltips</span>.
::selection - CSS: Cascading Style Sheets
syntax /* legacy firefox syntax (version 61 and below) */ ::-moz-selection ::selection examples html this text has special styles when you highlight it.
:active - CSS: Cascading Style Sheets
WebCSS:active
when using a mouse, "activation" typically starts when the user presses down the primary mouse button.
:enabled - CSS: Cascading Style Sheets
WebCSS:enabled
/* 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.
:first-of-type - CSS: Cascading Style Sheets
note that the universal selector (*) is implied when no simple selector is written.
:host() - CSS: Cascading Style Sheets
WebCSS:host()
note: this has no effect when used outside a shadow dom.
:host - CSS: Cascading Style Sheets
WebCSS:host
note: this has no effect when used outside a shadow dom.
:indeterminate - CSS: Cascading Style Sheets
/* 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 <progress> elements in an indeterminate state syntax :indeterminate examples checkbox & radio button this example applies special styles to the labels associated with indeterminate form fields.
:invalid - CSS: Cascading Style Sheets
WebCSS:invalid
syntax :invalid examples this example presents a simple form that colors elements green when they validate and red when they don't.
:last-of-type - CSS: Cascading Style Sheets
note that the universal selector (*) is implied when no simple selector is written.
:left - CSS: Cascading Style Sheets
WebCSS:left
/* selects any left-hand pages when printing */ @page :left { margin: 2in 3in; } whether a given page is "left" or "right" is determined by the major writing direction of the document.
:not() - CSS: Cascading Style Sheets
WebCSS:not
'='<attr-modifier> = i | s description there are several unusual effects and outcomes when using :not() that you should keep in mind when using it: the :not pseudo-class may not be nested, which means that :not(:not(...)) is invalid.
:nth-child() - CSS: Cascading Style Sheets
this may seem weird at first, but it makes more sense when the b part of the formula is >0, like in the next example.
:nth-last-child() - CSS: Cascading Style Sheets
in this example, list items turn red when there are at least three of them in a given list.
:right - CSS: Cascading Style Sheets
WebCSS:right
/* selects any right-hand pages when printing */ @page :right { margin: 2in 3in; } whether a given page is "left" or "right" is determined by the major writing direction of the document.
:state() - CSS: Cascading Style Sheets
WebCSS:state
custom-element:state(foo) { /* styles to apply when `custom-element` is in the `foo` state */ } syntax syntax not found in db!
:target - CSS: Cascading Style Sheets
WebCSS:target
/* selects an element with an id matching the current url's fragment */ :target { border: 2px solid black; } for example, the following url has a fragment (denoted by the # sign) that points to an element called section2: http://www.example.com/index.html#section2 the following element would be selected by a :target selector when the current url is equal to the above: <section id="section2">example</section> syntax :target examples a table of contents the :target pseudo-class can be used to highlight the portion of a page that has been linked to from a table of contents.
:visited - CSS: Cascading Style Sheets
WebCSS:visited
the alpha component of the element's non-:visited state will be used instead, except when that component is 0, in which case the style set in :visited will be ignored entirely.
@charset - CSS: Cascading Style Sheets
WebCSS@charset
@charset "utf-8"; this at-rule is useful when using non-ascii characters in some css properties, like content.
font-display - CSS: Cascading Style Sheets
the font-display descriptor determines how a font face is displayed based on whether and when it is downloaded and ready to use.
font-style - CSS: Cascading Style Sheets
note that a range is only supported when the font-style is oblique; for font-style: normal or italic, no second value is allowed.
font-variation-settings - CSS: Cascading Style Sheets
<string> <number> when rendering text, the list of opentype axis names is passed to the text layout engine to enable or disable font features.
font-weight - CSS: Cascading Style Sheets
when a specified weight doesn't exist, a nearby weight is used.
src - CSS: Cascading Style Sheets
WebCSS@font-facesrc
when a font is needed the user agent iterates over the set of references listed using the first one it can successfully activate.
@font-face - CSS: Cascading Style Sheets
syntax @font-face { font-family: "open sans"; src: url("/fonts/opensans-regular-webfont.woff2") format("woff2"), url("/fonts/opensans-regular-webfont.woff") format("woff"); } descriptors font-display determines how a font face is displayed based on whether and when it is downloaded and ready to use.
@font-feature-values - CSS: Cascading Style Sheets
this can help simplify your css when using multiple fonts.
any-pointer - CSS: Cascading Style Sheets
note: more than one value can match if the available devices have different characteristics, although none only matches when none of them are pointing devices.
aural - CSS: Cascading Style Sheets
WebCSS@mediaaural
syntax the aural css media type—which has been deprecated in favor of the speech media type—was used to specify a block of css that applied only when the content is being presented using a speech synthesis device.
hover - CSS: Cascading Style Sheets
WebCSS@mediahover
none the primary input mechanism cannot hover at all or cannot conveniently hover (e.g., many mobile devices emulate hovering when the user performs an inconvenient long tap), or there is no primary pointing input mechanism.
prefers-reduced-motion - CSS: Cascading Style Sheets
in windows 7: control panel > ease of access > make the computer easier to see > turn off all unnecessary animations (when possible).
@page - CSS: Cascading Style Sheets
WebCSS@page
the @page css at-rule is used to modify some css properties when printing a document.
viewport-fit - CSS: Cascading Style Sheets
accessibility concerns when using the viewport-fit descriptor, one must keep in mind that not all device displays are rectangular, and should therefore make use of the safe area inset variables.
At-rules - CSS: Cascading Style Sheets
WebCSSAt-rule
(deferred to level 4 of css spec) @page — describes the aspect of layout changes that will be applied when printing the document.
CSSOM View - CSS: Cascading Style Sheets
reference properties scroll-behavior guides coordinate systems a guide to the coordinate systems used to specify the position of a location in a display context, whether that context is a window on a monitor, a viewport on a mobile device, or a position on a sheet of paper when printing.
Detecting CSS animation support - CSS: Cascading Style Sheets
however, there are likely to be times when this feature isn't available, and you may wish to handle that case by using javascript code to simulate a similar effect.
Using URL values for the cursor property - CSS: Cascading Style Sheets
url values as cursors are supported in windows, os/2, and linux (when using gtk+ 2.4 or better) releases of mozilla.
CSS Basic Box Model - CSS: Cascading Style Sheets
this article describes the rules that govern when and why this happens, and how to control it.
Color picker tool - CSS: Cascading Style Sheets
thue = function sethue(value) { this.color.sethue(value); this.updatepickerbackground(); this.updatealphagradient(); this.updatepreviewcolor(); this.notify('red', this.color.r); this.notify('green', this.color.g); this.notify('blue', this.color.b); this.notify('hexa', this.color.gethexa()); this.notify('hue', this.color.hue); notify(this.topic, this.color); }; // updates when one of saturation/value/lightness changes colorpicker.prototype.updateslv = function updateslv() { this.updatepickerposition(); this.updatealphagradient(); this.updatepreviewcolor(); this.notify('red', this.color.r); this.notify('green', this.color.g); this.notify('blue', this.color.b); this.notify('hexa', this.color.gethexa()); notify(this.topic, this.color); }; /**********...
CSS Multi-column Layout - CSS: Cascading Style Sheets
handling overflow in multicol what happens when an item overflows the column it is in and what happens when there is too much columned content to fit a container.
CSS Fonts - CSS: Cascading Style Sheets
WebCSSCSS Fonts
it lets you define the style of a font, such as its family, size and weight, line height, and the glyph variants to use when multiple are available for a single character.
Implementing image sprites in CSS - CSS: Cascading Style Sheets
note: when using http/2, it may in fact be more bandwidth-friendly to use multiple small requests.
Consistent list indentation - CSS: Cascading Style Sheets
recommendations when altering the indentation of lists, make sure to set both the padding and margin.
CSS Motion Path - CSS: Cascading Style Sheets
the idea is that when you want to animate an element moving along a path, you previously only had animating translation, position, etc.
Using z-index - CSS: Cascading Style Sheets
top layer (closest to the observer) notes: when no z-index property is specified, elements are rendered on the default rendering layer 0 (zero).
Stacking context example 1 - CSS: Cascading Style Sheets
and this example shows what happens when a parent element does not create a stacking context.
Stacking without the z-index property - CSS: Cascading Style Sheets
when the z-index property is not specified on any element, elements are stacked in the following order (from bottom to top): the background and borders of the root element descendant non-positioned blocks, in order of appearance in the html descendant positioned elements, in order of appearance in the html keep in mind, when the order property alters rendering from the "order of appearance in the html" within flex containers, it similarly affects the order for stacking context.
The stacking context - CSS: Cascading Style Sheets
each stacking context is completely independent of its siblings: only descendant elements are considered when stacking is processed.
CSS Scrollbars - CSS: Cascading Style Sheets
accessibility concerns when you customize scrollbars, consider they have enough contrast and that their hit area is large enough for people who use touch input.
Using the :target pseudo-class in selectors - CSS: Cascading Style Sheets
when a url points at a specific piece of a document, it can be difficult for the user to notice.
Shapes from box values - CSS: Cascading Style Sheets
when to use the box values using box values is a simple way to create shapes, however this is by nature only going to work with very simple shapes that can be defined using the well-supported border-radius property.
Overview of CSS Shapes - CSS: Cascading Style Sheets
you can also use it to edit shapes generated via shape-outside, but only when you enable it via the layout.css.shape-outside.enabled pref.
Shapes From Images - CSS: Cascading Style Sheets
cors compatibility something that you will run into when creating shapes from an image is that the image you use must be cors compatible.
CSS Text Decoration - CSS: Cascading Style Sheets
be careful when removing the text decoration on anchors since users often depend on the underline to denote hyperlinks.</p> <p class="underover">this text has lines above <em>and</em> below it.</p> <p class="thick">this text has a really thick purple underline in supporting browsers.</p> <p class="blink">this text might blink for you, depending on the browser you use.</p> specifications ...
CSS Writing Modes - CSS: Cascading Style Sheets
used by hebrew or arabic scripts), bidirectional (used when mixing left-to-right and right-to-left scripts) and vertical (e.g.
Introducing the CSS Cascade - CSS: Cascading Style Sheets
WebCSSCascade
when several keyframes are appropriate, it chooses the latest defined in the most important document, but never combined all together.
Comments - CSS: Cascading Style Sheets
WebCSSComments
however, when using the <style> element, you may use <!-- --> to hide css from older browsers, although this is not recommended.
Pagination - CSS: Cascading Style Sheets
.pagination { list-style: none; margin: 0; padding: 0; display: flex; column-gap: 2px; } accessibility concerns we want to ensure that a person using a screenreader understands what this navigation does, and where they will go when clicking a link.
Replaced elements - CSS: Cascading Style Sheets
using css with replaced elements css handles replaced elements specifically in some cases, like when calculating margins and some auto values.
Linear-gradient Generator - CSS: Cascading Style Sheets
thue = function sethue(value) { this.color.sethue(value); this.updatepickerbackground(); this.updatealphagradient(); this.updatepreviewcolor(); this.notify('red', this.color.r); this.notify('green', this.color.g); this.notify('blue', this.color.b); this.notify('hexa', this.color.gethexa()); this.notify('hue', this.color.hue); notify(this.topic, this.color); }; // updates when one of saturation/value/lightness changes colorpicker.prototype.updateslv = function updateslv() { this.updatepickerposition(); this.updatealphagradient(); this.updatepreviewcolor(); this.notify('red', this.color.r); this.notify('green', this.color.g); this.notify('blue', this.color.b); this.notify('hexa', this.color.gethexa()); notify(this.topic, this.color); }; /**********...
<alpha-value> - CSS: Cascading Style Sheets
interpolation when animated, values of the <alpha-value> css data type are interpolated as real, floating-point numbers.
<angle> - CSS: Cascading Style Sheets
WebCSSangle
for dynamic properties, like when applying an animation or transition, the effect will nevertheless be different.
animation-delay - CSS: Cascading Style Sheets
note: when you specify multiple comma-separated values on an animation-* property, they will be assigned to the animations specified in the animation-name property in different ways depending on how many there are.
animation-direction - CSS: Cascading Style Sheets
note: when you specify multiple comma-separated values on an animation-* property, they will be assigned to the animations specified in the animation-name property in different ways depending on how many there are.
animation-duration - CSS: Cascading Style Sheets
note: when you specify multiple comma-separated values on an animation-* property, they will be assigned to the animations specified in the animation-name property in different ways depending on how many there are.
animation-iteration-count - CSS: Cascading Style Sheets
note: when you specify multiple values on an animation-* property, they will be assigned to the animations specified in the animation-name property in different ways depending on how many there are.
animation-name - CSS: Cascading Style Sheets
note: when you specify multiple comma-separated values on an animation-* property, they will be assigned to the animations specified in the animation-name property in different ways depending on how many there are.
animation-play-state - CSS: Cascading Style Sheets
note: when you specify multiple comma-separated values on an animation-* property, they will be assigned to the animations specified in the animation-name property in different ways depending on how many there are.
background-origin - CSS: Cascading Style Sheets
note that background-origin is ignored when background-attachment is fixed.
<blend-mode> - CSS: Cascading Style Sheets
the <blend-mode> css data type describes how colors should appear when elements overlap.
border-bottom-left-radius - CSS: Cascading Style Sheets
formal definition initial value0applies toall elements; but user agents are not required to apply to table and inline-table elements when border-collapse is collapse.
border-bottom-right-radius - CSS: Cascading Style Sheets
formal definition initial value0applies toall elements; but user agents are not required to apply to table and inline-table elements when border-collapse is collapse.
border-bottom-width - CSS: Cascading Style Sheets
if it's a keyword, it must be one of the following values: thin a thin border medium a medium border thick a thick border note: because the specification doesn't define the exact thickness denoted by each keyword, the precise result when using one of them is implementation-specific.
border-image-outset - CSS: Cascading Style Sheets
formal definition initial value0applies toall elements, except internal table elements when border-collapse is collapse.
border-image-source - CSS: Cascading Style Sheets
formal definition initial valuenoneapplies toall elements, except internal table elements when border-collapse is collapse.
border-left-width - CSS: Cascading Style Sheets
if it's a keyword, it must be one of the following values: thin a thin border medium a medium border thick a thick border note: because the specification doesn't define the exact thickness denoted by each keyword, the precise result when using one of them is implementation-specific.
border-right-width - CSS: Cascading Style Sheets
if it's a keyword, it must be one of the following values: thin a thin border medium a medium border thick a thick border note: because the specification doesn't define the exact thickness denoted by each keyword, the precise result when using one of them is implementation-specific.
border-top-left-radius - CSS: Cascading Style Sheets
formal definition initial value0applies toall elements; but user agents are not required to apply to table and inline-table elements when border-collapse is collapse.
border-top-right-radius - CSS: Cascading Style Sheets
formal definition initial value0applies toall elements; but user agents are not required to apply to table and inline-table elements when border-collapse is collapse.
border-top-width - CSS: Cascading Style Sheets
if it's a keyword, it must be one of the following values: thin a thin border medium a medium border thick a thick border note: because the specification doesn't define the exact thickness denoted by each keyword, the precise result when using one of them is implementation-specific.
border - CSS: Cascading Style Sheets
WebCSSborder
the border shorthand is especially useful when you want all four borders to be the same.
box-decoration-break - CSS: Cascading Style Sheets
the box-decoration-break css property specifies how an element's fragments should be rendered when broken across multiple lines, columns, or pages.
box-lines - CSS: Cascading Style Sheets
WebCSSbox-lines
each line computes flexes independently, so only elements on that line are considered when evaluating box-flex and box-flex-groups.
box-ordinal-group - CSS: Cascading Style Sheets
when the computed box-direction is normal, a box will display its elements starting from the lowest numbered ordinal group and ensure that those elements appear to the left (for horizontal boxes) or at the top (for vertical boxes) of the container.
caret-color - CSS: Cascading Style Sheets
on the other hand, the mouse cursor image shown when hovering over text where the cursor property is auto, or when hovering over an element where the cursor property is text or vertical-text, though it sometimes looks like a caret, is not a caret (it’s a cursor).
clip-path - CSS: Cascading Style Sheets
WebCSSclip-path
formal definition initial valuenoneapplies toall elements; in svg, it applies to container elements excluding the defs element and all graphics elementsinheritednopercentagesrefer to reference box when specified, otherwise border-boxcomputed valueas specified, but with <url> values made absoluteanimation typeyes, as specified for <basic-shape>, otherwise no formal syntax <clip-source> | [ <basic-shape> | <geometry-box> ] | nonewhere <clip-source> = <url><basic-shape> = <inset()> | <circle()> | <ellipse()> | <polygon()> | <path()><geometry-box> = <shape-box> | fill-box | stroke-box | view-boxw...
column-fill - CSS: Cascading Style Sheets
the column-fill css property controls how an element's contents are balanced when broken into columns.
column-span - CSS: Cascading Style Sheets
the column-span css property makes it possible for an element to span across all columns when its value is set to all.
column-width - CSS: Cascading Style Sheets
the actual column width may differ from the specified value: it may be wider when necessary to fill available space, and narrower when the available space is too small.
columns - CSS: Cascading Style Sheets
WebCSScolumns
the columns css shorthand property sets the number of columns to use when drawing an element's contents, as well as those columns' widths.
Computed value - CSS: Cascading Style Sheets
the relative values that remain in the computed value become absolute when the used value is determined.
contain - CSS: Cascading Style Sheets
WebCSScontain
of another article</h2> <img src="graphic.jpg" alt="photo"> <p>more content here.</p> </article> img { float: left; border: 3px solid black; } article { border: 1px solid black; } as you can see, because of the way floats work, the first image ends up inside the area of the second article: fixing with contain if we give each article the contain property with a value of content, when new elements are inserted the browser understands it only needs to recalculate the containing element's subtree, and not anything outside it: <h1>my blog</h1> <article> <h2>heading of a nice article</h2> <p>content here.</p> <img src="i-just-showed-up.jpg" alt="social"> </article> <article> <h2>another heading of another article</h2> <img src="graphic.jpg" alt="photo"> <p>more conte...
content - CSS: Cascading Style Sheets
WebCSScontent
html <h1>5</h1> <p>according to sir tim berners-lee, <q cite="http://www.w3.org/people/berners-lee/faq.html#internet">i was lucky enough to invent the web at the time when the internet already existed - and had for a decade and a half.</q> we must understand that there is nothing fundamentally wrong with building on the contributions of others.
<display-inside> - CSS: Cascading Style Sheets
note: browsers that support the two value syntax, on finding the inner value only, such as when display: flex or display: grid is specified, will set their outer value to block.
empty-cells - CSS: Cascading Style Sheets
this property has an effect only when the border-collapse property is separate.
grayscale() - CSS: Cascading Style Sheets
default value when omitted is 1.
filter - CSS: Cascading Style Sheets
WebCSSfilter
when a single filter property has two or more functions it's results will be different from when two or more filter properties are separately applied with the same functions.
fit-content() - CSS: Cascading Style Sheets
candidate recommendation defines the function when used as a track size.
float - CSS: Cascading Style Sheets
WebCSSfloat
formal definition initial valuenoneapplies toall elements, but has no effect if the value of display is none.inheritednocomputed valueas specifiedanimation typediscrete formal syntax left | right | none | inline-start | inline-end examples how floated elements are positioned as mentioned above, when an element is floated, it is taken out of the normal flow of the document (though still remaining part of it).
font-language-override - CSS: Cascading Style Sheets
this is useful, for example, when the typeface you're using lacks proper support for the language.
font-optical-sizing - CSS: Cascading Style Sheets
when optical sizing is used, small text sizes are often rendered with thicker strokes and larger serifs, whereas larger text is often rendered more delicately with more contrast between thicker and thinner strokes.
font-style - CSS: Cascading Style Sheets
when the specified style is not available, both italic and oblique faces are simulated by artificially sloping the glyphs of the regular face (use font-synthesis to control this behavior).
font-variant-numeric - CSS: Cascading Style Sheets
slashed-zero this keyword forces the use of a 0 with a slash; this is useful when a clear distinction between o and 0 is needed.
font-variant-position - CSS: Cascading Style Sheets
/* keyword values */ font-variant-position: normal; font-variant-position: sub; font-variant-position: super; /* global values */ font-variant-position: inherit; font-variant-position: initial; font-variant-position: unset; when the usage of these alternate glyphs is activated, if one character in the run doesn't have such a typographically-enhanced glyph, the whole set of characters of the run is rendered using a fallback method, synthesizing these glyphs.
grid-auto-columns - CSS: Cascading Style Sheets
when appearing outside a minmax() notation, it implies an automatic minimum (i.e.
grid-auto-rows - CSS: Cascading Style Sheets
when appearing outside a minmax() notation, it implies an automatic minimum (i.e.
grid-template-columns - CSS: Cascading Style Sheets
when appearing outside a minmax() notation, it implies an automatic minimum (i.e.
grid-template-rows - CSS: Cascading Style Sheets
when appearing outside a minmax() notation, it implies an automatic minimum (i.e.
height - CSS: Cascading Style Sheets
WebCSSheight
accessibility concerns ensure that elements set with a height are not truncated and/or do not obscure other content when the page is zoomed to increase text size.
ime-mode - CSS: Cascading Style Sheets
WebCSSime-mode
users may correct the inappropriate behavior of sites that don't follow this recommendation by placing the following css into their user stylesheet: input[type=password] { ime-mode: auto !important; } the mac version of gecko 1.9 (firefox 3) can't recover the previous state of the ime when a field for which it is disabled loses focus, so mac users may get grumpy when you use the disabled value.
inherit - CSS: Cascading Style Sheets
WebCSSinherit
inheritance is always from the parent element in the document tree, even when the parent element is not the containing block.
initial-letter - CSS: Cascading Style Sheets
<integer> defines the number of lines the initial letter should sink when the size of it is given.
isolation - CSS: Cascading Style Sheets
WebCSSisolation
this property is especially helpful when used in conjunction with mix-blend-mode.
line-break - CSS: Cascading Style Sheets
the line-break css property sets how to break lines of chinese, japanese, or korean (cjk) text when working with punctuation and symbols.
line-height-step - CSS: Cascading Style Sheets
when the property is set, line box heights are rounded up to the closest multiple of the unit.
list-style-position - CSS: Cascading Style Sheets
note that there is variance among browsers regarding behavior when a block element is placed first within a list element declared as list-style-position: inside.
margin-left - CSS: Cascading Style Sheets
in the rare cases where width is overconstrained (i.e., when all of width, margin-left, border, padding, the content area, and margin-right are defined), margin-left is ignored, and will have the same calculated value as if the auto value was specified.
margin-trim - CSS: Cascading Style Sheets
it also applies to ::first-letter and ::first-line.inheritednocomputed valueas specifiedanimation typediscrete formal syntax none | in-flow | all examples basic usage once support is implemented for this property, it will probably work like so: when you've got a container with some inline children and you want to put a margin between each child but not have it interfere with the spacing at the end of the row, you might do something like this: article { background-color: red; margin: 20px; padding: 20px; display: inline-block; } article > span { background-color: black; color: white; text-align: center; padding: 10px; marg...
mask-border-mode - CSS: Cascading Style Sheets
when browsers support it, it will specify the type of blending mode used for the mask border — luminance or alpha: mask-border-mode: luminance; mask-border-mode: alpha; specifications specification status comment css masking module level 1the definition of 'mask-border-mode' in that specification.
mask-border-source - CSS: Cascading Style Sheets
when it eventually starts to be supported, it will serve to define the source of the border mask.
mask-size - CSS: Cascading Style Sheets
WebCSSmask-size
when the image and container have different dimensions, the image is clipped either on left/right or at top/bottom.
max-height - CSS: Cascading Style Sheets
accessibility concerns ensure that elements set with a max-height are not truncated and/or do not obscure other content when the page is zoomed to increase text size.
max-width - CSS: Cascading Style Sheets
WebCSSmax-width
accessibility concerns ensure that elements set with a max-width are not truncated and/or do not obscure other content when the page is zoomed to increase text size.
min-height - CSS: Cascading Style Sheets
the element's height is set to the value of min-height whenever min-height is larger than max-height or height.
min-width - CSS: Cascading Style Sheets
WebCSSmin-width
the element's width is set to the value of min-width whenever min-width is larger than max-width or width.
<number> - CSS: Cascading Style Sheets
WebCSSnumber
interpolation when animated, values of the <number> css data type are interpolated as real, floating-point numbers.
offset-distance - CSS: Cascading Style Sheets
100% represents the total length of the path (when the offset-path is defined as a basic shape or path()).
outline-color - CSS: Cascading Style Sheets
it is often more convenient to use the shorthand property outline when defining the appearance of an outline.
outline-style - CSS: Cascading Style Sheets
it is often more convenient to use the shorthand property outline when defining the appearance of an outline.
outline-width - CSS: Cascading Style Sheets
it is often more convenient to use the shorthand property outline when defining the appearance of an outline.
overflow-anchor - CSS: Cascading Style Sheets
syntax /* keyword values */ overflow-anchor: auto; overflow-anchor: none; /* global values */ overflow-anchor: inherit; overflow-anchor: initial; overflow-anchor: unset; values auto the element becomes a potential anchor when adjusting scroll position.
overscroll-behavior-y - CSS: Cascading Style Sheets
the overscroll-behavior-y css property sets the browser's behavior when the vertical boundary of a scrolling area is reached.
<percentage> - CSS: Cascading Style Sheets
interpolation when animated, values of the <percentage> data type are interpolated as real, floating-point numbers.
perspective-origin - CSS: Cascading Style Sheets
syntax /* one-value syntax */ perspective-origin: x-position; /* two-value syntax */ perspective-origin: x-position y-position; /* when both x-position and y-position are keywords, the following is also valid */ perspective-origin: y-position x-position; /* global values */ perspective-origin: inherit; perspective-origin: initial; perspective-origin: unset; values x-position indicates the position of the abscissa of the vanishing point.
<position> - CSS: Cascading Style Sheets
interpolation when animated, a point's abscissa and ordinate values are interpolated independently.
repeating-conic-gradient() - CSS: Cascading Style Sheets
when defaulting to these values, the repeating arc is 360 degrees, and therefore doesn't repeat.
revert - CSS: Cascading Style Sheets
WebCSSrevert
h3 { font-weight: normal; color: blue; } <h3 style="font-weight: unset; color: unset;">this will still have font-weight: normal, but color: black</h3> <p>just some text</p> <h3 style="font-weight: revert; color: revert;">this should have its original font-weight (bold) and color: black</h3> <p>just some text</p> revert all reverting all values is useful when you did heavy modifications for something and then want to revert to defaults.
scroll-margin-inline-end - CSS: Cascading Style Sheets
last of all we specify the scroll margin values, a different one for the second and third child elements: .scroller > div:nth-child(2) { scroll-margin-inline-end: 1rem; } .scroller > div:nth-child(3) { scroll-margin-inline-end: 2rem; } this means that when scrolling past the middle child elements, the scrolling will snap to 1rem outside the inline end edge of the second <div>, and 2rems outside the inline end edge of the third <div>.
scroll-margin-inline-start - CSS: Cascading Style Sheets
last of all we specify the scroll margin-values, a different one for the second and third child elements: .scroller > div:nth-child(2) { scroll-margin-inline-start: 1rem; } .scroller > div:nth-child(3) { scroll-margin-inline-start: 2rem; } this means that when scrolling past the middle child elements, the scrolling will snap to 1rem outside the inline start edge of the second <div>, and 2rems outside the inline start edge of the third <div>.
scroll-margin-inline - CSS: Cascading Style Sheets
last of all we specify the scroll margin values, a different one for the second and third child elements: .scroller > div:nth-child(2) { scroll-margin-inline: 1rem; } .scroller > div:nth-child(3) { scroll-margin-inline: 2rem; } this means that when scrolling past the middle child elements, the scrolling will snap to 1rem outside the inline end edge of the second <div>, and 2rems outside the inline end edge of the third <div>.
scroll-margin - CSS: Cascading Style Sheets
last of all we specify the scroll margin-values, a different one for the second and third child elements: .scroller > div:nth-child(2) { scroll-margin: 1rem; } .scroller > div:nth-child(3) { scroll-margin: 2rem; } this means that when scrolling past the middle child elements, the scrolling will snap to 1rem outside the left edge of the second <div>, and 2rems outside the left edge of the third <div>.
scroll-snap-align - CSS: Cascading Style Sheets
syntax /* keyword values */ scroll-snap-align: none; scroll-snap-align: start end; /* when two values set first is block, second inline */ scroll-snap-align: center; /* global values */ scroll-snap-align: inherit; scroll-snap-align: initial; scroll-snap-align: unset; values none the box does not define a snap position in that axis.
scroll-snap-stop - CSS: Cascading Style Sheets
/* keyword values */ scroll-snap-stop: normal; scroll-snap-stop: always; /* global values */ scroll-snap-type: inherit; scroll-snap-type: initial; scroll-snap-type: unset; syntax values normal when the visual viewport of this element's scroll container is scrolled, it may "pass over" possible snap positions.
scrollbar-color - CSS: Cascading Style Sheets
accessibility concerns when using scrollbar-color property with specific color values, authors should ensure the specified colors have enough contrast between them.
scrollbar-width - CSS: Cascading Style Sheets
the scrollbar-width property allows the author to set the maximum thickness of an element’s scrollbars when they are shown.
<string> - CSS: Cascading Style Sheets
WebCSSstring
these include double quotes when used inside a double-quoted string, single quotes when used inside a single-quoted string, and the backslash itself.
symbols() - CSS: Cascading Style Sheets
WebCSSsymbols
[ <string> | <image> ]+ ); <symbols-type> can be one of the following: cyclic: the system cycles through the given values in the order of their definition, and returns to the start when it reaches the end.
text-align - CSS: Cascading Style Sheets
<string> when applied to a table cell, specifies the alignment character around which the cell's contents will align.
text-combine-upright - CSS: Cascading Style Sheets
] examples digits the digits value requires less markup than the all value when digits are being combined, but it is currently not very widely supported by browsers.
text-decoration-line - CSS: Cascading Style Sheets
when setting multiple line-decoration properties at once, it may be more convenient to use the text-decoration shorthand property instead.
text-decoration-skip-ink - CSS: Cascading Style Sheets
the text-decoration-skip-ink css property specifies how overlines and underlines are drawn when they pass over glyph ascenders and descenders.
text-decoration-style - CSS: Cascading Style Sheets
when setting multiple line-decoration properties at once, it may be more convenient to use the text-decoration shorthand property instead.
text-decoration - CSS: Cascading Style Sheets
be careful when removing the text decoration on anchors since users often depend on the underline to denote hyperlinks.</p> <p class="underover">this text has lines above <em>and</em> below it.</p> <p class="thick">this text has a really thick purple underline in supporting browsers.</p> <p class="blink">this text might blink for you, depending on the browser you use.</p> specifications ...
text-justify - CSS: Cascading Style Sheets
the text-justify css property sets what type of justification should be applied to text when text-align: justify; is set on an element.
text-orientation - CSS: Cascading Style Sheets
it only affects text in vertical mode (when writing-mode is not horizontal-tb).
text-size-adjust - CSS: Cascading Style Sheets
when an element containing text uses 100% of the screen's width, the algorithm increases its text size, but without modifying the layout.
scale() - CSS: Cascading Style Sheets
when a coordinate value is outside the [-1, 1] range, the element grows along that dimension; when inside, it shrinks.
scale3d() - CSS: Cascading Style Sheets
when a coordinate value is outside the [-1, 1] range, the element grows along that dimension; when inside, it shrinks.
scaleX() - CSS: Cascading Style Sheets
it modifies the abscissa of each element point by a constant factor, except when the scale factor is 1, in which case the function is the identity transform.
scaleY() - CSS: Cascading Style Sheets
it modifies the ordinate of each element point by a constant factor, except when the scale factor is 1, in which case the function is the identity transform.
scaleZ() - CSS: Cascading Style Sheets
this scaling transformation modifies the z-coordinate of each element point by a constant factor, except when the scale factor is 1, in which case the function is the identity transform.
translateZ() - CSS: Cascading Style Sheets
this has the effect of making the element appear larger when viewed on a 2d display, or closer when viewed using a vr headset or other 3d display device.
<transform-function> - CSS: Cascading Style Sheets
however, one major transformation is not linear, and therefore must be special-cased when using this notation: translation.
transition-property - CSS: Cascading Style Sheets
<custom-ident> a string identifying the property to which a transition effect should be applied when its value changes.
transition-timing-function - CSS: Cascading Style Sheets
whether the transition holds temporarily at 0%, 20%, 40%, 60% and 80%, on the 20%, 40%, 60%, 80% and 100%, or makes 5 stops between the 0% and 100% along the transition, or makes 5 stops including the 0% and 100% marks (on the 0%, 25%, 50%, 75%, and 100%) depends on which of the following jump terms is used: jump-start denotes a left-continuous function, so that the first jump happens when the transition begins; jump-end denotes a right-continuous function, so that the last jump happens when the animation ends; jump-none there is no jump on either end.
transition - CSS: Cascading Style Sheets
see how things are handled when lists of property values aren't the same length.
unicode-bidi - CSS: Cascading Style Sheets
when applying its bidirectional-resolution algorithm, its container element treats it as one or several u+fffc object replacement character, i.e.
unset - CSS: Cascading Style Sheets
WebCSSunset
in other words, it behaves like the inherit keyword in the first case, when the property is an inherited property, and like the initial keyword in the second case, when the property is a non-inherited property.
visibility - CSS: Cascading Style Sheets
the element cannot receive focus (such as when navigating through tab indexes).
width - CSS: Cascading Style Sheets
WebCSSwidth
accessibility concerns ensure that elements set with a width aren't truncated and don't obscure other content when the page is zoomed to increase text size.
writing-mode - CSS: Cascading Style Sheets
when set for an entire document, it should be set on the root element (html element for html documents).
CSS: Cascading Style Sheets
WebCSS
use css to solve common problems this module provides links to sections of content explaining how to use css to solve common problems when creating a web page.
exsl:node-set() - EXSLT
WebEXSLTexslnode-set
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes exsl:node-set() returns a node-set from a result tree fragment, which is what you get when you look at the xsl:variable instead of its select attribute to fetch a variable's value.
Common (exsl) - EXSLT
WebEXSLTexsl
exsl:node-set()exsl:node-set() returns a node-set from a result tree fragment, which is what you get when you look at the xsl:variable instead of its select attribute to fetch a variable's value.
EXSLT
exslt modules to use an exslt function, you need to declare the namespace the function is in, and then use the appropriate prefix when calling the function.
touchstart - Event reference
the touchstart event is fired when one or more touch points are placed on the touch surface.
Ajax - Developer guides
WebGuideAJAX
when these technologies are combined in the ajax model, web applications are able to make quick, incremental updates to the user interface without reloading the entire browser page.
Adding captions and subtitles to HTML5 video - Developer guides
the default attribute is set on the english <track> element, indicating to the browser that this is the default subtitle file definition to use when subtitles have been turned on and the user has not made a specific selection.
Live streaming web audio and video - Developer guides
the key consideration when streaming media to a browser is the fact that rather than playing a finite file we are relaying a file that is being created on the fly and has no pre-determined start or end.
Setting up adaptive streaming media sources - Developer guides
<video src="my.mpd" type="application/dash+xml"></video> it might be wise to provide a fallback for browsers that don't yet support mpeg-dash: <video> <source src="my.mpd" type="application/dash+xml"> <!-- fallback --> <source src="my.mp4" type="video/mp4"> <source src="my.webm" type="video/webm"> </video> live profile a useful piece of software when dealing with mpeg-dash is dash encoder.
Audio and video manipulation - Developer guides
for efficiency, you should consider using requestanimationframe() instead of settimeout() when running on browsers that support it.
Constraint validation - Developer guides
(this is typically done by the user-agent when determining which of the css pseudo-classes, :valid or :invalid, applies.) in contrast, the reportvalidity() method reports any constraint failures to the user.
Introduction to Web development - Developer guides
christian heilmann's javascript best practices — learn about some of the obvious and (not so) obvious best practices when writing javascript.
A hybrid approach - Developer guides
when it is right to choose this option combining server-side and client-side techniques is something that is always worth considering; there are so many options that one must just weigh the pros and cons of each individual technique employed.
Mobile-friendliness - Developer guides
for example, it is absolutely critical to keep in mind which browsers and devices you will target when picking a mobile strategy.
Separate sites for mobile and desktop - Developer guides
when it is right to choose this option firstly, if your target audience includes users on older or low-end feature phones, it is worth noting that you may need to employ this strategy to some degree no matter what.
Optimization and performance - Developer guides
when building modern web apps and sites, it's important to make your content perform well.
HTML attribute: capture - HTML: Hypertext Markup Language
examples when set on a file input type, operating systems with microphones and cameras will display a user interface allowing the selection from an existing file or the creating of a new one.
HTML attribute: max - HTML: Hypertext Markup Language
WebHTMLAttributesmax
yyyy-w## <input type="week" max="2019-w23" step=""> time hh:mm <input type="time" max="17:00" step="900"> datetime-local yyyy-mm-ddthh:mm <input type="datetime-local" min="2019-12-25t23:59"> number <number> <input type="number" min="0" step="5" max="100"> range <number> <input type="range" min="60" step="5" max="100"> note: when the data entered by the user doesn't adhere to the maximum value set, the value is considered invalid in contraint validation and will match the :invalid and :out-of-range pseudoclasses see client-side validation and rangeoverflow for more information.
HTML attribute: maxlength - HTML: Hypertext Markup Language
constraint validation is only applied when the value is changed by the user.
HTML attribute: min - HTML: Hypertext Markup Language
WebHTMLAttributesmin
yyyy-w## <input type="week" min="2019-w23" step=""> time hh:mm <input type="time" min="09:00" step="900"> datetime-local yyyy-mm-ddthh:mm <input type="datetime-local" min="2019-12-25t19:30"> number <number> <input type="number" min="0" step="5" max="100"> range <number> <input type="range" min="60" step="5" max="100"> note: when the data entered by the user doesn't adhere to the min value set, the value is considered invalid in contraint validation and will match the :invalid pseudoclass see client-side validation and rangeunderflow for more information.
HTML attribute: minlength - HTML: Hypertext Markup Language
constraint validation is only applied when the value is changed by the user.
<h1>–<h6>: The HTML Section Heading elements - HTML: Hypertext Markup Language
tent: h1 beetles h2 etymology h2 distribution and diversity h2 evolution h3 late paleozoic h3 jurassic h3 cretaceous h3 cenozoic h2 external morphology h3 head h4 mouthparts h3 thorax h4 prothorax h4 pterothorax h3 legs h3 wings h3 abdomen when headings are nested, heading levels may be "skipped" when closing a subsection.
<address>: The Contact Address element - HTML: Hypertext Markup Language
WebHTMLElementaddress
.com</a>.<br> if you see any bugs, please <a href="mailto:webmaster@somedomain.com"> contact webmaster</a>.<br> you may also want to visit us:<br> mozilla foundation<br> 331 e evelyn ave<br> mountain view, ca 94041<br> usa </address> result although it renders text with the same default styling as the <i> or <em> elements, it is more appropriate to use <address> when dealing with contact information, as it conveys additional semantic information.
<article>: The Article Contents element - HTML: Hypertext Markup Language
WebHTMLElementarticle
when an <article> element is nested, the inner element represents an article related to the outer element.
<b>: The Bring Attention To element - HTML: Hypertext Markup Language
WebHTMLElementb
the <b> element doesn't convey such special semantic information; use it only when no others fit.
<command>: The HTML Command element - HTML: Hypertext Markup Language
WebHTMLElementcommand
radiogroup this attribute gives the name of the group of commands, with a type of radio, that will be toggled when the command itself is toggled.
<del>: The Deleted Text element - HTML: Hypertext Markup Language
WebHTMLElementdel
this can be used when rendering "track changes" or source code diff information, for example.
<dfn>: The Definition element - HTML: Hypertext Markup Language
WebHTMLElementdfn
result the resulting content looks like this: using abbreviations and definitions together in some cases, you may wish to use an abbreviation for a term when defining it.
<div>: The Content Division element - HTML: Hypertext Markup Language
WebHTMLElementdiv
usage notes the <div> element should be used only when no other semantic element (such as <article> or <nav>) is appropriate.
<dl>: The Description List element - HTML: Hypertext Markup Language
WebHTMLElementdl
this can be useful when using microdata, or when global attributes apply to a whole group, or for styling purposes.
<em>: The Emphasis element - HTML: Hypertext Markup Language
WebHTMLElementem
the <em> element represents stress emphasis of its contents, while the <i> element represents text that is set off from the normal prose, such a foreign word, fictional character thoughts, or when the text refers to the definition of a word instead of representing its semantic meaning.
<input type="reset"> - HTML: Hypertext Markup Language
WebHTMLElementinputreset
when building a site, be sure to provide this information in a way that doesn't interfere with the site design (for example by providing an easily accessible link that points to information on what the site access keys are).
<isindex> - HTML: Hypertext Markup Language
WebHTMLElementisindex
when sent, the server would return a list of pages matching the query.
<kbd>: The Keyboard Input element - HTML: Hypertext Markup Language
WebHTMLElementkbd
result the output looks like this without a style sheet applied: with custom styles we can make more sense of this by adding some css: css we add a new style for <kbd> elements, key, which we can apply when rendering keyboard keys: kbd.key { border-radius: 3px; padding: 1px 2px 0; border: 1px solid black; } html then we update the html to use this class on the keys in the output to be presented: <p>you can also create a new document by pressing <kbd><kbd class="key">ctrl</kbd>+<kbd class="key">n</kbd></kbd>.</p> result the result is just what we want!
<li> - HTML: Hypertext Markup Language
WebHTMLElementli
implicit aria role listitem when child of an ol, ul or menu permitted aria roles menuitem, menuitemcheckbox, menuitemradio, option, none, presentation, radio, separator, tab, treeitem dom interface htmllielement attributes this element includes the global attributes.
<listing> - HTML: Hypertext Markup Language
WebHTMLElementlisting
the html 2 standard recommended that lines shouldn't be broken when not greater than 132 characters.
<main> - HTML: Hypertext Markup Language
WebHTMLElementmain
<body> <a href="#main-content">skip to main content</a> <!-- navigation and header content --> <main id="main-content"> <!-- main page content --> </main> </body> webaim: "skip navigation" links reader mode browser reader mode functionality looks for the presence of the <main> element, as well as heading and content sectioning elements when converting content into a specialized reader view.
<map> - HTML: Hypertext Markup Language
WebHTMLElementmap
examples <map name="primary"> <area shape="circle" coords="75,75,75" href="left.html"> <area shape="circle" coords="275,75,75" href="right.html"> </map> <img usemap="#primary" src="https://udn.realityripple.com/samples/6a/7e559101b3.png" alt="350 x 150 pic"> result expected live example output the live example above should appear similar to the following images (when using your keyboard tab key): for the left.html link: for the right.html link specifications specification status comment html living standardthe definition of '<map>' in that specification.
<mark>: The Mark Text element - HTML: Hypertext Markup Language
WebHTMLElementmark
usage notes typical use cases for <mark> include: when used in a quotation (<q>) or block quote (<blockquote>), it generally indicates text which is of special interest but is not marked in the original source material, or material which needs special scrutiny even though the original author didn't think it was of particular importance.
<meter>: The HTML Meter element - HTML: Hypertext Markup Language
WebHTMLElementmeter
when used with the low attribute and high attribute, it gives an indication where along the range is considered preferable.
<noembed>: The Embed Fallback element (Obsolete) - HTML: Hypertext Markup Language
WebHTMLElementnoembed
examples the message inside <noembed> tag will appear only when your browser does not support <embed> tag.
<ol>: The Ordered List element - HTML: Hypertext Markup Language
WebHTMLElementol
always an arabic numeral (1, 2, 3, etc.), even when the numbering type is letters or roman numerals.
<optgroup> - HTML: Hypertext Markup Language
WebHTMLElementoptgroup
label the name of the group of options, which the browser can use when labeling the options in the user interface.
<pre>: The Preformatted Text element - HTML: Hypertext Markup Language
WebHTMLElementpre
people experiencing low vision conditions and browsing with the aid of assistive technology such as a screen reader may not understand what the preformatted text characters are representing when they are read out in sequence.
<rb>: The Ruby Base element - HTML: Hypertext Markup Language
WebHTMLElementrb
in this case we don't need to include <rb> elements: <ruby> 漢 <rp>(</rp><rt>kan</rt><rp>)</rp> 字 <rp>(</rp><rt>ji</rt><rp>)</rp> </ruby> <ruby> <rb>漢<rb>字 <rp>(</rp><rt>kan<rt>ji<rp>)</rp> </ruby> body { font-size: 22px; } the output looks like so: the html above might look something like this when rendered by a browser without ruby support: 漢字 (kan ji) body { font-size: 22px; } note: see the article about the <ruby> element for further examples.
<s> - HTML: Hypertext Markup Language
WebHTMLElements
however, <s> is not appropriate when indicating document edits; for that, use the <del> and <ins> elements, as appropriate.
<samp>: The Sample Output element - HTML: Hypertext Markup Language
WebHTMLElementsamp
<p>when the process is complete, the utility will output the text <samp>scan complete.
<section>: The Generic Section element - HTML: Hypertext Markup Language
WebHTMLElementsection
do not use the <section> element as a generic container; this is what <div> is for, especially when the sectioning is only for styling purposes.
<small>: the side comment element - HTML: Hypertext Markup Language
WebHTMLElementsmall
authors are encouraged to use their best judgement when determining whether to use <small> or css.
<span> - HTML: Hypertext Markup Language
WebHTMLElementspan
it should be used only when no other semantic element is appropriate.
<style>: The Style Information element - HTML: Hypertext Markup Language
WebHTMLElementstyle
background-color: blue; padding: 5px; border: 1px solid black; } </style> <style> p { color: blue; background-color: yellow; } </style> </head> <body> <p>this is my paragraph.</p> </body> </html> including a media query in this example we build on the previous one, including a media attribute on the second <style> element so it is only applied when the viewport is less than 500px in width.
<sub>: The Subscript element - HTML: Hypertext Markup Language
WebHTMLElementsub
<var>x<sub>n</sub></var>.</p> the resulting output: chemical formulas when writing a chemical formula, such as h20, the number of atoms of a given element within the described molecule is represented using a subscripted number; in the case of water, the subscripted "2" indicates that there are two atoms of hydrogen in the molecule.
<summary>: The Disclosure Summary element - HTML: Hypertext Markup Language
WebHTMLElementsummary
when the user clicks on the summary, the parent <details> element is toggled open or closed, and then a toggle event is sent to the <details> element, which can be used to let you know when this state change occurs.
<sup>: The Superscript element - HTML: Hypertext Markup Language
WebHTMLElementsup
displaying superior lettering, which is used in some languages when rendering certain abbreviations.
<td>: The Table Data Cell element - HTML: Hypertext Markup Language
WebHTMLElementtd
the default value when this attribute is not specified is left.
<template>: The Content Template element - HTML: Hypertext Markup Language
WebHTMLElementtemplate
the html content template (<template>) element is a mechanism for holding html that is not to be rendered immediately when a page is loaded but may be instantiated subsequently during runtime using javascript.
<tfoot>: The Table Foot element - HTML: Hypertext Markup Language
WebHTMLElementtfoot
typical values for this include a period (.) when attempting to align numbers or monetary values.
<thead>: The Table Head element - HTML: Hypertext Markup Language
WebHTMLElementthead
typical values for this include a period (.) when attempting to align numbers or monetary values.
<var>: The Variable element - HTML: Hypertext Markup Language
WebHTMLElementvar
ode>: the html code element <kbd>: the html keyboard input element <samp>: the html sample output element if you encounter code that is mistakenly using <var> for style purposes rather than semantic purposes, you should either use a <span> with appropriate css or, an appropriate semantic element among the following: <em> <i> <q> default style most browsers apply font-style to "italic" when rendering <var>.
<wbr> - HTML: Hypertext Markup Language
WebHTMLElementwbr
in particular, it behaves like a unicode bidi bn code point, meaning it has no effect on bidi-ordering: <div dir=rtl>123,<wbr>456</div> displays, when not broken on two lines, 123,456 and not 456,123.
accesskey - HTML: Hypertext Markup Language
certain accesskey values may not be present on certain keyboards, especially when internationalization is a concern.
autocapitalize - HTML: Hypertext Markup Language
ocapitalization is applied (all letters default to lowercase) on or sentences: the first letter of each sentence defaults to a capital letter; all other letters default to lowercase words: the first letter of each word defaults to a capital letter; all other letters default to lowercase characters: all letters should default to uppercase the autocapitalize attribute doesn’t affect behavior when typing on a physical keyboard.
dir - HTML: Hypertext Markup Language
as the directionality of the text is semantically related to its content and not to its presentation, it is recommended that web developers use this attribute instead of the related css properties when possible.
id - HTML: Hypertext Markup Language
its purpose is to identify the element when linking (using a fragment identifier), scripting, or styling (with css).
inputmode - HTML: Hypertext Markup Language
for when the page implements its own keyboard input control.
itemscope - HTML: Hypertext Markup Language
itemscope itemtype movie itemprop (itemprop name) (itemprop value) itemprop director james cameron itemprop genre science fiction itemprop name avatar itemprop https://youtu.be/0ay1xikx7by trailer itemscope id attributes when you specify the itemscope attribute for an element, a new item is created.
tabindex - HTML: Hypertext Markup Language
a negative value is useful when you have off-screen content that appears on a specific event.
x-ms-acceleratorkey - HTML: Hypertext Markup Language
the x-ms-acceleratorkey attribute accessibly declares that an accelerator key has been assigned to an element: the element is activated via javascript when the key(s) are pressed on a keyboard.
Link types: noreferrer - HTML: Hypertext Markup Language
the noreferrer keyword for the rel attribute of the <a>, <area>, and <form> elements instructs the browser, when navigating to the target resource, to omit the referer header and otherwise leak no referrer information — and additionally to behave as if the noopener keyword were also specified.
Evolution of HTTP - HTTP
how much and when such restrictions are lifted is transmitted by the server to the client using a new bunch of http headers.
Common MIME types - HTTP
browsers pay a particular care when manipulating these files, attempting to safeguard the user to prevent dangerous behaviors.
Basics of HTTP - HTTP
flow of an http session this fundamental article describes a typical http session: what happens under the hood when you click on a link in your browser.
Reason: missing token ‘xyz’ in CORS header ‘Access-Control-Allow-Headers’ from CORS preflight channel - HTTP
this error occurs when attempting to preflight a header that is not expressly allowed (that is, it's not included in the list specified by the access-control-allow-headers header sent by the server).
Reason: Credential is not supported if the CORS header ‘Access-Control-Allow-Origin’ is ‘*’ - HTTP
to correct this problem on the client side, simply ensure that the credentials flag's value is false when issuing your cors request.
CORS errors - HTTP
WebHTTPCORSErrors
cors error messages firefox's console displays messages in its console when requests fail due to cors.
Accept - HTTP
WebHTTPHeadersAccept
browsers set adequate values for this header depending on the context where the request is done: when fetching a css stylesheet a different value is set for the request than when fetching an image, video or a script.
Access-Control-Allow-Headers - HTTP
access-control-allow-headers: x-custom-header multiple headers this example shows access-control-allow-headers when it specifies support for multiple headers.
Access-Control-Allow-Methods - HTTP
the access-control-allow-methods response header specifies the method or methods allowed when accessing the resource in response to a preflight request.
Access-Control-Request-Headers - HTTP
the access-control-request-headers request header is used by browsers when issuing a preflight request, to let the server know which http headers the client might send when the actual request is made.
Access-Control-Request-Method - HTTP
the access-control-request-method request header is used by browsers when issuing a preflight request, to let the server know which http method will be used when the actual request is made.
Cache-Control - HTTP
if-none-match or if-modified-since) to check for updates, even when the user explicitly refreshes the page.
Clear-Site-Data - HTTP
you can achieve that by adding the clear-site-data header when sending the page confirming that logging out from the site has been accomplished successfully (https://example.com/logout, for example): clear-site-data: "cache", "cookies", "storage", "executioncontexts" clearing cookies if this header is delivered with the response at https://example.com/clear-cookies, all cookies on the same domain https://example.com and any subdomains (like https://stage.
Content-Encoding - HTTP
when present, its value indicates which encodings were applied to the entity-body.
Content-Location - HTTP
<input type="number" name="amount"> </label> </p> <button type="submit">send money</button> </form> when the form is submitted, the site generates a receipt for the transaction.
CSP: base-uri - HTTP
when generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace.
CSP: block-all-mixed-content - HTTP
the http content-security-policy (csp) block-all-mixed-content directive prevents loading any assets over http when the page uses https.
CSP: child-src - HTTP
when generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace.
CSP: connect-src - HTTP
when generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace.
CSP: default-src - HTTP
when generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace.
CSP: font-src - HTTP
when generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace.
CSP: form-action - HTTP
when generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace.
CSP: frame-src - HTTP
when generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace.
CSP: img-src - HTTP
when generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace.
CSP: manifest-src - HTTP
when generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace.
CSP: media-src - HTTP
when generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace.
CSP: navigate-to - HTTP
when generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace.
CSP: object-src - HTTP
when generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace.
CSP: prefetch-src - HTTP
when generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace.
CSP: report-uri - HTTP
so for compatibility with current browsers while also adding forward compatibility when browsers get report-to support, you can specify both report-uri and report-to: content-security-policy: ...; report-uri https://endpoint.com; report-to groupname in browsers that support report-to, the report-uri directive will be ignored.
CSP: script-src-attr - HTTP
when generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace.
CSP: script-src-elem - HTTP
when generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace.
CSP: style-src-attr - HTTP
when generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace.
CSP: style-src-elem - HTTP
when generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace.
Digest - HTTP
WebHTTPHeadersDigest
when released, the "resource digests for http" draft therefore will obsolete rfc 3230 and will update the standard to be consistent.
Feature-Policy: autoplay - HTTP
when this policy is enabled and there were no user gestures, the promise returned by htmlmediaelement.play() will reject with a domexception.
Feature-Policy: camera - HTTP
when this policy is enabled, the promise returned by mediadevices.getusermedia() will reject with a notallowederror.
Feature-Policy: document-domain - HTTP
when this policy is enabled, attempting to set document.domain will fail and cause a securityerror domexception to be be thrown.
Feature-Policy: encrypted-media - HTTP
when this policy is enabled, the promise returned by navigator.requestmediakeysystemaccess() will reject with a domexception.
Feature-Policy: fullscreen - HTTP
when this policy is enabled, the returned promise rejects with a typeerror.
Feature-Policy: geolocation - HTTP
when this policy is enabled, calls to getcurrentposition() and watchposition() will cause those functions' callbacks to be invoked with a positionerror code of permission_denied.
Feature-Policy: microphone - HTTP
when this policy is enabled, the promise returned by mediadevices.getusermedia() will reject with a notallowederror.
Feature-Policy: midi - HTTP
when this policy is enabled, the promise returned by navigator.requestmidiaccess() will reject with a domexception.
Feature-Policy: payment - HTTP
when this policy is disabled, the paymentrequest() constructor will throw a syntaxerror.
Feature-Policy: publickey-credentials-get - HTTP
when this policy is enabled, any attempt to query public key credentials will result in an error.
If-Modified-Since - HTTP
when used in combination with if-none-match, it is ignored, unless the server doesn't support if-none-match.
Sec-Fetch-Site - HTTP
this can happen when user had initiated this request by, e.g.
Server-Timing - HTTP
consider to control which metrics are returned when and to whom on the server side.
TE - HTTP
WebHTTPHeadersTE
q when multiple transfer codings are acceptable, the q parameter of the quality value syntax can rank codings by preference.
Upgrade - HTTP
WebHTTPHeadersUpgrade
for example, the client might send a get request as shown, listing the preferred protocols to switch to (in this case "example/1" and "foo/2"): get /index.html http/1.1 host: www.example.com connection: upgrade upgrade: example/1, foo/2 note: connection: upgrade must be set whenever upgrade is sent.
WWW-Authenticate - HTTP
charset=<charset> tells the client the server's prefered encoding scheme when submitting a username and password.
Want-Digest - HTTP
when released, the "resource digests for http" draft therefore will obsolete rfc 3230 and will update the standard to be consistent.
Warning - HTTP
WebHTTPHeadersWarning
<warn-agent> the name or pseudonym of the server or software adding the warning header (might be "-" when the agent is unknown).
X-Content-Type-Options - HTTP
this can cause html web pages to be downloaded instead of being rendered when they are served with a mime type other than text/html.
X-Forwarded-Host - HTTP
therefore the user's privacy must be kept in mind when deploying this header.
X-Frame-Options - HTTP
header type response header forbidden header name no syntax there are two possible directives for x-frame-options: x-frame-options: deny x-frame-options: sameorigin directives if you specify deny, not only will attempts to load the page in a frame fail when loaded from other sites, attempts to do so will fail when loaded from the same site.
POST - HTTP
WebHTTPMethodsPOST
text/plain when the post request is sent via a method other than an html form — like via an xmlhttprequest — the body can take any type.
200 OK - HTTP
WebHTTPStatus200
the successful result of a put or a delete is often not a 200 ok but a 204 no content (or a 201 created when the resource is uploaded for the first time).
202 Accepted - HTTP
WebHTTPStatus202
the request might or might not eventually be acted upon, as it might be disallowed when processing actually takes place.
301 Moved Permanently - HTTP
WebHTTPStatus301
even if the specification requires the method (and the body) not to be altered when the redirection is performed, not all user-agents align with it - you can still find this type of bugged software out there.
304 Not Modified - HTTP
WebHTTPStatus304
this happens when the request method is safe, like a get or a head request, or when the request is conditional and uses a if-none-match or a if-modified-since header.
308 Permanent Redirect - HTTP
WebHTTPStatus308
for example, google drive uses a 308 resume incomplete response to indicate to the client when an incomplete upload stalled.[1] status 308 permanent redirect specifications specification title rfc 7538, section 3: 308 permanent redirect the hypertext transfer protocol status code 308 (permanent redirect) ...
409 Conflict - HTTP
WebHTTPStatus409
for example, you may get a 409 response when uploading a file which is older than the one already on the server resulting in a version control conflict.
411 Length Required - HTTP
WebHTTPStatus411
note: by specification, when sending data in a series of chunks, the content-length header is omitted and at the beginning of each chunk you need to add the length of the current chunk in hexadecimal format.
414 URI Too Long - HTTP
WebHTTPStatus414
there are a few rare conditions when this might occur: when a client has improperly converted a post request to a get request with long query information, when the client has descended into a loop of redirection (for example, a redirected uri prefix that points to a suffix of itself), or when the server is under attack by a client attempting to exploit potential security holes.
428 Precondition Required - HTTP
WebHTTPStatus428
when a precondition header is not matching the server side state, the response should be 412 precondition failed.
431 Request Header Fields Too Large - HTTP
WebHTTPStatus431
431 can be used when the total size of request headers is too large, or when a single header field is too large.
HTTP
WebHTTP
when serving an http request, a server can send a set-cookie http header with the response.
Numbers and dates - JavaScript
decimal numbers 1234567890 42 // caution when using leading zeros: 0888 // 888 parsed as decimal 0777 // parsed as octal in non-strict mode (511 in decimal) note that decimal literals can start with a zero (0) followed by another decimal digit, but if every digit after the leading 0 is smaller than 8, the number gets parsed as an octal number.
Character classes - JavaScript
\u{hhhh} or \u{hhhhh} (only when the u flag is set.) matches the character with the unicode value u+hhhh or u+hhhhh (hexadecimal digits).
Groups and ranges - JavaScript
this becomes important when capturing groups are nested.
Quantifiers - JavaScript
notice that when matching "caaaaaaandy", the match is "aaa", even though the original string had more "a"s in it.
Text formatting - JavaScript
const names = ['hochberg', 'hönigswald', 'holzman']; const germanphonebook = new intl.collator('de-de-u-co-phonebk'); // as if sorting ["hochberg", "hoenigswald", "holzman"]: console.log(names.sort(germanphonebook.compare).join(', ')); // logs "hochberg, hönigswald, holzman" some german words conjugate with extra umlauts, so in dictionaries it’s sensible to order ignoring umlauts (except when ordering words differing only by umlauts: schon before schön).
constructor - JavaScript
this.name = 'square'; } get area() { return this.height * this.width; } set area(value) { this.height = value**0.5; this.width = value**0.5; } } another example here the prototype of square class is changed—but the constructor of its base class polygon is still called when a new instance of a square is created.
The legacy Iterator protocol - JavaScript
an object is an legacy iterator when it implements a next() method with the following semantics, and throws stopiteration at the end of iteration.
Deprecated and obsolete features - JavaScript
string.prototype.substr probably won't be removed anytime soon, but it's defined in annex b of the ecma-262 standard, whose introduction states: "… programmers should not use or assume the existence of these features and behaviours when writing new ecmascript code.
Warning: -file- is being assigned a //# sourceMappingURL, but already has one - JavaScript
the javascript warning "-file- is being assigned a //# sourcemappingurl, but already has one." occurs when a source map has been specified more than once for a given javascript source.
TypeError: invalid Array.prototype.sort argument - JavaScript
the javascript exception "invalid array.prototype.sort argument" occurs when the argument of array.prototype.sort() isn't either undefined or a function which compares its operands.
Warning: 08/09 is not a legal ECMA-262 octal constant - JavaScript
the javascript warning "08 (or 09) is not a legal ecma-262 octal constant" occurs when 08 or 09 number literals are used.
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.
SyntaxError: invalid regular expression flag "x" - JavaScript
the javascript exception "invalid regular expression flag" occurs when the flags, defined after the second slash in regular expression literal, are not one of g, i, m, s, u, or y.
SyntaxError: return not in function - JavaScript
the javascript exception "return (or yield) not in function" occurs when a return or yield statement is called outside of a function.
TypeError: can't access property "x" of "y" - JavaScript
the javascript exception "can't access property" occurs when property access was operated on undefined or null values.
TypeError: property "x" is non-configurable and can't be deleted - JavaScript
the javascript exception "property is non-configurable and can't be deleted" occurs when it was attempted to delete a property, but that property is non-configurable.
TypeError: cyclic object value - JavaScript
the javascript exception "cyclic object value" occurs when object references were found in json.
SyntaxError: applying the 'delete' operator to an unqualified name is deprecated - JavaScript
the javascript strict mode-only exception "applying the 'delete' operator to an unqualified name is deprecated" occurs when variables are attempted to be deleted using the delete operator.
ReferenceError: deprecated caller or arguments usage - JavaScript
the javascript strict mode-only exception "deprecated caller or arguments usage" occurs when the deprecated function.caller or function.arguments properties are used.
Warning: expression closures are deprecated - JavaScript
the javascript warning "expression closures are deprecated" occurs when the non-standard expression closure syntax (shorthand function syntax) is used.
SyntaxError: "0"-prefixed octal literals and octal escape seq. are deprecated - JavaScript
the javascript strict mode-only exception "0-prefixed octal literals and octal escape sequences are deprecated; for octal literals use the "0o" prefix instead" occurs when deprecated octal literals and octal escape sequences are used.
Warning: Date.prototype.toLocaleFormat is deprecated - JavaScript
the javascript warning "date.prototype.tolocaleformat is deprecated; consider using intl.datetimeformat instead" occurs when the non-standard date.prototype.tolocaleformat method is used.
Warning: JavaScript 1.6's for-each-in loops are deprecated - JavaScript
the javascript warning "javascript 1.6's for-each-in loops are deprecated; consider using es6 for-of instead" occurs when a for each (variable in obj) statement is used.
TypeError: setting getter-only property "x" - JavaScript
the javascript strict mode-only exception "setting getter-only property" occurs when there is an attempt to set a new value to a property for which only a getter is specified.
SyntaxError: identifier starts immediately after numeric literal - JavaScript
the javascript exception "identifier starts immediately after numeric literal" occurs when an identifier started with a digit.
ReferenceError: invalid assignment left-hand side - JavaScript
the javascript exception "invalid assignment left-hand side" occurs when there was an unexpected assignment somewhere.
TypeError: invalid assignment to const "x" - JavaScript
the javascript exception "invalid assignment to const" occurs when it was attempted to alter a constant value.
RangeError: invalid date - JavaScript
the javascript exception "invalid date" occurs when a string leading to an invalid date has been provided to date or date.parse().
SyntaxError: for-in loop head declarations may not have initializers - JavaScript
the javascript strict mode-only exception "for-in loop head declarations may not have initializers" occurs when the head of a for...in contains an initializer expression, such as |for (var i = 0 in obj)|.
SyntaxError: a declaration in the head of a for-of loop can't have an initializer - JavaScript
the javascript exception "a declaration in the head of a for-of loop can't have an initializer" occurs when the head of a for...of loop contains an initializer expression such as |for (var i = 0 of iterable)|.
URIError: malformed URI sequence - JavaScript
the javascript exception "malformed uri sequence" occurs when uri encoding or decoding wasn't successful.
SyntaxError: Malformed formal parameter - JavaScript
the javascript exception "malformed formal parameter" occurs when the argument list of a function() constructor call is invalid somehow.
SyntaxError: missing ] after element list - JavaScript
the javascript exception "missing ] after element list" occurs when there is an error with the array initializer syntax somewhere.
SyntaxError: missing } after property list - JavaScript
the javascript exception "missing } after property list" occurs when there is a mistake in the object initializer syntax somewhere.
SyntaxError: missing = in const declaration - JavaScript
the javascript exception "missing = in const declaration" occurs when a const declaration was not given a value in the same statement (like const red_flag;).
SyntaxError: missing name after . operator - JavaScript
operator" occurs when there is a problem with how the dot operator (.) is used for property access.
SyntaxError: missing ) after argument list - JavaScript
the javascript exception "missing ) after argument list" occurs when there is an error with how a function is called.
SyntaxError: missing ) after condition - JavaScript
the javascript exception "missing ) after condition" occurs when there is an error with how an if condition is written.
TypeError: More arguments needed - JavaScript
the javascript exception "more arguments needed" occurs when there is an error with how a function is called.
RangeError: repeat count must be non-negative - JavaScript
the javascript exception "repeat count must be non-negative" occurs when the string.prototype.repeat() method is used with a count argument that is a negative number.
TypeError: "x" has no properties - JavaScript
the javascript exception "null (or undefined) has no properties" occurs when you attempt to access properties of null and undefined.
SyntaxError: missing variable name - JavaScript
sorry :( var debugger = "whoop"; // syntaxerror: missing variable name declaring multiple variables pay special attention to commas when declaring multiple variables.
RangeError: precision is out of range - JavaScript
the javascript exception "precision is out of range" occurs when a number that's outside of the range of 0 and 20 (or 21) was passed into tofixed or toprecision.
Error: Permission denied to access property "x" - JavaScript
the javascript exception "permission denied to access property" occurs when there was an attempt to access an object for which you have no permission.
TypeError: "x" is read-only - JavaScript
the javascript strict mode-only exception "is read-only" occurs when a global variable or object property that was assigned to is a read-only property.
SyntaxError: redeclaration of formal parameter "x" - JavaScript
the javascript exception "redeclaration of formal parameter" occurs when the same variable name occurs as a function parameter and is then redeclared using a let assignment in a function body again.
RangeError: repeat count must be less than infinity - JavaScript
the javascript exception "repeat count must be less than infinity" occurs when the string.prototype.repeat() method is used with a count argument that is infinity.
SyntaxError: "use strict" not allowed in function with non-simple parameters - JavaScript
the javascript exception "'use strict' not allowed in function" occurs when a "use strict" directive is used at the top of a function with default parameters, rest parameters, or destructuring parameters.
TypeError: invalid arguments - JavaScript
the javascript exception "invalid arguments" occurs when typed array constructors are provided with a wrong argument.
ReferenceError: assignment to undeclared variable "x" - JavaScript
the javascript strict mode-only exception "assignment to undeclated variable" occurs when the value has been assigned to an undeclared variable.
ReferenceError: reference to undefined property "x" - JavaScript
the javascript warning "reference to undefined property" occurs when a script attempted to access an object property which doesn't exist.
TypeError: "x" is (not) "y" - JavaScript
the javascript exception "x is (not) y" occurs when there was an unexpected type.
SyntaxError: unterminated string literal - JavaScript
the javascript error "unterminated string literal" occurs when there is an unterminated string somewhere.
TypeError: variable "x" redeclares argument - JavaScript
the javascript strict mode-only exception "variable redeclares argument" occurs when the same variable name occurs as a function parameter and is then redeclared using a var assignment in a function body again.
TypeError: invalid 'instanceof' operand 'x' - JavaScript
the javascript exception "invalid 'instanceof' operand" occurs when the right hand side operands of the instanceof operator isn't used with a constructor object, i.e.
Method definitions - JavaScript
when doing so: the asterisk (*) in the shorthand syntax must be before the generator property name.
arguments.callee - JavaScript
this is useful when the name of the function is unknown, such as within a function expression with no name (also called "anonymous functions").
Array.prototype.copyWithin() - JavaScript
the sequence is copied and pasted as one operation; pasted sequence will have the copied values even when the copy and paste region overlap.
Array.prototype.find() - JavaScript
) { let start = 2; while (start <= math.sqrt(element)) { if (element % start++ < 1) { return false; } } return element > 1; } console.log([4, 6, 8, 12].find(isprime)); // undefined, not found console.log([4, 5, 8, 12].find(isprime)); // 5 the following examples show that nonexistent and deleted elements are visited, and that the value passed to the callback is their value when visited: // declare array with no elements at indexes 2, 3, and 4 const array = [0,1,,,,5,6]; // shows all indexes, not just those with assigned values array.find(function(value, index) { console.log('visited index ', index, ' with value ', value); }); // shows all indexes, including deleted array.find(function(value, index) { // delete element 5 on first iteration if (index === 0) { ...
Array.prototype.findIndex() - JavaScript
thisarg optional optional object to use as this when executing callback.
Array.prototype.flatMap() - JavaScript
thisargoptional value to use as this when executing callback.
Array.prototype.includes() - JavaScript
note: when comparing strings and characters, includes() is case-sensitive.
Array.isArray() - JavaScript
little known fact: array.prototype itself is an array: array.isarray(array.prototype); // all following calls return false array.isarray(); array.isarray({}); array.isarray(null); array.isarray(undefined); array.isarray(17); array.isarray('array'); array.isarray(true); array.isarray(false); array.isarray(new uint8array(32)); array.isarray({ __proto__: array.prototype }); instanceof vs isarray when checking for array instance, array.isarray is preferred over instanceof because it works through iframes.
Array.prototype.lastIndexOf() - JavaScript
note that even when the index is negative, the array is still searched from back to front.
Array.prototype.length - JavaScript
when you extend an array by changing its length property, the number of actual elements increases; for example, if you set length to 3 when it is currently 2, the array now contains 3 elements, which causes the third element to be a non-iterable empty slot.
Array.prototype.slice() - JavaScript
when the color of myhonda is changed to purple, both arrays reflect the change.
Array.prototype.splice() - JavaScript
note: in ie8, it won't delete all when deletecount is omitted.
Array.prototype.toString() - JavaScript
javascript calls the tostring method automatically when an array is to be represented as a text value or when an array is referred to in a string concatenation.
Array.prototype.values() - JavaScript
// object { value: undefined, done: true } iteraror.next().value; // undefined one-use: the array iterator object is one use or temporary object example: var arr = ['a', 'b', 'c', 'd', 'e']; var iterator = arr.values(); for (let letter of iterator) { console.log(letter); } //"a" "b" "c" "d" "e" for (let letter of iterator) { console.log(letter); } // undefined reason: when next().done=true or currentindex>length the for..of loop ends.
ArrayBuffer.prototype.byteLength - JavaScript
the value is established when the array is constructed and cannot be changed.
ArrayBuffer - JavaScript
this is established when the array is constructed and cannot be changed.
Atomics - JavaScript
atomic operations when memory is shared, multiple threads can read and write the same data in memory.
Boolean.prototype.toString() - JavaScript
javascript calls the tostring() method automatically when a boolean is to be represented as a text value or when a boolean is referred to in a string concatenation.
DataView() constructor - JavaScript
(that probably wasn't a very helpful description.) you can think of the returned object as an "interpreter" of the array buffer of bytes — it knows how to convert numbers to fit within the buffer correctly, both when reading and writing to it.
DataView.prototype.buffer - JavaScript
the value is established when the dataview is constructed and cannot be changed.
Date.prototype[@@toPrimitive] - JavaScript
you rarely need to invoke the [@@toprimitive]() method yourself; javascript automatically invokes it when encountering an object where a primitive value is expected.
Date() constructor - JavaScript
parameters there are four basic forms for the date() constructor: no parameters when no parameters are provided, the newly-created date object represents the current date and time as of the time of instantiation.
Date.parse() - JavaScript
when the time zone offset is absent, date-only forms are interpreted as a utc time and date-time forms are interpreted as local time.
Date.prototype.toDateString() - JavaScript
examples a basic usage of todatestring() var d = new date(1993, 5, 28, 14, 39, 7); console.log(d.tostring()); // logs mon jun 28 1993 14:39:07 gmt-0600 (pdt) console.log(d.todatestring()); // logs mon jun 28 1993 note: month are 0-indexed when used as an argument of date (thus 0 corresponds to january and 11 to december).
Error() constructor - JavaScript
examples function call or new construction when error is used like a function -- without new, it will return an error object.
Function() constructor - JavaScript
description function objects created with the function constructor are parsed when the function is created.
Function.displayName - JavaScript
by entering the following in a console, it should display as something like "function my function()": var a = function() {}; a.displayname = 'my function'; a; // "function my function()" when defined, the displayname property returns the display name of a function: function dosomething() {} console.log(dosomething.displayname); // "undefined" var popup = function(content) { console.log(content); }; popup.displayname = 'show popup'; console.log(popup.displayname); // "show popup" defining a displayname in function expressions you can define a function with a display name in a f...
Generator.prototype.next() - JavaScript
can be omitted when done is true.
Generator.prototype.throw() - JavaScript
can be omitted when done is true.
InternalError - JavaScript
example cases are mostly when something is too large, e.g.: "too many switch cases", "too many parentheses in regular expression", "array initializer too large", "too much recursion".
Intl.DateTimeFormat.prototype.format() - JavaScript
most notably, the ie and edge browsers insert bidirectional control characters around dates, so the output text will flow properly when concatenated with other text.
Intl.DisplayNames.prototype.of() - JavaScript
the of() method receives a code and returns a string based on the locale and options provided when instantiating intl.displaynames.
Intl.DisplayNames - JavaScript
instance methods intl.displaynames.prototype.of() this method receives a code and returns a string based on the locale and options provided when instantiating intl.displaynames.
Intl.ListFormat() constructor - JavaScript
when style is short or narrow, unit is the only allowed value for the type option.
Intl​.List​Format​.prototype​.formatToParts() - JavaScript
the locale and style options used for formatting are given when constructing the intl.listformat instance.
Intl.Locale.prototype.collation - JavaScript
it is used whenever strings must be sorted and placed into a certain order, from search query results to ordering records in a database.
Intl.Locale.prototype.language - JavaScript
the main argument to the locale constructor must be a valid unicode locale identifier, so whenever the constructor is used, it must be passed an identifier with a language subtag.
Intl.Locale.prototype.minimize() - JavaScript
this is useful when there are superfluous subtags in the language identifier; for instance, "en-latn" can be simplified to "en", since "latn" is the only script used to write english.
Intl.Locale.prototype.numeric - JavaScript
if numeric is set to true, then the locale will take numeric characters into account when collating strings.
Intl.Locale.prototype.region - JavaScript
knowing the locale's region helps javascript programmers make sure that the content from their sites and applications is correctly displayed when viewed from different areas of the world.
Intl.Locale.prototype.script - JavaScript
there are exceptions to this rule, however, and it is important to indicate the script whenever possible, in order to have a complete unicode language identifier.
Intl.NumberFormat.prototype.formatToParts() - JavaScript
var numberstring = formatter.formattoparts(number).map(({type, value}) => { switch (type) { case 'currency': return `<strong>${value}</strong>`; default : return value; } }).reduce((string, part) => string + part); this will make the currency bold, when using the formattoparts() method.
Intl.NumberFormat - JavaScript
chinese decimal console.log(new intl.numberformat('zh-hans-cn-u-nu-hanidec').format(number)); // → 一二三,四五六.七八九 // when requesting a language that may not be supported, such as // balinese, include a fallback language, in this case indonesian console.log(new intl.numberformat(['ban', 'id']).format(number)); // → 123.456,789 using options the results can be customized using the options argument: var number = 123456.789; // request a currency format console.log(new intl.numberformat('de-de', { style: 'currenc...
Map - JavaScript
thus, when iterating over it, a map object returns keys in order of insertion.
Math.log1p() - JavaScript
when you calculate log(1 + x), you should get an answer very close to x, if x is small (that's why these are called 'natural' logarithms).
Math.max() - JavaScript
-infinity is the initial comparant because almost every other value is bigger, that's why when no arguments are given, -infinity is returned.
NaN - JavaScript
even when this is not the case, avoid overriding it.
Number.NEGATIVE_INFINITY - JavaScript
when the if statement executes, smallnumber has the value -infinity, so smallnumber is set to a more manageable value before continuing.
Number.POSITIVE_INFINITY - JavaScript
when the if statement executes, bignumber has the value infinity, so bignumber is set to a more manageable value before continuing.
Number.isNaN() - JavaScript
description due to both equality operators, == and ===, evaluating to false when checking if nan is nan, the function number.isnan() has become necessary.
Number.parseFloat() - JavaScript
or nan when the first non-whitespace character cannot be converted to a number.
Object() constructor - JavaScript
when called in a non-constructor context, object behaves identically to new object().
Object.prototype.__defineGetter__() - JavaScript
the __definegetter__ method binds an object's property to a function to be called when that property is looked up.
Object.prototype.isPrototypeOf() - JavaScript
t.create(bar.prototype); var baz = new baz(); console.log(baz.prototype.isprototypeof(baz)); // true console.log(bar.prototype.isprototypeof(baz)); // true console.log(foo.prototype.isprototypeof(baz)); // true console.log(object.prototype.isprototypeof(baz)); // true isprototypeof() method, along with the instanceof operator particularly comes in handy if you have code that can only function when dealing with objects descended from a specific prototype chain, e.g., to guarantee that certain methods or properties will be present on that object.
Object.keys() - JavaScript
operty.call(obj, prop)) { result.push(prop); } } if (hasdontenumbug) { for (i = 0; i < dontenumslength; i++) { if (hasownproperty.call(obj, dontenums[i])) { result.push(dontenums[i]); } } } return result; }; }()); } please note that the above code includes non-enumerable keys in ie7 (and maybe ie8), when passing in an object from a different window.
Object.seal() - JavaScript
attempting to delete or add properties to a sealed object, or to convert a data property to accessor or vice versa, will fail, either silently or by throwing a typeerror (most commonly, although not exclusively, when in strict mode code).
Object.prototype.toString() - JavaScript
description every object has a tostring() method that is automatically called when the object is to be represented as a text value or when an object is referred to in a manner in which a string is expected.
Object.values() - JavaScript
examples using object.values const obj = { foo: 'bar', baz: 42 }; console.log(object.values(obj)); // ['bar', 42] // array-like object const arraylikeobj1 = { 0: 'a', 1: 'b', 2: 'c' }; console.log(object.values(arraylikeobj1 )); // ['a', 'b', 'c'] // array-like object with random key ordering // when using numeric keys, the values are returned in the keys' numerical order const arraylikeobj2 = { 100: 'a', 2: 'b', 7: 'c' }; console.log(object.values(arraylikeobj2 )); // ['b', 'c', 'a'] // getfoo is property which isn't enumerable const my_obj = object.create({}, { getfoo: { value: function() { return this.foo; } } }); my_obj.foo = 'bar'; console.log(object.values(my_obj)); // ['bar'] // non-...
Promise.allSettled() - JavaScript
it is typically used when you have multiple asynchronous tasks that are not dependent on one another to complete successfully, or you'd always like to know the result of each promise.
Promise.any() - JavaScript
this returned promise is then resolved/rejected asynchronously (as soon as the stack is empty) when any of the promises in the given iterable resolve, or if all the promises have rejected.
Promise.prototype.then() - JavaScript
didn't bother to instantiate and return a promise in the prior then so the sequence may be a bit surprising // foobar // foobarbaz when a value is simply returned from within a then handler, it will effectively return promise.resolve(<value returned by whichever handler was called>).
handler.defineProperty() - JavaScript
const p = new proxy({}, { defineproperty: function(target, prop, descriptor) { console.log('called: ' + prop); return true; } }); const desc = { configurable: true, enumerable: true, value: 10 }; object.defineproperty(p, 'a', desc); // "called: a" when calling object.defineproperty() or reflect.defineproperty(), the descriptor passed to defineproperty() trap has one restriction—only following properties are usable (non-standard properties will be ignored): enumerable configurable writable value get set const p = new proxy({}, { defineproperty(target, prop, descriptor) { console.log(descriptor); return reflect.definepropert...
Proxy() constructor - JavaScript
handler an object whose properties are functions that define the behavior of the proxy when an operation is performed on it.
Proxy.revocable() - JavaScript
handler an object whose properties are functions define the behavior of proxy p when an operation is performed on it.
Proxy - JavaScript
examples basic example in this simple example, the number 37 gets returned as the default value when the property name is not in the object.
RangeError() constructor - JavaScript
the rangeerror() constructor creates an error when a value is not in the set or range of allowed values.
ReferenceError() constructor - JavaScript
the referenceerror object represents an error when a non-existent variable is referenced.
ReferenceError - JavaScript
the referenceerror object represents an error when a non-existent variable is referenced.
Reflect.get() - JavaScript
when used with proxy, it can be an object that inherits from target.
RegExp.prototype[@@match]() - JavaScript
the [@@match]() method retrieves the matches when matching a string against a regular expression.
RegExp.input ($_) - JavaScript
the value of the input property is modified whenever the searched string on the regular expression is changed and that string is matching.
RegExp.lastMatch ($&) - JavaScript
the value of the lastmatch property is read-only and modified whenever a successful match is made.
RegExp.lastParen ($+) - JavaScript
the value of the lastparen property is read-only and modified whenever a successful match is made.
RegExp.leftContext ($`) - JavaScript
the value of the leftcontext property is read-only and modified whenever a successful match is made.
RegExp.rightContext ($') - JavaScript
the value of the rightcontext property is read-only and modified whenever a successful match is made.
Planned changes to shared memory - JavaScript
when this flag is set to true, the constructed memory object can be shared between workers via postmessage(), just like sharedarraybuffer, and the backing buffer of the memory object is a sharedarraybuffer.
SharedArrayBuffer.prototype.byteLength - JavaScript
the value is established when the shared array is constructed and cannot be changed.
SharedArrayBuffer - JavaScript
this is established when the array is constructed and cannot be changed.
String() constructor - JavaScript
it performs type conversion when called as a function, rather than as a constructor, which is usually more useful.
String.prototype.charCodeAt() - JavaScript
'abc'.charcodeat(0) // returns 65 fixing charcodeat() to handle non-basic-multilingual-plane characters if their presence earlier in the string is unknown this version might be used in for loops and the like when it is unknown whether non-bmp characters exist before the specified index position.
String.prototype.indexOf() - JavaScript
therefore, when checking if a specific string exists within another string, the correct way to check would be: 'blue whale'.indexof('blue') !== -1 // true 'blue whale'.indexof('bloe') !== -1 // false ~('blue whale'.indexof('bloe')) // 0, which is falsy examples using indexof() the following example uses indexof() to locate values in the string "brave new world".
String.prototype.match() - JavaScript
it barked.'; const capturingregex = /(?<animal>fox|cat) jumps over/; const found = paragraph.match(capturingregex); console.log(found.groups); // {animal: "fox"} using match() with no parameter const str = "nothing will come of nothing."; str.match(); // returns [""] a non-regexp object as the parameter when the regexp parameter is a string or a number, it is implicitly converted to a regexp by using new regexp(regexp).
String.prototype.matchAll() - JavaScript
capture groups are ignored when using match() with the global /g flag: let regexp = /t(e)(st(\d?))/g; let str = 'test1test2'; str.match(regexp); // array ['test1', 'test2'] using matchall, you can access capture groups easily: let array = [...str.matchall(regexp)]; array[0]; // ['test1', 'e', 'st1', '1', index: 0, input: 'test1test2', length: 4] array[1]; // ['test2', 'e', 'st2', '2', index: 5, input: 'test1test2', length:...
String.prototype.normalize() - JavaScript
ng2); // false console.log(string1.length); // 1 console.log(string2.length); // 2 string1 = string1.normalize('nfkd'); string2 = string2.normalize('nfkd'); console.log(string1); // ff <- visual appearance changed console.log(string2); // ff console.log(string1 === string2); // true console.log(string1.length); // 2 console.log(string2.length); // 2 when applying compatibility normalization it's important to consider what you intend to do with the strings, since the normalized form may not be appropriate for all applications.
String.prototype.search() - JavaScript
description when you want to know whether a pattern is found, and also know its index within a string, use search().
String.prototype.substr() - JavaScript
to use this feature in jscript, you can use the following code: // only run when the substr() function is broken if ('ab'.substr(-1) != 'b') { /** * get the substring of a string * @param {integer} start where to start the substring * @param {integer} length how many characters to return * @return {string} */ string.prototype.substr = function(substr) { return function(start, length) { // call the original method return substr.cal...
String.prototype.substring() - JavaScript
console.log(text.substring(-5, 2)) // => "mo" console.log(text.substring(-5, -2)) // => "" slice() also treats nan arguments as 0, but when it is given negative values it counts backwards from the end of the string to find the indexes.
String.prototype.toLocaleUpperCase() - JavaScript
also notice that conversion is not necessarily a 1:1 character mapping, as some characters might result in two (or even more) characters when transformed to upper-case.
Symbol.prototype[@@toPrimitive] - JavaScript
you rarely need to invoke the [@@toprimitive]() method yourself; javascript automatically invokes it when encountering an object where a primitive value is expected.
Symbol.asyncIterator - JavaScript
const myasynciterable = { async* [symbol.asynciterator]() { yield "hello"; yield "async"; yield "iteration!"; } }; (async () => { for await (const x of myasynciterable) { console.log(x); // expected output: // "hello" // "async" // "iteration!" } })(); when creating an api, remember that async iterables are designed to represent something iterable — like a stream of data or a list —, not to completely replace callbacks and events in most situations.
Symbol.iterator - JavaScript
description whenever an object needs to be iterated (such as at the beginning of a for..of loop), its @@iterator method is called with no arguments, and the returned iterator is used to obtain the values to be iterated.
Symbol.species - JavaScript
for example, when using methods such as map() that return the default constructor, you want these methods to return a parent array object, instead of the myarray object.
Symbol.toStringTag - JavaScript
and more custom classes default to object tag when creating your own class, javascript defaults to the "object" tag: class validatorclass {} object.prototype.tostring.call(new validatorclass()); // "[object object]" custom tag with tostringtag now, with the help of tostringtag, you are able to set your own custom tag: class validatorclass { get [symbol.tostringtag]() { return 'validator'; } } object.prototype.tostring.call(new vali...
Symbol.unscopables - JavaScript
that's when the unscopables symbol was introduced.
Symbol.prototype.valueOf() - JavaScript
you rarely need to invoke the valueof method yourself; javascript automatically invokes it when encountering an object where a primitive value is expected.
SyntaxError() constructor - JavaScript
the syntaxerror constructor creates a new error object that represents an error when trying to interpret syntactically invalid code.
TypeError() constructor - JavaScript
the typeerror() constructor creates a new error when an operation could not be performed, typically (but not exclusively) when a value is not of the expected type.
TypedArray.prototype.buffer - JavaScript
the value is established when the typedarray is constructed and cannot be changed.
TypedArray.prototype.find() - JavaScript
object to use as this when executing callback.
TypedArray.prototype.findIndex() - JavaScript
object to use as this when executing callback.
TypedArray.prototype.lastIndexOf() - JavaScript
note that even when the index is negative, the typed array is still searched from back to front.
TypedArray.of() - JavaScript
hence, when working with proxy objects, it calls handler.set to create new elements rather than handler.defineproperty.
TypedArray.prototype.toString() - JavaScript
var numbers = new uint8array([2, 5, 8, 1, 4]) numbers.tostring(); // "2,5,8,1,4" javascript calls the tostring method automatically when a typed array is to be represented as a text value or when an array is referred to in a string concatenation.
URIError() constructor - JavaScript
the urierror() constructor creates an error when a global uri handling function was used in a wrong way.
URIError - JavaScript
the urierror object represents an error when a global uri handling function was used in a wrong way.
WeakMap - JavaScript
native weakmaps can be particularly useful constructs when mapping keys to information about the key that is valuable only if the key has not been garbage collected.
WebAssembly.Instance() constructor - JavaScript
syntax important: since instantiation for large modules can be expensive, developers should only use the instance() constructor when synchronous instantiation is absolutely required; the asynchronous webassembly.instantiatestreaming() method should be used at all other times.
WebAssembly.Memory() constructor - JavaScript
when present, the maximum parameter acts as a hint to the engine to reserve memory up front.
WebAssembly.Module() constructor - JavaScript
syntax important: since compilation for large modules can be expensive, developers should only use the module() constructor when synchronous compilation is absolutely required; the asynchronous webassembly.compilestreaming() method should be used at all other times.
WebAssembly.Module.exports() - JavaScript
when the module is received, we create an instance from it using the webassembly.instantiate() method, invoke an exported function from inside it, then show how we can return information on the available exports on a module using webassembly.module.exports.
WebAssembly.Module - JavaScript
when the module is received, we create an instance from it using the webassembly.instantiate() method and invoke an exported function from inside it.
WebAssembly.RuntimeError() constructor - JavaScript
the webassembly.runtimeerror() constructor creates a new webassembly runtimeerror object — the type that is thrown whenever webassembly specifies a trap.
WebAssembly.RuntimeError - JavaScript
the webassembly.runtimeerror object is the error type that is thrown whenever webassembly specifies a trap.
WebAssembly.compileStreaming() - JavaScript
because the compilestreaming() function accepts a promise for a response object, you can directly pass it a windoworworkerglobalscope.fetch() call, and it will pass the response into the function when it fulfills.
WebAssembly.instantiate() - JavaScript
when the module is received, we create an instance from it using the webassembly.instantiate() method and invoke an exported function from inside it.
WebAssembly.instantiateStreaming() - JavaScript
because the instantiatestreaming() function accepts a promise for a response object, you can directly pass it a windoworworkerglobalscope.fetch() call, and it will pass the response into the function when it fulfills.
decodeURI() - JavaScript
exceptions throws an urierror ("malformed uri sequence") exception when encodeduri contains invalid character sequences.
decodeURIComponent() - JavaScript
exceptions throws an urierror ("malformed uri sequence") exception when used wrongly.
encodeURI() - JavaScript
h-low pair ok console.log(encodeuri('\ud800\udfff')); // lone high surrogate throws "urierror: malformed uri sequence" console.log(encodeuri('\ud800')); // lone low surrogate throws "urierror: malformed uri sequence" console.log(encodeuri('\udfff')); encoding for ipv6 if one wishes to follow the more recent rfc3986 for urls, which makes square brackets reserved (for ipv6) and thus not encoded when forming something which could be part of a url (such as a host), the following code snippet may help: function fixedencodeuri(str) { return encodeuri(str).replace(/%5b/g, '[').replace(/%5d/g, ']'); } specifications specification ecmascript (ecma-262)the definition of 'encodeuri' in that specification.
escape() - JavaScript
… … programmers should not use or assume the existence of these features and behaviours when writing new ecmascript code.
null - JavaScript
it is not defined and has never been initialized: foo; //referenceerror: foo is not defined // foo is known to exist now but it has no type or value: var foo = null; foo; //null examples difference between null and undefined when checking for null or undefined, beware of the differences between equality (==) and identity (===) operators, as the former performs type-conversion.
parseFloat() - JavaScript
or nan when the first non-whitespace character cannot be converted to a number.
undefined - JavaScript
(even when this is not the case, avoid overriding it.) a variable that has not been assigned a value is of type undefined.
unescape() - JavaScript
… … programmers should not use or assume the existence of these features and behaviours when writing new ecmascript code.
Comma operator (,) - JavaScript
usage notes you can use the comma operator when you want to include multiple expressions in a location that requires a single expression.
Equality (==) - JavaScript
if the operands are of different types, try to convert them to the same type before comparing: when comparing a number to a string, try to convert the string to a numeric value.
Logical AND (&&) - JavaScript
when it is, it returns a boolean value.
Logical NOT (!) - JavaScript
when used with non-boolean values, it returns false if its single operand can be converted to true; otherwise, returns true.
Logical OR (||) - JavaScript
when it is, it returns a boolean value.
Logical OR assignment (||=) - JavaScript
syntax expr1 ||= expr2 description short-circuit evaluation the logical or operator works like this: x || y; // returns x when x is truthy // returns y when x is not truthy the logical or operator short-circuits: the second operand is only evaluated if the first operand doesn’t already determine the result.
Object initializer - JavaScript
you will see code like this: let a = 'foo', b = 42, c = {}; let o = { a: a, b: b, c: c } with ecmascript 2015, there is a shorter notation available to achieve the same: let a = 'foo', b = 42, c = {}; // shorthand property names (es2015) let o = {a, b, c} // in other words, console.log((o.a === {a}.a)) // true duplicate property names when using the same name for your properties, the second property will overwrite the first.
Pipeline operator (|>) - JavaScript
examples chaining function calls the pipeline operator can improve readability when chaining several functions.
Remainder (%) - JavaScript
the remainder operator (%) returns the remainder left over when one operand is divided by a second operand.
await - JavaScript
when resumed, the value of the await expression is that of the fulfilled promise.
new.target - JavaScript
for example, when d was initialized using new d(), the class definition of d was printed; and similarly, in case of c, the class c was printed.
yield* - JavaScript
the value of yield* expression itself is the value returned by that iterator when it's closed (i.e., when done is true).
yield - JavaScript
this halts execution of the generator entirely, and execution resumes in the caller (as is normally the case when an exception is thrown).
Expressions and operators - JavaScript
binary logical operators logical operators are typically used with boolean (logical) values, and when they are, they return a boolean value.
break - JavaScript
examples break in while loop the following function has a break statement that terminates the while loop when i is 3, and then returns the value 3 * x.
class - JavaScript
class foo {}; class foo {}; // uncaught syntaxerror: identifier 'foo' has already been declared the same error is thrown when a class has been defined before using the class expression.
do...while - JavaScript
when condition evaluates to false, control passes to the statement following the do...while.
for await...of - JavaScript
in such case for await...of throws when consuming rejected promise and doesn't call finally blocks within that generator.
for...in - JavaScript
therefore, it is better to use a for loop with a numeric index (or array.prototype.foreach() or the for...of loop) when iterating over arrays where the order of access is important.
for...of - JavaScript
the following example shows the difference between a for...of loop and a for...in loop when used with an array.
function declaration - JavaScript
you can use the function before you declared it: hoisted(); // logs "foo" function hoisted() { console.log('foo'); } note that function expressions are not hoisted: nothoisted(); // typeerror: nothoisted is not a function var nothoisted = function() { console.log('bar'); }; examples using function the following code declares a function that returns the total amount of sales, when given the number of units sold of products a, b, and c.
import.meta - JavaScript
for example, with the following html: <script type="module"> import './index.mjs?someurlinfo=5'; </script> ..the following javascript file will log the `someurlinfo parameter: // index.mjs new url(import.meta.url).searchparams.get('someurlinfo'); // 5 the same applies when a file imports another: // index.mjs import './index2.mjs?someurlinfo=5'; // index2.mjs new url(import.meta.url).searchparams.get('someurlinfo'); // 5 note that while node.js will pass on query parameters (or the hash) as in the latter example, as of node 14.1.0, a url with query parameters will err when loading in the form node --experimental-modules index.mjs?someurlinfo=5 (it is treated as ...
return - JavaScript
description when a return statement is used in a function body, the execution of the function is stopped.
while - JavaScript
when condition evaluates to false, execution continues with the statement after the while loop.
display - Web app manifests
the display mode changes how much of browser ui is shown to the user and can range from browser (when the full browser window is shown) to fullscreen (when the app is full-screened).
serviceworker - Web app manifests
update_via_cache whether the user agent cache should be bypassed when fetching the service worker.
start_url - Web app manifests
type string mandatory no the start_url member is a string that represents the start url of the web application — the prefered url that should be loaded when the user launches the web application (e.g., when the user taps on the web application's icon from a device's application menu or homescreen).
<merror> - MathML
WebMathMLElementmerror
note that this error is not thrown when your mathml markup is wrong or not well-formed xml.
<mrow> - MathML
WebMathMLElementmrow
when writing a mathml expression, you should group elements within an <mrow> in the same way as they are grouped in the mathematical interpretation of the expression.
<mstyle> - MathML
WebMathMLElementmstyle
the main effect is that larger versions of operators are displayed, when displaystyle is set to true.
<mtable> - MathML
WebMathMLElementmtable
the main effect is that larger versions of operators are displayed, when displaystyle is set to true.
CSS and JavaScript animation performance - Web Performance
developers can create an animation by simply changing an element's style each time the loop is called (or updating the canvas draw, or whatever.) note: like css transitions and animations, requestanimationframe() pauses when the current tab is pushed into the background.
Using dns-prefetch - Web Performance
when a browser requests a resource from a (third party) server, that cross-origin’s domain name must be resolved to an ip address before the browser can issue the request.
Responsive Navigation Patterns - Progressive web apps (PWAs)
in the smallest screen, when the user taps the button, the navigation menu slides into view and displays the navigation items.
SVG Core Attributes - SVG: Scalable Vector Graphics
WebSVGAttributeCore
its purpose is to identify the element when linking (using a fragment identifier), scripting, or styling (with css).
SVG Event Attributes - SVG: Scalable Vector Graphics
WebSVGAttributeEvents
they specifies some script to run when the event of the given type is dispatched to the element on which the attributes are specified.
amplitude - SVG: Scalable Vector Graphics
the amplitude attribute controls the amplitude of the gamma function of a component transfer element when its type attribute is gamma.
baseProfile - SVG: Scalable Vector Graphics
for example, the value of the attribute could be used by an authoring tool to warn the user when they are modifying the document beyond the scope of the specified base profile.
bias - SVG: Scalable Vector Graphics
WebSVGAttributebias
usage notes value <number> default value 0 animatable yes one application of bias is when it is desirable to have 0.5 gray value be the zero response of the filter.
by - SVG: Scalable Vector Graphics
WebSVGAttributeby
when a list of values is defined via the values attribute, the by attribute is ignored.
class - SVG: Scalable Vector Graphics
WebSVGAttributeclass
an element's class name serves two key roles: as a style sheet selector, for when an author assigns style information to a set of elements.
clipPathUnits - SVG: Scalable Vector Graphics
value userspaceonuse | objectboundingbox default value userspaceonuse animatable yes userspaceonuse this value indicates that all coordinates inside the <clippath> element refer to the user coordinate system as defined when the clipping path was created.
cursor - SVG: Scalable Vector Graphics
WebSVGAttributecursor
« svg attribute reference home the cursor attribute specifies the mouse cursor displayed when the mouse pointer is over an element.
direction - SVG: Scalable Vector Graphics
for other cases, such as when using right-to-left languages, it may be sufficient to add the direction attribute to the outermost <svg> element, and allow that direction to inherit to all text elements: note: as a presentation attribute, direction can be used as a css property.
dominant-baseline - SVG: Scalable Vector Graphics
when the initial value, auto, would give an undesired result, this property can be used to explicitly set the desired scaled-baseline-table.
end - SVG: Scalable Vector Graphics
WebSVGAttributeend
the element animation will end when the user presses the specified key.
filterRes - SVG: Scalable Vector Graphics
take care when assigning a non-default value to this attribute.
filterUnits - SVG: Scalable Vector Graphics
only one element is using this attribute: <filter> usage notes value userspaceonuse | objectboundingbox default value objectboundingbox animatable yes userspaceonuse x, y, width and height represent values in the current coordinate system that results from taking the current user coordinate system in place at the time when the <filter> element is referenced (i.e., the user coordinate system for the element referencing the <filter> element via a filter attribute).
font-size-adjust - SVG: Scalable Vector Graphics
this means that the first-choice font, when available, will appear the same size in browsers, whether or not they support font-size-adjust.
font-size - SVG: Scalable Vector Graphics
the font-size attribute refers to the size of the font from baseline to baseline when multiple lines of text are set solid in a multiline layout environment.
glyph-name - SVG: Scalable Vector Graphics
the glyph names can be used in situations where unicode character numbers do not provide sufficient information to access the correct glyph, such as when there are multiple glyphs per unicode character.
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 degrees, then the current text position is incremented according to the horizontal metrics of the glyph.
glyph-orientation-vertical - SVG: Scalable Vector Graphics
when the inline-progression-direction is vertical and the glyph-orientation-vertical results in an orientation angle that is a multiple of 180 degrees, then the current text position is incremented according to the vertical metrics of the glyph.
horiz-origin-x - SVG: Scalable Vector Graphics
the horiz-origin-x attribute indicates the x-coordinate in the font coordinate system of the origin of a glyph to be used when drawing horizontally oriented text.
horiz-origin-y - SVG: Scalable Vector Graphics
the horiz-origin-y attribute indicates the y-coordinate in the font coordinate system of the origin of a glyph to be used when drawing horizontally oriented text.
href - SVG: Scalable Vector Graphics
WebSVGAttributehref
specifically, timeevents are dispatched and the animation element can be used as syncbase in an identical fashion to when the url refers to a valid target element.
id - SVG: Scalable Vector Graphics
WebSVGAttributeid
note: you should avoid the use of id values that would be parsed as an svg view specification (e.g., mydrawing.svg#svgview(viewbox(0,200,1000,1000))) or a basic media fragment when used as a url target fragment.
intercept - SVG: Scalable Vector Graphics
the intercept attribute defines the intercept of the linear function of color component transfers when the type attribute is set to linear.
markerHeight - SVG: Scalable Vector Graphics
the markerheight attribute represents the height of the viewport into which the <marker> is to be fitted when it is rendered according to the viewbox and preserveaspectratio attributes.
markerWidth - SVG: Scalable Vector Graphics
the markerwidth attribute represents the width of the viewport into which the <marker> is to be fitted when it is rendered according to the viewbox and preserveaspectratio attributes.
maskContentUnits - SVG: Scalable Vector Graphics
value userspaceonuse | objectboundingbox default value userspaceonuse animatable yes userspaceonuse this value indicates that all coordinates inside the <mask> element refer to the user coordinate system as defined when the mask was created.
maskUnits - SVG: Scalable Vector Graphics
value userspaceonuse | objectboundingbox default value objectboundingbox animatable yes userspaceonuse this value indicates that all coordinates for the geometry attributes refer to the user coordinate system as defined when the mask was created.
onclick - SVG: Scalable Vector Graphics
WebSVGAttributeonclick
the onclick attribute specifies some script to run when the element is clicked.
orient - SVG: Scalable Vector Graphics
WebSVGAttributeorient
the orient attribute indicates how a marker is rotated when it is placed at its position on the shape.
patternContentUnits - SVG: Scalable Vector Graphics
value userspaceonuse | objectboundingbox default value userspaceonuse animatable yes userspaceonuse this value indicates that all coordinates inside the <pattern> element refer to the user coordinate system as defined when the pattern tile was created.
patternUnits - SVG: Scalable Vector Graphics
value userspaceonuse | objectboundingbox default value objectboundingbox animatable yes userspaceonuse this value indicates that all coordinates for the geometry properties refer to the user coordinate system as defined when the pattern was applied.
pointer-events - SVG: Scalable Vector Graphics
the pointer-events attribute is a presentation attribute that allows defining whether or when an element may be the target of a mouse event.
primitiveUnits - SVG: Scalable Vector Graphics
only one element is using this attribute: <filter> usage notes value userspaceonuse | objectboundingbox default value userspaceonuse animatable yes userspaceonuse this value indicates that any length values within the filter definitions represent values in the current user coordinate system in place at the time when the <filter> element is referenced (i.e., the user coordinate system for the element referencing the <filter> element via a filter attribute).
refX - SVG: Scalable Vector Graphics
WebSVGAttributerefX
for backwards compatibility, the behavior when refx is not specified on a <symbol> element is different from when it is specified with a value of 0, and therefore different from the behavior when an equivalent attribute is not specified on a <marker> element.
refY - SVG: Scalable Vector Graphics
WebSVGAttributerefY
for backwards compatibility, the behavior when refy is not specified on a <symbol> element is different from when it is specified with a value of 0, and therefore different from the behavior when an equivalent attribute is not specified on a <marker> element.
rendering-intent - SVG: Scalable Vector Graphics
absolute-colorimetric this value disables white point matching when converting colors.
requiredFeatures - SVG: Scalable Vector Graphics
this provides a way to design svg that gracefully falls back when features aren't available.
result - SVG: Scalable Vector Graphics
WebSVGAttributeresult
when referenced, this value will use the closest preceding filter primitive with the given result.
scale - SVG: Scalable Vector Graphics
WebSVGAttributescale
when the value of this attribute is 0, this operation has no effect on the source image.
shape-rendering - SVG: Scalable Vector Graphics
the shape-rendering attribute provides hints to the renderer about what tradeoffs to make when rendering shapes like paths, circles, or rectangles.
stroke-linecap - SVG: Scalable Vector Graphics
the stroke-linecap attribute is a presentation attribute defining the shape to be used at the end of open subpaths when they are stroked.
stroke-linejoin - SVG: Scalable Vector Graphics
the stroke-linejoin attribute is a presentation attribute defining the shape to be used at the corners of paths when they are stroked.
text-rendering - SVG: Scalable Vector Graphics
the text-rendering attribute provides hints to the renderer about what tradeoffs to make when rendering text.
textLength - SVG: Scalable Vector Graphics
when an "input" event occurs, we call svglength.newvaluespecifiedunits() to set the value of textlength to the slider's new value, using the svglength interface's svg_lengthtype_px unit type to indicate that the value represents pixels.
vert-origin-x - SVG: Scalable Vector Graphics
the vert-origin-x attribute indicates the x-coordinate in the font coordinate system of the origin of a glyph to be used when drawing vertically oriented text.
vert-origin-y - SVG: Scalable Vector Graphics
the vert-origin-y attribute indicates the y-coordinate in the font coordinate system of the origin of a glyph to be used when drawing vertically oriented text.
xlink:arcrole - SVG: Scalable Vector Graphics
this contextual role can differ from the meaning of the resource when taken outside the context of this particular arc.
xlink:title - SVG: Scalable Vector Graphics
it may be used, for example, to make titles available to applications used by visually impaired users, or to create a table of links, or to present help text that appears when a user lets a mouse pointer hover over a starting resource.
<feBlend> - SVG: Scalable Vector Graphics
WebSVGElementfeBlend
this is similar to what is known from image editing software when blending two layers.
Linking - SVG: Scalable Vector Graphics
WebSVGLinking
when svg documents are embedded within a parent html document using the tag: page1.html: <html> <body> <p>this is a svg button:</p> <object width="100" height="50" type="image/svg+xml" data="button.svg"/> </body> </html> button.svg: <?xml version="1.1" encoding="utf-8"?> <svg xmlns="http://www.w3.org/2000/svg"> <a xlink:href="page2.html" target="_top"> <g> <!-- button graphical elements here --> </g> </a> </svg> the specification says that the browser should navigate to the html document page2.html when the button graphics are clicked.
SVG 1.1 Support in Firefox - SVG: Scalable Vector Graphics
the title is displayed as a tooltip when the mouse hovers over the svg object.
Clipping and masking - SVG: Scalable Vector Graphics
but when you try to create a semicircle in svg, you will find out the use of the following properties quickly.
SVG Filters Tutorial - SVG: Scalable Vector Graphics
when creating them, try applying and testing the effect step by step.
SVG In HTML Introduction - SVG: Scalable Vector Graphics
when the user enters something incorrect into the form, the script sets the invalid attribute on the <body>, and a style rule changes the gradient end-stop color to red.
SVG and CSS - SVG: Scalable Vector Graphics
challenge change the stylesheet so that the inner petals all turn pink when the mouse pointer is over any one of them, without changing the way the outer petals work.
Referer header: privacy and security concerns - Web security
a sensible application would remove such risks by making password reset urls only usable for a single use, or when combined with a unique user token, and transmitting sensitive data in different ways.
Securing your site - Web security
this article showcases best practices to use when storing passwords.
Subresource Integrity - Web security
how browsers handle subresource integrity browsers handle sri by doing the following: when a browser encounters a <script> or <link> element with an integrity attribute, before executing the script or before applying any stylesheet specified by the <link> element, the browser must first compare the script or stylesheet to the expected hash given in the integrity value.
Weak signature algorithms - Web security
this article provides some information about signature algorithms known to be weak, so you can avoid them when appropriate.
Tutorials
client-side web apis when writing client-side javascript for websites or applications, you won't go very far before you start to use apis — interfaces for manipulating different aspects of the browser and operating system the site is running on, or even data from other websites or services.
choose - XPath
syntax choose( boolean , object1, object2 ) arguments boolean the boolean operation to use when determining which object to return.
XPath snippets - XPath
it avoids the more complex syntax of document.evaluate() for cases when it is not required as well as the need to use the special iterators on xpathresult (by returning an array instead).
<xsl:decimal-format> - XSLT: Extensible Stylesheet Language Transformations
nan specifies the string used when the value is not a number.
<xsl:if> - XSLT: Extensible Stylesheet Language Transformations
WebXSLTElementif
to achieve the functionality of an if-then-else statement, however, use the <xsl:choose> element with one <xsl:when> and one <xsl:otherwise> children.
<xsl:otherwise> - XSLT: Extensible Stylesheet Language Transformations
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the <xsl:otherwise> element is used to define the action that should be taken when none of the <xsl:when> conditions apply.
<xsl:output> - XSLT: Extensible Stylesheet Language Transformations
WebXSLTElementoutput
this attribute is only used when method="html" or method="xml".
<xsl:template> - XSLT: Extensible Stylesheet Language Transformations
WebXSLTElementtemplate
the processor uses this number when more than one template matches the same node.
<xsl:text> - XSLT: Extensible Stylesheet Language Transformations
WebXSLTElementtext
to output html-entities, use numerical values instead, eg &#160; for &nbsp;) specifies whether special characters are escaped when written to the output.
<xsl:value-of> - XSLT: Extensible Stylesheet Language Transformations
WebXSLTElementvalue-of
to output html-entities, use numerical values instead, eg &#160 for &nbsp) specifies whether special characters are escaped when written to the output.
The Netscape XSLT/XPath Reference - XSLT: Extensible Stylesheet Language Transformations
d) xsl:otherwise (supported) xsl:output (partially supported) xsl:param (supported) xsl:preserve-space (supported) xsl:processing-instruction xsl:sort (supported) xsl:strip-space (supported) xsl:stylesheet (partially supported) xsl:template (supported) xsl:text (partially supported) xsl:transform (supported) xsl:value-of (partially supported) xsl:variable (supported) xsl:when (supported) xsl:with-param (supported) axes ancestor ancestor-or-self attribute child descendant descendant-or-self following following-sibling namespace (not supported) parent preceding preceding-sibling self functions boolean() (supported) ceiling() (supported) concat() (supported) contains() (supported) count() (supported) current() (supported) document() (s...
Transforming XML with XSLT - XSLT: Extensible Stylesheet Language Transformations
lly supported) xsl:otherwise (supported) xsl:output (partially supported) xsl:param (supported) xsl:preserve-space (supported) xsl:processing-instruction xsl:sort (supported) xsl:strip-space (supported) xsl:stylesheet (partially supported) xsl:template (supported) xsl:text (partially supported) xsl:transform (supported) xsl:value-of (partially supported) xsl:variable (supported) xsl:when (supported) xsl:with-param (supported) axes ancestor ancestor-or-self attribute child descendant descendant-or-self following following-sibling namespace (not supported) parent preceding preceding-sibling self functions boolean() (supported) ceiling() (supported) concat() (supported) contains() (supported) count() (supported) current() (supported) document() (supporte...
XSLT: Extensible Stylesheet Language Transformations
WebXSLT
specifying parameters using processing instructions firefox allows stylesheet parameters to be specified when using the <?xml-stylesheet?> processing instruction.
Caching compiled WebAssembly modules - WebAssembly
nstantiatestreaming(fetch(url)).then(results => { return results.instance }); }); } caching a wasm module with the above library function defined, getting a wasm module instance and using its exported features (while handling caching in the background) is as simple as calling it with the following parameters: a cache version, which — as we explained above — you need to update when any wasm module is updated or moved to a different url.
WebAssembly Concepts - WebAssembly
we have run into performance problems, however, when trying to use javascript for more intensive use cases like 3d games, virtual and augmented reality, computer vision, image/video editing, and a number of other domains that demand native performance (see webassembly use cases for more ideas).
Exported WebAssembly functions - WebAssembly
when you call them, you get some activity in the background to convert the arguments into types that wasm can work with (for example converting javascript numbers to int32), the arguments are passed to the function inside your wasm module, the function is invoked, and the result is converted and passed back to javascript.
Index - WebAssembly
3 compiling a new c/c++ module to webassembly c, c++, compiling, emscripten, webassembly, wasm when you’ve written a new code module in a language like c/c++, you can compile it into webassembly using a tool like emscripten.
Loading and running WebAssembly code - WebAssembly
we then use the onload event handler to invoke a function when the response has finished downloading — in this function we get the array buffer from the response property, and then feed that into our webassembly.instantiate() method as we did with fetch.
Converting WebAssembly text format to wasm - WebAssembly
when it is called, it calls an imported javascript function called imported_func, which is run with the value (42) provided as a parameter.
Compiling an Existing C Module to WebAssembly - WebAssembly
when the pointer is returned to javascript land, it is treated as just a number.
onunload - XUL
« xul reference home onunload type: script code specifies a set of scripts to execute when the browser window is closed by the user.